]> www.fi.muni.cz Git - evince.git/blob - configure.ac
[shell] Port override_restrictions gconf key to GSettings
[evince.git] / configure.ac
1 # *****************************************************************************
2 # Versioning
3 # *****************************************************************************
4
5 m4_define([ev_major_version],[2])
6 m4_define([ev_minor_version],[30])
7 m4_define([ev_micro_version],[0])
8 m4_define([ev_extra_version],[])
9 m4_define([ev_version],[ev_major_version.ev_minor_version.ev_micro_version()ev_extra_version])
10
11 # The evince API version
12 m4_define([ev_api_version], [2.30])
13
14 # Libtool versioning. The backend and view libraries have separate versions.
15 # Before making a release, the libtool version should be modified.
16 # The string is of the form C:R:A.
17 # - If interfaces have been changed or added, but binary compatibility has
18 #   been preserved, change to C+1:0:A+1
19 # - If binary compatibility has been broken (eg removed or changed interfaces)
20 #   change to C+1:0:0
21 # - If the interface is the same as the previous version, change to C:R+1:A
22
23 # Libtool version of the backend library
24 m4_define([ev_document_lt_current],[2])
25 m4_define([ev_document_lt_revision],[0])
26 m4_define([ev_document_lt_age],[0])
27 m4_define([ev_document_lt_version_info],[ev_document_lt_current:ev_document_lt_revision:ev_document_lt_age])
28 m4_define([ev_document_lt_current_minus_age],[m4_eval(ev_document_lt_current - ev_document_lt_age)])
29
30 # Libtool version of the view library
31 m4_define([ev_view_lt_current],[2])
32 m4_define([ev_view_lt_revision],[0])
33 m4_define([ev_view_lt_age],[0])
34 m4_define([ev_view_lt_version_info],[ev_view_lt_current:ev_view_lt_revision:ev_view_lt_age])
35 m4_define([ev_view_lt_current_minus_age],[m4_eval(ev_view_lt_current - ev_view_lt_age)])
36
37 # Binary version for the document backends
38 m4_define([ev_binary_version],[ev_document_lt_current])
39
40 # *****************************************************************************
41
42 AC_PREREQ([2.57])
43 AC_INIT([Evince],[ev_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=evince],[evince])
44 AM_INIT_AUTOMAKE([1.10 foreign dist-bzip2 no-dist-gzip])
45
46 AC_CONFIG_HEADERS([config.h])
47 AC_CONFIG_MACRO_DIR([m4])
48
49 if test -z "$enable_maintainer_mode"; then
50   enable_maintainer_mode=yes
51 fi
52 AM_MAINTAINER_MODE([enable])
53
54 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
55
56 AM_PROG_LIBTOOL
57
58 AC_ISC_POSIX
59 AC_PROG_CC
60 AM_PROG_CC_STDC
61 AM_PROG_CC_C_O
62 AC_PROG_CXX
63 AC_STDC_HEADERS
64
65 AC_PROG_SED
66 AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
67 AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
68
69 GNOME_MAINTAINER_MODE_DEFINES
70 GNOME_COMPILE_WARNINGS
71 GNOME_CXX_WARNINGS
72
73 dnl FIXME: remove this when required gtk+ >= 2.19.7
74 DISABLE_DEPRECATED=
75 AC_SUBST([DISABLE_DEPRECATED])
76
77 IT_PROG_INTLTOOL([0.35.0])
78
79 GETTEXT_PACKAGE=evince
80 AC_SUBST(GETTEXT_PACKAGE)
81 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
82 AM_GLIB_GNU_GETTEXT
83
84 m4_pattern_allow([AM_V_GEN])dnl Make autoconf not complain about the rule below
85 EV_INTLTOOL_EVINCE_BACKEND_RULE='%.evince-backend:   %.evince-backend.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(AM_V_GEN) LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
86 AC_SUBST([EV_INTLTOOL_EVINCE_BACKEND_RULE])
87
88 GLIB_GSETTINGS
89
90 # Check which platform to use
91
92 AC_MSG_CHECKING([for which platform to build])
93 AC_ARG_WITH([platform],
94   [AS_HELP_STRING([--with-platform=gnome|win32|hildon],
95                   [Setting platform (default: gnome)])],
96   [case "$withval" in
97     gnome|win32|hildon) ;;
98     *) AC_MSG_ERROR([invalid argument "$withval" for --with-platform]) ;;
99    esac],
100   [case "$host" in
101      *-*-mingw*|*-*-cygwin*) with_platform="win32" ;;
102      *) with_platform=gnome ;;
103    esac])
104
105 AC_MSG_RESULT([$with_platform])
106
107 if test "$with_platform" = "win32"; then
108   AC_CHECK_TOOL([WINDRES],[windres])
109   AC_MSG_CHECKING([for native Win32])
110   case "$host" in
111     *-*-mingw*)
112       os_win32=yes
113       ;;
114     *)
115       os_win32=no
116       ;;
117   esac
118   AC_MSG_RESULT([$os_win32])
119 fi
120
121 AM_CONDITIONAL([PLATFORM_HILDON],[test "$with_platform" = "hildon"])
122 AM_CONDITIONAL([PLATFORM_WIN32],[test "$with_platform" = "win32"])
123
124 dnl Specify required versions of dependencies
125 DBUS_GLIB_REQUIRED=0.70
126 GTK_REQUIRED=2.20.0
127 GLIB_REQUIRED=2.25.3
128 KEYRING_REQUIRED=2.22.0
129 GCONF_REQUIRED=2.31.2
130 AC_SUBST([GLIB_REQUIRED])
131 AC_SUBST([GTK_REQUIRED])
132
133 GNOME_ICON_THEME_REQUIRED=2.17.1
134 LIBXML_REQUIRED=2.5.0
135
136 dnl Check dependencies
137
138 # LIB_CFLAGS       for helpers and generic widgets. (libdocument, cut-and-paste)
139 # BACKEND_CFLAGS   for backend implementations.
140 # FRONTEND_CFLAGS  for frontend implementations. (properties, thumbnailer)
141 # FRONTEND_LIBS
142 # SHELL_CFLAGS     for shell implementation.
143 # SHELL_LIBS
144
145 PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED)
146 PKG_CHECK_MODULES(LIBVIEW, gtk+-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
147 PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED)
148 PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
149 PKG_CHECK_MODULES(PREVIEWER, gtk+-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
150
151 SHELL_PLATFORM_PKGS=
152 case "$with_platform" in
153   hildon) AC_DEFINE([PLATFORM_HILDON],[1],[Define if building for the hildon platform])
154           SHELL_PLATFORM_PKGS="hildon-1 hildon-fm-2 libosso"
155           ;;
156   gnome)
157         # Evince has a rather soft run-time dependency on hicolor-icon-theme.
158         # If the hicolor theme is not available, Evince fails to display some
159         # icons. Because we cannot check for it at run-time, we instead
160         # would like to require the icon theme at compile-time. But, because
161         # the hicolor-icon-theme does not have a pkgconfig file, on gnome we
162         # require the gnome icon theme instead.
163         SHELL_PLATFORM_PKGS="gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED"
164         # The totem-screensaver and egg_smclient code use x11 directly.
165         SHELL_PLATFORM_PKGS="$SHELL_PLATFORM_PKGS x11"
166         ;;
167   *)
168         # On all other platforms we issue a warning about the runtime
169         # dependency.
170         AC_MSG_WARN([Evince has a soft run-time dependency on hicolor-icon-theme. You are advised to have this theme installed when running Evince.]);
171         SHELL_PLATFORM_PKGS=""
172         ;;
173 esac
174
175 PKG_CHECK_MODULES([SHELL_CORE],[libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gthread-2.0 $SHELL_PLATFORM_PKGS])
176
177 # *********
178 # SM client
179 # *********
180
181 GDK_TARGET="$($PKG_CONFIG --variable target gdk-2.0)"
182
183 AC_MSG_CHECKING([which smclient backend to use])
184 AC_ARG_WITH([smclient],
185   [AS_HELP_STRING([--with-smclient-backend=no|xsmp|win32|quartz],
186                   [Setting smclient backend (default:auto)])],
187   [],
188   [case "$GDK_TARGET" in
189     x11) case "$with_platform" in
190            gnome) with_smclient=xsmp ;;
191            *) with_smclient=no ;;
192          esac ;;
193     win32|quartz) with_smclient=$GDK_TARGET ;;
194     *) with_smclient=no ;;
195    esac])
196    
197 AC_MSG_RESULT([$with_smclient])
198
199 if test "$with_smclient" != "no"; then
200   AC_DEFINE([WITH_SMCLIENT],[1],[Define if smclient is enabled])
201
202   case "$with_smclient" in
203     xsmp) SMCLIENT_PKGS="sm >= 1.0.0" ;;
204     *) SMCLIENT_PKGS="" ;;
205   esac
206
207   PKG_CHECK_MODULES([SMCLIENT],[gtk+-2.0 gthread-2.0 $SMCLIENT_PKGS])
208   AC_SUBST([SMCLIENT_CFLAGS])
209   AC_SUBST([SMCLIENT_LIBS])
210 fi
211
212 AM_CONDITIONAL([WITH_SMCLIENT],[test "$with_smclient" != "no"])
213 AM_CONDITIONAL([WITH_SMCLIENT_XSMP],[test "$with_smclient" = "xsmp"])
214 AM_CONDITIONAL([WITH_SMCLIENT_WIN32],[test "$with_smclient" = "win32"])
215 AM_CONDITIONAL([WITH_SMCLIENT_QUARTZ],[test "$with_smclient" = "quartz"])
216
217 # ***
218
219 BACKEND_LIBTOOL_FLAGS="-module -avoid-version -no-undefined -export-symbols \$(top_srcdir)/backend/backend.symbols"
220 AC_SUBST(BACKEND_LIBTOOL_FLAGS)
221
222 dnl ===== Check special functions
223 evince_save_LIBS=$LIBS
224 LIBS="$LIBS $BACKEND_LIBS"
225 AC_CHECK_FUNCS(cairo_format_stride_for_width)
226 AC_CHECK_FUNCS(gtk_print_operation_get_n_pages_to_print)
227 LIBS=$evince_save_LIBS
228
229 # ******************
230 # GKT+ Unix Printing
231 # ******************
232
233 AC_MSG_CHECKING([whether gtk+-unix-print support is requested])
234 AC_ARG_WITH([gtk-unix-print],
235   [AS_HELP_STRING([--without-gtk-unix-print],
236                   [Disable the use of gtk-unix-print])],
237   [],[case "$os_win32" in
238         yes) with_gtk_unix_print=no ;;
239         *) with_gtk_unix_print=yes ;;
240       esac])
241       
242 AC_MSG_RESULT([$with_gtk_unix_print])
243
244 if test "$with_gtk_unix_print" = "yes"; then
245    PKG_CHECK_MODULES(GTKUNIXPRINT, [gtk+-unix-print-2.0 >= $GTK_REQUIRED])
246    AC_DEFINE([GTKUNIXPRINT_ENABLED], [1], [Define if gtk+-unix-print is enabled.])
247 fi
248
249 # *********************
250 # GNOME Keyring support
251 # *********************
252
253 AC_ARG_WITH(keyring,
254         [AS_HELP_STRING([--without-keyring],
255                         [Disable the use of gnome-keyring])],
256         [],
257         [case "$with_platform" in
258            gnome) with_keyring=yes ;;
259            hildon|win32) with_keyring=no ;;
260          esac])
261
262 AM_CONDITIONAL([WITH_KEYRING],[test "$with_keyring" = "yes"])
263
264 if test "$with_keyring" = "yes"; then
265         PKG_CHECK_MODULES(KEYRING, gnome-keyring-1 >= $KEYRING_REQUIRED)
266         AC_DEFINE([WITH_KEYRING],[1],[Define if KEYRING support is enabled])
267 fi
268
269 # ****
270 # DBUS
271 # ****
272
273 AC_ARG_ENABLE([dbus],
274   [AS_HELP_STRING([--disable-dbus], [Disable support for dbus])],
275   [],
276   [case "$with_platform" in
277       gnome) enable_dbus=yes ;;
278       hildon) enable_dbus=no ;;
279     esac])
280
281 if test "$enable_dbus" = "yes"; then
282   PKG_CHECK_MODULES([DBUS],[dbus-glib-1 >= $DBUS_GLIB_REQUIRED],[],
283                     [AC_MSG_ERROR([DBUS not found; use --disable-dbus to disable DBUS support])])
284
285   AC_PATH_PROG([DBUS_BINDING_TOOL], [dbus-binding-tool], [no])
286   if test x$DBUS_BINDING_TOOL = "xno" ; then
287           AC_MSG_ERROR([dbus-binding-tool executable not found in your path - should be installed with dbus glib bindings])
288   fi
289
290   AC_DEFINE([ENABLE_DBUS],[1],[Define if DBUS support is enabled])
291 fi
292
293 AC_SUBST([DBUS_CFLAGS])
294 AC_SUBST([DBUS_LIBS])
295
296 AM_CONDITIONAL([ENABLE_DBUS], [test "$enable_dbus" = "yes"])
297
298 if test "$enable_dbus" = "yes"; then
299    PKG_CHECK_MODULES([EV_DAEMON], [gthread-2.0 gio-2.0 >= $GLIB_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED])
300 fi
301
302 dnl ========= Check for GConf
303
304 AC_MSG_CHECKING([whether GConf support is requested])
305 AC_ARG_WITH([gconf],
306   [AS_HELP_STRING([--without-gconf],
307                   [Disable the use of gconf])],
308   [],
309   [case "$os_win32" in
310      yes) with_gconf=no ;;
311      *) with_gconf=yes ;;
312    esac])
313 AC_MSG_RESULT([$with_gconf])
314
315 AM_CONDITIONAL([WITH_GCONF],[test "$with_gconf" = "yes"])
316
317 if test "$with_gconf" = "yes"; then
318    PKG_CHECK_MODULES([GCONF],[gconf-2.0 >= $GCONF_REQUIRED])
319    AC_DEFINE([WITH_GCONF],[1],[Define if GConf support is enabled])
320
321    AM_GCONF_SOURCE_2
322
323    AC_PATH_PROG([GCONFTOOL], [gconftool-2], [false])
324    if test "$GCONFTOOL" = "false"; then
325       AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
326    fi
327 else
328    AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL],false)
329 fi
330
331 dnl Debug mode
332
333 AC_ARG_ENABLE([debug],
334         AS_HELP_STRING([--enable-debug],
335                        [Turn on evince debug mode]),
336         [enable_debug=$enableval],
337         [enable_debug=no])
338
339 if test "x$enable_debug" = "xyes"; then
340    DEBUG_FLAGS="-DEV_ENABLE_DEBUG"
341 fi
342
343 AC_ARG_ENABLE([tests],
344         AS_HELP_STRING([--enable-tests], [Enable the tests]),
345         [enable_tests=$enableval],
346         [enable_tests=yes])
347
348 AM_CONDITIONAL(ENABLE_TESTS, test x$enable_tests = xyes)
349
350 LIBDOCUMENT_CFLAGS="$LIBDOCUMENT_CFLAGS $DEBUG_FLAGS"
351 LIBDOCUMENT_LIBS="$LIBDOCUMENT_LIBS"
352 AC_SUBST(LIBDOCUMENT_CFLAGS)
353 AC_SUBST(LIBDOCUMENT_LIBS)
354
355 LIBVIEW_CFLAGS="$LIBVIEW_CFLAGS $GTKUNIXPRINT_CFLAGS $DEBUG_FLAGS"
356 LIBVIEW_LIBS="$LIBVIEW_LIBS $GTKUNIXPRINT_LIBS -lm"
357 AC_SUBST(LIBVIEW_CFLAGS)
358 AC_SUBST(LIBVIEW_LIBS)
359
360 BACKEND_CFLAGS="$BACKEND_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE $DEBUG_FLAGS"
361 BACKEND_LIBS="$BACKEND_LIBS -lm"
362 AC_SUBST(BACKEND_CFLAGS)
363 AC_SUBST(BACKEND_LIBS)
364
365 SHELL_CFLAGS="$SHELL_CORE_CFLAGS $DBUS_CFLAGS $KEYRING_CFLAGS $GCONF_CFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE $DEBUG_FLAGS"
366 SHELL_LIBS="$SHELL_CORE_LIBS $DBUS_LIBS $KEYRING_LIBS $GCONF_LIBS -lz -lm"
367 AC_SUBST(SHELL_CFLAGS)
368 AC_SUBST(SHELL_LIBS)
369
370 FRONTEND_CFLAGS="$FRONTEND_CORE_CFLAGS $DEBUG_FLAGS"
371 FRONTEND_LIBS="$FRONTEND_CORE_LIBS -lz"
372 AC_SUBST(FRONTEND_CFLAGS)
373 AC_SUBST(FRONTEND_LIBS)
374
375 EV_DAEMON_CFLAGS="$EV_DAEMON_CFLAGS $DEBUG_FLAGS"
376 AC_SUBST([EV_DAEMON_CFLAGS])
377 AC_SUBST([EV_DAEMON_LIBS])
378
379 # Check for Nautilus property page build
380 AC_ARG_ENABLE([nautilus],
381   [AS_HELP_STRING([--disable-nautilus],
382                   [Disable build of nautilus extensions])],
383   [],
384   [case "$with_platform" in
385      gnome) enable_nautilus=yes ;;
386      *) enable_nautilus=no ;;
387     esac])
388
389 if test "$enable_nautilus" = "yes" ; then
390   PKG_CHECK_MODULES([NAUTILUS],[gtk+-x11-2.0 $MM gthread-2.0 libnautilus-extension],
391                     [],[AC_MSG_ERROR([libnautilus-extension not found; use --disable-nautilus to disable the nautilus extensions])])
392   NAUTILUS_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libnautilus-extension`
393   AC_SUBST([nautilusextensiondir],[$NAUTILUS_EXTENSION_DIR])
394   AC_SUBST(NAUTILUS_CFLAGS)
395   AC_SUBST(NAUTILUS_LIBS)
396
397   AC_DEFINE([HAVE_NAUTILUS],[1], [defined if you build the nautilus plugin])
398 fi
399
400 AM_CONDITIONAL([ENABLE_NAUTILUS],[test "$enable_nautilus" = "yes"])
401
402 # Check for thumbnailer build
403
404 AC_ARG_ENABLE([thumbnailer],
405   [AS_HELP_STRING([--disable-thumbnailer],
406                   [Disable GNOME thumbnailer])],
407   [],
408   [case "$with_platform" in
409      gnome) enable_thumbnailer=yes ;;
410      *) enable_thumbnailer=no ;;
411     esac])
412
413 AM_CONDITIONAL([ENABLE_THUMBNAILER],[test "$enable_thumbnailer" = "yes"])
414
415 # ***************
416 # Print Previewer
417 # ***************
418
419 AC_ARG_ENABLE([previewer],
420   [AS_HELP_STRING([--disable-previewer],
421                   [Disable the GNOME Document Previewer])],
422   [],
423   [case "$with_platform" in
424       gnome) enable_previewer=yes ;;
425       *) enable_previewer=no ;;
426     esac])
427
428 if test x$enable_previewer = "xyes" ; then
429   PKG_CHECK_MODULES([PREVIEWER],[gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED])
430 fi
431
432 AM_CONDITIONAL([ENABLE_PREVIEWER],[test "$enable_previewer" = "yes"])
433 PREVIEWER_CFLAGS="$PREVIEWER_CFLAGS $GTKUNIXPRINT_CFLAGS $DEBUG_FLAGS"
434 PREVIEWER_LIBS="$PREVIEWER_LIBS $GTKUNIXPRINT_LIBS -lz"
435 AC_SUBST(PREVIEWER_CFLAGS)
436 AC_SUBST(PREVIEWER_LIBS)
437
438 # ***
439 # GIR
440 # ***
441
442 AC_MSG_CHECKING([whether GObject introspection is requested])
443 AC_ARG_ENABLE([introspection],
444         AS_HELP_STRING([--enable-introspection],
445                        [Enable GObject introspection]),
446         [enable_introspection=$enableval],
447         [enable_introspection=no])
448 AC_MSG_RESULT([$enable_introspection])
449
450 G_IR_SCANNER=
451 G_IR_COMPILER=
452 G_IR_GENERATE=
453 GIRDIR=
454 GIRTYPELIBDIR=
455
456 if test "$enable_introspection" = "yes"; then
457   GOBJECT_INTROSPECTION_REQUIRED=0.6
458   PKG_CHECK_MODULES([GOBJECT_INTROSPECTION],[gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED])
459
460   G_IR_SCANNER="$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)"
461   G_IR_COMPILER="$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)"
462   G_IR_GENERATE="$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)"
463   GIRDIR="$($PKG_CONFIG --variable=girdir gobject-introspection-1.0)"
464   GIRTYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
465 fi
466
467 AC_SUBST([G_IR_SCANNER])
468 AC_SUBST([G_IR_COMPILER])
469 AC_SUBST([G_IR_GENERATE])
470 AC_SUBST([GIRDIR])
471 AC_SUBST([GIRTYPELIBDIR])
472
473 AM_CONDITIONAL([ENABLE_INTROSPECTION],[test "$enable_introspection" = "yes"])
474
475 dnl ================== portability checks ===========================================
476
477 dnl for backtrace()
478 AC_CHECK_HEADERS([execinfo.h])
479
480 AC_CHECK_DECL([_NL_MEASUREMENT_MEASUREMENT],[
481   AC_DEFINE([HAVE__NL_MEASUREMENT_MEASUREMENT],[1],[Define if _NL_MEASUREMENT_MEASUREMENT is available])
482   ],[],[#include <langinfo.h>])
483
484 dnl ================== pdf checks ===================================================
485 AC_ARG_ENABLE([pdf],
486   [AS_HELP_STRING([--disable-pdf],
487                   [Disable the PDF support])],
488   [enable_pdf=$enableval],
489   [enable_pdf=yes])
490
491 if test "x$enable_pdf" = "xyes"; then
492     POPPLER_REQUIRED=0.12.0
493     PKG_CHECK_MODULES(POPPLER, poppler-glib >= $POPPLER_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED,enable_pdf=yes,enable_pdf=no)
494
495     if test "x$enable_pdf" = "xyes"; then
496             evince_save_LIBS=$LIBS
497             LIBS="$LIBS $POPPLER_LIBS"
498             AC_CHECK_FUNCS(poppler_page_render)
499             AC_CHECK_FUNCS(poppler_page_get_image)
500             AC_CHECK_FUNCS(poppler_annot_file_attachment_get_attachment)
501             LIBS=$evince_save_LIBS
502
503             PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, enable_cairo_pdf=yes, enable_cairo_pdf=no)
504             if test x$enable_cairo_pdf = xyes; then
505                     AC_DEFINE([HAVE_CAIRO_PDF], [1], [defined if cairo-pdf is available])
506             fi
507
508             PKG_CHECK_MODULES(CAIRO_PS, cairo-ps, enable_cairo_ps=yes, enable_cairo_ps=no)
509             if test x$enable_cairo_ps = xyes; then
510                     AC_DEFINE([HAVE_CAIRO_PS], [1], [defined if cairo-ps is available])
511             fi
512     else
513             AC_MSG_ERROR("PDF support is disabled since poppler-glib library version $POPPLER_REQUIRED or newer not found")
514     fi 
515 fi
516
517 AM_CONDITIONAL(ENABLE_PDF, test x$enable_pdf = xyes)
518 dnl ================== end of pdf checks ============================================
519
520 dnl libspectre (used by ps and dvi backends)
521 SPECTRE_REQUIRED=0.2.0 
522 PKG_CHECK_MODULES(SPECTRE, libspectre >= $SPECTRE_REQUIRED,have_spectre=yes,have_spectre=no)
523 AM_CONDITIONAL(HAVE_SPECTRE, test x$have_spectre = xyes)
524 if test "x$have_spectre" = "xyes"; then
525    AC_DEFINE([HAVE_SPECTRE], [1], [Have libspectre])
526 fi
527
528 dnl ================== ps checks ====================================================
529 AC_ARG_ENABLE(ps,
530         [AS_HELP_STRING([--disable-ps],
531                         [Disable the PostScript backend])],
532         [enable_ps=$enableval],
533         [enable_ps=yes])
534
535 if test "x$enable_ps" = "xyes"; then
536    if test "x$have_spectre" = "xyes"; then
537       AC_DEFINE([ENABLE_PS], [1], [Enable support for PostScript files.])
538    else
539       enable_ps="no"
540       AC_MSG_WARN([PS support is disabled since libspectre (version >= $SPECTRE_REQUIRED) is needed])
541    fi
542 fi
543 AM_CONDITIONAL(ENABLE_PS, test x$enable_ps = xyes)
544 dnl ======================== End of ps checks ===================================
545
546 dnl ================== tiff checks ===================================================
547 AC_ARG_ENABLE(tiff,
548             [AS_HELP_STRING([--disable-tiff],
549                             [Disable the support of multipage tiff])],
550             [enable_tiff=$enableval],
551             [enable_tiff=yes])
552
553 if test "x$enable_tiff" = "xyes"; then
554     AC_CHECK_HEADERS([tiff.h],enable_tiff=yes,enable_tiff=no,)
555     if test "x$enable_tiff" = "xyes"; then
556         AC_CHECK_LIB([tiff],TIFFOpen,enable_tiff=yes,enable_tiff=no,"-lz")
557         AC_CHECK_LIB([tiff],TIFFReadRGBAImageOriented,enable_tiff=yes,enable_tiff=no,"-lz")
558     fi
559     if test "x$enable_tiff" = "xyes"; then
560             AC_DEFINE([ENABLE_TIFF], [1], [Enable multipage tiff support.])
561     else
562             AC_MSG_WARN("Tiff support is disabled since tiff library version 3.6 or newer not found")
563     fi 
564 fi
565
566 AM_CONDITIONAL(ENABLE_TIFF, test x$enable_tiff = xyes)
567 dnl ================== end of tiff checks ============================================
568
569 dnl ================== djvu checks ===================================================
570
571 AC_ARG_ENABLE(djvu,
572             [AS_HELP_STRING([--disable-djvu],
573                             [Disable the support of djvu viewer])],
574             [enable_djvu=$enableval],
575             [enable_djvu=yes])
576
577 if test "x$enable_djvu" = "xyes"; then
578     DJVULIBRE_REQUIRED=3.5.17
579     PKG_CHECK_MODULES(DJVU, ddjvuapi >= $DJVULIBRE_REQUIRED, enable_djvu=yes, enable_djvu=no)
580
581     if test "x$enable_djvu" = "xyes"; then
582         AC_DEFINE([ENABLE_DJVU], [1], [Enable djvu viewer support.])
583     else
584         AC_MSG_WARN([   
585 ** Djvu support is disabled since a recent version of the djvulibre 
586 ** library was not found. You need at least djvulibre-3.5.17 which 
587 ** can be found on http://djvulibre.djvuzone.org 
588 ])
589     fi 
590 fi
591
592 AM_CONDITIONAL(ENABLE_DJVU, test x$enable_djvu = xyes)
593
594 dnl ================== End of djvu checks ===================================================
595
596 dnl ================== dvi checks ===================================================
597
598 AC_ARG_ENABLE(dvi,
599             [AS_HELP_STRING([--disable-dvi],
600             [Disable the support of dvi viewer])],
601             [enable_dvi=$enableval],
602             [enable_dvi=yes])
603
604 AC_ARG_ENABLE(t1lib,
605             [AS_HELP_STRING([--enable-t1lib],
606                             [Compile with support of t1lib for type1 fonts in dvi])],
607             [enable_type1_fonts=$enableval],
608             [enable_type1_fonts=no])
609
610 if test "x$enable_dvi" = "xyes"; then
611     AC_C_CONST
612     AC_C_INLINE
613     AC_TYPE_SIZE_T
614     AC_CHECK_SIZEOF(long, 4)
615     AC_CHECK_SIZEOF(int, 4)
616     AC_CHECK_SIZEOF(short, 2)
617     AC_CHECK_SIZEOF(void *, 4)
618     AC_CHECK_LIB([kpathsea],[kpse_init_prog],[enable_dvi=yes],[enable_dvi=no])
619
620     if test "x$enable_dvi" = "xyes"; then
621         AC_DEFINE([ENABLE_DVI], [1], [Enable dvi viewer support.])
622     else
623         AC_MSG_WARN("Dvi support is disabled since kpathsea library is not found. Check your TeX installation.")
624     fi
625 fi
626 AM_CONDITIONAL(ENABLE_DVI, test x$enable_dvi = xyes)
627
628 if test "x$enable_dvi" = "xyes"; then
629     if test "x$enable_type1_fonts" = "xyes"; then
630         AC_CHECK_LIB([t1],T1_InitLib,enable_type1_fonts=yes,enable_type1_fonts=no,[-lm])
631     fi
632
633     if test "x$enable_type1_fonts" = xyes; then
634         AC_DEFINE([WITH_TYPE1_FONTS], [1], [Enable t1lib support in dvi.])
635     fi
636 else 
637     enable_type1_fonts=no
638 fi
639 AM_CONDITIONAL(WITH_TYPE1_FONTS, test x$enable_type1_fonts = xyes)
640
641 dnl ================== End of dvi checks ===================================================
642
643 dnl ================== pixbuf checks ===================================================
644
645 AC_ARG_ENABLE(pixbuf,
646             [AS_HELP_STRING([--enable-pixbuf],
647                             [Compile with support of pixbuf])],
648             [enable_pixbuf=$enableval],
649             [enable_pixbuf=no])
650             
651 if test "x$enable_pixbuf" = "xyes"; then
652         AC_DEFINE([ENABLE_PIXBUF], [1], [Enable pixbuf support.])
653 fi
654
655 AM_CONDITIONAL(ENABLE_PIXBUF, test x$enable_pixbuf = xyes)
656
657 dnl ================== End of pixbuf checks ===================================================
658
659 dnl ================== comic book checks ===================================================
660  
661 AC_ARG_ENABLE(comics,
662         [AS_HELP_STRING([--enable-comics],
663                         [Compile with support for comic book archives])],
664         [enable_comics=$enableval],
665         [enable_comics=yes])
666         
667 if test "x$enable_comics" = "xyes"; then
668         AC_DEFINE([ENABLE_COMICS], [1], [Enable support for comics.])
669 fi
670 AM_CONDITIONAL(ENABLE_COMICS, test x$enable_comics = xyes)
671
672 dnl ================== End of comic book checks ============================================
673
674 dnl ================== impress book checks ===================================================
675
676 AC_ARG_ENABLE(impress,
677         [AS_HELP_STRING([--enable-impress],
678                         [Compile with support for impress presentations])],
679         [enable_impress=$enableval],
680         [enable_impress=no])
681         
682 if test "x$enable_impress" = "xyes"; then
683         AC_DEFINE([ENABLE_IMPRESS], [1], [Enable support for impress.])
684 fi 
685 AM_CONDITIONAL(ENABLE_IMPRESS, test x$enable_impress = xyes)
686
687 dnl ================== End of impress book checks ============================================
688
689 dnl =================== Mime types list ====================================================
690
691 if test "x$enable_pdf" = "xyes" ; then
692         EVINCE_MIME_TYPES="application/pdf;application/x-bzpdf;application/x-gzpdf;"
693 fi
694 if test "x$enable_ps" = "xyes" ; then
695         EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}application/postscript;application/x-bzpostscript;application/x-gzpostscript;image/x-eps;image/x-bzeps;image/x-gzeps;"
696 fi
697 if test "x$enable_dvi" = "xyes"; then
698         EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}application/x-dvi;application/x-bzdvi;application/x-gzdvi;"
699 fi
700 if test "x$enable_djvu" = "xyes"; then
701         EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}image/vnd.djvu;"
702 fi
703 if test "x$enable_tiff" = "xyes"; then
704         EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}image/tiff;"
705 fi
706 if test "x$enable_comics" = "xyes"; then
707         EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}application/x-cbr;application/x-cbz;application/x-cb7;application/x-cbt;"
708 fi
709 if test "x$enable_pixbuf" = "xyes"; then
710         EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}image/*;"
711 fi
712 if test "x$enable_impress" = "xyes"; then
713         EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}application/vnd.sun.xml.impress;application/vnd.oasis.opendocument.presentation;"
714 fi
715 AC_SUBST(EVINCE_MIME_TYPES)
716
717 AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R, 1, [Defines if localtime_r is available on your system]))
718
719 # *****************
720 # Help files
721 # *****************
722
723 GNOME_DOC_INIT([], gnome_doc_utils=yes, gnome_doc_utils=no)
724
725 AC_ARG_ENABLE(help,
726     [AS_HELP_STRING([--disable-help], [Disable offline help files])],
727     [enable_help=$enableval],
728     [enable_help=yes])
729
730 if test "x$enable_help" = "xyes" && test "x$os_win32" = "xyes" ; then
731     AC_MSG_WARN([Offline help is disabled (not implemented on Windows).])
732     enable_help=no
733 fi
734
735 if test "x$enable_help" = "xyes" && test "x$gnome_doc_utils" == "xno"; then
736     AC_MSG_ERROR(
737        [gnome-doc-utils not found; use --disable-help to disable help files]
738     )
739 fi
740
741 if test "x$enable_help" = "xyes"; then
742     AC_DEFINE([OFFLINE_HELP_ENABLED], [1], [Enable offline help])
743 fi
744
745 AM_CONDITIONAL(ENABLE_HELP, test "x$enable_help" = "xyes")
746
747 # *****************
748 # API documentation
749 # *****************
750
751 GTK_DOC_CHECK([1.13],[--flavour no-tmpl])
752
753 AC_SUBST([GLIB_PREFIX],[$($PKG_CONFIG --variable=prefix glib-2.0)])
754 AC_SUBST([GTK_PREFIX],[$($PKG_CONFIG --variable=prefix gtk+-2.0)])
755
756 # ******************
757 # Backends directory
758 # ******************
759
760 AC_SUBST([backenddir],"\$(libdir)/evince/ev_binary_version/backends")
761 AC_SUBST([backend_binary_version],"ev_binary_version")
762
763 # **********
764 # Versioning
765 # **********
766
767 AC_SUBST([EV_MAJOR_VERSION],[ev_major_version])
768 AC_SUBST([EV_MINOR_VERSION],[ev_minor_version])
769 AC_SUBST([EV_MICRO_VERSION],[ev_micro_version])
770
771 AC_SUBST([EV_API_VERSION],[ev_api_version])
772 AC_SUBST([EV_BINARY_VERSION],[ev_binary_version])
773
774 AC_SUBST([EV_DOCUMENT_LT_VERSION_INFO],[ev_document_lt_version_info])
775 AC_SUBST([EV_DOCUMENT_LT_CURRENT_MINUS_AGE],[ev_document_lt_current_minus_age])
776 AC_SUBST([EV_VIEW_LT_VERSION_INFO],[ev_view_lt_version_info])
777 AC_SUBST([EV_VIEW_LT_CURRENT_MINUS_AGE],[ev_view_lt_current_minus_age])
778
779 # *****************************************************************************
780 # *****************************************************************************
781
782 AC_CONFIG_FILES([
783 backend/Makefile
784 backend/comics/Makefile
785 backend/djvu/Makefile
786 backend/dvi/Makefile
787 backend/dvi/mdvi-lib/Makefile
788 backend/impress/Makefile
789 backend/pdf/Makefile
790 backend/pixbuf/Makefile
791 backend/ps/Makefile
792 backend/tiff/Makefile
793 cut-n-paste/Makefile
794 cut-n-paste/gimpcellrenderertoggle/Makefile
795 cut-n-paste/smclient/Makefile
796 cut-n-paste/toolbar-editor/Makefile
797 cut-n-paste/zoom-control/Makefile
798 cut-n-paste/totem-screensaver/Makefile
799 data/evince.desktop.in
800 data/Makefile
801 data/icons/Makefile
802 data/icons/16x16/Makefile
803 data/icons/16x16/apps/Makefile
804 data/icons/16x16/actions/Makefile
805 data/icons/16x16/mimetypes/Makefile
806 data/icons/22x22/Makefile
807 data/icons/22x22/apps/Makefile
808 data/icons/22x22/actions/Makefile
809 data/icons/22x22/mimetypes/Makefile
810 data/icons/24x24/Makefile
811 data/icons/24x24/apps/Makefile
812 data/icons/24x24/actions/Makefile
813 data/icons/24x24/mimetypes/Makefile
814 data/icons/32x32/Makefile
815 data/icons/32x32/actions/Makefile
816 data/icons/32x32/mimetypes/Makefile
817 data/icons/48x48/Makefile
818 data/icons/48x48/apps/Makefile
819 data/icons/48x48/actions/Makefile
820 data/icons/scalable/Makefile
821 data/icons/scalable/apps/Makefile
822 data/icons/scalable/actions/Makefile
823 data/icons/scalable/mimetypes/Makefile
824 help/Makefile
825 help/reference/Makefile
826 help/reference/libdocument/Makefile
827 help/reference/libdocument/version.xml
828 help/reference/libview/Makefile
829 help/reference/libview/version.xml
830 help/reference/shell/Makefile
831 help/reference/shell/version.xml
832 libdocument/Makefile
833 libdocument/ev-version.h
834 libmisc/Makefile
835 libview/Makefile
836 Makefile
837 po/Makefile.in
838 previewer/Makefile
839 properties/Makefile
840 shell/Makefile
841 test/Makefile
842 thumbnailer/Makefile
843 ])
844
845 AC_CONFIG_FILES(evince-document-[]ev_api_version[].pc:evince-document.pc.in)
846 AC_CONFIG_FILES(evince-view-[]ev_api_version[].pc:evince-view.pc.in)
847
848 AC_OUTPUT
849
850 echo "
851 Configure summary:
852         Platform...........:  $with_platform
853         GConf Support......:  $with_gconf
854         GTK+ Unix Print....:  $with_gtk_unix_print
855         Keyring Support....:  $with_keyring
856         DBUS Support.......:  $enable_dbus
857         SM client support..:  $with_smclient
858         Help files.........:  $enable_help
859         Nautilus Plugin....:  $enable_nautilus
860         Thumbnailer........:  $enable_thumbnailer
861         Previewer..........:  $enable_previewer
862         Gtk-Doc Support....:  $enable_gtk_doc
863         Debug mode.........:  $enable_debug
864         GObj. Introspection:  $enable_introspection
865         Tests..............:  $enable_tests
866
867         PDF Backend........:  $enable_pdf
868         PostScript Backend.:  $enable_ps
869         TIFF Backend.......:  $enable_tiff
870         DJVU Backend.......:  $enable_djvu
871         DVI Backend........:  $enable_dvi
872         Pixbuf Backend.....:  $enable_pixbuf
873         Comics Backend.....:  $enable_comics
874         Impress Backend....:  $enable_impress
875 "