dnl dnl The Webalizer - A web server log file analysis program dnl Copyright (C) 1997-2011 by Bradford L. Barrett dnl dnl configure.in template for The Webalizer Version 2.23 dnl Process this file with autoconf to produce a configure script. dnl AC_INIT(webalizer,V2.23) OPTS=${DEFS} LIBS=${LIBS} AC_SUBST(OPTS) AC_SUBST(WCMGR_LIBS) dnl ------------------------------------------ dnl default language (don't change!) dnl ------------------------------------------ DEFAULT_LANG="english" AC_SUBST(DEFAULT_LANG) dnl ------------------------------------------ dnl Checks for required programs. dnl ------------------------------------------ IN_CFLAGS=${CFLAGS} AC_PROG_CC AC_PROG_LN_S AC_PROG_INSTALL dnl ------------------------------------------ dnl check for platform specific settings dnl ------------------------------------------ AC_SYS_LARGEFILE AC_C_CHAR_UNSIGNED AC_CHECK_TYPE(u_int64_t, unsigned long long) AC_CHECK_DECL(altzone,OPTS="-DHAVE_ALTZONE ${OPTS}",,[#include ]) dnl ------------------------------------------ dnl force our own CFLAGS defaults if GCC dnl ------------------------------------------ if test "$GCC" = "yes"; then AC_ARG_ENABLE(static, [ --enable-static Build as static executable [[default=no]]], LDFLAGS="--static ${LDFLAGS}") if test "$IN_CFLAGS" = ""; then CFLAGS="-Wall -O2" fi if test "$ac_cv_c_char_unsigned" = "yes"; then CFLAGS="-fsigned-char ${CFLAGS}" fi AC_ARG_ENABLE(debug, [ --enable-debug Compile with debugging code [[default=no]]], CFLAGS="-g ${CFLAGS}") else if test "$IN_CFLAGS" = ""; then CFLAGS="-g" fi fi dnl ------------------------------------------ dnl check command line arguments dnl ------------------------------------------ AC_ARG_WITH(gd, [ --with-gd=DIR Alternate location for gd header files], S_GD="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}") AC_ARG_WITH(gdlib, [ --with-gdlib=DIR Alternate location for gd library], S_GDLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}") AC_ARG_WITH(png, [ --with-png=DIR Alternate location for png header files], S_PNG="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}") AC_ARG_WITH(pnglib, [ --with-pnglib=DIR Alternate location for png library], S_PNGLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}") AC_ARG_WITH(z, [ --with-z=DIR Alternate location for libz header files], S_Z="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}") AC_ARG_WITH(zlib, [ --with-zlib=DIR Alternate location for z library], S_ZLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}") AC_ARG_WITH(db, [ --with-db=DIR Alternate location for libdb header files], S_DB="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}") AC_ARG_WITH(dblib, [ --with-dblib=DIR Alternate location for db library], S_DBLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}") dnl ------------------------------------------ dnl these are needed on some platforms dnl ------------------------------------------ AC_CHECK_LIB(44bsd, main, LIBS="-l44bsd ${LIBS}") AC_CHECK_HEADERS(getopt.h) AC_CHECK_LIB(m, main, LIBS="-lm ${LIBS}"; HAVE_LIBM="1") if test "${HAVE_LIBM}" = "1"; then AC_CHECK_HEADERS(math.h) fi dnl ------------------------------------------ dnl ensure current libz is present - required! dnl ------------------------------------------ AC_CHECK_LIB(z, main, LIBZ="yes"; LIBS="-lz ${LIBS}") if test "${LIBZ}" = "yes"; then AC_CHECK_LIB(z, gzrewind,LIBZ="yes",LIBZ="no") if test "${LIBZ}" = "no"; then AC_MSG_ERROR(Old version of libz found.. please upgrade!) fi else AC_MSG_ERROR(z library not found.. please install libz) fi AC_CHECK_HEADER(zlib.h, HDR="yes", HDR="no") if test "${HDR}" = "no"; then AC_MSG_ERROR(zlib.h header not found.. please install) fi dnl ------------------------------------------ dnl ensure libpng is present - required! dnl ------------------------------------------ AC_CHECK_LIB(png, main, LIBPNG="yes"; LIBS="-lpng ${LIBS}",LIBPNG="no") if test "${LIBPNG}" = "no"; then AC_MSG_ERROR(png library not found.. please install libpng) fi dnl ------------------------------------------ dnl ensure libgd is present - required! dnl ------------------------------------------ AC_CHECK_LIB(gd, main, LIBGD="yes"; LIBS="-lgd ${LIBS}") if test "${LIBGD}" = "yes"; then AC_CHECK_LIB(gd, gdImagePng, LIBGD="yes", LIBGD="no") if test "${LIBGD}" = "no"; then AC_MSG_ERROR(Old version of libgd found.. please upgrade!) fi else AC_MSG_ERROR(gd library not found.. please install libgd) fi AC_CHECK_HEADER(gd.h, HDR="yes", HDR="no") if test "${HDR}" = "no"; then AC_MSG_ERROR(gd.h header not found.. please install) fi dnl ------------------------------------------ dnl DNS/GeoDB lookup specific tests dnl ------------------------------------------ AC_ARG_ENABLE(dns, [ --enable-dns Enable DNS/GeoDB lookup code [[default=yes]]], USE_DNS="${enableval}", USE_DNS="yes") if test "${USE_DNS}" = "yes"; then AC_CHECK_LIB(db, main, USE_DNS="yes", USE_DNS="no"; AC_MSG_WARN(libdb not found.. DNS/GeoDB code disabled!)) fi if test "${USE_DNS}" = "yes"; then AC_CHECK_HEADER(db.h, USE_DNS="yes", USE_DNS="no"; AC_MSG_WARN(db.h not found.. DNS/GeoDB code disabled!)) fi if test "${USE_DNS}" = "yes"; then dnl we have both library and header.. proceed OPTS="-DUSE_DNS ${OPTS}" LIBS="-ldb ${LIBS}" WCMGR_LIBS="-ldb" AC_CHECK_FUNC(fdatasync,DUMMY="") if test "$ac_cv_func_fdatasync" = "no"; then AC_CHECK_LIB(rt, fdatasync, LIBS="-lrt ${LIBS}";WCMGR_LIBS="-lrt ${WCMGR_LIBS}") fi AC_CHECK_FUNC(socket,DUMMY="",DUMMY="") if test "$ac_cv_func_socket" = "no"; then AC_CHECK_LIB(socket, main, LIBS="-lsocket ${LIBS}") fi AC_CHECK_HEADERS(sys/socket.h) AC_CHECK_FUNC(inet_pton,DUMMY="",DUMMY="") if test "$ac_cv_func_inet_pton" = "no"; then AC_CHECK_LIB(nsl,inet_pton, LIBS="-lnsl ${LIBS}") fi fi dnl ------------------------------------------ dnl BZip2 code specific tests dnl ------------------------------------------ AC_ARG_ENABLE(bz2, [ --enable-bz2 Enable BZip2 decompression code [[default=no]]], USE_BZIP="${enableval}", USE_BZIP="no") AC_ARG_WITH(bz2, [ --with-bz2=DIR Alternate location for bz2 header files], S_BZ2="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}") AC_ARG_WITH(bz2lib, [ --with-bz2lib=DIR Alternate location for bz2 library], S_BZ2LIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}") if test "${USE_BZIP}" = "yes"; then AC_CHECK_LIB(bz2, main, USE_BZIP="yes", USE_BZIP="no"; AC_MSG_WARN(libbz2 not found.. bzip2 code will will be disabled!)) fi if test "${USE_BZIP}" = "yes"; then AC_CHECK_LIB(bz2, BZ2_bzopen, USE_BZIP="yes", USE_BZIP="no"; AC_MSG_WARN(Old bz2 library found.. bzip2 code will be disabled!)) fi if test "${USE_BZIP}" = "yes"; then AC_CHECK_HEADER(bzlib.h, USE_BZIP="yes", USE_BZIP="no"; AC_MSG_WARN(bzlib.h not found.. bzip2 code will be disabled!)) fi if test "${USE_BZIP}" = "yes"; then dnl we have both library and header.. proceed OPTS="-DUSE_BZIP ${OPTS}" LIBS="-lbz2 ${LIBS}" fi dnl ------------------------------------------ dnl GeoIP code specific tests dnl ------------------------------------------ AC_ARG_ENABLE(geoip, [ --enable-geoip Enable GeoIP geolocation code [[default=no]]], USE_GEOIP="${enableval}", USE_GEOIP="no") AC_ARG_WITH(geoip, [ --with-geoip=DIR Alternate location for libGeoIP header files], S_GEOIP="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}") AC_ARG_WITH(geoiplib, [ --with-geoiplib=DIR Alternate location for geoip library], S_GEOIPLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}") if test "${USE_GEOIP}" = "yes"; then AC_CHECK_LIB(GeoIP, main, USE_GEOIP="yes", USE_GEOIP="no"; AC_MSG_WARN(libGeoIP not found.. GeoIP code will be disabled!)) fi if test "${USE_GEOIP}" = "yes"; then AC_CHECK_HEADER(GeoIP.h, USE_GEOIP="yes", USE_GEOIP="no"; AC_MSG_WARN(GeoIP.h not found.. GeoIP code will be disabled!)) fi if test "${USE_GEOIP}" = "yes"; then dnl we have both library and header.. proceed OPTS="-DUSE_GEOIP ${OPTS}" LIBS="-lGeoIP ${LIBS}" fi dnl ------------------------------------------ dnl check for default GeoDB directory dnl ------------------------------------------ AC_ARG_WITH(geodb, [ --with-geodb=DIR Default GeoDB data dir [[/usr/share/GeoDB]]], GEODB_LOC="${withval}", GEODB_LOC="/usr/share/GeoDB") AC_SUBST(GEODB_LOC) dnl ------------------------------------------ dnl check which hash function to use dnl ------------------------------------------ AC_ARG_ENABLE(oldhash, [ --enable-oldhash Use old hash function (slower) [[default=no]]], OLDHASH=${enableval}, OLDHASH="no") if test "$OLDHASH" = "yes"; then OPTS="-DUSE_OLDHASH"; fi dnl ------------------------------------------ dnl check language to use (default is english) dnl ------------------------------------------ LANG_CACHE=yes AC_ARG_WITH(language, [ --with-language=name Use language 'name' (default is english)], WEBALIZER_LANG="${withval}"; LANG_CACHE=no, LANG_CACHE=yes) if test "$WEBALIZER_LANG" = "no"; then WEBALIZER_LANG=english; fi dnl ------------------------------------------ dnl check if specfied language is valid dnl ------------------------------------------ AC_MSG_CHECKING(for language file) if test "$LANG_CACHE" = "yes"; then AC_CACHE_VAL(ac_cv_language, ac_cv_language=$DEFAULT_LANG) WEBALIZER_LANG=$ac_cv_language fi if test -f lang/webalizer_lang.${WEBALIZER_LANG}; then AC_MSG_RESULT(yes - ${WEBALIZER_LANG}) else if test -f lang/webalizer_lang.${DEFAULT_LANG}; then AC_MSG_RESULT('${WEBALIZER_LANG}' not found - using ${DEFAULT_LANG}) WEBALIZER_LANG=${DEFAULT_LANG} else AC_MSG_RESULT(no) AC_MSG_ERROR(language files not found... fix before continuing) fi fi ac_cv_language=${WEBALIZER_LANG} dnl ------------------------------------------ dnl create link to language file dnl ------------------------------------------ AC_LINK_FILES(lang/webalizer_lang.${WEBALIZER_LANG}, webalizer_lang.h) dnl ------------------------------------------ dnl done.. write out our Makefile dnl ------------------------------------------ AC_OUTPUT(Makefile) AC_MSG_NOTICE(Done. Type 'make' to continue with build.)