2 dnl We require Automake 1.7.1, which requires Autoconf 2.54.
5 m4_define([libgsf_version_major], [1])
6 m4_define([libgsf_version_minor], [14])
7 m4_define([libgsf_version_micro], [21])
8 m4_define([libgsf_version_extra], [])
9 m4_define([libgsf_full_version],
10 [libgsf_version_major.libgsf_version_minor.libgsf_version_micro[]libgsf_version_extra])
12 AC_INIT(libgsf, [libgsf_full_version],
13 [http://bugzilla.gnome.org/enter_bug.cgi?product=libgsf])
14 AC_CONFIG_SRCDIR(gsf/gsf.h)
15 AC_CONFIG_MACRO_DIR([m4])
16 AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS -I m4")
18 AC_SUBST(LIBGSF_MAJOR_VERSION, libgsf_version_major)
19 AC_SUBST(LIBGSF_MINOR_VERSION, libgsf_version_minor)
20 AC_SUBST(LIBGSF_MICRO_VERSION, libgsf_version_micro)
22 dnl Version info for libraries = CURRENT:REVISION:AGE
24 dnl Within each x.y.*, ABI is maintained backward compatible.
25 dnl We strive for forward compatibility too, except that we sometimes
26 dnl add new functions.
28 m4_define([version_iface],
29 m4_eval(100 * libgsf_version_major + libgsf_version_minor))
31 AC_SUBST([VERSION_INFO], [version_iface:libgsf_version_micro:0])
32 AC_SUBST([CURRENT_MINUS_AGE], m4_eval(version_iface - 0))
34 AM_INIT_AUTOMAKE(dist-bzip2)
36 AC_CONFIG_HEADERS(gsf-config.h)
39 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
41 dnl Propagate Gnome-specific variable ACLOCAL_FLAGS to Makefile.
42 AC_SUBST(ACLOCAL_AMFLAGS, $ACLOCAL_FLAGS)
44 dnl Checks for programs.
52 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
54 dnl Gettext/i18n stuff
56 IT_PROG_INTLTOOL([0.35.0])
60 GETTEXT_PACKAGE=AC_PACKAGE_NAME
61 AC_SUBST(GETTEXT_PACKAGE)
62 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
64 dnl Checks for libraries.
66 If we defined the module lists on the M4 level, we could have problems
67 with PKG_CHECK_MODULES from pkgconfig 0.16.0, which double quotes its
68 second argument (the module list).
69 As a handy workaround, we use shell variables.
71 dnl Modules common to libgsf and libgsf-gnome
76 dnl Modules required for libgsf
81 dnl Modules required for libgsf-gnome
85 PKG_CHECK_MODULES(LIBGSF, $libgsf_reqs)
87 ## this should come after `AC_PROG_CC'
88 ifdef([GNOME_COMPILE_WARNINGS],[GNOME_COMPILE_WARNINGS],)
89 CFLAGS="$CFLAGS $WARN_CFLAGS -DG_DISABLE_DEPRECATED"
90 if test "$GCC" = "yes"; then
91 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=2 -Wnested-externs -Winline -Wdeclaration-after-statement -Wundef -W -Wmissing-noreturn -Wmissing-format-attribute -Wno-pointer-sign \
92 -Wbitwise -Wcast-to-as -Wdefault-bitfield-sign -Wdo-while -Wparen-string -Wptr-subtraction-blows -Wreturn-void -Wtypesign ; do
94 CFLAGS="$CFLAGS $option"
95 AC_MSG_CHECKING([whether gcc understands $option])
96 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
99 if test $has_option = no; then
100 CFLAGS="$SAVE_CFLAGS"
102 AC_MSG_RESULT($has_option)
109 AC_CHECK_DECL(fdopen, fdopen_works=yes, fdopen_works=no)
110 if test $fdopen_works = no ; then
111 unset ac_cv_have_decl_fdopen
112 CFLAGS="$CFLAGS -D_POSIX_SOURCE"
113 AC_MSG_NOTICE([adding -D_POSIX_SOURCE to CFLAGS])
114 AC_CHECK_DECL(fdopen, fdopen_works=yes, fdopen_works=no)
115 if test $fdopen_works = no ; then
116 AC_MSG_ERROR([fdopen is not available])
120 # Unfortunately, -D_POSIX_SOURCE turns off struct timeval on Solaris
121 AC_MSG_CHECKING([whether struct timeval is available])
125 [[#include <sys/time.h>]],
126 [[struct timeval tv;]])],
127 struct_timeval_works=yes,
128 struct_timeval_works=no)
129 test $struct_timeval_works = yes && break
130 # Try this for the second attempt:
131 test $try = 1 && CFLAGS="$CFLAGS -D__EXTENSIONS__"
133 AC_MSG_RESULT($struct_timeval_works)
134 if test $struct_timeval_works = no ; then
135 AC_MSG_ERROR([struct timeval is not available])
138 AC_MSG_CHECKING([whether -D_BSD_SOURCE is needed for caddr_t])
140 [AC_LANG_PROGRAM([[#include <sys/types.h>]], [[caddr_t ca]])],
143 AC_MSG_RESULT($need_bsd1)
145 AC_MSG_CHECKING([whether -D_BSD_SOURCE is needed for lstat])
146 AC_LINK_IFELSE([AC_LANG_PROGRAM(
147 [[#include <sys/types.h>
148 #include <sys/stat.h>
149 #include <unistd.h>]],
150 [[void *ptr = &lstat]])],
151 need_bsd2=no, need_bsd2=yes)
152 AC_MSG_RESULT($need_bsd2)
153 if test $need_bsd1 = yes -o $need_bsd2 = yes; then
154 CFLAGS="$CFLAGS -D_BSD_SOURCE"
158 AC_CHECK_HEADERS(fcntl.h malloc.h unistd.h io.h sys/statfs.h sys/param.h sys/mount.h)
161 AC_MSG_CHECKING([form of statfs])
162 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
163 [[#ifdef HAVE_SYS_STATFS_H
164 #include <sys/statfs.h>
166 #ifdef HAVE_SYS_PARAM_H
167 #include <sys/param.h>
169 #ifdef HAVE_SYS_MOUNT_H
170 #include <sys/mount.h>
172 [[struct statfs buf; (void)(2*statfs("xyz",&buf));]])],
173 [AC_MSG_RESULT([2-arg, linux-style])
174 AC_DEFINE(HAVE_2ARG_STATFS, 1, [Define is you have two-argument statfs like linux])],
175 [AC_MSG_RESULT([none, or unknown])])
177 AC_CHECK_FUNCS(chown setrlimit)
179 AC_CHECK_FUNCS(gmtime_r, [],
180 [AC_CHECK_FUNCS(gmtime,
181 [AC_MSG_WARN(*** Please note that gmtime_r() is missing and I will use gmtime() which is not thread safe ***)],
182 [AC_MSG_ERROR([Neither gmtime_r or gmtime is available])])])
184 AC_CHECK_MEMBERS(struct tm.tm_gmtoff,,,
189 CFLAGS="$CFLAGS $LIBGSF_CFLAGS"
190 LIBS="$LIBGSF_LIBS $LIBS"
191 AC_CHECK_FUNCS(g_base64_encode)
192 AC_MSG_CHECKING([for g_chmod])
193 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <glib/gstdio.h>]], [[(void)g_chmod("/xxx",0777);]])],
194 [AC_DEFINE(HAVE_G_CHMOD, 1, [Define if g_chmod is available as macro or function])
197 AC_MSG_CHECKING([for g_access])
198 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <glib/gstdio.h>]], [[(void)g_access("/xxx",0777);]])],
199 [AC_DEFINE(HAVE_G_ACCESS, 1, [Define if g_access is available as macro or function])
205 AC_MSG_CHECKING([whether macro S_ISREG is available])
206 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
207 [[#include <sys/types.h>
208 #include <sys/stat.h>]],
209 [[S_ISREG(S_IFMT);]])],
211 [AH_TEMPLATE([S_ISREG], [Define S_ISREG if stat.h doesn't])
212 AC_DEFINE([S_ISREG(m)], [(((m) & S_IFMT) == S_IFREG)])
214 AC_MSG_RESULT($macro_s_isreg)
216 AC_MSG_CHECKING([for Win32 platform])
219 mingw* | pw32* | cygwin*)
221 AC_ARG_VAR(WINDRES, [The windres executable (used by win32 builds only).])
222 AC_CHECK_TOOL(WINDRES, windres)
223 AC_ARG_VAR(LIBEXE, [The lib.exe executable (used by win32 builds only).])
224 AC_CHECK_PROG(LIBEXE, lib.exe, yes, no)
227 AC_MSG_RESULT($with_win32)
228 AM_CONDITIONAL(WITH_WIN32, test $with_win32 = yes)
229 AM_CONDITIONAL(HAVE_LIBEXE, test x$LIBEXE = xyes)
230 AM_CONDITIONAL(CROSS_COMPILING, test x"$cross_compiling" != "xno")
232 ##################################################
233 # Checks for gtk-doc and docbook-tools
234 ##################################################
235 gtk_doc_installed=true
236 #ifdef([GTK_DOC_CHECK],[GTK_DOC_CHECK([1.0])],[gtk_doc_installed=false])
237 # I would have liked to conditionalize this, but
238 # that appears to break other things http://bugzilla.gnome.org/show_bug.cgi?id=156399
240 AM_CONDITIONAL(GTK_DOC_INSTALLED, $gtk_doc_installed)
242 dnl ***********************************************************************************
247 Z_DIR= Z_LIBS= Z_CPPFLAGS=
250 [[ --with-zlib=DIR use libz in DIR]],
254 CPPFLAGS="${CPPFLAGS} -I$withval/include"
255 LDFLAGS="${LDFLAGS} -L$withval/lib"
259 if test "x$with_zlib" != xno; then
261 AC_CHECK_HEADER(zlib.h, [AC_CHECK_LIB(z, gzread, [with_zlib=yes])])
263 if test "$with_zlib" = no; then
264 AC_MSG_ERROR([*** zlib is required])
266 if test "x$Z_DIR" != "x"; then
267 Z_CPPFLAGS="-I$Z_DIR/include"
269 *-*-solaris*) Z_LIBS="-L$Z_DIR/lib -R$Z_DIR/lib -lz" ;;
270 *) Z_LIBS="-L$Z_DIR/lib -lz" ;;
278 CPPFLAGS=${_cppflags}
281 dnl ***********************************************************************************
285 [--{with,without}-python Build with the python support],
286 if test "x$withval" = xno; then
291 if test "x$test_python" = xtrue ; then
295 AM_CHECK_PYTHON_HEADERS(,[pygobject_msg="NO. Missing python headers"])
298 if test "$pygobject_msg" = test; then
299 PKG_CHECK_MODULES(PYGTK, pygobject-2.0 >= 2.10.0,
301 [pygobject_msg="NO. pygtk problem"])
302 AC_SUBST(PYGTK_CFLAGS)
304 if test "$pygobject_msg" = test; then
305 AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no)
306 if test "$PYGTK_CODEGEN" = no; then
307 pygobject_msg="NO. Missing pygtk-codegen-2.0"
311 if test "$pygobject_msg" = test; then
314 AC_MSG_RESULT($pygobject_msg)
319 AM_CONDITIONAL(WITH_PYTHON, [test "$pygobject_msg" = yes])
321 dnl ***********************************************************************************
328 [--{with,without}-bz2 Build additional wrappers for BZ2],
329 if test "x$withval" = xno; then
335 if test "x$test_bz2" = xtrue ; then
336 AC_MSG_CHECKING([usable libbz2])
338 dnl AC_CHECK_LIB doesn't work with the Windows port of libbz2 because
339 dnl it uses the __stdcall calling convention where the callee cleans
340 dnl up the stack. You have to include <bzlib.h> in order to get the
341 dnl right calling convention, and the link fails if not. Since we
342 dnl require both -lbz2 and <bzlib.h>, just test if a program which
343 dnl uses both can be compiled.
356 return BZ2_bzDecompressInit (NULL, 0, 0);
363 if test "$bz2_ok" = yes; then
364 AC_DEFINE(HAVE_BZ2, 1, [Is bzip2 available and enabled])
366 AC_MSG_RESULT($bz2_ok)
368 AC_MSG_WARN(*** BZ2 support disabled (BZ2 header or library not found) ***)
371 AC_MSG_WARN([BZ2 support disabled, as requested (Use --with-bz2 to enable)])
376 dnl ****************************************************************************
382 [--{with,without}-gio Build additional wrappers for GIO],
390 if test $want_gio = no ; then
391 AC_MSG_WARN([GIO support disabled, as requested (Use --with-gio to enable)])
393 PKG_CHECK_MODULES(LIBGSF_GIO, gio-2.0,
395 [if test $want_gio = yes; then
396 AC_MSG_ERROR([GIO support requested, but not available.])
398 AC_MSG_WARN([GIO support disabled, unable to find required version of GIO])
401 AM_CONDITIONAL(WITH_GIO, test $have_gio = yes)
404 dnl ****************************************************************************
412 AC_ARG_WITH(gnome_vfs,
413 [--{with,without}-gnome-vfs Build wrappers for GNOME-VFS],
415 yes) want_gnome_vfs=yes;;
416 no) want_gnome_vfs=no;;
419 if test $want_gnome_vfs = auto -a "$want_gio" = yes; then
423 if test $want_gnome_vfs = yes; then
424 if test "$want_gio" = yes; then
425 CFLAGS="$CFLAGS -DLIBGSF_GNOMEVFS_VIA_GIO"
427 GNOMEVFS_REQ="gnome-vfs-2.0 >= 2.2.0 gnome-vfs-module-2.0 >= 2.2.0"
428 libgsf_gnome_reqs="$libgsf_gnome_reqs $GNOMEVFS_REQ"
432 AC_SUBST(GNOMEVFS_REQ)
437 AC_HELP_STRING([--without-bonobo],[disable the use of bonobo]),
438 [case "${withval}" in
439 yes) want_bonobo=yes ;;
440 no) want_bonobo=no ;;
441 *) AC_MSG_ERROR(bad value ${withval} for --with-bonobo) ;;
443 [want_bonobo=auto]) dnl Default value
445 BONOBO_REQ="libbonobo-2.0 >= 2.0.0"
447 if test $want_bonobo = no ; then
448 AC_MSG_WARN([Bonobo support disabled, as requested (Use --with-bonobo to enable)])
450 PKG_CHECK_MODULES(LIBGSF_BONOBO, $BONOBO_REQ,
452 [if test $want_bonobo = yes; then
453 AC_MSG_ERROR([Bonobo support requested, but not available.])
455 AC_MSG_WARN([Bonobo support disabled, unable to find required version])
459 if test $have_bonobo = yes; then
460 libgsf_gnome_reqs="$libgsf_gnome_reqs $BONOBO_REQ"
468 dnl check for gdk_pixbuf
469 AC_ARG_WITH(gdk_pixbuf,
470 AC_HELP_STRING([--without-gdk-pixbuf],[disable the use of gdk-pixbuf]),
471 [case "${withval}" in
472 yes) want_gdk_pixbuf=yes ;;
473 no) want_gdk_pixbuf=no ;;
474 *) AC_MSG_ERROR(bad value ${withval} for --with-gdk-pixbuf) ;;
476 [want_gdk_pixbuf=auto]) dnl Default value
478 if test $want_gdk_pixbuf = no ; then
479 AC_MSG_WARN([gdk-pixbuf support disabled, as requested (Use --with-gdk-pixbuf to enable)])
481 PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0,
482 [AC_DEFINE(HAVE_GDK_PIXBUF, 1, [Define if gdk-pixbuf is available])],
483 [if test $want_gdk_pixbuf = yes; then
484 AC_MSG_ERROR([gdk-pixbuf support requested, but not available.])
486 AC_MSG_WARN([gdk-pixbuf support disabled, unable to find required version])
491 if test $want_gnome = no ; then
492 AC_MSG_WARN([GNOME support disabled, as requested (Use --with-gnome-vfs and/or --with-bonobo to enable)])
494 PKG_CHECK_MODULES(LIBGSF_GNOME, $libgsf_gnome_reqs,
496 [AC_MSG_ERROR([GNOME support requested, but not available.])])
498 AM_CONDITIONAL(WITH_LIBGSF_GNOME, test $have_gnome = yes)
499 AM_CONDITIONAL(WITH_LIBGSF_GNOMEVFS, test $want_gnome_vfs = yes)
500 AM_CONDITIONAL(WITH_LIBGSF_BONOBO, test $have_bonobo = yes)
502 # ===================
503 # GConf configuration
505 AC_HELP_STRING([--without-gconf],[disable the use of gconf (default: auto)]),
509 AS_IF([test "$with_gconf" != "no"], [
510 PKG_CHECK_EXISTS([gconf-2.0 >= 2.24.0],[
511 AC_CHECK_PROG([GCONFTOOL], [gconftool-2], [gconftool-2], [no])
512 AS_IF([test "$GCONFTOOL" = "no"], [
513 AC_MSG_WARN([thumbnailer will not be built, unable to find gconftool-2])
521 AS_IF([test "$have_gconf" = "yes"], [], [
522 AS_IF([test "$with_gconf" = "yes"],
523 [AC_MSG_ERROR([gconf support requested, but not available.])])
527 AM_CONDITIONAL(WITH_GCONF, test "$have_gconf" = "yes")
529 # ===================
531 LDFLAGS="-no-undefined $LDFLAGS"
556 AC_MSG_RESULT([Configured $PACKAGE $VERSION])