-
Notifications
You must be signed in to change notification settings - Fork 5
/
configure.in
322 lines (266 loc) · 10.1 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
dnl
dnl The Webalizer - A web server log file analysis program
dnl Copyright (C) 1997-2013 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 <time.h>])
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.)