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