dnl set version (or would AM_INIT_AUTOMAKE(package_name, package_version) be better? dnl to update the version, modify here and run "autoconf" to generate a new ./configure script dnl AC_INIT must be the first macro called. dnl Have configure make sure the source code is found AC_INIT(src/swish.c) dnl revision name AC_SUBST(VERSION) VERSION=2.2rc1 dnl Corresponds to NAME in src/Makefile.in AC_SUBST(PROJECT) PROJECT=swish-e dnl Check for gettimeofday() AC_CHECK_FUNC(BSDgettimeofday, [AC_DEFINE(HAVE_BSDGETTIMEOFDAY)], [AC_CHECK_FUNC(gettimeofday, , [AC_DEFINE(NO_GETTOD)])]) dnl check for #! (shebang) AC_SYS_INTERPRETER dnl Set the @SET_MAKE@ variable=make if $(MAKE) not set AC_PROG_MAKE_SET dnl Check for Perl - used for making the distribution AC_PATH_PROG(PERL, perl, /usr/local/bin/perl,$PATH:/usr/bin:/usr/local/bin:/opt/bin:/usr/freeware/bin) dnl -- from src/configure.in -- dnl Check for a C compiler AC_PROG_CC dnl Resolve ranlib dependencies AC_PROG_RANLIB dnl Checks for libraries. dnl Replace `main' with a function in -lm: AC_CHECK_LIB(m, main) dnl Check for vsnprintf in libsnprintf.so AC_CHECK_LIB(snprintf, vsnprintf) dnl Checks for header files. dnl looks for dirent.h and sets HAVE_DIRENT_H -- do we use? AC_HEADER_DIRENT dnl Looks for standard C headers dnl which we need and don't do anything abut if we don't have them dnl so why bother? dnl AC_HEADER_STDC dnl Again, I don't think we do any tests for these, so why bother AC_CHECK_HEADERS(unistd.h stdlib.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T AC_STRUCT_TM dnl Checks for library functions. AC_FUNC_ALLOCA AC_FUNC_STRFTIME AC_FUNC_VPRINTF AC_CHECK_FUNCS(re_comp regcomp strdup strstr) AC_CHECK_LIB(m,log) AC_REPLACE_FUNCS(vsnprintf) dnl Optional building with libxml2 dnl Probably should be 2.4.5 + patches LIBXML_REQUIRED_VERSION=2.4.3 AC_ARG_WITH(libxml2,AC_HELP_STRING([--with-libxml2=DIR],[use libxml2 in DIR (YES if found)]),,withval=maybe) dnl if the user explicity asked for no libxml2 if test "$withval" != "no"; then dnl find xml2-config program XML2_CONFIG="no" if test "$withval" != "yes" && test "$withval" != "maybe" ; then XML2_CONFIG_PATH="$withval/bin" AC_PATH_PROG(XML2_CONFIG, xml2-config,"no", $XML2_CONFIG_PATH) else XML2_CONFIG_PATH=$PATH AC_PATH_PROG(XML2_CONFIG, xml2-config,"no", $XML2_CONFIG_PATH) fi dnl we can't do anything without xml2-config if test "$XML2_CONFIG" = "no"; then withval="no" else withval=`$XML2_CONFIG --prefix` fi dnl if withval still maybe then we have failed if test "$withval" = "maybe"; then withval = "no" fi fi if test "$withval" = "no"; then AC_MSG_RESULT([Not building with libxml2 - use --with-libxml2 to enable]) else AC_SUBST(LIBXML_REQUIRED_VERSION) AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION) AC_DEFUN(VERSION_TO_NUMBER, [`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`]) dnl dnl test version and init our variables dnl vers=VERSION_TO_NUMBER($XML2_CONFIG --version) XML2_VERSION=`$XML2_CONFIG --version` if test "$vers" -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION);then LIBXML2_LIB="`$XML2_CONFIG --libs`" LIBXML2_CFLAGS="`$XML2_CONFIG --cflags`" AC_MSG_RESULT(found version $XML2_VERSION) else AC_MSG_ERROR(You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of swish) fi AC_DEFINE(HAVE_LIBXML2) LIBXML2_OBJS="parser.o" AC_SUBST(LIBXML2_OBJS) AC_SUBST(LIBXML2_LIB) AC_SUBST(LIBXML2_CFLAGS) fi dnl Checks for zlib library. -- from libxml2 configure.in _cppflags="${CPPFLAGS}" _ldflags="${LDFLAGS}" AC_ARG_WITH(zlib,AC_HELP_STRING([--with-zlib=DIR], [use zlib in DIR (YES if found)]),,withval=maybe) dnl if withval not no or and not yes if test "$withval" != "no" -a "$withval" != "yes"; then Z_DIR=$withval CPPFLAGS="${CPPFLAGS} -I$withval/include" LDFLAGS="${LDFLAGS} -L$withval/lib" fi dnl if withval is maybe if test "$withval" == "maybe"; then withval="yes" Z_DIR="" CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}" fi dnl if withval not no then try to enable zlib support if test "$withval" != "no"; then AC_CHECK_HEADERS(zlib.h, AC_CHECK_LIB(z, gzread,[ AC_DEFINE(HAVE_LIBZ) if test "x${Z_DIR}" != "x"; then Z_CFLAGS="-I${Z_DIR}/include" Z_LIBS="-L${Z_DIR}/lib -lz" else Z_LIBS="-lz" fi])) AC_SUBST(Z_CFLAGS) AC_SUBST(Z_LIBS) AC_DEFINE(HAVE_ZLIB) else AC_MSG_RESULT([Not building with zlib for property compression - use --with-zlib to enable]) fi CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags} dnl Header file for -D defines and sets @DEFS@ to -DHAVE_CONFIG_H AC_CONFIG_HEADER(src/acconfig.h) AC_OUTPUT(Makefile doc/Makefile src/Makefile)