1 | AC_PREREQ(2.52) |
---|
2 | AC_INIT(gsf/gsf.h) |
---|
3 | |
---|
4 | dnl Set release number |
---|
5 | dnl This is derived from "Versioning" chapter of info libtool documentation. |
---|
6 | PACKAGE=libgsf |
---|
7 | dnl 4a) Increment when removing or changing interfaces. |
---|
8 | LIBGSF_MAJOR_VERSION=1 |
---|
9 | dnl 4a) 5) Increment when adding interfaces. |
---|
10 | dnl 6) Set to zero when removing or changing interfaces. |
---|
11 | LIBGSF_MINOR_VERSION=10 |
---|
12 | dnl 3) Increment when interfaces not changed at all, |
---|
13 | dnl only bug fixes or internal changes made. |
---|
14 | dnl 4b) Set to zero when adding, removing or changing interfaces. |
---|
15 | LIBGSF_MICRO_VERSION=1 |
---|
16 | dnl |
---|
17 | dnl Set this too |
---|
18 | MAJOR_VERSION_PLUS_MINOR_VERSION=`expr $LIBGSF_MAJOR_VERSION + $LIBGSF_MINOR_VERSION` |
---|
19 | dnl |
---|
20 | VERSION=$LIBGSF_MAJOR_VERSION.$LIBGSF_MINOR_VERSION.$LIBGSF_MICRO_VERSION |
---|
21 | dnl Version info for libraries = CURRENT:REVISION:AGE |
---|
22 | VERSION_INFO=$MAJOR_VERSION_PLUS_MINOR_VERSION:$LIBGSF_MICRO_VERSION:$LIBGSF_MINOR_VERSION |
---|
23 | AC_SUBST(VERSION_INFO) |
---|
24 | AC_SUBST(LIBGSF_MAJOR_VERSION) |
---|
25 | AC_SUBST(LIBGSF_MINOR_VERSION) |
---|
26 | AC_SUBST(LIBGSF_MICRO_VERSION) |
---|
27 | |
---|
28 | dnl Start automake |
---|
29 | AM_CONFIG_HEADER(gsf-config.h) |
---|
30 | AM_INIT_AUTOMAKE($PACKAGE, $VERSION) |
---|
31 | AM_MAINTAINER_MODE |
---|
32 | |
---|
33 | dnl Checks for programs. |
---|
34 | AC_PROG_CC |
---|
35 | AC_PROG_MAKE_SET |
---|
36 | AC_LIBTOOL_WIN32_DLL |
---|
37 | AM_PROG_LIBTOOL |
---|
38 | |
---|
39 | AC_FUNC_FSEEKO |
---|
40 | AC_SYS_LARGEFILE |
---|
41 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
---|
42 | |
---|
43 | dnl Checks for libraries. |
---|
44 | dnl Modules common to libgsf and libgsf-gnome |
---|
45 | m4_define(LIBGSF_MODULES,[gobject-2.0 >= 2.0.0 |
---|
46 | glib-2.0 >= 2.0.0 |
---|
47 | libxml-2.0 >= 2.4.16]) |
---|
48 | PKG_CHECK_MODULES(LIBGSF,LIBGSF_MODULES) |
---|
49 | |
---|
50 | ## this should come after `AC_PROG_CC' |
---|
51 | ifdef([GNOME_COMPILE_WARNINGS],[GNOME_COMPILE_WARNINGS],) |
---|
52 | CFLAGS="$CFLAGS $WARN_CFLAGS -DG_DISABLE_DEPRECATED" |
---|
53 | if test "$GCC" = "yes"; then |
---|
54 | for option in -Wno-system-headers -Wfloat-equal -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wformat -Wnested-externs -Winline; do |
---|
55 | SAVE_CFLAGS="$CFLAGS" |
---|
56 | CFLAGS="$CFLAGS $option" |
---|
57 | AC_MSG_CHECKING([whether gcc understands $option]) |
---|
58 | AC_TRY_COMPILE([], [], |
---|
59 | has_option=yes, |
---|
60 | has_option=no,) |
---|
61 | if test $has_option = no; then |
---|
62 | CFLAGS="$SAVE_CFLAGS" |
---|
63 | fi |
---|
64 | AC_MSG_RESULT($has_option) |
---|
65 | unset has_option |
---|
66 | unset SAVE_CFLAGS |
---|
67 | done |
---|
68 | unset option |
---|
69 | fi |
---|
70 | |
---|
71 | AC_CHECK_DECL(fdopen, fdopen_works=yes, fdopen_works=no) |
---|
72 | if test $fdopen_works = no ; then |
---|
73 | unset ac_cv_have_decl_fdopen |
---|
74 | CFLAGS="$CFLAGS -D_POSIX_SOURCE" |
---|
75 | AC_MSG_NOTICE([adding -D_POSIX_SOURCE to CFLAGS]) |
---|
76 | AC_CHECK_DECL(fdopen, fdopen_works=yes, fdopen_works=no) |
---|
77 | if test $fdopen_works = no ; then |
---|
78 | AC_MSG_ERROR([fdopen is not available]) |
---|
79 | fi |
---|
80 | fi |
---|
81 | |
---|
82 | # Unfortunately, -D_POSIX_SOURCE turns off struct timeval on Solaris |
---|
83 | AC_MSG_CHECKING([whether struct timeval is available]) |
---|
84 | AC_TRY_COMPILE([#include <sys/time.h>], [struct timeval tv;], struct_timeval_works=yes, struct_timeval_works=no) |
---|
85 | AC_MSG_RESULT($struct_timeval_works) |
---|
86 | |
---|
87 | if test $struct_timeval_works = no ; then |
---|
88 | CFLAGS="$CFLAGS -D__EXTENSIONS__" |
---|
89 | AC_MSG_CHECKING([whether struct timeval is available with -D__EXTENSIONS__]) |
---|
90 | AC_TRY_COMPILE([#include <sys/time.h>], [struct timeval tv;], struct_timeval_works=yes, struct_timeval_works=no) |
---|
91 | AC_MSG_RESULT($struct_timeval_works) |
---|
92 | if test $struct_timeval_works = no ; then |
---|
93 | AC_MSG_ERROR([struct timeval is not available]) |
---|
94 | fi |
---|
95 | fi |
---|
96 | |
---|
97 | AC_MSG_CHECKING([whether -D_BSD_SOURCE is needed for caddr_t]) |
---|
98 | AC_TRY_COMPILE([#include <sys/types.h>], [caddr_t ca], need_bsd1=no, need_bsd1=yes) |
---|
99 | AC_MSG_RESULT($need_bsd1) |
---|
100 | |
---|
101 | AC_MSG_CHECKING([whether -D_BSD_SOURCE is needed for lstat]) |
---|
102 | AC_TRY_LINK([#include <sys/types.h> |
---|
103 | #include <sys/stat.h> |
---|
104 | #include <unistd.h> |
---|
105 | ], [void *ptr = &lstat], need_bsd2=no, need_bsd2=yes) |
---|
106 | AC_MSG_RESULT($need_bsd2) |
---|
107 | if test $need_bsd1 = yes -o $need_bsd2 = yes; then |
---|
108 | CFLAGS="$CFLAGS -D_BSD_SOURCE" |
---|
109 | fi |
---|
110 | |
---|
111 | AC_CHECK_HEADERS(fcntl.h malloc.h unistd.h io.h) |
---|
112 | AC_FUNC_MMAP |
---|
113 | |
---|
114 | AC_CHECK_FUNCS(lstat readlink) |
---|
115 | |
---|
116 | AC_MSG_CHECKING([for native Win32]) |
---|
117 | case "$host" in |
---|
118 | *-*-mingw*) |
---|
119 | native_win32=yes |
---|
120 | ;; |
---|
121 | *) |
---|
122 | native_win32=no |
---|
123 | ;; |
---|
124 | esac |
---|
125 | AC_MSG_RESULT([$native_win32]) |
---|
126 | AM_CONDITIONAL(OS_WIN32, test "$native_win32" = yes) |
---|
127 | |
---|
128 | AC_MSG_CHECKING([for Win32 platform in general]) |
---|
129 | case "$host" in |
---|
130 | *-*-mingw*|*-*-cygwin*) |
---|
131 | platform_win32=yes |
---|
132 | ;; |
---|
133 | *) |
---|
134 | platform_win32=no |
---|
135 | ;; |
---|
136 | esac |
---|
137 | AC_MSG_RESULT($platform_win32) |
---|
138 | AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = yes) |
---|
139 | |
---|
140 | ################################################## |
---|
141 | # Checks for gtk-doc and docbook-tools |
---|
142 | ################################################## |
---|
143 | GTK_DOC_CHECK([1.0]) |
---|
144 | |
---|
145 | dnl *********************************************************************************** |
---|
146 | dnl libxml |
---|
147 | dnl |
---|
148 | AC_CHECK_LIB(z, zlibVersion, |
---|
149 | [Z_LIBS=-lz AC_SUBST(Z_LIBS)], |
---|
150 | AC_MSG_ERROR([*** zlib is required])) |
---|
151 | |
---|
152 | dnl *********************************************************************************** |
---|
153 | dnl |
---|
154 | dnl Uncomment to enable Python bindings. automake1.5 or later is required. |
---|
155 | dnl |
---|
156 | dnl AM_PATH_PYTHON |
---|
157 | dnl AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) |
---|
158 | dnl check for pygtk |
---|
159 | dnl PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= 1.99.10, |
---|
160 | dnl [pygtk_msg="yes"], |
---|
161 | dnl [pygtk_msg="NO. pygtk problem"]) |
---|
162 | dnl AC_SUBST(PYGTK_CFLAGS) |
---|
163 | dnl AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no) |
---|
164 | dnl if test "x$PYGTK_CODEGEN" = xno; then |
---|
165 | dnl AC_MSG_ERROR(could not find pygtk-codegen-2.0 script) |
---|
166 | dnl fi |
---|
167 | |
---|
168 | dnl if test "x$pygtk_msg" = "xyes"; then |
---|
169 | dnl AM_CONDITIONAL(WITH_PYTHON, true) |
---|
170 | dnl else |
---|
171 | AM_CONDITIONAL(WITH_PYTHON, false) |
---|
172 | dnl fi |
---|
173 | |
---|
174 | dnl *********************************************************************************** |
---|
175 | |
---|
176 | dnl bz2 |
---|
177 | dnl |
---|
178 | BZ2_LIBS= |
---|
179 | test_bz2=true |
---|
180 | AC_ARG_WITH(bz2, |
---|
181 | [--{with,without}-bz2 Build additional wrappers for BZ2], |
---|
182 | if test "x$withval" = xno; then |
---|
183 | test_bz2=false |
---|
184 | fi |
---|
185 | ) |
---|
186 | |
---|
187 | with_bz2=false |
---|
188 | if test "x$test_bz2" = xtrue ; then |
---|
189 | AC_CHECK_LIB(bz2, BZ2_bzDecompressInit, |
---|
190 | bz2_ok=yes, |
---|
191 | bz2_ok=no |
---|
192 | AC_MSG_WARN(*** BZ2 support disabled (BZ2 library not found) ***)) |
---|
193 | |
---|
194 | if test "$bz2_ok" = yes; then |
---|
195 | AC_MSG_CHECKING([for bzlib.h]) |
---|
196 | AC_TRY_CPP( |
---|
197 | [#include <stdio.h> |
---|
198 | #undef PACKAGE |
---|
199 | #undef VERSION |
---|
200 | #undef HAVE_STDLIB_H |
---|
201 | #include <bzlib.h>], |
---|
202 | bz2_ok=yes, |
---|
203 | bz2_ok=no) |
---|
204 | AC_MSG_RESULT($bz2_ok) |
---|
205 | fi |
---|
206 | |
---|
207 | if test "$bz2_ok" = yes; then |
---|
208 | AC_DEFINE(HAVE_BZ2, 1, [Is bzip2 available and enabled]) |
---|
209 | BZ2_LIBS="-lbz2" |
---|
210 | else |
---|
211 | AC_MSG_WARN(*** BZ2 support disabled (BZ2 header not found) ***) |
---|
212 | fi |
---|
213 | else |
---|
214 | AC_MSG_WARN([BZ2 support disabled, as requested (Use --with-bz2 to enable)]) |
---|
215 | fi |
---|
216 | |
---|
217 | AC_SUBST(BZ2_LIBS) |
---|
218 | |
---|
219 | dnl *********************************************************************************** |
---|
220 | |
---|
221 | dnl gnome |
---|
222 | dnl |
---|
223 | test_gnome=true |
---|
224 | AC_ARG_WITH(gnome, |
---|
225 | [--{with,without}-gnome Build additional wrappers for GNOME-VFS and BONOBO], |
---|
226 | if test "x$withval" = xno; then |
---|
227 | test_gnome=false |
---|
228 | fi |
---|
229 | ) |
---|
230 | with_gnome=false |
---|
231 | if test "x$test_gnome" = xtrue ; then |
---|
232 | PKG_CHECK_MODULES(LIBGSF_GNOME,[ |
---|
233 | LIBGSF_MODULES |
---|
234 | libbonobo-2.0 >= 2.0.0 |
---|
235 | gnome-vfs-2.0 >= 1.9.16 |
---|
236 | gnome-vfs-module-2.0 >= 1.9.16 |
---|
237 | ],[with_gnome=true], [AC_MSG_WARN([GNOME support disabled, unable to find required version of VFS and/or Bonobo])]) |
---|
238 | else |
---|
239 | AC_MSG_WARN([GNOME support disabled, as requested (Use --with-gnome to enable)]) |
---|
240 | fi |
---|
241 | |
---|
242 | AC_SUBST(LIBGSF_GNOME_CFLAGS) |
---|
243 | AC_SUBST(LIBGSF_GNOME_LIBS) |
---|
244 | AM_CONDITIONAL(WITH_LIBGSF_GNOME, $with_gnome) |
---|
245 | |
---|
246 | AC_SUBST(LIBGSF_CFLAGS) |
---|
247 | AC_SUBST(LIBGSF_LIBS) |
---|
248 | |
---|
249 | AC_SUBST(ACLOCAL_FLAGS) |
---|
250 | |
---|
251 | AC_OUTPUT([ |
---|
252 | Makefile |
---|
253 | doc/Makefile |
---|
254 | gsf/Makefile |
---|
255 | gsf-gnome/Makefile |
---|
256 | gsf-win32/Makefile |
---|
257 | tests/Makefile |
---|
258 | python/Makefile |
---|
259 | gsf/version.c |
---|
260 | libgsf-1.pc |
---|
261 | libgsf-1.spec |
---|
262 | libgsf-gnome-1.pc |
---|
263 | libgsf-gnome-1.spec |
---|
264 | libgsf-win32-1.pc |
---|
265 | libgsf-zip |
---|
266 | doc/version.xml |
---|
267 | ]) |
---|
268 | |
---|
269 | AC_MSG_RESULT([Configured $PACKAGE $VERSION]) |
---|
270 | |
---|
271 | rm -f po/po2tbl.sed |
---|