]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - configure.ac
Add support to decompress xz files
[thirdparty/sarg.git] / configure.ac
index 5888f2bd652f1e4fcbc0d08da4107d73c0dee893..1a598ad13a86393d497e576dd64cb33d01d8a6b2 100644 (file)
@@ -1,7 +1,16 @@
 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
 
@@ -80,8 +89,8 @@ AS_IF([test $ac_cv_header_getopt_h = "no"],[AC_MSG_ERROR("getopt.h is required t
 
 # Build with gd
 AC_ARG_WITH([gd],
-AS_HELP_STRING([--with-gd],[Compile with support for the graphical gd library]),
-[],[with_gd=check])
+       AS_HELP_STRING([--with-gd],[Compile with support for the graphical gd library]),
+       [],[with_gd=check])
 AS_IF([test "x$with_gd" != "xno"],
 [
        AC_CHECK_HEADERS(gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h)
@@ -101,8 +110,8 @@ AS_IF([test "x$with_gd" != "xno"],
 
 # Build with LDAP
 AC_ARG_WITH([ldap],
-AS_HELP_STRING([--with-ldap],[Compile with LDAP support]),
-[],[with_ldap=check])
+       AS_HELP_STRING([--with-ldap],[Compile with LDAP support]),
+       [],[with_ldap=check])
 AS_IF([test "x$with_ldap" != "xno"],
 [
        AC_CHECK_HEADERS([ldap_cdefs.h] [ldap_features.h] [ldap.h],,break)
@@ -118,8 +127,8 @@ AS_IF([test "x$with_ldap" != "xno"],
 
 # Build with iconv
 AC_ARG_WITH([iconv],
-AS_HELP_STRING([--with-iconv],[Compile with support for iconv]),
-[],[with_iconv=check])
+       AS_HELP_STRING([--with-iconv],[Compile with support for iconv]),
+       [],[with_iconv=check])
 AS_IF([test "x$with_iconv" != "xno"],
 [
        dnl Check for iconv
@@ -132,8 +141,8 @@ AS_IF([test "x$with_iconv" != "xno"],
 
 # Build with pcre
 AC_ARG_WITH([pcre],
-AS_HELP_STRING([--with-pcre],[Compile with support for the Perl Compatible Regular Expressions library]),
-[],[with_pcre=check])
+       AS_HELP_STRING([--with-pcre],[Compile with support for the Perl Compatible Regular Expressions library]),
+       [],[with_pcre=check])
 AS_IF([test "x$with_pcre" != "xno"],
 [
        AC_CHECK_HEADERS(pcre.h)
@@ -150,25 +159,37 @@ AS_IF([test "x$with_pcre" != "xno"],
 
 # Build with file globbing
 AC_ARG_WITH([glob],
-AS_HELP_STRING([--without-glob],[Ignore wildcards in file names]),
-[with_glob=no],[with_glob=yes])
+       AS_HELP_STRING([--without-glob],[Ignore wildcards in file names]),
+       [],[with_glob=yes])
 AS_IF([test "x$with_glob" != "xno"],
 [
-       AC_CHECK_HEADERS(glob.h)
+       AC_CHECK_HEADERS([glob.h],[],
+       [
+               AS_IF([test "x$with_glob" != "xcheck"],
+               [
+                       AC_MSG_FAILURE([glob.h not found (use --without-glob to compile without file globbing)])
+               ])
+       ])
 ],[
        glob_status="disabled"
 ])
 
 # Build with zlib
 AC_ARG_WITH([zlib],
-AS_HELP_STRING([--with-zlib],[Compile with support to decompress gz files]),
-[],[with_zlib=check])
+       AS_HELP_STRING([--with-zlib],[Compile with support to decompress gz files]),
+       [],[with_zlib=check])
 AS_IF([test "x$with_zlib" != "xno" ],
 [
        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"
@@ -177,6 +198,54 @@ AS_IF([test "x$with_zlib" != "xno" ],
        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"
+])
+
+# Build with liblzma
+AC_ARG_WITH([liblzma],
+       AS_HELP_STRING([--with-liblzma],[Compile with support to decompress xz files]),
+       [],[with_liblzma=check])
+AS_IF([test "x$with_liblzma" != "xno" ],
+[
+       AC_CHECK_HEADERS(lzma.h)
+       AS_IF([test "x$ac_cv_header_lzma_h" = "xyes"],
+       [
+               AC_CHECK_LIB([lzma],[lzma_stream_decoder],
+               [
+                       LIBS="-llzma ${LIBS}"
+                       HAVE_LIBLZMA_LIB="yes"
+               ],[
+                       HAVE_LIBLZMA_LIB=""
+               ])
+               AS_IF([test "x$HAVE_LIBLZMA_LIB" != "xyes"],[AC_MSG_ERROR([liblzma was not found])])
+       ],[
+               liblzma_status="not found"
+       ])
+],[
+       liblzma_status="disabled"
+])
+
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 AC_STRUCT_TM
@@ -261,11 +330,11 @@ AS_IF([test "x$ac_cv_have_decl_LLONG_MAX" != "xyes"],
 
 dnl Select sarg-php directory
 AC_ARG_ENABLE(sargphp,
-AS_HELP_STRING([--enable-sargphp=sargphpdir],
-[Select sargphpdir as the directory to install sarg-php into]),
-[
-       AS_IF([test "$enableval" -a "x$enableval" != "xno"],[SARGPHPDIR=$enableval])
-],[SARGPHPDIR="/var/www/html"])
+       AS_HELP_STRING([--enable-sargphp=sargphpdir],
+       [Select sargphpdir as the directory to install sarg-php into]),
+       [
+               AS_IF([test "$enableval" -a "x$enableval" != "xno"],[SARGPHPDIR=$enableval])
+       ],[SARGPHPDIR="/var/www/html"])
 AS_IF([test "$SARGPHPDIR"],
 [
        AC_MSG_NOTICE([using $SARGPHPDIR as the directory to install sarg-php])
@@ -274,11 +343,11 @@ AS_IF([test "$SARGPHPDIR"],
 
 dnl Select fonts dir
 AC_ARG_ENABLE(fontdir,
-AS_HELP_STRING([--enable-fontdir=fontdir],
-[Select fontdir as the directory with the fonts to use in the reports]),
-[
-       AS_IF([test "$enableval" -a "x$enableval" != "xno"],[FONTDIR=$enableval])
-],[FONTDIR="${datarootdir}/sarg/fonts"])
+       AS_HELP_STRING([--enable-fontdir=fontdir],
+       [Select fontdir as the directory with the fonts to use in the reports]),
+       [
+               AS_IF([test "$enableval" -a "x$enableval" != "xno"],[FONTDIR=$enableval])
+       ],[FONTDIR="${datarootdir}/sarg/fonts"])
 AS_IF([test "$FONTDIR"],
 [
        AS_IF([test "x$prefix" = "xNONE"],
@@ -293,11 +362,11 @@ AS_IF([test "$FONTDIR"],
 
 dnl Select images dir
 AC_ARG_ENABLE(imagedir,
-AS_HELP_STRING([--enable-imagedir=imagedir],
-[Select imagedir as the directory with the images to use in the reports]),
-[
-       AS_IF([test "$enableval"],[IMAGEDIR=$enableval])
-],[IMAGEDIR="${datarootdir}/sarg/images"])
+       AS_HELP_STRING([--enable-imagedir=imagedir],
+       [Select imagedir as the directory with the images to use in the reports]),
+       [
+               AS_IF([test "$enableval"],[IMAGEDIR=$enableval])
+       ],[IMAGEDIR="${datarootdir}/sarg/images"])
 AS_IF([test "x$prefix" = "xNONE"],
 [
        tempfullpath=`prefix=$ac_default_prefix ; eval "echo $IMAGEDIR"`
@@ -309,8 +378,8 @@ AC_SUBST(IMAGEDIR)
 
 dnl Enable extra compile and run time protection
 AC_ARG_ENABLE(extraprotection,
-AS_HELP_STRING([--enable-extraprotection],
-[Enable compile and runtime extra protections]),
+       AS_HELP_STRING([--enable-extraprotection],
+       [Enable compile and runtime extra protections]),
 [
        AS_IF([test "$enableval"],
        [
@@ -336,8 +405,8 @@ AS_HELP_STRING([--enable-extraprotection],
 
 dnl Enable double check of the data written in the reports
 AC_ARG_ENABLE(doublecheck,
-AS_HELP_STRING([--enable-doublecheck],
-[Make sarg double check the data it manipulates and output a warning if an error is found]),
+       AS_HELP_STRING([--enable-doublecheck],
+       [Make sarg double check the data it manipulates and output a warning if an error is found]),
 [
        AS_IF([test "$enableval"],
        [
@@ -347,8 +416,8 @@ AS_HELP_STRING([--enable-doublecheck],
 
 dnl Get the xsl stylesheet to produce the manpage
 AC_ARG_ENABLE(xsl-man,
-AS_HELP_STRING([--enable-xsl-man=man-xsl-style-sheet],
-[Select the directory containing the the XSL stylesheets to convert DocBook into man page]),
+       AS_HELP_STRING([--enable-xsl-man=man-xsl-style-sheet],
+       [Select the directory containing the the XSL stylesheets to convert DocBook into man page]),
 [
        AS_IF([test "$enableval"],
        [
@@ -361,20 +430,19 @@ AC_CHECK_FILES([/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.x
        # debian
        XSL_MAN_STYLESHEET="/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl"
        AC_SUBST(XSL_MAN_STYLESHEET)
-],
-[
-AC_CHECK_FILES([/usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl],
-[
-       # gentoo
-       XSL_MAN_STYLESHEET="/usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl"
-       AC_SUBST(XSL_MAN_STYLESHEET)
-],)
+],[
+       AC_CHECK_FILES([/usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl],
+       [
+               # gentoo
+               XSL_MAN_STYLESHEET="/usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl"
+               AC_SUBST(XSL_MAN_STYLESHEET)
+       ])
 ]))
 
 dnl Get the xsl stylesheet to produce the html page
 AC_ARG_ENABLE(xsl-html,
-AS_HELP_STRING([--enable-xsl-html=html-xsl-style-sheet],
-[Select the directory containing the the XSL stylesheets to convert DocBook into html page]),
+       AS_HELP_STRING([--enable-xsl-html=html-xsl-style-sheet],
+       [Select the directory containing the the XSL stylesheets to convert DocBook into html page]),
 [
        AS_IF([test "$enableval"],
        [
@@ -394,7 +462,7 @@ AC_CHECK_FILES([/usr/share/sgml/docbook/xsl-stylesheets/html/onechunk.xsl],
        # gentoo
        XSL_HTML_STYLESHEET="/usr/share/sgml/docbook/xsl-stylesheets/html/onechunk.xsl"
        AC_SUBST(XSL_HTML_STYLESHEET)
-],)
+])
 ]))
 
 AC_SUBST(PACKAGE,"$PACKAGE_NAME")
@@ -430,3 +498,15 @@ AS_IF([test "x$zlib_status" = "xdisabled"],[
 ],[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])
+])
+
+AS_IF([test "x$liblzma_status" = "xdisabled"],[
+       AC_MSG_NOTICE([Not building with liblzma as requested on the configuration command line])
+],[test "x$liblzma_status" = "xnot found"],[
+       AC_MSG_NOTICE([lzma.h was not found so it won't be possible to process xz files])
+])