configure.ac 21.7 KB
Newer Older
1
m4_define([poppler_version_major],[0])
Albert Astals Cid's avatar
0.18.0  
Albert Astals Cid committed
2 3
m4_define([poppler_version_minor],[18])
m4_define([poppler_version_micro],[0])
4 5
m4_define([poppler_version],[poppler_version_major.poppler_version_minor.poppler_version_micro])

Kristian Høgsberg's avatar
Kristian Høgsberg committed
6
AC_PREREQ(2.59)
7
AC_INIT([poppler],[poppler_version],[https://bugs.freedesktop.org/enter_bug.cgi?product=poppler])
Vincent Torri's avatar
Vincent Torri committed
8
AC_CONFIG_MACRO_DIR([m4])
9
AM_INIT_AUTOMAKE([foreign])
10
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
11 12
AM_CONFIG_HEADER(config.h)
AM_CONFIG_HEADER(poppler/poppler-config.h)
13
AC_C_BIGENDIAN
Kristian Høgsberg's avatar
Kristian Høgsberg committed
14

15 16
dnl ##### Initialize libtool.
AC_LIBTOOL_WIN32_DLL
17
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
18
AC_PROG_LIBTOOL
19 20

dnl ##### Checks for programs.
Kristian Høgsberg's avatar
Kristian Høgsberg committed
21
AC_PROG_CC
22
AC_PROG_CXX
Kristian Høgsberg's avatar
Kristian Høgsberg committed
23 24 25 26 27 28
AC_ISC_POSIX
AC_PROG_CC_STDC
#if test -z "$CXX" -a "$CC" = "gcc"; then
#  CXX="gcc"
#fi
AC_PROG_CXX
29
if test "x$GXX" = "xyes"; then
30 31 32 33 34 35 36
  case "$host_os" in
    cygwin* | mingw*)
    ;;
    *)
      CXXFLAGS="$CXXFLAGS -ansi"
    ;;
  esac
37
fi
Kristian Høgsberg's avatar
Kristian Høgsberg committed
38 39
AC_PROG_INSTALL

40
dnl ##### Check for pkgconfig
Vincent Torri's avatar
Vincent Torri committed
41
PKG_PROG_PKG_CONFIG
42

43 44 45
dnl ##### Export the version
AC_DEFINE([POPPLER_VERSION], [poppler_version], [Defines the poppler version])

Kristian Høgsberg's avatar
Kristian Høgsberg committed
46
dnl Enable these unconditionally.
47
AC_DEFINE([OPI_SUPPORT], [1], [Generate OPI comments in PS output.])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
48 49 50
AC_DEFINE([MULTITHREADED], [1], [Enable multithreading support.])
AC_DEFINE([TEXTOUT_WORD_LIST], [1], [Enable word list support.])

Albert Astals Cid's avatar
Albert Astals Cid committed
51 52 53
dnl Check for OS specific flags
win32_libs=""
create_shared_lib=""
54
auto_import_flags=""
Albert Astals Cid's avatar
Albert Astals Cid committed
55
case "$host_os" in
56 57 58
  cygwin*)
    create_shared_lib="-no-undefined"
  ;;
Carlo Bramini's avatar
Carlo Bramini committed
59
  mingw*)
60
    os_win32=yes
Albert Astals Cid's avatar
Albert Astals Cid committed
61 62
    win32_libs="-lgdi32"
    create_shared_lib="-no-undefined"
63
    auto_import_flags="-Wl,--enable-auto-import"
Albert Astals Cid's avatar
Albert Astals Cid committed
64 65 66 67 68
  ;;
esac

AC_SUBST(win32_libs)
AC_SUBST(create_shared_lib)
69
AC_SUBST(auto_import_flags)
Albert Astals Cid's avatar
Albert Astals Cid committed
70

71 72
ACX_PTHREAD()

73 74 75 76 77 78 79 80
dnl Install xpdf headers
AC_ARG_ENABLE(xpdf-headers,
	      AC_HELP_STRING([--enable-xpdf-headers],
	                     [Install unsupported xpdf headers.]),
              enable_xpdf_headers=$enableval,
              enable_xpdf_headers="no")
AM_CONDITIONAL(ENABLE_XPDF_HEADERS, test x$enable_xpdf_headers = xyes)

81 82
AC_ARG_ENABLE(single-precision,
[  --enable-single-precision     use single precision arithmetic (instead of double precision) in the Splash backend],
83
AC_DEFINE(USE_FLOAT,      [1], [Use single precision arithmetic in the Splash backend]))
84

85
AC_ARG_ENABLE(fixedpoint,
86
[  --enable-fixedpoint     use fixed point (instead of double precision) arithmetic in the Splash backend],
87
AC_DEFINE(USE_FIXEDPOINT, [1], [Use fixed point arithmetic in the Splash backend]))
88

89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
dnl Relocation support
AC_ARG_ENABLE(relocatable,
    AC_HELP_STRING([--disable-relocatable],
                   [Hardcode the poppler library location (on Windows).]),
    enable_relocatable=$enableval,
    [if test x$os_win32 = xyes; then
         # default to yes on native Windows.
         enable_relocatable="yes"
     else
         # default to no everywhere else.
         enable_relocatable="no"
     fi
    ]
)

if test x$enable_relocatable = xyes; then
    if test x$os_win32 = xyes; then
     AC_DEFINE([ENABLE_RELOCATABLE],
               [1],[Do not hardcode the library location])
    else
        AC_MSG_ERROR(
               [Invalid setting for relocatable, only supported on windows])

    fi
fi

115
AC_DEFINE_DIR(POPPLER_DATADIR, "{datarootdir}/poppler", [Poppler data dir])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
116 117 118 119

dnl ##### Checks for header files.
AC_PATH_XTRA
AC_HEADER_DIRENT
120
AC_CHECK_HEADERS([stdint.h])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
121 122 123 124 125 126

dnl ##### Switch over to C++.  This will make the checks below a little
dnl ##### bit stricter (requiring function prototypes in include files).
dnl ##### (99% of xpdf is written in C++.)
AC_LANG_CPLUSPLUS

127 128 129 130
AC_CHECK_DECL(gettimeofday, [AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Defines if gettimeofday is available on your system]))],[],[#include <sys/time.h>])
AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R, 1, [Defines if localtime_r is available on your system]))
AC_CHECK_FUNC(gmtime_r, AC_DEFINE(HAVE_GMTIME_R, 1, [Defines if gmtime_r is available on your system]))

Kristian Høgsberg's avatar
Kristian Høgsberg committed
131 132 133 134 135 136
dnl ##### Check for extra libraries needed by X.  (LynxOS needs this.)
AC_CHECK_FUNC(gethostbyname)
if test $ac_cv_func_gethostbyname = no; then
  AC_CHECK_LIB(bsd, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd")
fi

137 138 139 140 141 142 143 144 145 146 147 148 149 150
AC_CHECK_FUNC(nanosleep,,)
dnl try in librt if not found in current LIBS
if test x$ac_cv_func_nanosleep = xno
then
   AC_CHECK_LIB(rt,nanosleep, X_EXTRA_LIBS="$X_EXTRA_LIBS -lrt")
fi

dnl try in libposix4, if not found so far
if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno
then
   AC_CHECK_LIB(posix4,nanosleep, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix4")
fi


151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
dnl Test for libopenjpeg
AC_ARG_ENABLE(libopenjpeg,
	      AC_HELP_STRING([--disable-libopenjpeg],
	                     [Don't build against libopenjpeg.]),
              enable_libopenjpeg=$enableval,
              enable_libopenjpeg="try")
if test x$enable_libopenjpeg = xyes; then
  AC_CHECK_LIB([openjpeg], [opj_cio_open],,
	       AC_MSG_ERROR("*** libopenjpeg library not found ***"))
  AC_CHECK_HEADERS([openjpeg.h],,
		   AC_MSG_ERROR("*** libopenjpeg headers not found ***"))
elif test x$enable_libopenjpeg = xtry; then
  AC_CHECK_LIB([openjpeg], [opj_cio_open],
               [enable_libopenjpeg="yes"],
	       [enable_libopenjpeg="no"])
  AC_CHECK_HEADERS([openjpeg.h],,
		   [enable_libopenjpeg="no"])
fi

if test x$enable_libopenjpeg = xyes; then
  LIBOPENJPEG_LIBS="-lopenjpeg"
  AC_SUBST(LIBOPENJPEG_LIBS)
  AC_DEFINE(ENABLE_LIBOPENJPEG)
174 175 176 177 178 179 180 181
  AC_TRY_COMPILE([
#include <openjpeg.h>
], [
  int foo = OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
], have_openjpeg_flag="yes", am_cv_proto_iconv_arg1="no")
  if test x$have_openjpeg_flag = xyes; then
    AC_DEFINE(WITH_OPENJPEG_IGNORE_PCLR_CMAP_CDEF_FLAG, 1, [OpenJPEG with the OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG flag.])
  fi
182 183 184 185 186 187
fi

AM_CONDITIONAL(BUILD_LIBOPENJPEG, test x$enable_libopenjpeg = xyes)
AH_TEMPLATE([ENABLE_LIBOPENJPEG],
	    [Use libopenjpeg instead of builtin jpeg2000 decoder.])

188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
dnl ##### Test for libtiff
AC_ARG_ENABLE(libtiff,
		AC_HELP_STRING([--disable-libtiff],
				[Don't build against libtiff.]),
		enable_libtiff=$enableval,
		enable_libtiff="try")

if test x$enable_libtiff = xyes; then
  AC_CHECK_LIB([tiff], [TIFFOpen],,
		AC_MSG_ERROR("*** libtiff library not found ***"))
  AC_CHECK_HEADERS([tiffio.h],,
		AC_MSG_ERROR("*** libtiff headers not found ***"))
elif test x$enable_libtiff = xtry; then
  AC_CHECK_LIB([tiff], [TIFFOpen],
		[enable_libtiff="yes"],
		[enable_libtiff="no"])
  AC_CHECK_HEADERS([tiffio.h],,
		[enable_libtiff="no"])
fi

if test x$enable_libtiff = xyes; then
  LIBTIFF_LIBS="-ltiff"
  AC_SUBST(LIBTIFF_LIBS)
  AC_DEFINE(ENABLE_LIBTIFF)
fi

AM_CONDITIONAL(BUILD_LIBTIFF, test x$enable_libtiff = xyes)
AH_TEMPLATE([ENABLE_LIBTIFF], [Build against libtiff.])
if test x$enable_libtiff = xyes; then
  AC_DEFINE(ENABLE_LIBTIFF, 1, [Build against libtiff.])
fi
219

Kristian Høgsberg's avatar
Kristian Høgsberg committed
220
dnl ##### Checks for library functions.
221
AC_CHECK_FUNCS(popen mkstemp mkstemps)
Kristian Høgsberg's avatar
Kristian Høgsberg committed
222 223 224 225 226 227 228 229 230 231 232 233 234 235

dnl ##### Back to C for the library tests.
AC_LANG_C

dnl ##### Check for fseeko/ftello or fseek64/ftell64
dnl The LARGEFILE and FSEEKO macros have to be called in C, not C++, mode.
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
AC_CHECK_FUNCS(fseek64, xpdf_cv_func_fseek64=yes, xpdf_cv_func_fseek64=no)
AC_CHECK_FUNCS(ftell64, xpdf_cv_func_ftell64=yes, xpdf_cv_func_ftell64=no)
if test "$xpdf_cv_func_fseek64" = yes -a "$xpdf_cv_func_ftell64" = yes; then
  AC_DEFINE(HAVE_FSEEK64)
fi

236
dnl Test for zlib
237 238 239
AC_ARG_ENABLE([zlib],
  [AS_HELP_STRING([--enable-zlib],[Build with zlib])],
  [],[enable_zlib="no"])
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
if test x$enable_zlib = xyes; then
  AC_CHECK_LIB([z], [inflate],,
	       AC_MSG_ERROR("*** zlib library not found ***"))
  AC_CHECK_HEADERS([zlib.h],,
		   AC_MSG_ERROR("*** zlib headers not found ***"))
elif test x$enable_zlib = xtry; then
  AC_CHECK_LIB([z], [inflate],
               [enable_zlib="yes"],
	       [enable_zlib="no"])
  AC_CHECK_HEADERS([zlib.h],,
		   [enable_zlib="no"])
fi

if test x$enable_zlib = xyes; then
  ZLIB_LIBS="-lz"
  AC_SUBST(ZLIB_LIBS)
  AC_DEFINE(ENABLE_ZLIB)
fi

AM_CONDITIONAL(BUILD_ZLIB, test x$enable_zlib = xyes)
AH_TEMPLATE([ENABLE_ZLIB],
	    [Use zlib instead of builtin zlib decoder.])
262

Hib Eris's avatar
Hib Eris committed
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
dnl Test for libcurl
AC_ARG_ENABLE(libcurl,
	      AC_HELP_STRING([--enable-libcurl],
	                     [Build with libcurl based HTTP support.]),
              enable_libcurl=$enableval,
              enable_libcurl="no")

if test x$enable_libcurl = xyes; then
  PKG_CHECK_MODULES(LIBCURL, libcurl)
  AC_DEFINE(ENABLE_LIBCURL, 1, [Build against libcurl.])
  AC_DEFINE(POPPLER_HAS_CURL_SUPPORT, 1,
     [Support for curl based doc builder is compiled in.])
fi

AM_CONDITIONAL(BUILD_LIBCURL, test x$enable_libcurl = xyes)
278

279 280 281 282 283 284
dnl Test for libjpeg
AC_ARG_ENABLE(libjpeg,
	      AC_HELP_STRING([--disable-libjpeg],
	                     [Don't build against libjpeg.]),
              enable_libjpeg=$enableval,
              enable_libjpeg="try")
285
if test x$enable_libjpeg != xno; then
286
  POPPLER_FIND_JPEG
287 288 289 290 291 292
fi

AM_CONDITIONAL(BUILD_LIBJPEG, test x$enable_libjpeg = xyes)
AH_TEMPLATE([ENABLE_LIBJPEG],
            [Use libjpeg instead of builtin jpeg decoder.])

293 294 295
dnl Test for libpng
AC_ARG_ENABLE(libpng,
	      AC_HELP_STRING([--disable-libpng],
296
	                     [Do not build against libpng.]),
297 298
              enable_libpng=$enableval,
              enable_libpng="try")
299

300
if test x$enable_libpng != xno; then
301 302 303 304 305 306
  PKG_CHECK_MODULES(LIBPNG, libpng, [enable_libpng="yes"],
      [enable_libpng="no"])
fi

if test x$enable_libpng = xyes; then
  AC_DEFINE(ENABLE_LIBPNG, 1, [Build against libpng.])
307 308 309
fi

AM_CONDITIONAL(BUILD_LIBPNG, test x$enable_libpng = xyes)
310

Kristian Høgsberg's avatar
Kristian Høgsberg committed
311 312 313
dnl Check for freetype headers
FREETYPE_LIBS=
FREETYPE_CFLAGS=
314

315
PKG_CHECK_MODULES(FREETYPE, freetype2,
316 317 318 319
                  [freetype_pkgconfig=yes], [freetype_pkgconfig=no])

if test "x$freetype_pkgconfig" = "xyes"; then

Kristian Høgsberg's avatar
Kristian Høgsberg committed
320 321
  AC_DEFINE(HAVE_FREETYPE_H, 1, [Have FreeType2 include files])

322 323 324 325
else

  AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
  if test "x$FREETYPE_CONFIG" != "xno" ; then
326

327 328 329
    FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
    FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
    AC_DEFINE(HAVE_FREETYPE_H, 1, [Have FreeType2 include files])
330

Kristian Høgsberg's avatar
Kristian Høgsberg committed
331 332 333 334 335 336 337
  fi

fi

AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_LIBS)

338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
AC_MSG_CHECKING([which font configuration to use])
AC_ARG_WITH([font_configuration],
   [AS_HELP_STRING([--with-font-configuration=fontconfig|win32],
                   [Select font configuration backend])],
   [],
   [if test x$os_win32 = xyes; then
        # default to win32 on native Windows.
        with_font_configuration=win32
    else
        # default to fontconig everywhere else.
        with_font_configuration=fontconfig
    fi
   ]
)
AC_MSG_RESULT([$with_font_configuration])

case $with_font_configuration in
  win32)
     AC_DEFINE([WITH_FONTCONFIGURATION_WIN32],
               [1],[Use win32 font configuration backend])
     # Set the minimum required Internet Explorer version to 5.0
     CPPFLAGS="$CPPFLAGS -D_WIN32_IE=0x0500"
     ;;
  fontconfig)
     AC_DEFINE([WITH_FONTCONFIGURATION_FONTCONFIG],
               [1],[Use fontconfig font configuration backend])
     PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.0.0)
     ;;
  *)
     AC_MSG_ERROR(
               [Invalid font configuration setting: $with_font_configuration])
     ;;
esac

AM_CONDITIONAL(BUILD_WITH_WIN32_FONTCONFIGURATION,
               test x$with_font_configuration = xwin32)
374

Kristian Høgsberg's avatar
Kristian Høgsberg committed
375 376 377 378 379
AC_ARG_ENABLE(splash-output,
              AC_HELP_STRING([--disable-splash-output],
	                     [Don't build the Splash graphics backend.]),,
              enable_splash_output="yes")
AM_CONDITIONAL(BUILD_SPLASH_OUTPUT, test x$enable_splash_output = xyes)
380 381 382 383
AH_TEMPLATE([HAVE_SPLASH], [Use splash for rendering.])
if test x$enable_splash_output = xyes; then
  AC_DEFINE(HAVE_SPLASH)
fi
Kristian Høgsberg's avatar
Kristian Høgsberg committed
384

385
CAIRO_VERSION="1.10.0"
386
AC_SUBST(CAIRO_VERSION)
Kristian Høgsberg's avatar
Kristian Høgsberg committed
387 388
AC_ARG_ENABLE(cairo-output,
              AC_HELP_STRING([--disable-cairo-output],
389 390 391
                             [Don't build the cairo graphics backend.]),
              enable_cairo_output=$enableval,
              enable_cairo_output="try")
392
use_cairo=""
Kristian Høgsberg's avatar
Kristian Høgsberg committed
393
if test x$enable_cairo_output = xyes; then
394
  PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION cairo-ft >= $CAIRO_VERSION)
395
elif test x$enable_cairo_output = xtry; then
396
  PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION cairo-ft >= $CAIRO_VERSION,
397
                    [enable_cairo_output="yes"],
398 399 400 401 402
                    [enable_cairo_output="no"
		     use_cairo="no (requires cairo >= $CAIRO_VERSION)"])
fi
if test x$use_cairo = x; then
   use_cairo=$enable_cairo_output
Kristian Høgsberg's avatar
Kristian Høgsberg committed
403 404
fi

405 406 407
AC_SUBST(CAIRO_CFLAGS)
AC_SUBST(CAIRO_LIBS)

408 409 410
AM_CONDITIONAL(BUILD_CAIRO_OUTPUT, test x$enable_cairo_output = xyes)
AH_TEMPLATE([HAVE_CAIRO], [Use cairo for rendering.])
if test x$enable_cairo_output = xyes; then
411 412 413 414 415 416 417 418 419 420
  PDFTOCAIRO_DEPS="cairo cairo-ft"
  dnl Check for optional cairo backends used by pdftocairo
  PKG_CHECK_EXISTS(cairo-pdf, [PDFTOCAIRO_DEPS="$PDFTOCAIRO_DEPS cairo-pdf"], [])
  PKG_CHECK_EXISTS(cairo-ps,  [PDFTOCAIRO_DEPS="$PDFTOCAIRO_DEPS cairo-ps"],  [])
  PKG_CHECK_EXISTS(cairo-svg, [PDFTOCAIRO_DEPS="$PDFTOCAIRO_DEPS cairo-svg"], [])

  PKG_CHECK_MODULES(PDFTOCAIRO, $PDFTOCAIRO_DEPS)
  AC_SUBST(PDFTOCAIRO_CFLAGS)
  AC_SUBST(PDFTOCAIRO_LIBS)

421
  AC_DEFINE(HAVE_CAIRO)
422 423
  CAIRO_FEATURE="#define POPPLER_HAS_CAIRO 1"
  CAIRO_REQ="cairo"
Chris Wilson's avatar
Chris Wilson committed
424
  AC_CHECK_HEADERS(fcntl.h sys/mman.h sys/stat.h)
425 426 427
else
  CAIRO_FEATURE="#undef POPPLER_HAS_CAIRO"
  CAIRO_REQ=""
428
fi
429 430
AC_SUBST(CAIRO_FEATURE)
AC_SUBST(CAIRO_REQ)
431

432
use_glib=""
433
found_introspection=no
434 435 436 437 438
if test x$enable_cairo_output = xyes; then
  POPPLER_GLIB_DISABLE_DEPRECATED=""
  POPPLER_GLIB_DISABLE_SINGLE_INCLUDES=""

  GLIB_REQUIRED=2.18
Rex Dieter's avatar
Rex Dieter committed
439
  AC_SUBST(GLIB_REQUIRED)
440 441 442 443 444 445 446 447 448 449
  AC_ARG_ENABLE(poppler-glib,
	        AC_HELP_STRING([--disable-poppler-glib],
		               [Don't compile poppler glib wrapper.]),
              		       enable_poppler_glib=$enableval,
			       enable_poppler_glib="try")
  if test x$enable_poppler_glib = xyes; then
    PKG_CHECK_MODULES(POPPLER_GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo >= $CAIRO_VERSION)
  elif test x$enable_poppler_glib = xtry; then
    PKG_CHECK_MODULES(POPPLER_GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo >= $CAIRO_VERSION,
                      [enable_poppler_glib="yes"],
450 451
                      [enable_poppler_glib="no"
                      use_glib="no (requires glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo >= $CAIRO_VERSION)"])
452 453
  fi
  if test x$enable_poppler_glib = xyes; then
454 455 456
    # Check for introspection
    GOBJECT_INTROSPECTION_CHECK([0.6.7])

457 458 459 460 461 462 463 464
    AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
    POPPLER_GLIB_DISABLE_DEPRECATED="$POPPLER_GLIB_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED"
    POPPLER_GLIB_DISABLE_SINGLE_INCLUDES="$POPPLER_GLIB_DISABLE_SINGLE_INCLUDES -DG_DISABLE_SINGLE_INCLUDES"
  fi
else
  if test x$enable_poppler_glib = xyes; then
    AC_MSG_ERROR("Cairo output is required to build glib frontend")
  fi
465
  use_glib="no (requires cairo output)"
466
  enable_poppler_glib="no"
467
fi
468 469 470
if test x$use_glib = x; then
   use_glib=$enable_poppler_glib
fi
471
AM_CONDITIONAL(BUILD_POPPLER_GLIB, test x$enable_poppler_glib = xyes)
472
AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
473
AC_SUBST(GLIB_REQ)
474
AC_SUBST(POPPLER_GLIB_DISABLE_DEPRECATED)
475
AC_SUBST(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES)
476

477 478
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])

479 480 481 482
dnl 
dnl Try Qt4
dnl

483 484 485 486 487
AC_ARG_ENABLE(poppler-qt4,
              AC_HELP_STRING([--disable-poppler-qt4],
	                     [Don't compile poppler Qt4 wrapper.]),
              enable_poppler_qt4=$enableval,
              enable_poppler_qt4="try")
488
if test x$enable_poppler_qt4 = xyes; then
489
  PKG_CHECK_MODULES(POPPLER_QT4, 
Albert Astals Cid's avatar
Albert Astals Cid committed
490
	            QtCore >= 4.4.0 QtGui >= 4.4.0 QtXml >= 4.4.0)
491
  PKG_CHECK_MODULES(POPPLER_QT4_TEST, 
Albert Astals Cid's avatar
Albert Astals Cid committed
492
	            QtTest >= 4.4.0)
493
elif test x$enable_poppler_qt4 = xtry; then
494
  PKG_CHECK_MODULES(POPPLER_QT4,
Albert Astals Cid's avatar
Albert Astals Cid committed
495
                    QtCore >= 4.4.0 QtGui >= 4.4.0 QtXml >= 4.4.0,
496 497
                    [enable_poppler_qt4="yes"],
                    [enable_poppler_qt4="no"])
498 499
  if test x$enable_poppler_qt4 = xyes; then
    PKG_CHECK_MODULES(POPPLER_QT4_TEST,
Albert Astals Cid's avatar
Albert Astals Cid committed
500
                    QtTest >= 4.4.0,
501 502 503
                    [enable_poppler_qt4="yes"],
                    [enable_poppler_qt4="no"])
  fi
504
fi
505 506 507

AC_SUBST(POPPLER_QT4_CXXFLAGS)
AC_SUBST(POPPLER_QT4_LIBS)
508
AC_SUBST(POPPLER_QT4_TEST_LIBS)
509

510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
if test x$enable_poppler_qt4 = xyes; then
  AC_MSG_CHECKING([for Qt4 moc])
  MOCQT4=`which moc`
  mocversion=`$MOCQT4 -v 2>&1`
  mocversiongrep=`echo $mocversion | grep "Qt 4"`
  if test x"$mocversiongrep" != x"$mocversion"; then
    # moc was not the qt4 one, try with moc-qt4
    MOCQT4=`which moc-qt4`
    mocversion=`$MOCQT4 -v 2>&1`
    mocversiongrep=`echo $mocversion | grep "Qt 4"`
    if test x"$mocversiongrep" != x"$mocversion"; then
      # no valid moc found
      enable_poppler_qt4=no;
      MOCQT4="not found"
    fi
  fi
  AC_SUBST(MOCQT4)
  AC_MSG_RESULT([$MOCQT4])
fi

530
AM_CONDITIONAL(BUILD_POPPLER_QT4, test "x$enable_poppler_qt4" = "xyes")
531

532 533 534 535 536 537 538 539 540
dnl
dnl CPP frontend
dnl

AC_ARG_ENABLE(poppler-cpp,
              AC_HELP_STRING([--disable-poppler-cpp],
                             [Don't compile poppler cpp wrapper.]),
              enable_poppler_cpp=$enableval,
              enable_poppler_cpp="yes")
541 542 543 544 545 546
if test x$enable_poppler_cpp = xyes; then
  AM_ICONV()
  if test x$am_func_iconv != xyes; then
    enable_poppler_cpp=no
  fi
fi
547 548 549 550

AM_CONDITIONAL(BUILD_POPPLER_CPP, test "x$enable_poppler_cpp" = "xyes")


Kristian Høgsberg's avatar
Kristian Høgsberg committed
551 552
AC_ARG_ENABLE(gtk-test,
              AC_HELP_STRING([--disable-gtk-test],
553 554 555
	                     [Don't compile GTK+ test program.]),
              enable_gtk_test=$enableval,
              enable_gtk_test="try")
Kristian Høgsberg's avatar
Kristian Høgsberg committed
556
if test x$enable_gtk_test = xyes; then
557
  PKG_CHECK_MODULES(GTK_TEST, gtk+-2.0 >= 2.14 gdk-pixbuf-2.0 gthread-2.0 gio-2.0)
558
elif test x$enable_gtk_test = xtry; then
559
  PKG_CHECK_MODULES(GTK_TEST, gtk+-2.0 >= 2.14 gdk-pixbuf-2.0 gthread-2.0 gio-2.0,
560 561
                    [enable_gtk_test="yes"],
                    [enable_gtk_test="no"])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
562
fi
563
AM_CONDITIONAL(BUILD_GTK_TEST, test x$enable_gtk_test = xyes -a x$enable_poppler_glib = xyes)
Kristian Høgsberg's avatar
Kristian Høgsberg committed
564

565 566 567 568 569 570 571
AC_ARG_ENABLE(utils,
              AC_HELP_STRING([--disable-utils],
	                     [Don't compile poppler command line utils.]),
              enable_utils=$enableval,
              enable_utils="yes")
AM_CONDITIONAL(BUILD_UTILS, test x$enable_utils = xyes)

572 573 574 575 576
AC_ARG_ENABLE(compile-warnings,
              AC_HELP_STRING([--enable-compile-warnings=@<:@no/yes/kde@:>@]
                             [Turn on compiler warnings.]),,
              [enable_compile_warnings="yes"])

577 578 579 580 581 582 583 584
dnl
dnl   Color Management
dnl

AC_ARG_ENABLE(cms,
	      AC_HELP_STRING([--disable-cms],
	                     [Don't use color management system.]),
              enable_cms=$enableval,
585
              enable_cms="try")
586
if test x$enable_cms = xyes; then
587 588 589 590 591 592
  PKG_CHECK_MODULES(LCMS, lcms)
elif test x$enable_cms = xtry; then
  PKG_CHECK_MODULES(LCMS, lcms, [enable_cms=yes], [enable_cms=no])
fi

if test "x$enable_cms" = "xyes"; then
593 594 595 596
  AC_DEFINE(USE_CMS, 1, [Defines if use cms])
fi
AM_CONDITIONAL(USE_CMS, test x$enable_cms = xyes)

597 598 599 600
if test "x$GCC" != xyes; then
  enable_compile_warnings=no
fi
case "$enable_compile_warnings" in
601
  no)	;;
602
  yes)	CXXFLAGS="-Wall -Wno-write-strings -Woverloaded-virtual -Wnon-virtual-dtor -Wcast-align -fno-exceptions -fno-check-new -fno-common $CXXFLAGS" ;;
603
  kde)	CXXFLAGS="-Wnon-virtual-dtor -Wno-long-long -Wundef \
604
		-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -Wcast-align \
Albert Astals Cid's avatar
Albert Astals Cid committed
605
		-Wconversion -Wall -W -Wpointer-arith \
606 607 608 609 610
		-Wwrite-strings -O2 -Wformat-security \
		-Wmissing-format-attribute -fno-exceptions -fno-check-new \
		-fno-common $CXXFLAGS" ;;
esac

611 612 613 614 615 616 617 618 619 620 621
case $($PKG_CONFIG --version) in
  0.?|0.1[0-7])
    PC_REQUIRES_PRIVATE="";
    PC_REQUIRES="poppler = $VERSION";;
  *)
    PC_REQUIRES_PRIVATE="Requires.private: poppler = $VERSION";
    PC_REQUIRES="";;
esac

AC_SUBST(PC_REQUIRES)
AC_SUBST(PC_REQUIRES_PRIVATE)
622

623 624 625
AC_SUBST([POPPLER_MAJOR_VERSION],[poppler_version_major])
AC_SUBST([POPPLER_MINOR_VERSION],[poppler_version_minor])
AC_SUBST([POPPLER_MICRO_VERSION],[poppler_version_micro])
626
AC_SUBST([POPPLER_VERSION],[poppler_version])
627

Kristian Høgsberg's avatar
Kristian Høgsberg committed
628 629 630 631 632 633
AC_OUTPUT([
Makefile
goo/Makefile
fofi/Makefile
splash/Makefile
poppler/Makefile
634
utils/Makefile
635
glib/Makefile
636
glib/poppler-features.h
637
glib/reference/Makefile
638
glib/reference/version.xml
639
glib/demo/Makefile
Kristian Høgsberg's avatar
Kristian Høgsberg committed
640
test/Makefile
641 642 643
qt4/Makefile
qt4/src/Makefile
qt4/tests/Makefile
644
qt4/demos/Makefile
645
cpp/Makefile
646
cpp/poppler-version.h
647
cpp/tests/Makefile
Kristian Høgsberg's avatar
Kristian Høgsberg committed
648
poppler.pc
649
poppler-uninstalled.pc
Kristian Høgsberg's avatar
Kristian Høgsberg committed
650
poppler-cairo.pc
651
poppler-cairo-uninstalled.pc
652
poppler-splash.pc
653
poppler-splash-uninstalled.pc
654
poppler-glib.pc
655
poppler-glib-uninstalled.pc
Pino Toscano's avatar
Pino Toscano committed
656
poppler-qt4.pc
657 658 659
poppler-qt4-uninstalled.pc
poppler-cpp.pc
poppler-cpp-uninstalled.pc])
660 661 662 663


echo ""
echo "Building poppler with support for:"
664
echo "  font configuration: $with_font_configuration"
665
echo "  splash output:      $enable_splash_output"
666
echo "  cairo output:       $use_cairo"
667
echo "  qt4 wrapper:        $enable_poppler_qt4"
668
echo "  glib wrapper:       $use_glib"
669
echo "    introspection:    $found_introspection"
670
echo "  cpp wrapper:        $enable_poppler_cpp"
671
echo "  use gtk-doc:        $enable_gtk_doc"
672
echo "  use libjpeg:        $enable_libjpeg"
673
echo "  use libpng:         $enable_libpng"
674
echo "  use libtiff:        $enable_libtiff"
675
echo "  use zlib:           $enable_zlib"
Hib Eris's avatar
Hib Eris committed
676
echo "  use libcurl:        $enable_libcurl"
677
echo "  use libopenjpeg:    $enable_libopenjpeg"
678
echo "  use cms:            $enable_cms"
Albert Astals Cid's avatar
 
Albert Astals Cid committed
679
echo "  command line utils: $enable_utils"
680 681 682 683 684 685
echo ""

if test x$enable_splash_output = xno -a x$enable_cairo_output = xno; then
	echo "  Warning: There is no rendering backend enabled"
fi

686 687 688 689
if test x$enable_single_precision = xyes -a x$enable_fixedpoint = xyes; then
	echo "  Warning: Single precision and fixed point options should not be enabled at the same time"
fi

690 691 692 693 694 695 696 697 698 699 700
if test x$enable_libjpeg != xyes; then
	echo "  Warning: Using libjpeg is recommended"
fi

if test x$enable_zlib != xno; then
	echo "  Warning: Using zlib is not totally safe"
fi

if test x$enable_libopenjpeg != xyes; then
	echo "  Warning: Using libopenjpeg is recommended"
fi