-
Notifications
You must be signed in to change notification settings - Fork 16
/
configure.ac
528 lines (483 loc) · 14.7 KB
/
configure.ac
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
dnl Process this file with autoconf to produce a configure script.
AC_INIT(c_icap_modules,m4_normalize(m4_include([VERSION.m4])))
#AC_INIT(c_icap_modules, 0.3.2)
AM_MAINTAINER_MODE
AC_CONFIG_HEADERS(autoconf.h)
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
AM_PROG_AR
AC_C_BIGENDIAN
AC_DISABLE_STATIC
LT_INIT(dlopen, win32-dll)
AC_SUBST(LIBTOOL_DEPS)
AC_SUBST(LIBTOOL_DEPS)
case "$host_os" in
cygwin*)
MODS_LDFLAGS="-no-undefined"
iscygwin="yes"
;;
*)
MODS_LDFLAGS=""
;;
esac
AC_SUBST(MODS_LDFLAGS)
CFLAGS="$CFLAGS -Wall"
AC_ARG_ENABLE(virus_scan_profiles,
[ --enable-virus_scan-profiles Enable support for configuration profiles in virus_scan service (experimental)],
[ if test a"$enableval"=a"yes"; then
virus_scan_profiles_support="yes"
AC_DEFINE(USE_VSCAN_PROFILES, 1, [Define USE_VSCAN_PROFILES if configuration profiles for virus_scan service are enabled])
else
virus_scan_profiles_support="no"
fi
],
[ virus_scan_profiles_support="no" ]
)
#check for c-icap
AC_ARG_WITH(c-icap,
[ --with-c-icap Where to find c-icap ],
[
cicapdir="$withval"
if test -f $withval/bin/c-icap-config; then
cicapflags=`$withval/bin/c-icap-config --cflags`
cicaplibs=`$withval/bin/c-icap-config --libs`
cicapetc=`$withval/bin/c-icap-config --configdir`
cicapprefix=`$withval/bin/c-icap-config --prefix`
cicapmods=`$withval/bin/c-icap-config --modulesdir`
cicapdatadir=`$withval/bin/c-icap-config --datarootdir`
cicaplibflags=`$withval/bin/c-icap-libicapapi-config --cflags`
cicapliblibs=`$withval/bin/c-icap-libicapapi-config --libs`
else
cicapflags=`c-icap-config --cflags`
cicaplibs=`c-icap-config --libs`
cicapetc=`c-icap-config --configdir`
cicapprefix=`c-icap-config --prefix`
cicapmods=`c-icap-config --modulesdir`
cicapdatadir=`c-icap-config --datarootdir`
cicaplibflags=`c-icap-libicapapi-config --cflags`
cicapliblibs=`c-icap-libicapapi-config --libs`
fi
],
)
if test -z "$cicapdir"; then
if c-icap-config >& /dev/null; then
cicapflags=`c-icap-config --cflags`
cicaplibs=`c-icap-config --libs`
cicapetc=`c-icap-config --configdir`
cicapprefix=`c-icap-config --prefix`
cicapmods=`c-icap-config --modulesdir`
cicapdatadir=`c-icap-config --datarootdir`
cicaplibflags=`c-icap-libicapapi-config --cflags`
cicapliblibs=`c-icap-libicapapi-config --libs`
else
echo "ERROR: c-icap-config not found!"
exit -1;
fi
fi
AM_CONDITIONAL(CICAPMODULESDIR, [test -n $cicapmods])
CFLAGS="$CFLAGS $cicapflags"
MODULES_LIBADD="$cicaplibs"
UTILITIES_LIBADD="$cicapliblibs"
UTILITIES_CFLAGS="$cicaplibflags"
CONFDIR="$cicapetc"
MODSDIR="$cicapmods"
DATADIR="$cicapdatadir"
AC_SUBST(MODULES_LIBADD)
AC_SUBST(UTILITIES_LIBADD)
AC_SUBST(UTILITIES_CFLAGS)
AC_SUBST(CONFDIR)
AC_SUBST(MODSDIR)
AC_SUBST(DATADIR)
#Check for icapapi functions
OLD_LIBS=$LIBS
LIBS="$LIBS $cicapliblibs"
AC_CHECK_LIB(icapapi, ci_brinflate_to_simple_file, [cicap_brotli='yes';AC_DEFINE(HAVE_CICAP_BROTLI, 1,Define HAVE_CICAP_BROTLI if c-icap supports brotli)], [cicap_brotli='no'])
AC_CHECK_LIB(icapapi, ci_decompress_to_simple_file, [cicap_decompress_to='yes';AC_DEFINE(HAVE_CICAP_DECOMPRESS_TO, 1,Define HAVE_CICAP_DECOMPRESS_TO if c-icap has ci_decompress_to_ family functions)], [cicap_decompress_to='no'])
AC_CHECK_LIB(icapapi, ci_decompress_error, [cicap_decompress_error='yes';AC_DEFINE(HAVE_CICAP_DECOMPRESS_ERROR, 1,Define HAVE_CICAP_DECOMPRESS_ERROR if c-icap has ci_decompress_error function)], [cicap_decompress_error='no'])
LIBS=$OLD_LIBS
# Checks for libraries
AC_ARG_WITH(clamav,
[ --with-clamav Where to find ClamAv ],
[ case "$withval" in
yes)
# AC_MSG_WARN([--with-clamav called without argument])
clamav="yes"
;;
no )
clamav="no"
;;
* )
clamav="yes"
clamavinc=-I"$withval"/include
clamavlib=-L"$withval"/lib
;;
esac
],
)
#check if the clamav is installed
if test a"$clamav" != "ano"; then
AC_MSG_CHECKING([for a working clamav library])
# Save old CFLAGS/LDFLAGS
OLDCFLAGS=$CFLAGS
OLDLIBS=$LIBS
CFLAGS="$clamavinc $CFLAGS"
LIBS="$clamavlib -lclamav $LIBS"
AC_LINK_IFELSE(
[AC_LANG_SOURCE(
[
#include <clamav.h>
int main(){
char *s = cl_retver();
return 0;
}
])
],
[clamav="yes"; AC_MSG_RESULT(yes)],
[clamav="no"; AC_MSG_RESULT(no)]
)
CFLAGS=$OLDCFLAGS
LIBS=$OLDLIBS
else
AC_MSG_NOTICE([clamav is disabled])
fi
if test a"$clamav" = "ayes"; then
AC_DEFINE(HAVE_CLAMAV, 1, [Define HAVE_CLAMAV if clamav is installed])
AC_SUBST(clamavinc)
AC_SUBST(clamavlib)
OLD_CFLAGS=$CFLAGS
CFLAGS=$clamavinc
AC_MSG_CHECKING([for clamav 0.90.x or newer])
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[
#include <clamav.h>
int main(int argc, char *argv[])
{
struct cl_engine node; node.refcount=1;
}
])],
[
AC_DEFINE(HAVE_LIBCLAMAV_09X,1,[Define HAVE_LIBCLAMAV_09X if have clamav 0.90.x or newer])
AC_MSG_RESULT(yes)
],
AC_MSG_RESULT(no),
)
AC_MSG_CHECKING([for maxratio field in cl_limits struct])
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[
#include <clamav.h>
int main(int argc, cgar *argv[])
{
struct cl_limits limits;
limits.maxratio=200;
}
])],
[
AC_DEFINE(HAVE_LIBCLAMAV_LIMITS_MAXRATIO,1,[Define HAVE_LIBCLAMAV_LIMITS_MAXRATIO if has cl_limits.maxratio])
AC_MSG_RESULT(yes)
],
AC_MSG_RESULT(no),
)
#
# clamav drop the cl_limits struct at version 0.95. I think it is
# a good check for clamav lib version.
AC_MSG_CHECKING([for clamav 0.95 or newer])
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[
#include <clamav.h>
int main(int argc, char *argv[])
{
struct cl_limits limits;
}
])],
AC_MSG_RESULT(no),
[
AC_DEFINE(HAVE_LIBCLAMAV_095,1,[Define HAVE_LIBCLAMAV_095 if have clamav 0.95.x or newer])
AC_MSG_RESULT(yes)
]
)
#
# clamav dropped CL_SCAN_HEURISTIC_ENCRYPTED in 0.101 replacing it with
# CL_SCAN_HEURISTIC_ENCRYPTED_ARCHIVE and CL_SCAN_HEURISTIC_ENCRYPTED_DOC
# restore flags / clamav tests
AC_MSG_CHECKING([for HAVE_CL_SCAN_OPTIONS in clamav.h])
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[
#include <clamav.h>
int main(int argc, char *argv[])
{
struct cl_scan_options CLAMSCAN_OPTIONS = { 0, 0, 0, 0, 0 };
}
])],
[
AC_DEFINE(HAVE_CL_SCAN_OPTIONS,1,[Define HAVE_CL_SCAN_OPTIONS if have clamav 0.101.x or newer])
AC_MSG_RESULT(yes)
],
AC_MSG_RESULT(no),
)
CFLAGS=$OLD_CFLAGS
fi # if test a"$clamav" = "ayes";
###############
# Detect Berkeley DB library
libdb="yes"
libdbpath=""
AC_ARG_WITH(bdb,
[ --with-bdb Where to find Berkeley DB library ],
[ case "$withval" in
yes)
libdb="yes"
;;
no )
libdb="no"
;;
* )
libdb="yes"
libdbpath=$withval
;;
esac
],
)
if test a"$libdb" != "ano"; then
# Save old CFLAGS/LDFLAGS
OLDCFLAGS=$CFLAGS
OLDLDFLAGS=$LDFLAGS
OLDLIBS=$LIBS
if test "a$libdbpath" != "a"; then
CFLAGS="-I$libdbpath/include $CFLAGS"
LDFLAGS="-L$libdbpath/lib $LDFLAGS"
fi
# We are going to see if we can found a Berkeley DB located under a
# libdbpath/include/db4x directory and use lbdbpath/lib/libdb-4.x library.
for DBVER in "" 6 6.3 6.2 6.1 6.0 5 5.4 5.3 5.2 5.1 5.0 4 4.9 4.8 4.7 4.6 4.5 4.4 4.3 4.2; do
if test -z $DBVER; then
usedblib="-ldb"
incdbdir=""
else
usedblib="-ldb-$DBVER"
incdbdir=db`echo $DBVER|sed 's/\.//'`"/"
fi
if test -z "$libdbpath"; then
print_libdbpath="..."
else
print_libdbpath="under $libdbpath..."
fi
echo -n "checking for BerleleyDB v$DBVER $print_libdbpath"
LIBS="$usedblib $OLD_LIBS"
AC_LINK_IFELSE(
[AC_LANG_SOURCE(
[
#include <${incdbdir}db.h>
int main(){
int major,minor,patch;
if (!db_version(&major,&minor,&patch))
return -1;
return 0;
}
])
],
[echo yes;libdb="yes";],
[echo "no";libdb="no";]
)
if test a"$libdb" = "ayes"; then
BDB_ADD_LDADD=""
BDB_ADD_FLAG=""
if test "a$libdbpath" != "a"; then
BDB_ADD_LDADD="-L$libdbpath/lib "
BDB_ADD_FLAG="-I$libdbpath/include"
fi
BDB_ADD_LDADD="$BDB_ADD_LDADD$usedblib"
AC_SUBST(BDB_ADD_LDADD)
AC_SUBST(BDB_ADD_FLAG)
AC_DEFINE(HAVE_BDB, 1, [Define HAVE_BDB if berkeley DB is installed])
AC_DEFINE_UNQUOTED(BDB_HEADER_PATH(incfile), [<${incdbdir}incfile>], [Set DB_HEADER_PATH macro to compute berkeley DB header subpath])
break;
fi
done
CFLAGS=$OLDCFLAGS
LDFLAGS=$OLDLDFLAGS
LIBS=$OLDLIBS
fi
if test a"$libdb" = "ayes"; then
AC_DEFINE(HAVE_BDB, 1, [Define HAVE_BDB if berkeley DB is installed])
fi
# Detect LMDB library
liblmdb="yes"
liblmdbpath=""
AC_ARG_WITH(lmdb,
[ --with-lmdb Where to find LMDB library ],
[ case "$withval" in
yes)
liblmdb="yes"
;;
no )
liblmdb="no"
;;
* )
liblmdb="yes"
liblmdbpath=$withval
;;
esac
],
)
if test a"$liblmdb" != "ano"; then
# Save old CFLAGS/LDFLAGS
OLDCFLAGS=$CFLAGS
OLDLDFLAGS=$LDFLAGS
OLDLIBS=$LIBS
if test "a$liblmdbpath" != "a"; then
CFLAGS="-I$liblmdbpath/include $CFLAGS"
LDFLAGS="-L$liblmdbpath/lib $LDFLAGS"
fi
AC_CHECK_LIB(lmdb, mdb_version, [liblmdb="yes"], [liblmdb="no"])
CFLAGS=$OLDCFLAGS
LDFLAGS=$OLDLDFLAGS
LIBS=$OLDLIBS
fi
if test a"$liblmdb" = "ayes"; then
AC_DEFINE(HAVE_LMDB, 1, [Define HAVE_LMDB if the LMDB library is installed])
if test "a$liblmdbpath" != "a"; then
LMDB_ADD_LDADD="-L$liblmdbpath/lib -llmdb"
LMDB_ADD_FLAG="-I$liblmdbpath/include"
else
LMDB_ADD_LDADD="-llmdb"
fi
AC_SUBST(LMDB_ADD_LDADD)
AC_SUBST(LMDB_ADD_FLAG)
fi
# Detect tokyocabinet library
libtokyocabinet="yes"
libtokyocabinetpath=""
AC_ARG_WITH(tokyocabinet,
[ --with-tokyocabinet Where to find tokyocabinet library ],
[ case "$withval" in
yes)
libtokyocabinet="yes"
;;
no )
libtokyocabinet="no"
;;
* )
libtokyocabinet="yes"
libtokyocabinetpath=$withval
;;
esac
],
)
if test a"$libtokyocabinet" != "ano"; then
# Save old CFLAGS/LDFLAGS
OLDCFLAGS=$CFLAGS
OLDLDFLAGS=$LDFLAGS
OLDLIBS=$LIBS
if test "a$libtokyocabinetpath" != "a"; then
CFLAGS="-I$libtokyocabinetpath/include $CFLAGS"
LDFLAGS="-L$libtokyocabinetpath/lib $LDFLAGS"
fi
AC_CHECK_LIB(tokyocabinet, tcbdbopen, [libtokyocabinet="yes"], [libtokyocabinet="no"])
CFLAGS=$OLDCFLAGS
LDFLAGS=$OLDLDFLAGS
LIBS=$OLDLIBS
if test a"$libtokyocabinet" = "ayes"; then
AC_DEFINE(HAVE_TOKYOCABINET, 1, [Define HAVE_TOKYOCABINET if the tokyocabinet library is installed])
if test "a$libtokyocabinetpath" != "a"; then
TOKYOCABINET_ADD_LDADD="-L$libtokyocabinetpath/lib -ltokyocabinet"
TOKYOCABINET_ADD_FLAG="-I$libtokyocabinetpath/include"
else
TOKYOCABINET_ADD_LDADD="-ltokyocabinet"
fi
AC_SUBST(TOKYOCABINET_ADD_LDADD)
AC_SUBST(TOKYOCABINET_ADD_FLAG)
fi
fi
# hiredis library
hiredis="yes"
hiredispath=""
AC_ARG_WITH(hiredis,
[ --with-hiredis Where to find hiredis library ],
[ case "$withval" in
yes)
hiredis="yes"
;;
no)
hiredis="no"
;;
*)
hiredis="yes"
hiredispath = $withval
;;
esac
],
)
if test "a$hiredis" = "ayes"; then
OLDCFLAGS=$CFLAGS
OLDLDFLAGS=$LDFLAGS
OLDLIBS=$LIBS
if test "a$hiredispath" != "a"; then
CFLAGS="-I$hiredispath/include $CFLAGS"
LDFLAGS="-L$lhiredispath/lib $LDFLAGS"
fi
AC_CHECK_LIB(hiredis, redisConnect, [hiredis="yes"], [hiredis="no"])
CFLAGS=$OLDCFLAGS
LDFLAGS=$OLDLDFLAGS
LIBS=$OLDLIBS
fi
if test "a$hiredis" = "ayes"; then
AC_DEFINE(USE_HIREDIS, 1, [Define USE_HIREDIS to include support for HIREDIS])
if test "a$hiredispath" = "a"; then
HIREDIS_CXXFLAGS=""
HIREDIS_LIBADD=" -lhiredis"
else
HIREDIS_CXXFLAGS=-I"$hiredispath"/include
HIREDIS_LIBADD="-L$hiredispath/lib -Wl,-rpath -Wl,$hiredispath/lib -lhiredis"
fi
AC_SUBST(HIREDIS_CXXFLAGS)
AC_SUBST(HIREDIS_LIBADD)
fi
AC_MSG_CHECKING([if fds can send through unix sockets])
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/un.h>
int main(int argc, char **argv) {
struct msghdr mh;
struct cmsghdr cmh;
mh.msg_control = NULL;
mh.msg_controllen = 0;
cmh.cmsg_level = SOL_SOCKET;
cmh.cmsg_type = SCM_RIGHTS;
}
])],
[
AC_DEFINE(HAVE_FD_PASSING,1,[Define HAVE_FD_PASSING if sending fd through unix socket supported])
AC_MSG_RESULT(yes)
],
AC_MSG_RESULT(no),
)
# Check for header files
AC_CHECK_HEADERS(ctype.h)
AC_CHECK_FUNCS(strcasestr,
AC_DEFINE(HAVE_STRCASESTR,1,[Define HAVE_STRCASESTR if strcasestr exists])
)
# Now determine which modules will going to build .....
AM_CONDITIONAL(USECXX_CODE, [test a"$CXX" != a])
AM_CONDITIONAL(USECLAMAV,[test a"$clamav" != ano])
AM_CONDITIONAL(USEBDB, [test a"$libdb" != ano])
AM_CONDITIONAL(USELMDB, [test a"$liblmdb" != ano])
AM_CONDITIONAL(USEHIREDIS, [test a"$hiredis" != ano])
AM_CONDITIONAL(USETOKYOCABINET, [test a"$libtokyocabinet" != ano])
AM_CONDITIONAL(USE_VSCAN_PROFILES,[test a"$virus_scan_profiles_support" != a"no"])
AC_CONFIG_FILES([Makefile services/Makefile services/virus_scan/Makefile services/url_check/Makefile services/content_filtering/Makefile modules/Makefile doc/Makefile doc/man/Makefile])
AC_OUTPUT
if test a"$virus_scan_profiles_support" != a"no"; then
echo -e "\n"\
"******************************************************************\n"\
"* WARNING! Using profiles in virus_scan service may open serious\n"\
"* security hole in your http cache systems.\n"\
"* Do not enable/use profiles in virus_scan service unless you are\n"\
"* sure what you are doing, and read the related documentation.\n"\
"*******************************************************************\n"
fi