]> www.fi.muni.cz Git - evince.git/blob - configure.ac
0.1.1
[evince.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_PREREQ(2.59)
4 AC_INIT(evince, 0.1.1)
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_RANLIB
22 AC_PROG_INTLTOOL
23
24 ALL_LINGUAS="cs de en_CA ja nb nl pt_BR sv zh_CN"
25
26 AM_GLIB_GNU_GETTEXT
27
28 GETTEXT_PACKAGE=AC_PACKAGE_NAME
29 AC_SUBST(GETTEXT_PACKAGE)
30 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
31
32 PKG_CHECK_MODULES(LIBEVPRIVATE, gtk+-2.0 >= 2.4.0)
33 PKG_CHECK_MODULES(RECENT_FILES, gtk+-2.0 >= 2.4.0 libgnomeui-2.0 >= 2.4.0)
34 PKG_CHECK_MODULES(SHELL, gtk+-2.0 >= 2.5.0 libgnomeui-2.0 gnome-vfs-2.0 libgnomeprint-2.2 libgnomeprintui-2.2 libglade-2.0)
35 PKG_CHECK_MODULES(DVI, gtk+-2.0 >= 2.6.0)
36 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0)
37 PKG_CHECK_MODULES(PS, gtk+-2.0 >= 2.6.0 gnome-vfs-2.0 libgnomeui-2.0)
38
39 GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`  
40 AC_SUBST(GLIB_GENMARSHAL)
41
42 dnl Compile with disable-deprecated switches
43
44 AC_ARG_ENABLE(deprecated,
45 AC_HELP_STRING([--disable-deprecated],
46                [Don't allow any deprecated GTK+/etc. features.]),
47 set_enable_deprecated="$enableval",[
48 if test -f $srcdir/autogen.sh; then
49         is_cvs_version=true
50         set_enable_deprecated=no
51 else
52         set_enable_deprecated=yes
53         fi
54 ])
55 AC_MSG_CHECKING([whether to disable deprecated glib/gtk+/etc. features])
56 if test "$set_enable_deprecated" != "yes"; then
57         AC_MSG_RESULT(yes)
58         EVINCE_DISABLE_DEPRECATED="-DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -DBONOBO_DISABLE_DEPRECATED"
59 else
60         AC_MSG_RESULT(no)
61         EVINCE_DISABLE_DEPRECATED=""
62 fi
63 AC_SUBST(EVINCE_DISABLE_DEPRECATED)
64
65 dnl ================== Xpdf aconf.h.in checks ==================================
66
67 AH_TEMPLATE([HAVE_LIBSM], [Define to 1 if you have session management.])
68 AH_TEMPLATE([ENABLE_NLS], [Use Native Language Support.])
69 AH_TEMPLATE([HAVE_CATGETS], [Use catgets functions.])
70 AH_TEMPLATE([HAVE_GETTEXT], [Use gettext functions.])
71
72 dnl Optional features.
73 AH_TEMPLATE([A4_PAPER],
74             [Use A4 paper size instead of Letter for PostScript output.])
75 AC_ARG_ENABLE(a4-paper,
76               AC_HELP_STRING([--enable-a4-paper],
77                              [use A4 paper size instead of Letter for 
78                               PostScript output]),
79               AC_DEFINE(A4_PAPER))
80
81 dnl never define NO_TEXT_SELECT, just remember this Xpdf setting.
82 AH_TEMPLATE([NO_TEXT_SELECT], [Do not allow text selection.])
83
84 AH_TEMPLATE([OPI_SUPPORT],
85             [Include support for OPI comments.])
86 AC_ARG_ENABLE(opi,
87               AC_HELP_STRING([--enable-opi],
88                              [include support for OPI comments]),
89               AC_DEFINE(OPI_SUPPORT))
90
91 dnl enable these unconditionally.
92 AC_DEFINE([MULTITHREADED], [1], [Enable multithreading support.])
93 AC_DEFINE([TEXTOUT_WORD_LIST], [1], [Enable word list support.])
94               
95 AH_TEMPLATE([APPDEFDIR],
96             [Directory with the Xpdf app-defaults file.])
97 AC_ARG_WITH(appdef-dir,
98             AC_HELP_STRING([--with-appdef-dir],
99                            [set app-defaults directory]),
100             AC_DEFINE_UNQUOTED(APPDEFDIR, "$with_appdef_dir"))
101
102 dnl Path to xpdfrc.
103 dnl This ugly kludge to get the sysconfdir path is needed because
104 dnl autoconf doesn't actually set the prefix variable until later.
105 if test "$sysconfdir" = '${prefix}/etc'; then
106   if test "x$prefix" = xNONE; then
107     system_xpdfrc="$ac_default_prefix/etc/xpdfrc"
108   else
109     system_xpdfrc="$prefix/etc/xpdfrc"
110   fi
111 else
112   system_xpdfrc="$sysconfdir/xpdfrc"
113 fi
114 AC_DEFINE_UNQUOTED(SYSTEM_XPDFRC, "$system_xpdfrc",
115                    [Full path for the system-wide xpdfrc file.])
116
117 dnl Checks for header files.
118 AC_HEADER_DIRENT
119
120 dnl Switch over to C++.  This will make the checks below a little
121 dnl bit stricter (requiring function prototypes in include files).
122 dnl (99% of xpdf is written in C++.)
123 AC_LANG_CPLUSPLUS
124
125 dnl Look for header that defines select() and fd_set.
126 AC_MSG_CHECKING([select() and fd_set in sys/select.h and sys/bsdtypes.h])
127 AC_TRY_COMPILE([#include <stdlib.h>
128 #include <stddef.h>
129 #include <unistd.h>
130 #include <sys/types.h>],
131   [fd_set fds;
132 select(0, NULL, NULL, NULL, NULL);], xpdf_ok=yes, xpdf_ok=no)
133 if test $xpdf_ok = yes; then
134   AC_MSG_RESULT([not needed])
135 else
136   AC_TRY_COMPILE([#include <stdlib.h>
137 #include <stddef.h>
138 #include <unistd.h>
139 #include <sys/types.h>
140 #include <sys/select.h>],
141     [fd_set fds;
142 select(0, NULL, NULL, NULL, NULL);], xpdf_ok=yes, xpdf_ok=no)
143   if test $xpdf_ok = yes; then
144     AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Have sys/select.h.])
145     AC_MSG_RESULT([need sys/select.h])
146   else
147     AC_TRY_COMPILE([#include <stdlib.h>
148 #include <stddef.h>
149 #include <unistd.h>
150 #include <sys/types.h>
151 #include <sys/bsdtypes.h>],
152       [fd_set fds;
153 select(0, NULL, NULL, NULL, NULL);], xpdf_ok=yes, xpdf_ok=no)
154     if test $xpdf_ok = yes; then
155       AC_DEFINE(HAVE_SYS_BSDTYPES_H, 1, [Have sys/bsdtypes.h.])
156       AC_MSG_RESULT([need sys/bsdtypes.h])
157     else
158       AC_MSG_RESULT([problem])
159     fi
160   fi
161 fi
162
163 dnl Look for header that defines FD_ZERO.
164 AC_MSG_CHECKING([FD_ZERO and strings.h or bstring.h])
165 AC_TRY_COMPILE([#include <stdlib.h>
166 #include <sys/types.h>
167 #ifdef HAVE_SYS_SELECT_H
168 #include <sys/select.h>
169 #endif],
170 [fd_set fds; FD_ZERO(&fds);], xpdf_ok=yes, xpdf_ok=no)
171 if test $xpdf_ok = yes; then
172   AC_MSG_RESULT([not needed])
173 else
174   AC_TRY_COMPILE([#include <stdlib.h>
175 #include <sys/types.h>
176 #include <strings.h>
177 #ifdef HAVE_SYS_SELECT_H
178 #include <sys/select.h>
179 #endif],
180     [fd_set fds; FD_ZERO(&fds);], xpdf_ok=yes, xpdf_ok=no)
181   if test $xpdf_ok = yes; then
182     AC_DEFINE(HAVE_STRINGS_H, 1, [Have strings.h.])
183     AC_MSG_RESULT([need strings.h])
184   else
185     AC_TRY_COMPILE([#include <stdlib.h>
186 #include <sys/types.h>
187 #include <bstring.h>
188 #ifdef HAVE_SYS_SELECT_H
189 #include <sys/select.h>
190 #endif],
191       [fd_set fds; FD_ZERO(&fds);], xpdf_ok=yes, xpdf_ok=no)
192     if test $xpdf_ok = yes; then
193       AC_DEFINE(HAVE_BSTRING_H, 1, [Have bstring.h.])
194       AC_MSG_RESULT([need bstring.h])
195     else
196       AC_MSG_RESULT([problem])
197     fi
198   fi
199 fi
200
201 dnl Look for rewinddir.
202 AC_CHECK_FUNCS(rewinddir)
203 if test $ac_cv_func_rewinddir = no; then
204   AC_CHECK_LIB(cposix, rewinddir)
205 fi
206
207 dnl Checks for library functions.
208 AC_CHECK_FUNCS(popen)
209 dnl # This should use 'AC_CHECK_FUNCS(mkstemp)' but that fails if
210 dnl # the mkstemp exists in the library but isn't declared in the
211 dnl # include file (e.g., in cygwin 1.1.2).
212 AC_CACHE_CHECK([for mkstemp],
213 xpdf_cv_func_mkstemp,
214 [AC_TRY_LINK([#include <stdlib.h>
215 #include <unistd.h>],
216 [mkstemp("foo");],
217 xpdf_cv_func_mkstemp=yes, xpdf_cv_func_mkstemp=no)])
218 if test "$xpdf_cv_func_mkstemp" = yes; then
219   AC_DEFINE(HAVE_MKSTEMP, 1, [Have mkstemp().])
220 fi
221 dnl Check for mkstemps, just like mkstemp.
222 AC_CACHE_CHECK([for mkstemps],
223 xpdf_cv_func_mkstemps,
224 [AC_TRY_LINK([#include <stdlib.h>
225 #include <unistd.h>],
226 [mkstemps("foo", 0);],
227 xpdf_cv_func_mkstemps=yes, xpdf_cv_func_mkstemps=no)])
228 if test "$xpdf_cv_func_mkstemps" = yes; then
229   AC_DEFINE(HAVE_MKSTEMPS, 1, [Have mkstemps().])
230 fi
231
232 dnl Check select argument type: on HP-UX before version 10, select
233 dnl takes (int *) instead of (fd_set *).
234 AC_CACHE_CHECK([whether select takes fd_set arguments],
235 xpdf_cv_func_select_arg,
236 [AC_TRY_COMPILE([#include <sys/types.h>
237 #include <sys/time.h>
238 #include <unistd.h>
239 #ifdef HAVE_SYS_SELECT_H
240 #include <sys/select.h>
241 #endif],
242 [fd_set fds;
243 select(1, &fds, &fds, &fds, 0);],
244 xpdf_cv_func_select_arg=yes, xpdf_cv_func_select_arg=no)])
245 if test "$xpdf_cv_func_select_arg" != yes; then
246   AC_DEFINE(SELECT_TAKES_INT, 1, [select() takes int, not fd_set arguments.])
247 fi
248
249 dnl Back to C for the library tests.
250 AC_LANG_C
251
252 dnl Check for fseeko/ftello or fseek64/ftell64
253 dnl The LARGEFILE and FSEEKO macros have to be called in C, not C++, mode.
254 AC_SYS_LARGEFILE
255 AC_FUNC_FSEEKO
256 AC_CHECK_FUNCS(fseek64, xpdf_cv_func_fseek64=yes, xpdf_cv_func_fseek64=no)
257 AC_CHECK_FUNCS(ftell64, xpdf_cv_func_ftell64=yes, xpdf_cv_func_ftell64=no)
258 if test "$xpdf_cv_func_fseek64" = yes -a "$xpdf_cv_func_ftell64" = yes; then
259   AC_DEFINE(HAVE_FSEEK64, 1, [Have fseek64().])
260 fi
261
262 dnl Check for freetype headers
263 FREETYPE_LIBS=
264 FREETYPE_CFLAGS=
265 AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
266 if test "x$FREETYPE_CONFIG" != "xno" ; then
267   FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
268   FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
269   AC_DEFINE(HAVE_FREETYPE_H, 1, [Have FreeType2 include files])
270 fi
271
272 AC_SUBST(FREETYPE_CFLAGS)
273 AC_SUBST(FREETYPE_LIBS)
274
275 dnl ================== End of xpdf checks ===========================================
276
277 dnl ================== ggv checks ===================================================
278 AC_ARG_WITH(gs-pkg,
279             [  --with-gs=dir       Directory Where GhostScript package is installed.])
280
281 if test "x$with_gs" = "x"; then
282         AC_PATH_PROG(GS_PROG, gs)
283         if test -z "$GS_PROG"; then
284                 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 GGV)
285         fi
286 else
287         GS_PROG=$with_gs
288 fi
289
290 AC_DEFINE_UNQUOTED(GS_PATH, "$GS_PROG", [Path to the 'gs' executable.])
291
292
293 dnl check for GS version and define appropriate alpha parameters
294 AC_MSG_CHECKING(for Ghostscript version...)
295 GS_VERSION=`$GS_PROG --version | head -n 1`
296 AC_MSG_RESULT(found $GS_VERSION)
297 dnl GS tends to get a lot of BadMatch errors with the *AlphaBits parameters
298 dnl so I've commented their use out
299 dnl if test "$GS_VERSION" -gt "5"; then
300 dnl     AA_PARMS="-sDEVICE=x11 -dTextAlphaBits=4 -dGraphicsAlphaBits=4"
301 dnl else
302 dnl     AA_PARMS="-sDEVICE=x11alpha"
303 dnl fi
304 AA_PARMS="-sDEVICE=x11alpha -dNOPLATFONTS"
305 AC_DEFINE_UNQUOTED(ALPHA_PARAMS, "$AA_PARMS", [Anti-aliasing parameters for Ghostscript.])
306 AC_MSG_RESULT(Antialiasing parameters for Ghostscript: $AA_PARMS)
307
308
309 dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
310 dnl stolen from nautilus and gnome-common
311
312 AC_ARG_ENABLE(more-warnings,
313 [  --enable-more-warnings  Maximum compiler warnings],
314 set_more_warnings="$enableval",[
315 if test -f $srcdir/autogen.sh; then
316         is_cvs_version=true
317         set_more_warnings=yes
318 else
319         set_more_warnings=no
320 fi
321 ])
322 AC_MSG_CHECKING(for more warnings, including -Werror)
323 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
324         AC_MSG_RESULT([yes, using gcc])
325         CFLAGS="\
326         -Wall \
327         -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
328         -Wnested-externs -Wpointer-arith \
329         -Wcast-align -Wsign-compare \
330         -Werror \
331         $CFLAGS"
332
333 dnl     case " $CFLAGS " in
334 dnl         *[\ \       ]-ansi[\ \      ]*) ;;
335 dnl         *) CFLAGS="$CFLAGS -ansi" ;;
336 dnl     esac
337 dnl     case " $CFLAGS " in
338 dnl         *[\ \       ]-pedantic[\ \  ]*) ;;
339 dnl         *) CFLAGS="$CFLAGS -pedantic" ;;
340 dnl     esac
341
342         for option in -Wno-strict-aliasing -Wno-sign-compare; do
343                 SAVE_CFLAGS="$CFLAGS"
344                 CFLAGS="$CFLAGS $option"
345                 AC_MSG_CHECKING([whether gcc understands $option])
346                 AC_TRY_COMPILE([], [],
347                         has_option=yes,
348                         has_option=no,)
349                 if test $has_option = no; then
350                         CFLAGS="$SAVE_CFLAGS"
351                 fi
352                 AC_MSG_RESULT($has_option)
353                 unset has_option
354                 unset SAVE_CFLAGS
355         done
356         unset option
357 else
358         AC_MSG_RESULT(no)
359 fi
360
361 dnl ======================== End of ggv checks =================================
362
363 AC_OUTPUT([
364 Makefile
365 cut-n-paste/Makefile
366 cut-n-paste/recent-files/Makefile
367 data/Makefile
368 pdf/Makefile
369 pdf/goo/Makefile
370 pdf/fofi/Makefile
371 pdf/splash/Makefile
372 pdf/xpdf/Makefile
373 pixbuf/Makefile
374 ps/Makefile
375 po/Makefile.in
376 backend/Makefile
377 shell/Makefile
378 dvi/Makefile
379 dvi/dvilib/Makefile
380 ])