dnl Process this file with autoconf or autoreconf to produce a configure script.
AC_INIT([sarg],[2.4.0-pre2])
AC_CONFIG_SRCDIR([log.c])
-AC_CONFIG_AUX_DIR(cfgaux)
+AC_CONFIG_AUX_DIR([cfgaux])
+AC_CONFIG_MACRO_DIR([m4])
+
+dnl We don't use automake but the following macro is required to
+dnl install "install-sh" that is required by configure.
+dnl I may be a bug in autoconf 2.69...
+dnl But if it is enabled, the AM_GNU_GETTEXT produce a warning!
+dnl The solution for now is to manually run automake -a before
+dnl running the configure script
+dnl AM_INIT_AUTOMAKE
AC_CANONICAL_HOST
AC_CHECK_HEADERS(zlib.h)
AS_IF([test "x$ac_cv_header_zlib_h" = "xyes"],
[
- AC_CHECK_LIB(z, gzopen,LIBS="-lz ${LIBS}"; HAVE_ZLIB_LIB="yes", HAVE_ZLIB_LIB="")
+ AC_CHECK_LIB([z],[gzopen],
+ [
+ LIBS="-lz ${LIBS}"
+ HAVE_ZLIB_LIB="yes"
+ ],[
+ HAVE_ZLIB_LIB=""
+ ])
AS_IF([test "x$HAVE_ZLIB_LIB" != "xyes"],[AC_MSG_ERROR([zlib was not found])])
],[
zlib_status="not found"
zlib_status="disabled"
])
+# Build with bzlib
+AC_ARG_WITH([bzlib],
+ AS_HELP_STRING([--with-bzlib],[Compile with support to decompress bz2 files]),
+ [],[with_bzlib=check])
+AS_IF([test "x$with_bzlib" != "xno" ],
+[
+ AC_CHECK_HEADERS(bzlib.h)
+ AS_IF([test "x$ac_cv_header_bzlib_h" = "xyes"],
+ [
+ AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],
+ [
+ LIBS="-lbz2 ${LIBS}"
+ HAVE_BZLIB_LIB="yes"
+ ],[
+ HAVE_BZLIB_LIB=""
+ ])
+ AS_IF([test "x$HAVE_BZLIB_LIB" != "xyes"],[AC_MSG_ERROR([bzlib was not found])])
+ ],[
+ bzlib_status="not found"
+ ])
+],[
+ bzlib_status="disabled"
+])
+
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_STRUCT_TM
],[test "x$zlib_status" = "xnot found"],[
AC_MSG_NOTICE([zlib.h was not found so it won't be possible to process gzipped files])
])
+
+AS_IF([test "x$bzlib_status" = "xdisabled"],[
+ AC_MSG_NOTICE([Not building with bzlib as requested on the configuration command line])
+],[test "x$bzlib_status" = "xnot found"],[
+ AC_MSG_NOTICE([bzlib.h was not found so it won't be possible to process bzipped files])
+])