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