2 dnl The Webalizer - A web server log file analysis program
3 dnl Copyright (C) 1997-2011 by Bradford L. Barrett
5 dnl configure.in template for The Webalizer Version 2.23
6 dnl Process this file with autoconf to produce a configure script.
9 AC_INIT(webalizer,V2.23)
16 dnl ------------------------------------------
17 dnl default language (don't change!)
18 dnl ------------------------------------------
20 DEFAULT_LANG="english"
21 AC_SUBST(DEFAULT_LANG)
23 dnl ------------------------------------------
24 dnl Checks for required programs.
25 dnl ------------------------------------------
32 dnl ------------------------------------------
33 dnl check for platform specific settings
34 dnl ------------------------------------------
38 AC_CHECK_TYPE(u_int64_t, unsigned long long)
39 AC_CHECK_DECL(altzone,OPTS="-DHAVE_ALTZONE ${OPTS}",,[#include <time.h>])
41 dnl ------------------------------------------
42 dnl force our own CFLAGS defaults if GCC
43 dnl ------------------------------------------
45 if test "$GCC" = "yes"; then
48 [ --enable-static Build as static executable [[default=no]]],
49 LDFLAGS="--static ${LDFLAGS}")
51 if test "$IN_CFLAGS" = ""; then
54 if test "$ac_cv_c_char_unsigned" = "yes"; then
55 CFLAGS="-fsigned-char ${CFLAGS}"
59 [ --enable-debug Compile with debugging code [[default=no]]],
60 CFLAGS="-g ${CFLAGS}")
63 if test "$IN_CFLAGS" = ""; then
68 dnl ------------------------------------------
69 dnl check command line arguments
70 dnl ------------------------------------------
73 [ --with-gd=DIR Alternate location for gd header files],
74 S_GD="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}")
76 [ --with-gdlib=DIR Alternate location for gd library],
77 S_GDLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}")
79 [ --with-png=DIR Alternate location for png header files],
80 S_PNG="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}")
82 [ --with-pnglib=DIR Alternate location for png library],
83 S_PNGLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}")
85 [ --with-z=DIR Alternate location for libz header files],
86 S_Z="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}")
88 [ --with-zlib=DIR Alternate location for z library],
89 S_ZLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}")
91 [ --with-db=DIR Alternate location for libdb header files],
92 S_DB="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}")
94 [ --with-dblib=DIR Alternate location for db library],
95 S_DBLIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}")
97 dnl ------------------------------------------
98 dnl these are needed on some platforms
99 dnl ------------------------------------------
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)
108 dnl ------------------------------------------
109 dnl ensure current libz is present - required!
110 dnl ------------------------------------------
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!)
119 AC_MSG_ERROR(z library not found.. please install libz)
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)
127 dnl ------------------------------------------
128 dnl ensure libpng is present - required!
129 dnl ------------------------------------------
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)
136 dnl ------------------------------------------
137 dnl ensure libgd is present - required!
138 dnl ------------------------------------------
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!)
147 AC_MSG_ERROR(gd library not found.. please install libgd)
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)
155 dnl ------------------------------------------
156 dnl DNS/GeoDB lookup specific tests
157 dnl ------------------------------------------
160 [ --enable-dns Enable DNS/GeoDB lookup code [[default=yes]]],
161 USE_DNS="${enableval}", USE_DNS="yes")
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!))
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!))
173 if test "${USE_DNS}" = "yes"; then
174 dnl we have both library and header.. proceed
175 OPTS="-DUSE_DNS ${OPTS}"
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}")
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}")
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}")
194 dnl ------------------------------------------
195 dnl BZip2 code specific tests
196 dnl ------------------------------------------
199 [ --enable-bz2 Enable BZip2 decompression code [[default=no]]],
200 USE_BZIP="${enableval}", USE_BZIP="no")
203 [ --with-bz2=DIR Alternate location for bz2 header files],
204 S_BZ2="${withval}"; CPPFLAGS="${CPPFLAGS} -I${withval}")
206 [ --with-bz2lib=DIR Alternate location for bz2 library],
207 S_BZ2LIB="${withval}"; LDFLAGS="-L${withval} ${LDFLAGS}")
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!))
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!))
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!))
224 if test "${USE_BZIP}" = "yes"; then
225 dnl we have both library and header.. proceed
226 OPTS="-DUSE_BZIP ${OPTS}"
230 dnl ------------------------------------------
231 dnl GeoIP code specific tests
232 dnl ------------------------------------------
235 [ --enable-geoip Enable GeoIP geolocation code [[default=no]]],
236 USE_GEOIP="${enableval}", USE_GEOIP="no")
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}")
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!))
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!))
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}"
261 dnl ------------------------------------------
262 dnl check for default GeoDB directory
263 dnl ------------------------------------------
266 [ --with-geodb=DIR Default GeoDB data dir [[/usr/share/GeoDB]]],
267 GEODB_LOC="${withval}", GEODB_LOC="/usr/share/GeoDB")
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
278 dnl ------------------------------------------
279 dnl check language to use (default is english)
280 dnl ------------------------------------------
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
288 dnl ------------------------------------------
289 dnl check if specfied language is valid
290 dnl ------------------------------------------
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
298 if test -f lang/webalizer_lang.${WEBALIZER_LANG}; then
299 AC_MSG_RESULT(yes - ${WEBALIZER_LANG})
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}
306 AC_MSG_ERROR(language files not found... fix before continuing)
309 ac_cv_language=${WEBALIZER_LANG}
311 dnl ------------------------------------------
312 dnl create link to language file
313 dnl ------------------------------------------
315 AC_LINK_FILES(lang/webalizer_lang.${WEBALIZER_LANG}, webalizer_lang.h)
317 dnl ------------------------------------------
318 dnl done.. write out our Makefile
319 dnl ------------------------------------------
322 AC_MSG_NOTICE(Done. Type 'make' to continue with build.)