1m4_define([poppler_version_major],[0])
2m4_define([poppler_version_minor],[16])
3m4_define([poppler_version_micro],[3])
4m4_define([poppler_version],[poppler_version_major.poppler_version_minor.poppler_version_micro])
5
6AC_PREREQ(2.59)
7AC_INIT([poppler],[poppler_version],[https://bugs.freedesktop.org/enter_bug.cgi?product=poppler])
8AC_CONFIG_MACRO_DIR([m4])
9AM_INIT_AUTOMAKE([foreign])
10m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
11AM_CONFIG_HEADER(config.h)
12AM_CONFIG_HEADER(poppler/poppler-config.h)
13AC_C_BIGENDIAN
14
15dnl ##### Initialize libtool.
16AC_LIBTOOL_WIN32_DLL
17define([AC_LIBTOOL_LANG_F77_CONFIG], [:])
18AC_PROG_LIBTOOL
19
20dnl ##### Checks for programs.
21AC_PROG_CC
22AC_PROG_CXX
23AC_ISC_POSIX
24AC_PROG_CC_STDC
25#if test -z "$CXX" -a "$CC" = "gcc"; then
26#  CXX="gcc"
27#fi
28AC_PROG_CXX
29if test "x$GXX" = "xyes"; then
30  case "$host_os" in
31    cygwin* | mingw*)
32    ;;
33    *)
34      CXXFLAGS="$CXXFLAGS -ansi"
35    ;;
36  esac
37fi
38AC_PROG_INSTALL
39
40dnl ##### Check for pkgconfig
41PKG_PROG_PKG_CONFIG
42
43dnl Enable these unconditionally.
44AC_DEFINE([OPI_SUPPORT], [1], [Generate OPI comments in PS output.])
45AC_DEFINE([MULTITHREADED], [1], [Enable multithreading support.])
46AC_DEFINE([TEXTOUT_WORD_LIST], [1], [Enable word list support.])
47
48dnl Check for OS specific flags
49win32_libs=""
50create_shared_lib=""
51auto_import_flags=""
52case "$host_os" in
53  cygwin*)
54    create_shared_lib="-no-undefined"
55  ;;
56  mingw*)
57    os_win32=yes
58    win32_libs="-lgdi32"
59    create_shared_lib="-no-undefined"
60    auto_import_flags="-Wl,--enable-auto-import"
61  ;;
62esac
63
64AC_SUBST(win32_libs)
65AC_SUBST(create_shared_lib)
66AC_SUBST(auto_import_flags)
67
68ACX_PTHREAD()
69
70dnl Install xpdf headers
71AC_ARG_ENABLE(xpdf-headers,
72	      AC_HELP_STRING([--enable-xpdf-headers],
73	                     [Install unsupported xpdf headers.]),
74              enable_xpdf_headers=$enableval,
75              enable_xpdf_headers="no")
76AM_CONDITIONAL(ENABLE_XPDF_HEADERS, test x$enable_xpdf_headers = xyes)
77
78AC_ARG_ENABLE(single-precision,
79[  --enable-single-precision     use single precision arithmetic (instead of double precision) in the Splash backend],
80AC_DEFINE(USE_FLOAT,      [1], [Use single precision arithmetic in the Splash backend]))
81
82AC_ARG_ENABLE(fixedpoint,
83[  --enable-fixedpoint     use fixed point (instead of double precision) arithmetic in the Splash backend],
84AC_DEFINE(USE_FIXEDPOINT, [1], [Use fixed point arithmetic in the Splash backend]))
85
86dnl Relocation support
87AC_ARG_ENABLE(relocatable,
88    AC_HELP_STRING([--disable-relocatable],
89                   [Hardcode the poppler library location (on Windows).]),
90    enable_relocatable=$enableval,
91    [if test x$os_win32 = xyes; then
92         # default to yes on native Windows.
93         enable_relocatable="yes"
94     else
95         # default to no everywhere else.
96         enable_relocatable="no"
97     fi
98    ]
99)
100
101if test x$enable_relocatable = xyes; then
102    if test x$os_win32 = xyes; then
103     AC_DEFINE([ENABLE_RELOCATABLE],
104               [1],[Do not hardcode the library location])
105    else
106        AC_MSG_ERROR(
107               [Invalid setting for relocatable, only supported on windows])
108
109    fi
110fi
111
112AC_DEFINE_DIR(POPPLER_DATADIR, "{datarootdir}/poppler", [Poppler data dir])
113
114dnl ##### Checks for header files.
115AC_PATH_XTRA
116AC_HEADER_DIRENT
117
118dnl ##### Switch over to C++.  This will make the checks below a little
119dnl ##### bit stricter (requiring function prototypes in include files).
120dnl ##### (99% of xpdf is written in C++.)
121AC_LANG_CPLUSPLUS
122
123AC_CHECK_DECL(gettimeofday, [AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Defines if gettimeofday is available on your system]))],[],[#include <sys/time.h>])
124AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R, 1, [Defines if localtime_r is available on your system]))
125AC_CHECK_FUNC(gmtime_r, AC_DEFINE(HAVE_GMTIME_R, 1, [Defines if gmtime_r is available on your system]))
126
127dnl ##### Check for extra libraries needed by X.  (LynxOS needs this.)
128AC_CHECK_FUNC(gethostbyname)
129if test $ac_cv_func_gethostbyname = no; then
130  AC_CHECK_LIB(bsd, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd")
131fi
132
133AC_CHECK_FUNC(nanosleep,,)
134dnl try in librt if not found in current LIBS
135if test x$ac_cv_func_nanosleep = xno
136then
137   AC_CHECK_LIB(rt,nanosleep, X_EXTRA_LIBS="$X_EXTRA_LIBS -lrt")
138fi
139
140dnl try in libposix4, if not found so far
141if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno
142then
143   AC_CHECK_LIB(posix4,nanosleep, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix4")
144fi
145
146
147dnl Test for libopenjpeg
148AC_ARG_ENABLE(libopenjpeg,
149	      AC_HELP_STRING([--disable-libopenjpeg],
150	                     [Don't build against libopenjpeg.]),
151              enable_libopenjpeg=$enableval,
152              enable_libopenjpeg="try")
153if test x$enable_libopenjpeg = xyes; then
154  AC_CHECK_LIB([openjpeg], [opj_cio_open],,
155	       AC_MSG_ERROR("*** libopenjpeg library not found ***"))
156  AC_CHECK_HEADERS([openjpeg.h],,
157		   AC_MSG_ERROR("*** libopenjpeg headers not found ***"))
158elif test x$enable_libopenjpeg = xtry; then
159  AC_CHECK_LIB([openjpeg], [opj_cio_open],
160               [enable_libopenjpeg="yes"],
161	       [enable_libopenjpeg="no"])
162  AC_CHECK_HEADERS([openjpeg.h],,
163		   [enable_libopenjpeg="no"])
164fi
165
166if test x$enable_libopenjpeg = xyes; then
167  LIBOPENJPEG_LIBS="-lopenjpeg"
168  AC_SUBST(LIBOPENJPEG_LIBS)
169  AC_DEFINE(ENABLE_LIBOPENJPEG)
170fi
171
172AM_CONDITIONAL(BUILD_LIBOPENJPEG, test x$enable_libopenjpeg = xyes)
173AH_TEMPLATE([ENABLE_LIBOPENJPEG],
174	    [Use libopenjpeg instead of builtin jpeg2000 decoder.])
175
176
177dnl ##### Checks for library functions.
178AC_CHECK_FUNCS(popen mkstemp mkstemps)
179
180dnl ##### Back to C for the library tests.
181AC_LANG_C
182
183dnl ##### Check for fseeko/ftello or fseek64/ftell64
184dnl The LARGEFILE and FSEEKO macros have to be called in C, not C++, mode.
185AC_SYS_LARGEFILE
186AC_FUNC_FSEEKO
187AC_CHECK_FUNCS(fseek64, xpdf_cv_func_fseek64=yes, xpdf_cv_func_fseek64=no)
188AC_CHECK_FUNCS(ftell64, xpdf_cv_func_ftell64=yes, xpdf_cv_func_ftell64=no)
189if test "$xpdf_cv_func_fseek64" = yes -a "$xpdf_cv_func_ftell64" = yes; then
190  AC_DEFINE(HAVE_FSEEK64)
191fi
192
193dnl Test for zlib
194AC_ARG_ENABLE([zlib],
195  [AS_HELP_STRING([--enable-zlib],[Build with zlib])],
196  [],[enable_zlib="no"])
197if test x$enable_zlib = xyes; then
198  AC_CHECK_LIB([z], [inflate],,
199	       AC_MSG_ERROR("*** zlib library not found ***"))
200  AC_CHECK_HEADERS([zlib.h],,
201		   AC_MSG_ERROR("*** zlib headers not found ***"))
202elif test x$enable_zlib = xtry; then
203  AC_CHECK_LIB([z], [inflate],
204               [enable_zlib="yes"],
205	       [enable_zlib="no"])
206  AC_CHECK_HEADERS([zlib.h],,
207		   [enable_zlib="no"])
208fi
209
210if test x$enable_zlib = xyes; then
211  ZLIB_LIBS="-lz"
212  AC_SUBST(ZLIB_LIBS)
213  AC_DEFINE(ENABLE_ZLIB)
214fi
215
216AM_CONDITIONAL(BUILD_ZLIB, test x$enable_zlib = xyes)
217AH_TEMPLATE([ENABLE_ZLIB],
218	    [Use zlib instead of builtin zlib decoder.])
219
220dnl Test for libcurl
221AC_ARG_ENABLE(libcurl,
222	      AC_HELP_STRING([--enable-libcurl],
223	                     [Build with libcurl based HTTP support.]),
224              enable_libcurl=$enableval,
225              enable_libcurl="no")
226
227if test x$enable_libcurl = xyes; then
228  PKG_CHECK_MODULES(LIBCURL, libcurl)
229  AC_DEFINE(ENABLE_LIBCURL, 1, [Build against libcurl.])
230  AC_DEFINE(POPPLER_HAS_CURL_SUPPORT, 1,
231     [Support for curl based doc builder is compiled in.])
232fi
233
234AM_CONDITIONAL(BUILD_LIBCURL, test x$enable_libcurl = xyes)
235
236dnl Test for libjpeg
237AC_ARG_ENABLE(libjpeg,
238	      AC_HELP_STRING([--disable-libjpeg],
239	                     [Don't build against libjpeg.]),
240              enable_libjpeg=$enableval,
241              enable_libjpeg="try")
242if test x$enable_libjpeg != xno; then
243  POPPLER_FIND_JPEG
244fi
245
246AM_CONDITIONAL(BUILD_LIBJPEG, test x$enable_libjpeg = xyes)
247AH_TEMPLATE([ENABLE_LIBJPEG],
248            [Use libjpeg instead of builtin jpeg decoder.])
249
250dnl Test for libpng
251AC_ARG_ENABLE(libpng,
252	      AC_HELP_STRING([--disable-libpng],
253	                     [Do not build against libpng.]),
254              enable_libpng=$enableval,
255              enable_libpng="try")
256
257if test x$enable_libpng != xno; then
258  PKG_CHECK_MODULES(LIBPNG, libpng, [enable_libpng="yes"],
259      [enable_libpng="no"])
260fi
261
262if test x$enable_libpng = xyes; then
263  AC_DEFINE(ENABLE_LIBPNG, 1, [Build against libpng.])
264fi
265
266AM_CONDITIONAL(BUILD_LIBPNG, test x$enable_libpng = xyes)
267
268dnl Check for freetype headers
269FREETYPE_LIBS=
270FREETYPE_CFLAGS=
271
272# XXX EMSCRIPTEN: Force freetype detection
273AC_DEFINE(HAVE_FREETYPE_H, 1, [Have FreeType2 include files])
274#PKG_CHECK_MODULES(FREETYPE, freetype2,
275#                  [freetype_pkgconfig=yes], [freetype_pkgconfig=no])
276#
277#if test "x$freetype_pkgconfig" = "xyes"; then
278#
279#  AC_DEFINE(HAVE_FREETYPE_H, 1, [Have FreeType2 include files])
280#
281#else
282#
283#  AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
284#  if test "x$FREETYPE_CONFIG" != "xno" ; then
285#
286#    FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
287#    FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
288#    AC_DEFINE(HAVE_FREETYPE_H, 1, [Have FreeType2 include files])
289#
290#  fi
291#
292#fi
293
294AC_SUBST(FREETYPE_CFLAGS)
295AC_SUBST(FREETYPE_LIBS)
296
297AC_MSG_CHECKING([which font configuration to use])
298AC_ARG_WITH([font_configuration],
299   [AS_HELP_STRING([--with-font-configuration=fontconfig|win32],
300                   [Select font configuration backend])],
301   [],
302   [if test x$os_win32 = xyes; then
303        # default to win32 on native Windows.
304        with_font_configuration=win32
305    else
306        # default to fontconig everywhere else.
307        with_font_configuration=fontconfig
308    fi
309   ]
310)
311AC_MSG_RESULT([$with_font_configuration])
312
313case $with_font_configuration in
314  win32)
315     AC_DEFINE([WITH_FONTCONFIGURATION_WIN32],
316               [1],[Use win32 font configuration backend])
317     # Set the minimum required Internet Explorer version to 5.0
318     CPPFLAGS="$CPPFLAGS -D_WIN32_IE=0x0500"
319     ;;
320  fontconfig)
321     AC_DEFINE([WITH_FONTCONFIGURATION_FONTCONFIG],
322               [1],[Use fontconfig font configuration backend])
323     PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.0.0)
324     ;;
325  *)
326     AC_MSG_ERROR(
327               [Invalid font configuration setting: $with_font_configuration])
328     ;;
329esac
330
331AM_CONDITIONAL(BUILD_WITH_WIN32_FONTCONFIGURATION,
332               test x$with_font_configuration = xwin32)
333
334AC_ARG_ENABLE(splash-output,
335              AC_HELP_STRING([--disable-splash-output],
336	                     [Don't build the Splash graphics backend.]),,
337              enable_splash_output="yes")
338AM_CONDITIONAL(BUILD_SPLASH_OUTPUT, test x$enable_splash_output = xyes)
339AH_TEMPLATE([HAVE_SPLASH], [Use splash for rendering.])
340if test x$enable_splash_output = xyes; then
341  AC_DEFINE(HAVE_SPLASH)
342fi
343
344CAIRO_VERSION="1.10.0"
345AC_SUBST(CAIRO_VERSION)
346AC_ARG_ENABLE(cairo-output,
347              AC_HELP_STRING([--disable-cairo-output],
348                             [Don't build the cairo graphics backend.]),
349              enable_cairo_output=$enableval,
350              enable_cairo_output="try")
351if test x$enable_cairo_output = xyes; then
352  PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
353elif test x$enable_cairo_output = xtry; then
354  PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION,
355                    [enable_cairo_output="yes"],
356                    [enable_cairo_output="no"])
357fi
358
359AC_SUBST(CAIRO_CFLAGS)
360AC_SUBST(CAIRO_LIBS)
361
362AM_CONDITIONAL(BUILD_CAIRO_OUTPUT, test x$enable_cairo_output = xyes)
363AH_TEMPLATE([HAVE_CAIRO], [Use cairo for rendering.])
364if test x$enable_cairo_output = xyes; then
365  AC_DEFINE(HAVE_CAIRO)
366  CAIRO_FEATURE="#define POPPLER_HAS_CAIRO 1"
367  CAIRO_REQ="cairo"
368  AC_CHECK_HEADERS(fcntl.h sys/mman.h sys/stat.h)
369else
370  CAIRO_FEATURE="#undef POPPLER_HAS_CAIRO"
371  CAIRO_REQ=""
372fi
373AC_SUBST(CAIRO_FEATURE)
374AC_SUBST(CAIRO_REQ)
375
376found_introspection=no
377if test x$enable_cairo_output = xyes; then
378  POPPLER_GLIB_DISABLE_DEPRECATED=""
379  POPPLER_GLIB_DISABLE_SINGLE_INCLUDES=""
380
381  GLIB_REQUIRED=2.18
382  AC_ARG_ENABLE(poppler-glib,
383	        AC_HELP_STRING([--disable-poppler-glib],
384		               [Don't compile poppler glib wrapper.]),
385              		       enable_poppler_glib=$enableval,
386			       enable_poppler_glib="try")
387  if test x$enable_poppler_glib = xyes; then
388    PKG_CHECK_MODULES(POPPLER_GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo >= $CAIRO_VERSION)
389  elif test x$enable_poppler_glib = xtry; then
390    PKG_CHECK_MODULES(POPPLER_GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo >= $CAIRO_VERSION,
391                      [enable_poppler_glib="yes"],
392                      [enable_poppler_glib="no"])
393  fi
394  if test x$enable_poppler_glib = xyes; then
395    # Check for introspection
396    GOBJECT_INTROSPECTION_CHECK([0.6.7])
397
398    GLIB_REQ="glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo >= $CAIRO_VERSION"
399    AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
400    POPPLER_GLIB_DISABLE_DEPRECATED="$POPPLER_GLIB_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED"
401    POPPLER_GLIB_DISABLE_SINGLE_INCLUDES="$POPPLER_GLIB_DISABLE_SINGLE_INCLUDES -DG_DISABLE_SINGLE_INCLUDES"
402  fi
403else
404  if test x$enable_poppler_glib = xyes; then
405    AC_MSG_ERROR("Cairo output is required to build glib frontend")
406  fi
407  enable_poppler_glib="no"
408  GLIB_REQ=""
409fi
410AM_CONDITIONAL(BUILD_POPPLER_GLIB, test x$enable_poppler_glib = xyes)
411AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
412AC_SUBST(GLIB_REQ)
413
414GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
415
416dnl
417dnl GDK
418dnl
419AC_ARG_ENABLE(gdk,
420              AC_HELP_STRING([--disable-gdk],
421	                     [Compile without gdk.]),
422              enable_gdk=$enableval,
423	      enable_gdk="try")
424
425if test x$enable_poppler_glib = xyes; then
426  if test x$enable_gdk = xyes; then
427    PKG_CHECK_MODULES(GDK, gdk-2.0)
428  elif test x$enable_gdk = xtry; then
429    PKG_CHECK_MODULES(GDK, gdk-2.0,
430                      [enable_gdk="yes"],
431                      [enable_gdk="no"])
432  fi
433  if test x$enable_gdk = xyes; then
434    GDK_REQ="gdk-2.0 gdk-pixbuf-2.0"
435    AC_DEFINE(POPPLER_WITH_GDK,[1], [Have GDK])
436    GDK_FEATURE="#define POPPLER_WITH_GDK 1"
437    POPPLER_GLIB_DISABLE_DEPRECATED="$POPPLER_GLIB_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED"
438    POPPLER_GLIB_DISABLE_SINGLE_INCLUDES="$POPPLER_GLIB_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
439  else
440    enable_gdk="no"
441    GDK_FEATURE=""
442    GDK_REQ=""
443  fi
444else
445  enable_gdk="no"
446  GDK_REQ=""
447fi
448AM_CONDITIONAL(BUILD_WITH_GDK, test x$enable_gdk = xyes)
449AC_SUBST(GDK_CFLAGS)
450AC_SUBST(GDK_LIBS)
451AC_SUBST(GDK_FEATURE)
452AC_SUBST(GDK_REQ)
453
454AC_SUBST(POPPLER_GLIB_DISABLE_DEPRECATED)
455AC_SUBST(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES)
456
457AC_ARG_ENABLE(poppler-qt,
458	      AC_HELP_STRING([--disable-poppler-qt],
459			     [Don't compile poppler qt wrapper.]),
460	      enable_poppler_qt=$enableval,
461	      enable_poppler_qt="try")
462
463if test x$enable_poppler_qt = xyes; then
464  POPPLER_FIND_QT(POPPLER_QT,,)
465elif test x$enable_poppler_qt = xtry; then
466  POPPLER_FIND_QT(POPPLER_QT,
467		  [enable_poppler_qt="yes"],
468                  [enable_poppler_qt="no"])
469fi
470AC_SUBST(POPPLER_QT_CXXFLAGS)
471AC_SUBST(POPPLER_QT_LIBS)
472
473AM_CONDITIONAL(BUILD_POPPLER_QT, test "x$enable_poppler_qt" = "xyes")
474
475dnl
476dnl Try Qt4
477dnl
478
479AC_ARG_ENABLE(poppler-qt4,
480              AC_HELP_STRING([--disable-poppler-qt4],
481	                     [Don't compile poppler Qt4 wrapper.]),
482              enable_poppler_qt4=$enableval,
483              enable_poppler_qt4="try")
484if test x$enable_poppler_qt4 = xyes; then
485  PKG_CHECK_MODULES(POPPLER_QT4,
486	            QtCore >= 4.4.0 QtGui >= 4.4.0 QtXml >= 4.4.0)
487  PKG_CHECK_MODULES(POPPLER_QT4_TEST,
488	            QtTest >= 4.4.0)
489elif test x$enable_poppler_qt4 = xtry; then
490  PKG_CHECK_MODULES(POPPLER_QT4,
491                    QtCore >= 4.4.0 QtGui >= 4.4.0 QtXml >= 4.4.0,
492                    [enable_poppler_qt4="yes"],
493                    [enable_poppler_qt4="no"])
494  if test x$enable_poppler_qt4 = xyes; then
495    PKG_CHECK_MODULES(POPPLER_QT4_TEST,
496                    QtTest >= 4.4.0,
497                    [enable_poppler_qt4="yes"],
498                    [enable_poppler_qt4="no"])
499  fi
500fi
501
502AC_SUBST(POPPLER_QT4_CXXFLAGS)
503AC_SUBST(POPPLER_QT4_LIBS)
504AC_SUBST(POPPLER_QT4_TEST_LIBS)
505
506if test x$enable_poppler_qt4 = xyes; then
507  AC_MSG_CHECKING([for Qt4 moc])
508  MOCQT4=`which moc`
509  mocversion=`$MOCQT4 -v 2>&1`
510  mocversiongrep=`echo $mocversion | grep "Qt 4"`
511  if test x"$mocversiongrep" != x"$mocversion"; then
512    # moc was not the qt4 one, try with moc-qt4
513    MOCQT4=`which moc-qt4`
514    mocversion=`$MOCQT4 -v 2>&1`
515    mocversiongrep=`echo $mocversion | grep "Qt 4"`
516    if test x"$mocversiongrep" != x"$mocversion"; then
517      # no valid moc found
518      enable_poppler_qt4=no;
519      MOCQT4="not found"
520    fi
521  fi
522  AC_SUBST(MOCQT4)
523  AC_MSG_RESULT([$MOCQT4])
524fi
525
526AM_CONDITIONAL(BUILD_POPPLER_QT4, test "x$enable_poppler_qt4" = "xyes")
527
528dnl
529dnl CPP frontend
530dnl
531
532AC_ARG_ENABLE(poppler-cpp,
533              AC_HELP_STRING([--disable-poppler-cpp],
534                             [Don't compile poppler cpp wrapper.]),
535              enable_poppler_cpp=$enableval,
536              enable_poppler_cpp="yes")
537if test x$enable_poppler_cpp = xyes; then
538  AM_ICONV()
539  if test x$am_func_iconv != xyes; then
540    enable_poppler_cpp=no
541  fi
542fi
543
544AM_CONDITIONAL(BUILD_POPPLER_CPP, test "x$enable_poppler_cpp" = "xyes")
545
546
547AC_ARG_ENABLE(gtk-test,
548              AC_HELP_STRING([--disable-gtk-test],
549	                     [Don't compile GTK+ test program.]),
550              enable_gtk_test=$enableval,
551              enable_gtk_test="try")
552if test x$enable_gtk_test = xyes; then
553  PKG_CHECK_MODULES(GTK_TEST, gtk+-2.0 >= 2.14 gdk-pixbuf-2.0 gthread-2.0 gio-2.0)
554elif test x$enable_gtk_test = xtry; then
555  PKG_CHECK_MODULES(GTK_TEST, gtk+-2.0 >= 2.14 gdk-pixbuf-2.0 gthread-2.0 gio-2.0,
556                    [enable_gtk_test="yes"],
557                    [enable_gtk_test="no"])
558fi
559AM_CONDITIONAL(BUILD_GTK_TEST, test x$enable_gtk_test = xyes -a x$enable_poppler_glib = xyes)
560
561AC_ARG_ENABLE(abiword-output,
562              AC_HELP_STRING([--disable-abiword-output],
563                             [Don't build the abiword backend.]),
564              enable_abiword_output=$enableval,
565              enable_abiword_output="try")
566if test x$enable_abiword_output = xyes; then
567  PKG_CHECK_MODULES(ABIWORD, libxml-2.0)
568elif test x$enable_abiword_output = xtry; then
569  PKG_CHECK_MODULES(ABIWORD, libxml-2.0,
570                    [enable_abiword_output="yes"],
571                    [enable_abiword_output="no"])
572fi
573
574AM_CONDITIONAL(BUILD_ABIWORD_OUTPUT, test x$enable_abiword_output = xyes)
575
576AC_ARG_ENABLE(utils,
577              AC_HELP_STRING([--disable-utils],
578	                     [Don't compile poppler command line utils.]),
579              enable_utils=$enableval,
580              enable_utils="yes")
581AM_CONDITIONAL(BUILD_UTILS, test x$enable_utils = xyes)
582
583AC_ARG_ENABLE(compile-warnings,
584              AC_HELP_STRING([--enable-compile-warnings=@<:@no/yes/kde@:>@]
585                             [Turn on compiler warnings.]),,
586              [enable_compile_warnings="yes"])
587
588dnl
589dnl   Color Management
590dnl
591
592AC_ARG_ENABLE(cms,
593	      AC_HELP_STRING([--disable-cms],
594	                     [Don't use color management system.]),
595              enable_cms=$enableval,
596              enable_cms="try")
597if test x$enable_cms = xyes; then
598  PKG_CHECK_MODULES(LCMS, lcms)
599elif test x$enable_cms = xtry; then
600  PKG_CHECK_MODULES(LCMS, lcms, [enable_cms=yes], [enable_cms=no])
601fi
602
603if test "x$enable_cms" = "xyes"; then
604  AC_DEFINE(USE_CMS, 1, [Defines if use cms])
605fi
606AM_CONDITIONAL(USE_CMS, test x$enable_cms = xyes)
607
608if test "x$GCC" != xyes; then
609  enable_compile_warnings=no
610fi
611case "$enable_compile_warnings" in
612  no)	;;
613  yes)	CXXFLAGS="-Wall -Wno-write-strings -Woverloaded-virtual -Wnon-virtual-dtor -Wcast-align -fno-exceptions -fno-common $CXXFLAGS" ;;
614  kde)	CXXFLAGS="-Wnon-virtual-dtor -Wno-long-long -Wundef \
615		-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -Wcast-align \
616		-Wconversion -Wall -W -Wpointer-arith \
617		-Wwrite-strings -O2 -Wformat-security \
618		-Wmissing-format-attribute -fno-exceptions \
619		-fno-common $CXXFLAGS" ;;
620esac
621
622case $($PKG_CONFIG --version) in
623  0.?|0.1[0-7])
624    PC_REQUIRES_PRIVATE="";
625    PC_REQUIRES="poppler = $VERSION";;
626  *)
627    PC_REQUIRES_PRIVATE="Requires.private: poppler = $VERSION";
628    PC_REQUIRES="";;
629esac
630
631AC_SUBST(PC_REQUIRES)
632AC_SUBST(PC_REQUIRES_PRIVATE)
633
634AC_SUBST([POPPLER_MAJOR_VERSION],[poppler_version_major])
635AC_SUBST([POPPLER_MINOR_VERSION],[poppler_version_minor])
636AC_SUBST([POPPLER_MICRO_VERSION],[poppler_version_micro])
637AC_SUBST([POPPLER_VERSION],[poppler_version])
638
639AC_OUTPUT([
640Makefile
641goo/Makefile
642fofi/Makefile
643splash/Makefile
644poppler/Makefile
645utils/Makefile
646glib/Makefile
647glib/poppler-features.h
648glib/reference/Makefile
649glib/reference/version.xml
650glib/demo/Makefile
651test/Makefile
652qt/Makefile
653qt4/Makefile
654qt4/src/Makefile
655qt4/tests/Makefile
656qt4/demos/Makefile
657cpp/Makefile
658cpp/poppler-version.h
659cpp/tests/Makefile
660poppler.pc
661poppler-uninstalled.pc
662poppler-cairo.pc
663poppler-cairo-uninstalled.pc
664poppler-splash.pc
665poppler-splash-uninstalled.pc
666poppler-glib.pc
667poppler-glib-uninstalled.pc
668poppler-qt.pc
669poppler-qt-uninstalled.pc
670poppler-qt4.pc
671poppler-qt4-uninstalled.pc
672poppler-cpp.pc
673poppler-cpp-uninstalled.pc])
674
675
676echo ""
677echo "Building poppler with support for:"
678echo "  font configuration: $with_font_configuration"
679echo "  splash output:      $enable_splash_output"
680echo "  cairo output:       $enable_cairo_output"
681echo "  abiword output:     $enable_abiword_output"
682echo "  qt wrapper:         $enable_poppler_qt"
683echo "  qt4 wrapper:        $enable_poppler_qt4"
684echo "  glib wrapper:       $enable_poppler_glib"
685echo "    use GDK:          $enable_gdk"
686echo "    introspection:    $found_introspection"
687echo "  cpp wrapper:        $enable_poppler_cpp"
688echo "  use gtk-doc:        $enable_gtk_doc"
689echo "  use libjpeg:        $enable_libjpeg"
690echo "  use libpng:         $enable_libpng"
691echo "  use zlib:           $enable_zlib"
692echo "  use libcurl:        $enable_libcurl"
693echo "  use libopenjpeg:    $enable_libopenjpeg"
694echo "  use cms:            $enable_cms"
695echo "  command line utils: $enable_utils"
696echo ""
697
698if test x$enable_splash_output = xno -a x$enable_cairo_output = xno; then
699	echo "  Warning: There is no rendering backend enabled"
700fi
701
702if test x$enable_single_precision = xyes -a x$enable_fixedpoint = xyes; then
703	echo "  Warning: Single precision and fixed point options should not be enabled at the same time"
704fi
705
706if test x$enable_libjpeg != xyes; then
707	echo "  Warning: Using libjpeg is recommended"
708fi
709
710if test x$enable_zlib != xno; then
711	echo "  Warning: Using zlib is not totally safe"
712fi
713
714if test x$enable_libopenjpeg != xyes; then
715	echo "  Warning: Using libopenjpeg is recommended"
716fi
717