-*- mode: m4 -*- dnl We require Automake 1.7.1, which requires Autoconf 2.54. AC_PREREQ(2.54) m4_define([libgsf_version_major], [1]) m4_define([libgsf_version_minor], [14]) m4_define([libgsf_version_micro], [7]) m4_define([libgsf_version_extra], []) m4_define([libgsf_full_version], [libgsf_version_major.libgsf_version_minor.libgsf_version_micro[]libgsf_version_extra]) AC_INIT(libgsf, [libgsf_full_version], [http://bugzilla.gnome.org/enter_bug.cgi?product=libgsf]) AC_CONFIG_SRCDIR(gsf/gsf.h) AC_CONFIG_MACRO_DIR([m4]) AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS -I m4") AC_SUBST(LIBGSF_MAJOR_VERSION, libgsf_version_major) AC_SUBST(LIBGSF_MINOR_VERSION, libgsf_version_minor) AC_SUBST(LIBGSF_MICRO_VERSION, libgsf_version_micro) dnl Version info for libraries = CURRENT:REVISION:AGE dnl dnl Within each x.y.*, ABI is maintained backward and _forward_ compatible. dnl (As a consequence, no exported function may be added.) dnl So it's enough to have one interface number per each x.y.* branch. dnl dnl OTOH, we are not able to keep ABI strictly backward compatible throughout dnl the whole x.*.*. dnl The easiest way is to declare no ABI compatibility, ie. AGE is always 0. dnl m4_define([version_iface], m4_eval(100 * libgsf_version_major + libgsf_version_minor)) AC_SUBST([VERSION_INFO], [version_iface:libgsf_version_micro:0]) AC_SUBST([CURRENT_MINUS_AGE], m4_eval(version_iface - 0)) AM_INIT_AUTOMAKE(dist-bzip2) AC_CONFIG_HEADERS(gsf-config.h) AM_MAINTAINER_MODE dnl Propagate Gnome-specific variable ACLOCAL_FLAGS to Makefile. AC_SUBST(ACLOCAL_AMFLAGS, $ACLOCAL_FLAGS) dnl Checks for programs. AC_PROG_CC AC_PROG_MAKE_SET AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL AC_FUNC_FSEEKO AC_SYS_LARGEFILE AC_PATH_PROG(PKG_CONFIG, pkg-config, no) dnl Gettext/i18n stuff AC_PROG_INTLTOOL ALL_LINGUAS="es oc sv zh_HK zh_TW" AM_GLIB_GNU_GETTEXT GETTEXT_PACKAGE=AC_PACKAGE_NAME AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.]) dnl Checks for libraries. ifelse([ If we defined the module lists on the M4 level, we could have problems with PKG_CHECK_MODULES from pkgconfig 0.16.0, which double quotes its second argument (the module list). As a handy workaround, we use shell variables. ]) dnl Modules common to libgsf and libgsf-gnome common_reqs=" gobject-2.0 >= 2.6.0 glib-2.0 >= 2.8.0 " dnl Modules required for libgsf libgsf_reqs=" $common_reqs libxml-2.0 >= 2.4.16 " dnl Modules required for libgsf-gnome libgsf_gnome_reqs=" $common_reqs gnome-vfs-2.0 >= 2.2.0 gnome-vfs-module-2.0 >= 2.2.0 " PKG_CHECK_MODULES(LIBGSF, $libgsf_reqs) ## this should come after `AC_PROG_CC' ifdef([GNOME_COMPILE_WARNINGS],[GNOME_COMPILE_WARNINGS],) CFLAGS="$CFLAGS $WARN_CFLAGS -DG_DISABLE_DEPRECATED" if test "$GCC" = "yes"; then 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 -Wdeclaration-after-statement -Wundef -W -Wmissing-noreturn -Wmissing-format-attribute -Wno-pointer-sign; do SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $option" AC_MSG_CHECKING([whether gcc understands $option]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], has_option=yes, has_option=no) if test $has_option = no; then CFLAGS="$SAVE_CFLAGS" fi AC_MSG_RESULT($has_option) unset has_option unset SAVE_CFLAGS done unset option fi AC_CHECK_DECL(fdopen, fdopen_works=yes, fdopen_works=no) if test $fdopen_works = no ; then unset ac_cv_have_decl_fdopen CFLAGS="$CFLAGS -D_POSIX_SOURCE" AC_MSG_NOTICE([adding -D_POSIX_SOURCE to CFLAGS]) AC_CHECK_DECL(fdopen, fdopen_works=yes, fdopen_works=no) if test $fdopen_works = no ; then AC_MSG_ERROR([fdopen is not available]) fi fi # Unfortunately, -D_POSIX_SOURCE turns off struct timeval on Solaris AC_MSG_CHECKING([whether struct timeval is available]) for try in 1 2; do AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[struct timeval tv;]])], struct_timeval_works=yes, struct_timeval_works=no) test $struct_timeval_works = yes && break # Try this for the second attempt: test $try = 1 && CFLAGS="$CFLAGS -D__EXTENSIONS__" done AC_MSG_RESULT($struct_timeval_works) if test $struct_timeval_works = no ; then AC_MSG_ERROR([struct timeval is not available]) fi AC_MSG_CHECKING([whether -D_BSD_SOURCE is needed for caddr_t]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[caddr_t ca]])], need_bsd1=no, need_bsd1=yes) AC_MSG_RESULT($need_bsd1) AC_MSG_CHECKING([whether -D_BSD_SOURCE is needed for lstat]) AC_LINK_IFELSE([AC_LANG_PROGRAM( [[#include #include #include ]], [[void *ptr = &lstat]])], need_bsd2=no, need_bsd2=yes) AC_MSG_RESULT($need_bsd2) if test $need_bsd1 = yes -o $need_bsd2 = yes; then CFLAGS="$CFLAGS -D_BSD_SOURCE" fi AC_TYPE_MODE_T AC_CHECK_HEADERS(fcntl.h malloc.h unistd.h io.h) AC_FUNC_MMAP AC_CHECK_FUNCS(chown setrlimit) AC_CHECK_FUNCS(gmtime_r, [], [AC_CHECK_FUNCS(gmtime, [AC_MSG_WARN(*** Please note that gmtime_r() is missing and I will use gmtime() which is not thread safe ***)], [AC_MSG_ERROR([Neither gmtime_r or gmtime is available])])]) AC_CHECK_MEMBERS(struct tm.tm_gmtoff,,, [#include ]) SAVE_CFLAGS=$CFLAGS SAVE_LIBS=$LIBS CFLAGS="$CFLAGS $LIBGSF_CFLAGS" LIBS="$LIBGSF_LIBS $LIBS" AC_MSG_CHECKING([for g_chmod]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[(void)g_chmod("/xxx",0777);]])], [AC_DEFINE(HAVE_G_CHMOD, 1, [Define if g_chmod is available as macro or function]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) AC_MSG_CHECKING([for g_access]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[(void)g_access("/xxx",0777);]])], [AC_DEFINE(HAVE_G_ACCESS, 1, [Define if g_access is available as macro or function]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) CFLAGS=$SAVE_CFLAGS LIBS=$SAVE_LIBS AC_MSG_CHECKING([whether macro S_ISREG is available]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include #include ]], [[S_ISREG(S_IFMT);]])], [macro_s_isreg=yes], [AH_TEMPLATE([S_ISREG], [Define S_ISREG if stat.h doesn't]) AC_DEFINE([S_ISREG(m)], [(((m) & S_IFMT) == S_IFREG)]) macro_s_isreg=no]) AC_MSG_RESULT($macro_s_isreg) AC_MSG_CHECKING([for Win32 platform]) with_win32=no case $host_os in mingw* | pw32* | cygwin*) with_win32=yes AC_ARG_VAR(WINDRES, [The windres executable (used by win32 builds only).]) AC_CHECK_TOOL(WINDRES, windres) AC_ARG_VAR(LIBEXE, [The lib.exe executable (used by win32 builds only).]) AC_CHECK_PROG(LIBEXE, lib.exe, yes, no) ;; esac AC_MSG_RESULT($with_win32) AM_CONDITIONAL(WITH_WIN32, test $with_win32 = yes) AM_CONDITIONAL(HAVE_LIBEXE, test x$LIBEXE = xyes) AM_CONDITIONAL(CROSS_COMPILING, test x"$cross_compiling" != "xno") ################################################## # Checks for gtk-doc and docbook-tools ################################################## gtk_doc_installed=true #ifdef([GTK_DOC_CHECK],[GTK_DOC_CHECK([1.0])],[gtk_doc_installed=false]) # I would have liked to conditionalize this, but # that appears to break other things http://bugzilla.gnome.org/show_bug.cgi?id=156399 GTK_DOC_CHECK([1.0]) AM_CONDITIONAL(GTK_DOC_INSTALLED, $gtk_doc_installed) dnl *********************************************************************************** # Check for zlib. _cppflags=$CPPFLAGS _ldflags=$LDFLAGS Z_DIR= Z_LIBS= Z_CPPFLAGS= AC_ARG_WITH(zlib, [[ --with-zlib=DIR use libz in DIR]], [case $withval in yes|no) ;; *) Z_DIR=$withval CPPFLAGS="${CPPFLAGS} -I$withval/include" LDFLAGS="${LDFLAGS} -L$withval/lib" ;; esac]) if test "x$with_zlib" != xno; then with_zlib=no AC_CHECK_HEADER(zlib.h, [AC_CHECK_LIB(z, gzread, [with_zlib=yes])]) fi if test "$with_zlib" = no; then AC_MSG_ERROR([*** zlib is required]) fi if test "x$Z_DIR" != "x"; then Z_CPPFLAGS="-I$Z_DIR/include" case $host in *-*-solaris*) Z_LIBS="-L$Z_DIR/lib -R$Z_DIR/lib -lz" ;; *) Z_LIBS="-L$Z_DIR/lib -lz" ;; esac else Z_LIBS="-lz" fi AC_SUBST(Z_CPPFLAGS) AC_SUBST(Z_LIBS) CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags} dnl *********************************************************************************** test_python=true AC_ARG_WITH(python, [--{with,without}-python Build with the python support], if test "x$withval" = xno; then test_python=false fi ) if test "x$test_python" = xtrue ; then pygobject_msg=test AM_PATH_PYTHON AM_CHECK_PYTHON_HEADERS(,[pygobject_msg="NO. Missing python headers"]) dnl check for pygtk if test "$pygobject_msg" = test; then PKG_CHECK_MODULES(PYGTK, pygobject-2.0 >= 2.10.0, [], [pygobject_msg="NO. pygtk problem"]) AC_SUBST(PYGTK_CFLAGS) fi if test "$pygobject_msg" = test; then AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no) if test "$PYGTK_CODEGEN" = no; then pygobject_msg="NO. Missing pygtk-codegen-2.0" fi fi if test "$pygobject_msg" = test; then pygobject_msg=yes fi AC_MSG_RESULT($pygobject_msg) else pygobject_msg=no fi AM_CONDITIONAL(WITH_PYTHON, [test "$pygobject_msg" = yes]) dnl *********************************************************************************** dnl bz2 dnl BZ2_LIBS= test_bz2=true AC_ARG_WITH(bz2, [--{with,without}-bz2 Build additional wrappers for BZ2], if test "x$withval" = xno; then test_bz2=false fi ) with_bz2=false if test "x$test_bz2" = xtrue ; then AC_CHECK_LIB(bz2, BZ2_bzDecompressInit, bz2_ok=yes, bz2_ok=no AC_MSG_WARN(*** BZ2 support disabled (BZ2 library not found) ***)) if test "$bz2_ok" = yes; then AC_MSG_CHECKING([for bzlib.h]) AC_PREPROC_IFELSE( [AC_LANG_SOURCE( [[#include #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H #include ]])], bz2_ok=yes, bz2_ok=no) AC_MSG_RESULT($bz2_ok) fi if test "$bz2_ok" = yes; then AC_DEFINE(HAVE_BZ2, 1, [Is bzip2 available and enabled]) BZ2_LIBS="-lbz2" else AC_MSG_WARN(*** BZ2 support disabled (BZ2 header not found) ***) fi else AC_MSG_WARN([BZ2 support disabled, as requested (Use --with-bz2 to enable)]) fi AC_SUBST(BZ2_LIBS) dnl *********************************************************************************** dnl gnome dnl want_gnome=auto AC_ARG_WITH(gnome, [--{with,without}-gnome Build additional wrappers for GNOME-VFS and BONOBO], [case $withval in yes) want_gnome=yes;; no) want_gnome=no;; esac[]dnl ]) have_bonobo=no have_gnome=no if test $want_gnome = no ; then AC_MSG_WARN([GNOME support disabled, as requested (Use --with-gnome to enable)]) else dnl check for bonobo AC_ARG_WITH(bonobo, AC_HELP_STRING([--without-bonobo],[disable the use of bonobo]), [case "${withval}" in yes) have_bonobo=yes ;; no) have_bonobo=no ;; *) AC_MSG_ERROR(bad value ${withval} for --with-bonobo) ;; esac], [have_bonobo=yes]) dnl Default value if test $have_bonobo = yes; then libgsf_gnome_reqs="$libgsf_gnome_reqs libbonobo-2.0 >= 2.0.0" fi PKG_CHECK_MODULES(LIBGSF_GNOME, $libgsf_gnome_reqs, [have_gnome=yes], [if test $want_gnome = yes; then AC_MSG_ERROR([GNOME support requested, but not available.]) else AC_MSG_WARN([GNOME support disabled, unable to find required version of VFS and/or Bonobo]) fi]) fi AM_CONDITIONAL(WITH_LIBGSF_GNOME, test $have_gnome = yes) AM_CONDITIONAL(WITH_LIBGSF_BONOBO, test $have_bonobo = yes) dnl *********************************************************************************** dnl gvfs dnl want_gvfs=auto AC_ARG_WITH(gvfs, [--{with,without}-gvfs Build additional wrappers for GVFS], [case $withval in yes) want_gvfs=yes;; no) want_gvfs=no;; esac[]dnl ]) have_gvfs=no if test $want_gvfs = no ; then AC_MSG_WARN([GVFS support disabled, as requested (Use --with-gvfs to enable)]) else PKG_CHECK_MODULES(LIBGSF_GVFS, gio-standalone >= 0.0.1, [have_gvfs=yes], [if test $want_gvfs = yes; then AC_MSG_ERROR([GVFS support requested, but not available.]) else AC_MSG_WARN([GVFS support disabled, unable to find required version of GVFS]) fi]) fi AM_CONDITIONAL(WITH_GVFS, test $have_gvfs = yes) # =================== # GConf configuration dnl The following conditional is set in AM_GCONF_SOURCE_2. dnl Because we may skip its execution, we have to set a default here. AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false]) dnl Don't publish the GCONFTOOL variable, AM_GCONF_SOURCE_2 has ``gconftool-2'' hardwired. m4_pattern_allow([^AM_GCONF_SOURCE_2$]) GCONFTOOL= AC_CHECK_PROG([GCONFTOOL], [gconftool-2], [gconftool-2], [no]) if test "x$GCONFTOOL" = "xno"; then AC_MSG_WARN([thumbnailer will not be built, unable to find gconftool-2]) else AM_GCONF_SOURCE_2 fi AM_CONDITIONAL(WITH_GCONF, test "x$GCONFTOOL" != "xno") LDFLAGS="-no-undefined $LDFLAGS" AC_CONFIG_FILES([ Makefile m4/Makefile doc/Makefile gsf/Makefile gsf-gnome/Makefile gsf-gvfs/Makefile gsf-win32/Makefile tests/Makefile tools/Makefile python/Makefile thumbnailer/Makefile po/Makefile.in gsf/version.c doc/version.xml libgsf-1.pc libgsf-1.spec libgsf-gnome-1.pc libgsf-gvfs-1.pc libgsf-gnome-1.spec libgsf-win32-1.pc libgsf-zip ]) AC_OUTPUT AC_MSG_RESULT([Configured $PACKAGE $VERSION])