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