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