]> www.fi.muni.cz Git - evince.git/blob - configure.ac
Make printing support optional. Patch from Eduardo de Barros Lima
[evince.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_PREREQ(2.57)
4 AC_INIT(evince, 0.5.0)
5 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
6
7 AM_CONFIG_HEADER(config.h)
8
9 AM_MAINTAINER_MODE
10
11 AM_PROG_LIBTOOL
12
13 AC_ISC_POSIX
14 AC_PROG_CC
15 AM_PROG_CC_STDC
16 AC_PROG_CXX
17 AC_STDC_HEADERS
18 AC_PROG_INTLTOOL
19 AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
20 AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
21
22 GNOME_COMMON_INIT
23 GNOME_DOC_INIT
24 GNOME_MAINTAINER_MODE_DEFINES
25 GNOME_COMPILE_WARNINGS
26 GNOME_CXX_WARNINGS
27 GNOME_DEBUG_CHECK
28
29 ALL_LINGUAS="be bg bn ca cs cy da de el en_CA en_GB es et eu fa fi fr gl gu he hi hu id it ja ko ku lt mk nb ne nl no pa pl pt pt_BR ro ru rw sk sq sr sr@Latn sv th tr uk vi wa zh_CN zh_HK zh_TW"
30
31 AM_GLIB_GNU_GETTEXT
32
33 GETTEXT_PACKAGE=AC_PACKAGE_NAME
34 AC_SUBST(GETTEXT_PACKAGE)
35 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
36
37 dnl Check dependencies
38
39 # LIB_CFLAGS       for helpers and generic widgets. (lib, cut-and-paste)
40 # BACKEND_CFLAGS   for backend implementations.
41 # FRONTEND_CFLAGS  for frontend implementations. (properties, thumbnailer)
42 # FRONTEND_LIBS
43 # SHELL_CFLAGS     for shell implementation.
44 # SHELL_LIBS
45
46 POPPLER_REQUIRED=0.5.0
47 DBUS_GLIB_REQUIRED=0.33
48 GTK_REQUIRED=2.6.0
49 LIBGNOMEUI_REQUIRED=2.6.0
50 KEYRING_REQUIRED=0.4.0
51 LIBGNOMEPRINTUI_REQUIRED=2.5.1
52
53 PKG_CHECK_MODULES(LIB, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED)
54 PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED gnome-vfs-2.0)
55 PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libglade-2.0 poppler-glib >= $POPPLER_REQUIRED)
56 PKG_CHECK_MODULES(POPPLER, poppler-glib >= $POPPLER_REQUIRED)
57 PKG_CHECK_MODULES(SHELL_CORE, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED gnome-vfs-2.0 libglade-2.0 gconf-2.0 poppler-glib >= $POPPLER_REQUIRED gnome-keyring-1 >= $KEYRING_REQUIRED)
58
59 GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`  
60 AC_SUBST(GLIB_GENMARSHAL)
61
62
63 dnl ========= Check for libgnomeprintui
64 AC_ARG_ENABLE(gnome-print,
65         [AC_HELP_STRING([--disable-gnome-print], [Compile without print support])],
66         enable_gnome_print="$enableval",
67         enable_gnome_print=yes)
68
69 if test x$enable_gnome_print = xyes; then
70         PKG_CHECK_MODULES(GNOME_PRINT, 
71                 libgnomeprintui-2.2 >= $LIBGNOMEPRINTUI_REQUIRED,
72                 enable_gnome_print=yes, enable_gnome_print=no)
73 fi
74
75 AC_SUBST(GNOME_PRINT_CFLAGS)
76 AC_SUBST(GNOME_PRINT_LIBS)
77
78 if test x$enable_gnome_print = xyes; then
79         AC_DEFINE([WITH_GNOME_PRINT],[1],[Enable Print Support.])
80 fi 
81
82 AM_CONDITIONAL(WITH_GNOME_PRINT, test x$enable_gnome_print = xyes)
83
84 dnl ========= Check for DBUS
85 PKG_CHECK_MODULES([DBUS], [dbus-glib-1 >= $DBUS_GLIB_REQUIRED],
86         [enable_dbus=yes],[enable_dbus=no])
87 AC_SUBST([DBUS_CFLAGS])
88 AC_SUBST([DBUS_LIBS])
89
90 if test "x$enable_dbus" = "xno"; then
91         AC_MSG_WARN([DBUS support is disabled since dbus $DBUS_GLIB_REQUIRED or higher was not found])
92 fi
93
94 if test "x$enable_dbus" = "xyes" ; then
95         AC_PATH_PROG([DBUS_BINDING_TOOL], [dbus-binding-tool], [no])
96
97         if test x$DBUS_BINDING_TOOL = "xno" ; then
98                 AC_MSG_ERROR([dbus-binding-tool executable not found in your path - should be installed with dbus glib bindings])
99         fi                                            
100
101         AC_DEFINE([ENABLE_DBUS],[1],[Define if DBUS support is enabled])
102
103         DBUS_VERSION=`$PKG_CONFIG --modversion dbus-glib-1 | sed 's/0\.\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\)/\1/'`
104         AC_DEFINE_UNQUOTED(DBUS_VERSION, $DBUS_VERSION, [DBUS version.])
105 fi
106
107 SHELL_CFLAGS="$SHELL_CORE_CFLAGS $DBUS_CFLAGS"
108 SHELL_LIBS="$SHELL_CORE_LIBS $DBUS_LIBS -lz"
109 AC_SUBST(SHELL_CFLAGS)
110 AC_SUBST(SHELL_LIBS)
111
112 FRONTEND_CFLAGS="$FRONTEND_CORE_CFLAGS"
113 FRONTEND_LIBS="$FRONTEND_CORE_LIBS -lz"
114 AC_SUBST(FRONTEND_CFLAGS)
115 AC_SUBST(FRONTEND_LIBS)
116
117 AM_CONDITIONAL([ENABLE_DBUS], [test "x$enable_dbus" = "xyes"])
118 AM_CONDITIONAL([DBUS_TOOL_NO_PREFIX], [test "x$DBUS_VERSION" = "x33"])
119
120 dnl Check for Nautilus property page build
121 AC_ARG_ENABLE(nautilus,
122         AC_HELP_STRING([--enable-nautilus],[compile the nautilus plugin]),
123         [case "${enableval}" in
124         yes) ENABLE_NAUTILUS=yes ;;
125         no) ENABLE_NAUTILUS=no ;;
126         *) AC_MSG_ERROR(bad value ${enableval} for --enable-nautilus) ;;
127         esac],
128         [ENABLE_NAUTILUS=yes]) dnl Default value
129
130 if test x$ENABLE_NAUTILUS = "xyes" ; then
131         PKG_CHECK_MODULES(NAUTILUS, gtk+-x11-2.0 $MM gthread-2.0 libnautilus-extension,
132                         [HAVE_NAUTILUS=yes], [HAVE_NAUTILUS=no])
133 fi
134
135 AC_SUBST(NAUTILUS_CFLAGS)
136 AC_SUBST(NAUTILUS_LIBS)
137 if test x$HAVE_NAUTILUS = "xyes"; then
138         AC_DEFINE(HAVE_NAUTILUS, 1, [defined if you build the nautilus plugin])
139 fi
140 AM_CONDITIONAL(HAVE_NAUTILUS, test x$HAVE_NAUTILUS = "xyes")
141
142 dnl Check for functions not present in gtk 2.6
143 evince_save_LIBS=$LIBS
144 LIBS="$LIBS $FRONTEND_CORE_LIBS"
145 AC_CHECK_FUNCS(gtk_icon_view_get_visible_range)
146 AC_CHECK_FUNCS(gtk_window_present_with_time)
147 AC_CHECK_FUNCS(g_file_set_contents)
148 LIBS=$evince_save_LIBS
149
150 dnl GConf configuration
151 AM_GCONF_SOURCE_2
152
153 AC_PATH_PROG([GCONFTOOL], [gconftool-2], [no])
154 if test "x$GCONFTOOL" = "xno"; then
155         AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
156 fi
157
158 dnl ================== portability checks ===========================================
159
160 dnl for backtrace()
161 AC_CHECK_HEADERS([execinfo.h])
162
163 dnl ================== ggv checks ===================================================
164 AC_ARG_ENABLE(ps,
165         [AC_HELP_STRING([--disable-ps], [Compile without PostScript backend])],enable_ps=$enableval,enable_ps="yes")
166
167 if test x$enable_ps = xyes; then
168         AC_DEFINE([ENABLE_PS], [1], [Enable support for PostScript files.])
169 fi 
170
171 AM_CONDITIONAL(ENABLE_PS, test x$enable_ps = xyes)
172
173 if test x$enable_ps = xyes; then
174 AC_ARG_WITH(gs,
175             [AC_HELP_STRING([--with-gs=dir], [Directory Where GhostScript package is installed.])])
176
177 if test "x$with_gs" = "x"; then
178         AC_PATH_PROG(GS_PROG, gs)
179         if test -z "$GS_PROG"; then
180                 AC_MSG_ERROR(Unable to find GhostScript in the PATH. Provide the full path for GhostScript(--with-gs=PATH). You need to have Ghostscript installed in order to run evince)
181         fi
182 else
183         GS_PROG=$with_gs
184 fi
185
186 AC_DEFINE_UNQUOTED(GS_PATH, "$GS_PROG", [Path to the 'gs' executable.])
187
188 dnl check for GS version
189 AC_MSG_CHECKING(for Ghostscript version...)
190 GS_VERSION=`gs --version | head -n 1 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
191 AC_MSG_RESULT(found $GS_VERSION)
192 if test "$GS_VERSION" -lt "7"; then
193         AC_MSG_ERROR([You need Ghostscript version >= 7 in order to run evince])
194 fi
195
196 AC_ARG_WITH(gs-aa-params,
197             [AC_HELP_STRING([--with-gs-aa-params], [Define antialiasing params for ghostscript])],AA_PARAMS=$withval,
198             AA_PARMS="-sDEVICE=x11alpha -dNOPLATFONTS -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -dDOINTERPOLATE"
199             )
200 AC_DEFINE_UNQUOTED(ALPHA_PARAMS, "$AA_PARMS", [Anti-aliasing parameters for Ghostscript.])
201 AC_MSG_RESULT(Antialiasing parameters for Ghostscript: $AA_PARMS)
202
203 fi
204 dnl ======================== End of ggv checks =================================
205
206 dnl ================== tiff checks ===================================================
207 AC_ARG_ENABLE(tiff,
208             [AC_HELP_STRING([--enable-tiff], [Compile with support of multipage tiff])],enable_tiff="$enableval",enable_tiff=yes)
209
210 if test "x$enable_tiff" = "xyes"; then
211     AC_CHECK_HEADERS([tiff.h],enable_tiff=yes,enable_tiff=no,)
212     if test "x$enable_tiff" = "xyes"; then
213         AC_CHECK_LIB([tiff],TIFFOpen,enable_tiff=yes,enable_tiff=no,"-lz")
214         AC_CHECK_LIB([tiff],TIFFReadRGBAImageOriented,enable_tiff=yes,enable_tiff=no,"-lz")
215     fi
216     if test "x$enable_tiff" = "xyes"; then
217             AC_DEFINE([ENABLE_TIFF], [1], [Enable multipage tiff support.])
218             FRONTEND_LIBS="$FRONTEND_LIBS -ltiff"
219             SHELL_LIBS="$SHELL_LIBS -ltiff"
220     else
221             AC_MSG_WARN("Tiff support is disabled since tiff library version 3.6 or newer not found")
222     fi 
223 fi
224
225 AM_CONDITIONAL(ENABLE_TIFF, test x$enable_tiff = xyes)
226 dnl ================== end of tiff checks ============================================
227
228 dnl ================== djvu checks ===================================================
229
230 AC_ARG_ENABLE(djvu,
231             [AC_HELP_STRING([--enable-djvu], [Compile with support of djvu viewer])],enable_djvu="$enableval",enable_djvu=no)
232
233 if test "x$enable_djvu" = "xyes"; then
234     AC_CHECK_HEADERS([libdjvu/ddjvuapi.h],enable_djvu=yes,enable_djvu=no,)
235
236     if test "x$enable_djvu" = "xyes"; then
237         AC_CHECK_LIB([djvulibre],ddjvu_context_create,enable_djvu=yes,enable_djvu=no,"-lpthread")
238         AC_CHECK_LIB([djvulibre],ddjvu_document_get_pageinfo,enable_djvu=yes,enable_djvu=no,"-lpthread")
239     fi
240
241     if test "x$enable_djvu" = "xyes"; then
242         AC_DEFINE([ENABLE_DJVU], [1], [Enable djvu viewer support.])
243     else
244         AC_MSG_WARN([   
245 ** Djvu support is disabled since a recent version of the djvulibre 
246 ** library was not found. You need at least djvulibre-3.5.15 which 
247 ** can be found on http://djvulibre.djvuzone.org 
248 ])
249     fi 
250 fi
251
252 AM_CONDITIONAL(ENABLE_DJVU, test x$enable_djvu = xyes)
253
254 dnl ================== End of djvu checks ===================================================
255
256 dnl ================== dvi checks ===================================================
257
258 AC_ARG_ENABLE(dvi,
259             [AC_HELP_STRING([--enable-dvi], [Compile with support of dvi viewer])],enable_dvi="$enableval",enable_dvi=no)
260
261 AC_ARG_ENABLE(t1lib,
262             [AC_HELP_STRING([--enable-t1lib], [Compile with support of t1lib for type1 fonts in dvi])],enable_type1_fonts="$enableval",enable_type1_fonts=no)
263
264 if test "x$enable_dvi" = "xyes"; then
265     AC_C_CONST
266     AC_C_INLINE
267     AC_TYPE_SIZE_T
268     AC_CHECK_SIZEOF(long, 4)
269     AC_CHECK_SIZEOF(int, 4)
270     AC_CHECK_SIZEOF(short, 2)
271     AC_CHECK_SIZEOF(void *, 4)
272     AC_CHECK_LIB([kpathsea],[kpse_init_prog],[enable_dvi=yes],[enable_dvi=no])
273
274     if test "x$enable_dvi" = "xyes"; then
275         AC_DEFINE([ENABLE_DVI], [1], [Enable dvi viewer support.])
276     else
277         AC_MSG_WARN("Dvi support is disabled since kpathsea library is not found. Check your TeX installation.")
278     fi
279 fi
280 AM_CONDITIONAL(ENABLE_DVI, test x$enable_dvi = xyes)
281
282 if test "x$enable_dvi" = "xyes"; then
283     if test "x$enable_type1_fonts" = "xyes"; then
284         AC_CHECK_LIB([t1],T1_InitLib,enable_type1_fonts=yes,enable_type1_fonts=no,[-lm])
285     fi
286
287     if test "x$enable_type1_fonts" = xyes; then
288         AC_DEFINE([WITH_TYPE1_FONTS], [1], [Enable t1lib support in dvi.])
289     fi
290 else 
291     enable_type1_fonts=no
292 fi
293 AM_CONDITIONAL(WITH_TYPE1_FONTS, test x$enable_type1_fonts = xyes)
294
295 dnl ================== End of dvi checks ===================================================
296
297 dnl ================== pixbuf checks ===================================================
298
299 AC_ARG_ENABLE(pixbuf,
300             [AC_HELP_STRING([--enable-pixbuf], [Compile with support of pixbuf])],enable_pixbuf="$enableval",enable_pixbuf=no)
301 if test "x$enable_pixbuf" = "xyes"; then
302         AC_DEFINE([ENABLE_PIXBUF], [1], [Enable pixbuf support.])
303 fi
304 AM_CONDITIONAL(ENABLE_PIXBUF, test x$enable_pixbuf = xyes)
305
306 dnl ================== End of pixbuf checks ===================================================
307
308 dnl ================== comic book checks ===================================================
309  
310 AC_ARG_ENABLE(comics,
311         [AC_HELP_STRING([--enable-comics], [Compile with support for comic book archives])],enable_comics="$enableval",enable_comics=no)
312 if test "x$enable_comics" = "xyes"; then
313         AC_DEFINE([ENABLE_COMICS], [1], [Enable support for comics.])
314 fi 
315 AM_CONDITIONAL(ENABLE_COMICS, test x$enable_comics = xyes)
316
317 dnl ================== End of comic book checks ============================================
318
319 dnl =================== Mime types list ====================================================
320
321 EVINCE_MIME_TYPES="application/pdf"
322
323 if test "x$disable_ps" = "xno" ; then
324         EVINCE_MIME_TYPES="$EVINCE_MIME_TYPES;application/postscript;application/x-gzpostscript"
325 fi
326 if test "x$enable_dvi" = "xyes"; then
327         EVINCE_MIME_TYPES="$EVINCE_MIME_TYPES;application/x-dvi"
328 fi
329 if test "x$enable_djvu" = "xyes"; then
330         EVINCE_MIME_TYPES="$EVINCE_MIME_TYPES;image/vnd.djvu"
331 fi
332 if test "x$enable_tiff" = "xyes"; then
333         EVINCE_MIME_TYPES="$EVINCE_MIME_TYPES;image/tiff"
334 fi
335 if test "x$enable_comics" = "xyes"; then
336         EVINCE_MIME_TYPES="$EVINCE_MIME_TYPES;application/x-cbr;application/x-cbz"
337 fi
338 AC_SUBST(EVINCE_MIME_TYPES)
339
340 AC_CONFIG_FILES([
341 Makefile
342 cut-n-paste/Makefile
343 cut-n-paste/recent-files/Makefile
344 cut-n-paste/zoom-control/Makefile
345 cut-n-paste/toolbar-editor/Makefile
346 data/Makefile
347 data/evince.desktop.in
348 lib/Makefile
349 pdf/Makefile
350 pixbuf/Makefile
351 tiff/Makefile
352 ps/Makefile
353 djvu/Makefile
354 dvi/Makefile
355 dvi/mdvi-lib/Makefile
356 comics/Makefile
357 po/Makefile.in
358 backend/Makefile
359 properties/Makefile
360 shell/Makefile
361 thumbnailer/Makefile
362 help/Makefile
363 ])
364
365 AC_OUTPUT
366
367 echo "
368 Configure summary:
369         Print Support......:  $enable_gnome_print
370         DBUS Support.......:  $enable_dbus
371         Nautilus Plugin....:  $HAVE_NAUTILUS
372
373         PostScript Backend.:  $enable_ps
374         TIFF Backend.......:  $enable_tiff
375         DJVU Backend.......:  $enable_djvu
376         DVI Backend........:  $enable_dvi
377         Pixbuf Backend.....:  $enable_pixbuf
378         Comics Backend.....:  $enable_comics
379 "