]> www.fi.muni.cz Git - evince.git/blob - configure.ac
Enable dbus when available, do not require a configure option.
[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.3.2)
5 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
6
7 dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
8 AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS")
9
10 AM_CONFIG_HEADER(config.h)
11
12 AM_MAINTAINER_MODE
13
14 AM_PROG_LIBTOOL
15
16 AC_ISC_POSIX
17 AC_PROG_CC
18 AM_PROG_CC_STDC
19 AC_PROG_CXX
20 AC_STDC_HEADERS
21 AC_PROG_INTLTOOL
22 AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
23 AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
24
25 GNOME_DEBUG_CHECK
26
27 ALL_LINGUAS="bg ca cs da de el en_CA en_GB es fi fr hu ja ko lt nb nl no pt_BR ru rw sk sv th uk wa zh_CN zh_TW"
28
29 AM_GLIB_GNU_GETTEXT
30
31 GETTEXT_PACKAGE=AC_PACKAGE_NAME
32 AC_SUBST(GETTEXT_PACKAGE)
33 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
34
35 POPPLER_REQUIRED=0.3.3
36 DBUS_GLIB_REQUIRED=0.33
37
38 PKG_CHECK_MODULES(LIBEVPRIVATE, gtk+-2.0 >= 2.4.0)
39 PKG_CHECK_MODULES(TOOLBAR_EDITOR, gtk+-2.0 >= 2.4.0 libgnomeui-2.0 >= 2.4.0)
40 PKG_CHECK_MODULES(RECENT_FILES, gtk+-2.0 >= 2.4.0 libgnomeui-2.0 >= 2.4.0)
41 PKG_CHECK_MODULES(ZOOM_CONTROL, gtk+-2.0 >= 2.4.0)
42 PKG_CHECK_MODULES(SHELL, gtk+-2.0 >= 2.6.0 libgnomeui-2.0 >= 2.6.0 gnome-vfs-2.0 libgnomeprint-2.2 >= 2.5.1 libgnomeprintui-2.2 libglade-2.0 gconf-2.0 poppler-glib >= $POPPLER_REQUIRED)
43 PKG_CHECK_MODULES(THUMBNAILER, gtk+-2.0 >= 2.6.0 gnome-vfs-2.0 poppler-glib >= $POPPLER_REQUIRED)
44 PKG_CHECK_MODULES(PROPERTIES, gtk+-2.0 >= 2.6.0 libglade-2.0 poppler-glib >= $POPPLER_REQUIRED)
45 PKG_CHECK_MODULES(DVI, gtk+-2.0 >= 2.6.0)
46 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0)
47 PKG_CHECK_MODULES(PS, gtk+-2.0 >= 2.6.0 gnome-vfs-2.0 libgnomeui-2.0)
48 PKG_CHECK_MODULES(POPPLER_GLIB, poppler-glib >= $POPPLER_REQUIRED)
49
50 GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`  
51 AC_SUBST(GLIB_GENMARSHAL)
52
53 PKG_CHECK_EXISTS([dbus-glib-1 >= $DBUS_GLIB_REQUIRED], [enable_dbus=yes],
54                   [AC_MSG_WARN("DBUS support is disabled since dbus 0.33 or higher was not found")
55                   enable_dbus=no])
56
57 if test "x$enable_dbus" = "xyes" ; then
58         PKG_CHECK_MODULES([DBUS], [dbus-glib-1 >= $DBUS_GLIB_REQUIRED])
59         AC_DEFINE([ENABLE_DBUS],[1],[Define if DBUS support is enabled])
60         AC_DEFINE([ENABLE_METADATA],[1],[Define if metadata support is enabled])
61
62         DBUS_VERSION=`$PKG_CONFIG --modversion dbus-glib-1 | sed 's/0.\([[0-9]]*\)/\1/'`
63         AC_DEFINE_UNQUOTED(DBUS_VERSION, $DBUS_VERSION, [DBUS version.])
64 fi
65
66 AM_CONDITIONAL([ENABLE_DBUS], [test "x$enable_dbus" = "xyes"])
67 AM_CONDITIONAL([ENABLE_METADATA], [test "x$enable_dbus" = "xyes"])
68 AM_CONDITIONAL([DBUS_TOOL_NO_PREFIX], [test "x$DBUS_VERSION" = "x33"])
69
70 dnl Check for Nautilus property page build
71 AC_ARG_ENABLE(nautilus,
72         AC_HELP_STRING([--enable-nautilus],[compile the nautilus plugin]),
73         [case "${enableval}" in
74         yes) ENABLE_NAUTILUS=yes ;;
75         no) ENABLE_NAUTILUS=no ;;
76         *) AC_MSG_ERROR(bad value ${enableval} for --enable-nautilus) ;;
77         esac],
78         [ENABLE_NAUTILUS=yes]) dnl Default value
79
80 if test x$ENABLE_NAUTILUS = "xyes" ; then
81         PKG_CHECK_MODULES(NAUTILUS, gtk+-x11-2.0 $MM gthread-2.0 libnautilus-extension,
82                         [HAVE_NAUTILUS=yes], [HAVE_NAUTILUS=no])
83 fi
84
85 AC_SUBST(NAUTILUS_CFLAGS)
86 AC_SUBST(NAUTILUS_LIBS)
87 if test x$HAVE_NAUTILUS = "xyes"; then
88         AC_DEFINE(HAVE_NAUTILUS, 1, [defined if you build the nautilus plugin])
89 fi
90 AM_CONDITIONAL(HAVE_NAUTILUS, test x$HAVE_NAUTILUS = "xyes")
91
92 dnl Compile with disable-deprecated switches
93
94 AC_ARG_ENABLE(deprecated,
95 AC_HELP_STRING([--disable-deprecated],
96                [Don't allow any deprecated GTK+/etc. features.]),
97 set_enable_deprecated="$enableval",[
98 if test -f $srcdir/autogen.sh; then
99         is_cvs_version=true
100         set_enable_deprecated=no
101 else
102         set_enable_deprecated=yes
103         fi
104 ])
105 AC_MSG_CHECKING([whether to disable deprecated glib/gtk+/etc. features])
106 if test "$set_enable_deprecated" != "yes"; then
107         AC_MSG_RESULT(yes)
108         EVINCE_DISABLE_DEPRECATED="-DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -DBONOBO_DISABLE_DEPRECATED"
109 else
110         AC_MSG_RESULT(no)
111         EVINCE_DISABLE_DEPRECATED=""
112 fi
113 AC_SUBST(EVINCE_DISABLE_DEPRECATED)
114
115 evince_save_LIBS=$LIBS
116 LIBS="$LIBS $GTK_LIBS"
117 AC_CHECK_FUNCS(gtk_icon_view_get_visible_range)
118 LIBS=$evince_save_LIBS
119
120 AM_GCONF_SOURCE_2
121
122 AC_PATH_PROG([GCONFTOOL], [gconftool-2], [no])
123 if test "x$GCONFTOOL" = "xno"; then
124         AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
125 fi
126
127 dnl ================== ggv checks ===================================================
128 AC_ARG_WITH(gs-pkg,
129             [  --with-gs=dir       Directory Where GhostScript package is installed.])
130
131 if test "x$with_gs" = "x"; then
132         AC_PATH_PROG(GS_PROG, gs)
133         if test -z "$GS_PROG"; then
134                 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)
135         fi
136 else
137         GS_PROG=$with_gs
138 fi
139
140 AC_DEFINE_UNQUOTED(GS_PATH, "$GS_PROG", [Path to the 'gs' executable.])
141
142
143 dnl check for GS version
144 AC_MSG_CHECKING(for Ghostscript version...)
145 GS_VERSION=`gs --version | head -n 1 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
146 AC_MSG_RESULT(found $GS_VERSION)
147 if test "$GS_VERSION" -lt "7"; then
148         AC_MSG_ERROR([You need Ghostscript version >= 7 in order to run evince])
149 fi
150 AA_PARMS="-sDEVICE=x11alpha -dNOPLATFONTS"
151 AC_DEFINE_UNQUOTED(ALPHA_PARAMS, "$AA_PARMS", [Anti-aliasing parameters for Ghostscript.])
152 AC_MSG_RESULT(Antialiasing parameters for Ghostscript: $AA_PARMS)
153 dnl ======================== End of ggv checks =================================
154
155 dnl ================== tiff checks ===================================================
156 AC_ARG_ENABLE(tiff,
157             [AC_HELP_STRING([--enable-tiff], [Compile with support of multipage tiff])],enable_tiff="$enableval",enable_tiff=yes)
158
159 if test "x$enable_tiff" = "xyes"; then
160     AC_CHECK_HEADERS([tiff.h],enable_tiff=yes,enable_tiff=no,)
161     if test "x$enable_tiff" = "xyes"; then
162         AC_CHECK_LIB([tiff],TIFFOpen,enable_tiff=yes,enable_tiff=no,"-lz")
163         AC_CHECK_LIB([tiff],TIFFReadRGBAImageOriented,enable_tiff=yes,enable_tiff=no,"-lz")
164     fi
165     if test "x$enable_tiff" = "xyes"; then
166             AC_DEFINE([ENABLE_TIFF], [1], [Enable multipage tiff support.])
167     else
168             AC_MSG_WARN("Tiff support is disabled since tiff library version 3.6 or newer not found")
169     fi 
170 fi
171
172 AM_CONDITIONAL(ENABLE_TIFF, test x$enable_tiff = xyes)
173 dnl ================== end of tiff checks ============================================
174
175 dnl ================== djvu checks ===================================================
176
177 AC_ARG_ENABLE(djvu,
178             [AC_HELP_STRING([--enable-djvu], [Compile with support of djvu viewer])],enable_djvu="$enableval",enable_djvu=no)
179
180 if test "x$enable_djvu" = "xyes"; then
181     AC_CHECK_HEADERS([libdjvu/ddjvuapi.h],enable_djvu=yes,enable_djvu=no,)
182
183     if test "x$enable_djvu" = "xyes"; then
184         AC_CHECK_LIB([djvulibre],ddjvu_context_create,enable_djvu=yes,enable_djvu=no,"-lpthread")
185         AC_CHECK_LIB([djvulibre],ddjvu_document_get_pageinfo,enable_djvu=yes,enable_djvu=no,"-lpthread")
186     fi
187
188     if test "x$enable_djvu" = "xyes"; then
189         AC_DEFINE([ENABLE_DJVU], [1], [Enable djvu viewer support.])
190     else
191         AC_MSG_WARN([   
192 ** Djvu support is disabled since recent version of djvulibre 
193 ** library was not found. To get proper djvu support you need to
194 ** install development version of djvulibre. You can get it from
195 ** anonymous CVS server on djvulibre.sf.net. Just use something
196 ** like:
197
198 ** cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/djvu co djvulibre-3.5
199 ])
200     fi 
201 fi
202
203 AM_CONDITIONAL(ENABLE_DJVU, test x$enable_djvu = xyes)
204
205 dnl ================== End of djvu checks ===================================================
206
207 dnl ================== dvi checks ===================================================
208
209 AC_ARG_ENABLE(dvi,
210             [AC_HELP_STRING([--enable-dvi], [Compile with support of dvi viewer])],enable_dvi="$enableval",enable_dvi=no)
211
212 AC_ARG_ENABLE(t1lib,
213             [AC_HELP_STRING([--enable-t1lib], [Compile with support of t1lib for type1 fonts in dvi])],enable_type1_fonts="$enableval",enable_type1_fonts=no)
214
215 if test "x$enable_dvi" = "xyes"; then
216     AC_C_CONST
217     AC_C_INLINE
218     AC_TYPE_SIZE_T
219     AC_CHECK_SIZEOF(long, 4)
220     AC_CHECK_SIZEOF(int, 4)
221     AC_CHECK_SIZEOF(short, 2)
222     AC_CHECK_SIZEOF(void *, 4)
223     AC_CHECK_LIB([kpathsea],[kpse_init_prog],[enable_dvi=yes],[enable_dvi=no])
224
225     if test "x$enable_dvi" = "xyes"; then
226         AC_DEFINE([ENABLE_DVI], [1], [Enable dvi viewer support.])
227     else
228         AC_MSG_WARN("Dvi support is disabled since kpathsea library is not found. Check your TeX installation.")
229     fi
230 fi
231 AM_CONDITIONAL(ENABLE_DVI, test x$enable_dvi = xyes)
232
233 if test "x$enable_dvi" = "xyes"; then
234     if test "x$enable_type1_fonts" = "xyes"; then
235         AC_CHECK_LIB([t1lib],T1_InitLib,enable_type1_fonts=yes,enable_type1_fonts=no)
236     fi
237
238     if test "x$enable_type1_fonts" = xyes; then
239         AC_DEFINE([WITH_TYPE1_FONTS], [1], [Enable t1lib support in dvi.])
240     fi
241 else 
242     enable_type1_fonts=no
243 fi
244 AM_CONDITIONAL(WITH_TYPE1_FONTS, test x$enable_type1_fonts = xyes)
245
246 dnl ================== End of dvi checks ===================================================
247
248 dnl =================== Mime types list ====================================================
249
250 EVINCE_MIME_TYPES="application/pdf;application/postscript;application/x-gzpostscript"
251
252 if test "x$enable_dvi" = "xyes"; then
253         EVINCE_MIME_TYPES="$EVINCE_MIME_TYPES;application/x-dvi"
254 fi
255 if test "x$enable_djvu" = "xyes"; then
256         EVINCE_MIME_TYPES="$EVINCE_MIME_TYPES;image/vnd.djvu"
257 fi
258 if test "x$enable_tiff" = "xyes"; then
259         EVINCE_MIME_TYPES="$EVINCE_MIME_TYPES;image/tiff"
260 fi
261 AC_SUBST(EVINCE_MIME_TYPES)
262
263 dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
264 dnl stolen from nautilus and gnome-common
265
266 AC_ARG_ENABLE(more-warnings,
267 [  --enable-more-warnings  Maximum compiler warnings],
268 set_more_warnings="$enableval",[
269 if test -f $srcdir/autogen.sh; then
270         is_cvs_version=true
271         set_more_warnings=yes
272 else
273         set_more_warnings=no
274 fi
275 ])
276 AC_MSG_CHECKING(for more warnings, including -Werror)
277 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
278         AC_MSG_RESULT([yes, using gcc])
279         CFLAGS="\
280         -Wall \
281         -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
282         -Wnested-externs -Wpointer-arith \
283         -Wcast-align -Wsign-compare \
284         -Werror \
285         $CFLAGS"
286
287 dnl     case " $CFLAGS " in
288 dnl         *[\ \       ]-ansi[\ \      ]*) ;;
289 dnl         *) CFLAGS="$CFLAGS -ansi" ;;
290 dnl     esac
291 dnl     case " $CFLAGS " in
292 dnl         *[\ \       ]-pedantic[\ \  ]*) ;;
293 dnl         *) CFLAGS="$CFLAGS -pedantic" ;;
294 dnl     esac
295
296         for option in -Wno-strict-aliasing -Wno-sign-compare; do
297                 SAVE_CFLAGS="$CFLAGS"
298                 CFLAGS="$CFLAGS $option"
299                 AC_MSG_CHECKING([whether gcc understands $option])
300                 AC_TRY_COMPILE([], [],
301                         has_option=yes,
302                         has_option=no,)
303                 if test $has_option = no; then
304                         CFLAGS="$SAVE_CFLAGS"
305                 fi
306                 AC_MSG_RESULT($has_option)
307                 unset has_option
308                 unset SAVE_CFLAGS
309         done
310         unset option
311 else
312         AC_MSG_RESULT(no)
313 fi
314
315 AC_OUTPUT([
316 Makefile
317 cut-n-paste/Makefile
318 cut-n-paste/recent-files/Makefile
319 cut-n-paste/zoom-control/Makefile
320 cut-n-paste/toolbar-editor/Makefile
321 data/Makefile
322 data/evince.desktop.in
323 lib/Makefile
324 pdf/Makefile
325 pixbuf/Makefile
326 tiff/Makefile
327 ps/Makefile
328 djvu/Makefile
329 dvi/Makefile
330 dvi/mdvi-lib/Makefile
331 po/Makefile.in
332 backend/Makefile
333 properties/Makefile
334 shell/Makefile
335 thumbnailer/Makefile
336 help/Makefile
337 help/C/Makefile
338 ])