| 1 | dnl |
| 2 | dnl The Webalizer - A web server log file analysis program |
| 3 | dnl Copyright (C) 1997-2011 by Bradford L. Barrett |
| 4 | dnl |
| 5 | dnl configure.in template for The Webalizer Version 2.23 |
| 6 | dnl Process this file with autoconf to produce a configure script. |
| 7 | dnl |
| 8 | |
| 9 | AC_INIT(webalizer,V2.23) |
| 10 | |
| 11 | OPTS=${DEFS} |
| 12 | LIBS=${LIBS} |
| 13 | AC_SUBST(OPTS) |
| 14 | AC_SUBST(WCMGR_LIBS) |
| 15 | |
| 16 | dnl ------------------------------------------ |
| 17 | dnl default language (don't change!) |
| 18 | dnl ------------------------------------------ |
| 19 | |
| 20 | DEFAULT_LANG="english" |
| 21 | AC_SUBST(DEFAULT_LANG) |
| 22 | |
| 23 | dnl ------------------------------------------ |
| 24 | dnl Checks for required programs. |
| 25 | dnl ------------------------------------------ |
| 26 | |
| 27 | IN_CFLAGS=${CFLAGS} |
| 28 | AC_PROG_CC |
| 29 | AC_PROG_LN_S |
| 30 | AC_PROG_INSTALL |
| 31 | |
| 32 | dnl ------------------------------------------ |
| 33 | dnl check for platform specific settings |
| 34 | dnl ------------------------------------------ |
| 35 | |
| 36 | AC_SYS_LARGEFILE |
| 37 | AC_C_CHAR_UNSIGNED |
| 38 | AC_CHECK_TYPE(u_int64_t, unsigned long long) |
| 39 | AC_CHECK_DECL(altzone,OPTS="-DHAVE_ALTZONE ${OPTS}",,[#include <time.h>]) |
| 40 | |
| 41 | dnl ------------------------------------------ |
| 42 | dnl force our own CFLAGS defaults if GCC |
| 43 | dnl ------------------------------------------ |
| 44 | |
| 45 | if test "$GCC" = "yes"; then |
| 46 | |
| 47 | AC_ARG_ENABLE(static, |
| 48 | [ --enable-static Build as static executable [[default=no]]], |
| 49 | LDFLAGS="--static ${LDFLAGS}") |
| 50 | |
| 51 | if test "$IN_CFLAGS" = ""; then |
| 52 | CFLAGS="-Wall -O2" |
| 53 | fi |
| 54 | if test "$ac_cv_c_char_unsigned" = "yes"; then |
| 55 | CFLAGS="-fsigned-char ${CFLAGS}" |
| 56 | fi |
| 57 | |
| 58 | AC_ARG_ENABLE(debug, |
| 59 | [ --enable-debug Compile with debugging code [[default=no]]], |
| 60 | CFLAGS="-g ${CFLAGS}") |
| 61 | |
| 62 | else |
| 63 | if test "$IN_CFLAGS" = ""; then |
| 64 | CFLAGS="-g" |
| 65 | fi |
| 66 | fi |
| 67 | |
| 68 | dnl ------------------------------------------ |
| 69 | dnl check command line arguments |
| 70 | dnl ------------------------------------------ |
| 71 | |
| 72 | AC_ARG_WITH(gd, |
| 73 | [ --with-gd=DIR Alternate location for gd header files], |
| 74 | S_GD="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}") |
| 75 | AC_ARG_WITH(gdlib, |
| 76 | [ --with-gdlib=DIR Alternate location for gd library], |
| 77 | S_GDLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}") |
| 78 | AC_ARG_WITH(png, |
| 79 | [ --with-png=DIR Alternate location for png header files], |
| 80 | S_PNG="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}") |
| 81 | AC_ARG_WITH(pnglib, |
| 82 | [ --with-pnglib=DIR Alternate location for png library], |
| 83 | S_PNGLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}") |
| 84 | AC_ARG_WITH(z, |
| 85 | [ --with-z=DIR Alternate location for libz header files], |
| 86 | S_Z="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}") |
| 87 | AC_ARG_WITH(zlib, |
| 88 | [ --with-zlib=DIR Alternate location for z library], |
| 89 | S_ZLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}") |
| 90 | AC_ARG_WITH(db, |
| 91 | [ --with-db=DIR Alternate location for libdb header files], |
| 92 | S_DB="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}") |
| 93 | AC_ARG_WITH(dblib, |
| 94 | [ --with-dblib=DIR Alternate location for db library], |
| 95 | S_DBLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}") |
| 96 | |
| 97 | dnl ------------------------------------------ |
| 98 | dnl these are needed on some platforms |
| 99 | dnl ------------------------------------------ |
| 100 | |
| 101 | AC_CHECK_LIB(44bsd, main, LIBS="-l44bsd ${LIBS}") |
| 102 | AC_CHECK_HEADERS(getopt.h) |
| 103 | AC_CHECK_LIB(m, main, LIBS="-lm ${LIBS}"; HAVE_LIBM="1") |
| 104 | if test "${HAVE_LIBM}" = "1"; then |
| 105 | AC_CHECK_HEADERS(math.h) |
| 106 | fi |
| 107 | |
| 108 | dnl ------------------------------------------ |
| 109 | dnl ensure current libz is present - required! |
| 110 | dnl ------------------------------------------ |
| 111 | |
| 112 | AC_CHECK_LIB(z, main, LIBZ="yes"; LIBS="-lz ${LIBS}") |
| 113 | if test "${LIBZ}" = "yes"; then |
| 114 | AC_CHECK_LIB(z, gzrewind,LIBZ="yes",LIBZ="no") |
| 115 | if test "${LIBZ}" = "no"; then |
| 116 | AC_MSG_ERROR(Old version of libz found.. please upgrade!) |
| 117 | fi |
| 118 | else |
| 119 | AC_MSG_ERROR(z library not found.. please install libz) |
| 120 | fi |
| 121 | |
| 122 | AC_CHECK_HEADER(zlib.h, HDR="yes", HDR="no") |
| 123 | if test "${HDR}" = "no"; then |
| 124 | AC_MSG_ERROR(zlib.h header not found.. please install) |
| 125 | fi |
| 126 | |
| 127 | dnl ------------------------------------------ |
| 128 | dnl ensure libpng is present - required! |
| 129 | dnl ------------------------------------------ |
| 130 | |
| 131 | AC_CHECK_LIB(png, main, LIBPNG="yes"; LIBS="-lpng ${LIBS}",LIBPNG="no") |
| 132 | if test "${LIBPNG}" = "no"; then |
| 133 | AC_MSG_ERROR(png library not found.. please install libpng) |
| 134 | fi |
| 135 | |
| 136 | dnl ------------------------------------------ |
| 137 | dnl ensure libgd is present - required! |
| 138 | dnl ------------------------------------------ |
| 139 | |
| 140 | AC_CHECK_LIB(gd, main, LIBGD="yes"; LIBS="-lgd ${LIBS}") |
| 141 | if test "${LIBGD}" = "yes"; then |
| 142 | AC_CHECK_LIB(gd, gdImagePng, LIBGD="yes", LIBGD="no") |
| 143 | if test "${LIBGD}" = "no"; then |
| 144 | AC_MSG_ERROR(Old version of libgd found.. please upgrade!) |
| 145 | fi |
| 146 | else |
| 147 | AC_MSG_ERROR(gd library not found.. please install libgd) |
| 148 | fi |
| 149 | |
| 150 | AC_CHECK_HEADER(gd.h, HDR="yes", HDR="no") |
| 151 | if test "${HDR}" = "no"; then |
| 152 | AC_MSG_ERROR(gd.h header not found.. please install) |
| 153 | fi |
| 154 | |
| 155 | dnl ------------------------------------------ |
| 156 | dnl DNS/GeoDB lookup specific tests |
| 157 | dnl ------------------------------------------ |
| 158 | |
| 159 | AC_ARG_ENABLE(dns, |
| 160 | [ --enable-dns Enable DNS/GeoDB lookup code [[default=yes]]], |
| 161 | USE_DNS="${enableval}", USE_DNS="yes") |
| 162 | |
| 163 | if test "${USE_DNS}" = "yes"; then |
| 164 | AC_CHECK_LIB(db, main, USE_DNS="yes", |
| 165 | USE_DNS="no"; AC_MSG_WARN(libdb not found.. DNS/GeoDB code disabled!)) |
| 166 | fi |
| 167 | |
| 168 | if test "${USE_DNS}" = "yes"; then |
| 169 | AC_CHECK_HEADER(db.h, USE_DNS="yes", |
| 170 | USE_DNS="no"; AC_MSG_WARN(db.h not found.. DNS/GeoDB code disabled!)) |
| 171 | fi |
| 172 | |
| 173 | if test "${USE_DNS}" = "yes"; then |
| 174 | dnl we have both library and header.. proceed |
| 175 | OPTS="-DUSE_DNS ${OPTS}" |
| 176 | LIBS="-ldb ${LIBS}" |
| 177 | WCMGR_LIBS="-ldb" |
| 178 | AC_CHECK_FUNC(fdatasync,DUMMY="") |
| 179 | if test "$ac_cv_func_fdatasync" = "no"; then |
| 180 | AC_CHECK_LIB(rt, fdatasync, |
| 181 | LIBS="-lrt ${LIBS}";WCMGR_LIBS="-lrt ${WCMGR_LIBS}") |
| 182 | fi |
| 183 | AC_CHECK_FUNC(socket,DUMMY="",DUMMY="") |
| 184 | if test "$ac_cv_func_socket" = "no"; then |
| 185 | AC_CHECK_LIB(socket, main, LIBS="-lsocket ${LIBS}") |
| 186 | fi |
| 187 | AC_CHECK_HEADERS(sys/socket.h) |
| 188 | AC_CHECK_FUNC(inet_pton,DUMMY="",DUMMY="") |
| 189 | if test "$ac_cv_func_inet_pton" = "no"; then |
| 190 | AC_CHECK_LIB(nsl,inet_pton, LIBS="-lnsl ${LIBS}") |
| 191 | fi |
| 192 | fi |
| 193 | |
| 194 | dnl ------------------------------------------ |
| 195 | dnl BZip2 code specific tests |
| 196 | dnl ------------------------------------------ |
| 197 | |
| 198 | AC_ARG_ENABLE(bz2, |
| 199 | [ --enable-bz2 Enable BZip2 decompression code [[default=no]]], |
| 200 | USE_BZIP="${enableval}", USE_BZIP="no") |
| 201 | |
| 202 | AC_ARG_WITH(bz2, |
| 203 | [ --with-bz2=DIR Alternate location for bz2 header files], |
| 204 | S_BZ2="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}") |
| 205 | AC_ARG_WITH(bz2lib, |
| 206 | [ --with-bz2lib=DIR Alternate location for bz2 library], |
| 207 | S_BZ2LIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}") |
| 208 | |
| 209 | if test "${USE_BZIP}" = "yes"; then |
| 210 | AC_CHECK_LIB(bz2, main, USE_BZIP="yes", |
| 211 | USE_BZIP="no"; AC_MSG_WARN(libbz2 not found.. bzip2 code will will be disabled!)) |
| 212 | fi |
| 213 | |
| 214 | if test "${USE_BZIP}" = "yes"; then |
| 215 | AC_CHECK_LIB(bz2, BZ2_bzopen, USE_BZIP="yes", |
| 216 | USE_BZIP="no"; AC_MSG_WARN(Old bz2 library found.. bzip2 code will be disabled!)) |
| 217 | fi |
| 218 | |
| 219 | if test "${USE_BZIP}" = "yes"; then |
| 220 | AC_CHECK_HEADER(bzlib.h, USE_BZIP="yes", |
| 221 | USE_BZIP="no"; AC_MSG_WARN(bzlib.h not found.. bzip2 code will be disabled!)) |
| 222 | fi |
| 223 | |
| 224 | if test "${USE_BZIP}" = "yes"; then |
| 225 | dnl we have both library and header.. proceed |
| 226 | OPTS="-DUSE_BZIP ${OPTS}" |
| 227 | LIBS="-lbz2 ${LIBS}" |
| 228 | fi |
| 229 | |
| 230 | dnl ------------------------------------------ |
| 231 | dnl GeoIP code specific tests |
| 232 | dnl ------------------------------------------ |
| 233 | |
| 234 | AC_ARG_ENABLE(geoip, |
| 235 | [ --enable-geoip Enable GeoIP geolocation code [[default=no]]], |
| 236 | USE_GEOIP="${enableval}", USE_GEOIP="no") |
| 237 | |
| 238 | AC_ARG_WITH(geoip, |
| 239 | [ --with-geoip=DIR Alternate location for libGeoIP header files], |
| 240 | S_GEOIP="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}") |
| 241 | AC_ARG_WITH(geoiplib, |
| 242 | [ --with-geoiplib=DIR Alternate location for geoip library], |
| 243 | S_GEOIPLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}") |
| 244 | |
| 245 | if test "${USE_GEOIP}" = "yes"; then |
| 246 | AC_CHECK_LIB(GeoIP, main, USE_GEOIP="yes", |
| 247 | USE_GEOIP="no"; AC_MSG_WARN(libGeoIP not found.. GeoIP code will be disabled!)) |
| 248 | fi |
| 249 | |
| 250 | if test "${USE_GEOIP}" = "yes"; then |
| 251 | AC_CHECK_HEADER(GeoIP.h, USE_GEOIP="yes", |
| 252 | USE_GEOIP="no"; AC_MSG_WARN(GeoIP.h not found.. GeoIP code will be disabled!)) |
| 253 | fi |
| 254 | |
| 255 | if test "${USE_GEOIP}" = "yes"; then |
| 256 | dnl we have both library and header.. proceed |
| 257 | OPTS="-DUSE_GEOIP ${OPTS}" |
| 258 | LIBS="-lGeoIP ${LIBS}" |
| 259 | fi |
| 260 | |
| 261 | dnl ------------------------------------------ |
| 262 | dnl check for default GeoDB directory |
| 263 | dnl ------------------------------------------ |
| 264 | |
| 265 | AC_ARG_WITH(geodb, |
| 266 | [ --with-geodb=DIR Default GeoDB data dir [[/usr/share/GeoDB]]], |
| 267 | GEODB_LOC="${withval}", GEODB_LOC="/usr/share/GeoDB") |
| 268 | AC_SUBST(GEODB_LOC) |
| 269 | |
| 270 | dnl ------------------------------------------ |
| 271 | dnl check which hash function to use |
| 272 | dnl ------------------------------------------ |
| 273 | AC_ARG_ENABLE(oldhash, |
| 274 | [ --enable-oldhash Use old hash function (slower) [[default=no]]], |
| 275 | OLDHASH=${enableval}, OLDHASH="no") |
| 276 | if test "$OLDHASH" = "yes"; then OPTS="-DUSE_OLDHASH"; fi |
| 277 | |
| 278 | dnl ------------------------------------------ |
| 279 | dnl check language to use (default is english) |
| 280 | dnl ------------------------------------------ |
| 281 | |
| 282 | LANG_CACHE=yes |
| 283 | AC_ARG_WITH(language, |
| 284 | [ --with-language=name Use language 'name' (default is english)], |
| 285 | WEBALIZER_LANG="${withval}"; LANG_CACHE=no, LANG_CACHE=yes) |
| 286 | if test "$WEBALIZER_LANG" = "no"; then WEBALIZER_LANG=english; fi |
| 287 | |
| 288 | dnl ------------------------------------------ |
| 289 | dnl check if specfied language is valid |
| 290 | dnl ------------------------------------------ |
| 291 | |
| 292 | AC_MSG_CHECKING(for language file) |
| 293 | if test "$LANG_CACHE" = "yes"; then |
| 294 | AC_CACHE_VAL(ac_cv_language, ac_cv_language=$DEFAULT_LANG) |
| 295 | WEBALIZER_LANG=$ac_cv_language |
| 296 | fi |
| 297 | |
| 298 | if test -f lang/webalizer_lang.${WEBALIZER_LANG}; then |
| 299 | AC_MSG_RESULT(yes - ${WEBALIZER_LANG}) |
| 300 | else |
| 301 | if test -f lang/webalizer_lang.${DEFAULT_LANG}; then |
| 302 | AC_MSG_RESULT('${WEBALIZER_LANG}' not found - using ${DEFAULT_LANG}) |
| 303 | WEBALIZER_LANG=${DEFAULT_LANG} |
| 304 | else |
| 305 | AC_MSG_RESULT(no) |
| 306 | AC_MSG_ERROR(language files not found... fix before continuing) |
| 307 | fi |
| 308 | fi |
| 309 | ac_cv_language=${WEBALIZER_LANG} |
| 310 | |
| 311 | dnl ------------------------------------------ |
| 312 | dnl create link to language file |
| 313 | dnl ------------------------------------------ |
| 314 | |
| 315 | AC_LINK_FILES(lang/webalizer_lang.${WEBALIZER_LANG}, webalizer_lang.h) |
| 316 | |
| 317 | dnl ------------------------------------------ |
| 318 | dnl done.. write out our Makefile |
| 319 | dnl ------------------------------------------ |
| 320 | |
| 321 | AC_OUTPUT(Makefile) |
| 322 | AC_MSG_NOTICE(Done. Type 'make' to continue with build.) |