35
35
dnl -Wall and -Werror here are NOT CFLAGS, they refer to automake warnings
36
36
dnl enable stealth builds and psychedelic tests
37
AM_INIT_AUTOMAKE([-Wall -Wportability -Wno-override -Werror std-options foreign dist-bzip2 no-define color-tests parallel-tests tar-ustar])
37
AM_INIT_AUTOMAKE([1.11 -Wall -Wportability -Wno-override std-options foreign dist-bzip2 no-define color-tests parallel-tests tar-ustar])
38
38
AM_SILENT_RULES([yes])
41
40
dnl we told automake to not define these, since we want to include
42
41
dnl the date in the version
43
42
AC_DEFINE([PACKAGE], PACKAGE_NAME, [Name of package])
45
dnl change this on a release
46
dnl VERSION="devel-`date +%Y%m%d`"
52
LIBCLAMAV_VERSION="$LC_CURRENT":"$LC_REVISION":"$LC_AGE"
53
AC_SUBST([LIBCLAMAV_VERSION])
43
AC_USE_SYSTEM_EXTENSIONS
45
m4_include([m4/reorganization/version.m4])
60
47
LT_CONFIG_LTDL_DIR([libltdl])
61
48
LT_INIT([dlopen disable-static])
62
49
LTDL_INIT([recursive])
51
m4_include([m4/reorganization/build_tools.m4])
52
m4_include([m4/reorganization/headers.m4])
63
54
AC_CONFIG_FILES([libltdl/Makefile])
65
major=`expr $LC_CURRENT - $LC_AGE`
66
AC_DEFINE_UNQUOTED([LIBCLAMAV_FULLVER], "$major.$LC_AGE.$LC_REVISION",
67
["Full library version number"])
68
AC_DEFINE_UNQUOTED([LIBCLAMAV_MAJORVER], $major,
69
["Major library version number"])
70
56
AC_DEFINE([SCANBUFF], 131072, [scan buffer size])
71
57
AC_DEFINE([FILEBUFF], 8192, [file i/o buffer size])
84
AC_ARG_ENABLE([gcc-vcheck],
85
[ --disable-gcc-vcheck do not check for buggy gcc version ],
86
gcc_check=$enableval, gcc_check="yes")
88
msg_gcc_check="use --disable-gcc-vcheck to disable this check. Before reporting any bugs check with a supported version of gcc"
90
dnl Check for gcc-4.1.0
91
if test "$gcc_check" = "yes"; then
92
if test "x$ac_compiler_gnu" = "xyes"; then
93
AC_MSG_CHECKING([for a supported version of gcc])
94
gcc_version=`${CC} -dumpversion`
95
case "${gcc_version}" in
97
AC_MSG_RESULT([no (${gcc_version})])
98
AC_MSG_ERROR([gcc 4.1.0 is known to incorrectly compile upx.c. Upgrade your compiler to at least 4.1.1/4.1.2)])
101
AC_MSG_RESULT([ok (${gcc_version})])
104
case "${gcc_version}" in
105
[[56789]].* | 4.[[3456789]].*)
106
# bb #1581 - temporarely add -fno-strict-aliasing so gcc 4.4.0
108
CFLAGS="$CFLAGS -fno-strict-aliasing"
116
VERSION_SUFFIX="$VERSION_SUFFIX-broken-compiler"
119
# add distcheck warning flags
120
distcheck_enable_flags=0
121
if test "x$ac_compiler_gnu" = "xyes"; then
122
gcc_version=`${CC} -dumpversion`
123
case "${gcc_version}" in
125
distcheck_enable_flags=1
128
distcheck_enable_flags=1
133
dnl Checks if compiler produces valid code, regardless of compiler
134
dnl we do these checks here to avoid receiving endless bugreports about
135
dnl breakages due to compiler bugs.
137
dnl Check if compiler produces invalid code on gcc PR27603 (affects upx.c)
138
dnl testcase from gcc testsuite
139
AC_MSG_CHECKING([for gcc bug PR27603])
142
/* (C) Richard Guenther */
149
for (j = 0; j < 6; j++)
151
if ((unsigned)j - 3 <= 1)
157
], [AC_MSG_RESULT([ok, bug not present])],
158
[AC_MSG_ERROR([your compiler has gcc PR27603 bug, use a different compiler, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27603])], [AC_MSG_RESULT([cross-compiling, assumed ok])])
160
dnl Check if compiler produces invalid code on gcc PR26763-2 (affects upx.c)
161
dnl testcase from gcc testsuite
162
AC_MSG_CHECKING([for gcc bug PR26763-2])
165
/* (C) Richard Guenther */
166
extern void abort(void);
168
static int try (char *a, int d)
177
if (try (bla + 50, -1))
182
], [AC_MSG_RESULT([ok, bug not present])],
183
[AC_MSG_ERROR([your compiler has gcc PR26763-2 bug, use a different compiler, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26763])],[AC_MSG_RESULT([cross-compiling, assumed ok])])
185
dnl Check if compiler produces invalid code on own testcase based on upx.c
186
AC_MSG_CHECKING([for valid code generation of CLI_ISCONTAINED])
194
unsigned int backsize;
195
signed int unp_offset;
197
{(char*)0xf78ab008, 0x2e000, 1, 4, -1594},
198
{(char*)0xb7af1008, 0x2e000, 1, 4, -1594}
201
extern void abort(void);
203
#define CLI_ISCONTAINED(bb, bb_size, sb, sb_size) \
204
((bb_size) > 0 && (sb_size) > 0 && (size_t)(sb_size) <= (size_t)(bb_size) \
205
&& (sb) >= (bb) && ((sb) + (sb_size)) <= ((bb) + (bb_size)) && ((sb) + (sb_size)) > (bb) && (sb) < ((bb) + (bb_size)))
209
unsigned int backsize, dcur;
210
int dval=0x12000, unp_offset;
212
char* dst = (char*)0x12000;
216
unp_offset=0x800002c7;
218
if (!CLI_ISCONTAINED(dst, *dsize, dst+dcur+unp_offset, backsize) || !CLI_ISCONTAINED(dst, *dsize, dst+dcur, backsize) || unp_offset >=0)
228
for(i=0;i<sizeof(values)/sizeof(values[0]);i++) {
229
struct v* v= &values[i];
231
unsigned int* dsize = &v->dsize;
232
unsigned int dcur = v->dcur;
233
unsigned int backsize = v->backsize-1;
234
signed int unp_offset = v->unp_offset;
236
if(!CLI_ISCONTAINED(dst, *dsize, dst+dcur+unp_offset, backsize) ||
237
!CLI_ISCONTAINED(dst, *dsize,dst+dcur,backsize) || unp_offset >= 0) {
245
], [AC_MSG_RESULT([ok, bug not present])],
246
[AC_MSG_ERROR([your compiler has a bug that causes clamav bug no. 670, use a different compiler, see http://bugs.clamav.net/bugzilla/show_bug.cgi?id=670])], [AC_MSG_RESULT([cross-compiling, assumed ok])])
248
dnl Check if compiler produces invalid code on gcc PR28045 (affects upx.c)
249
dnl testcase from gcc testsuite
250
AC_MSG_CHECKING([for gcc bug PR28045])
253
/* (C) Andrew Pinski */
254
extern void abort(void);
257
unsigned int bits : 1;
258
signed long val : ((sizeof(long) * 8) - 1);
260
static int Fnegate (struct a b)
262
if ((-((long)b.val)) <= ((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL))
263
&& (-((long)b.val)) >= (-(((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL))) - 1))
273
], [AC_MSG_RESULT([ok, bug not present])],
274
[AC_MSG_ERROR([your compiler has gcc PR28045 bug, use a different compiler, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28045])], [AC_MSG_RESULT([cross-compiling, assumed ok])])
276
dnl Check if compiler produces invalid code on gcc PR37573 (affects autoit.c)
277
dnl this is a bug in gcc 4.4.0, but for some reason it affects gcc 4.1.2 too
278
dnl gcc 4.1.3 is OK. This bug occurs only at -O3.
279
AC_MSG_CHECKING([for gcc bug PR37573])
296
unsigned int *c = s->c;
299
for (i = 0; i < 227; i++)
301
((((c[i] ^ c[i + 1]) & 0x7ffffffe) ^ c[i]) >> 1) ^
302
((0 - (c[i + 1] & 1)) & 0x9908b0df) ^ c[i + 397];
305
((((c[i] ^ c[i + 1]) & 0x7ffffffe) ^ c[i]) >> 1) ^
306
((0 - (c[i + 1] & 1)) & 0x9908b0df) ^ c[i - 227];
308
((((c[623] ^ c[0]) & 0x7ffffffe) ^ c[623]) >> 1) ^ ((0 - (c[0] & 1)) &
315
r ^= ((r & 0xff3a58ad) << 7);
316
r ^= ((r & 0xffffdf8c) << 15);
318
return (unsigned char) (r >> 1);
322
bar (unsigned char *p, unsigned int q, unsigned int r)
326
unsigned int *c = s.c;
328
for (i = 1; i < 624; i++)
329
c[i] = i + 0x6c078965 * ((c[i - 1] >> 30) ^ c[i - 1]);
335
static unsigned char p[23] = {
336
0xc0, 0x49, 0x17, 0x32, 0x62, 0x1e, 0x2e, 0xd5, 0x4c, 0x19, 0x28, 0x49,
337
0x91, 0xe4, 0x72, 0x83, 0x91, 0x3d, 0x93, 0x83, 0xb3, 0x61, 0x38
340
static unsigned char q[23] = {
341
0x3e, 0x41, 0x55, 0x54, 0x4f, 0x49, 0x54, 0x20, 0x55, 0x4e, 0x49, 0x43,
342
0x4f, 0x44, 0x45, 0x20, 0x53, 0x43, 0x52, 0x49, 0x50, 0x54, 0x3c
350
bar (p, s, s + 0xa25e);
351
if (memcmp (p, q, s) != 0)
356
], [AC_MSG_RESULT([ok, bug not present])],
357
[AC_MSG_ERROR([your compiler has gcc PR37573 bug, use a lower optimization level (-O1 or -O2), see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37573])], [AC_MSG_RESULT([cross-compiling, assumed ok])])
359
dnl Linker feature checks
360
dnl check for version script support in the linker (GNU ld, or Solaris ld style)
361
AC_CACHE_CHECK([for ld --version-script], [ac_cv_ld_version_script], [dnl
362
cat > conftest.c <<EOF
363
void cl_symbol1(void) {}
364
void cli_symbol2(void) {}
366
cat > conftest.map <<EOF
382
dnl check for GNU ld style linker version script
383
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $pic_flag $LDFLAGS -shared
384
-o conftest.so conftest.c
385
-Wl,--version-script,conftest.map
386
1>&AS_MESSAGE_LOG_FD]);
388
VERSIONSCRIPTFLAG=--version-script
389
ac_cv_ld_version_script=yes
391
dnl check for Solaris ld style linker version script
392
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $pic_flag $LDFLAGS -shared
393
-o conftest.so conftest.c
395
1>&AS_MESSAGE_LOG_FD]);
398
ac_cv_ld_version_script=yes;
400
ac_cv_ld_version_script=no
404
AC_SUBST([VERSIONSCRIPTFLAG])
405
AM_CONDITIONAL([VERSIONSCRIPT], test "x$ac_cv_ld_version_script" = "xyes")
407
# it is not fatal if gperf is missing
408
AM_MISSING_PROG(GPERF, gperf)
411
AC_CHECK_HEADERS([stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h sys/times.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h limits.h sys/filio.h sys/uio.h termios.h stdbool.h pwd.h grp.h])
412
AC_CHECK_HEADER([syslog.h],AC_DEFINE([USE_SYSLOG],1,[use syslog]),)
415
AC_COMPILE_CHECK_SIZEOF([short])
416
AC_COMPILE_CHECK_SIZEOF([int])
417
AC_COMPILE_CHECK_SIZEOF([long])
418
AC_COMPILE_CHECK_SIZEOF([long long])
419
AC_COMPILE_CHECK_SIZEOF([void *])
59
m4_include([m4/reorganization/c_options.m4])
60
m4_include([m4/reorganization/compiler_checks.m4])
61
m4_include([m4/reorganization/linker_checks.m4])
421
63
AC_ARG_ENABLE([experimental],
422
64
[ --enable-experimental enable experimental code],
430
72
build_configure_args=`echo "$ac_configure_args" | sed -e 's/[\"]//g'`
431
73
AC_SUBST([BUILD_CONFIGURE_FLAGS], [$build_configure_args])
433
AX_CHECK_UNAME_SYSCALL
434
AC_CHECK_LIB([socket], [bind], [LIBS="$LIBS -lsocket"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lsocket"; CLAMD_LIBS="$CLAMD_LIBS -lsocket"])
435
AC_SEARCH_LIBS([gethostent],[nsl], [(LIBS="$LIBS -lnsl"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lnsl"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lnsl"; CLAMD_LIBS="$CLAMD_LIBS -lnsl")])
437
AC_CHECK_FUNCS([poll setsid memcpy snprintf vsnprintf strerror_r strlcpy strlcat strcasestr inet_ntop setgroups initgroups ctime_r mkstemp mallinfo madvise])
440
dnl Check if anon maps are available, check if we can determine the page size
441
AC_C_FUNC_MMAP_PRIVATE
443
AC_C_FUNC_MMAP_ANONYMOUS
444
AC_ARG_ENABLE([mempool],[ --disable-mempool disable memory pools], enable_mempool=$enableval, enable_mempool="yes")
446
if test "$enable_mempool" = "yes"; then
447
if test "$ac_cv_c_mmap_private" != "yes"; then
448
AC_MSG_NOTICE([****** mempool support disabled (mmap not available or not usable)])
450
if test "$ac_cv_c_can_get_pagesize" != "yes"; then
451
AC_MSG_NOTICE([****** mempool support disabled (pagesize cannot be determined)])
453
if test "$ac_cv_c_mmap_anonymous" = "no"; then
454
AC_MSG_NOTICE([****** mempool support disabled (anonymous mmap not available)])
456
AC_DEFINE([USE_MPOOL],1,[enable memory pools])
466
[ --enable-check Enable 'check' unit tests (default=auto)], enable_check_ut=$enableval, enable_check_ut="auto" )
468
if test "$enable_check_ut" = "auto" ; then
469
PKG_CHECK_EXISTS([check], [enable_check_ut="yes"],
470
[enable_check_ut="no"])
473
if test "$enable_check_ut" = "yes" ; then
474
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
476
AM_CONDITIONAL([HAVE_LIBCHECK],test "X$CHECK_LIBS" != "X")
478
AC_ARG_ENABLE(coverage,
479
AC_HELP_STRING([--enable-coverage],
480
[turn on test coverage
481
@<:@default=no@:>@]),
482
[enable_cov=$enableval],[enable_cov="no"])
484
if test "x$enable_coverage" = "xyes"; then
485
if test "x$CHECK_LIBS" = "x"; then
486
AC_MSG_ERROR([Coverage testing required, but unit tests not enabled!])
488
if test "x$ac_compiler_gnu" != "xyes"; then
489
AC_MSG_ERROR([coverage testing only works if gcc is used])
492
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
493
LDFLAGS="$LDFLAGS -lgcov"
494
AC_CHECK_PROGS(GCOV, gcov, false)
495
AC_CHECK_PROGS(LCOV, lcov, false)
496
AC_CHECK_PROGS(GENHTML, genhtml, false)
499
AM_CONDITIONAL(ENABLE_COVERAGE, test "x$enable_coverage" = "xyes")
502
AC_CHECK_HEADER([pthread.h],[have_pthreads=yes],)
75
m4_include([m4/reorganization/code_checks/functions.m4])
76
m4_include([m4/reorganization/code_checks/mpool.m4])
77
m4_include([m4/reorganization/code_checks/unit_tests.m4])
78
m4_include([m4/reorganization/code_checks/coverage.m4])
80
dnl libclamav dependencies
81
m4_include([m4/reorganization/libs/xml.m4])
82
m4_include([m4/reorganization/libs/openssl.m4])
504
84
AM_MAINTAINER_MODE
506
AC_MSG_CHECKING([for zlib installation])
508
[ --with-zlib=DIR path to directory containing zlib library (default=
509
/usr/local or /usr if not found in /usr/local)],
511
if test "$withval"; then
513
AC_MSG_RESULT([using $ZLIB_HOME])
517
if test ! -f "$ZLIB_HOME/include/zlib.h"
521
AC_MSG_RESULT([$ZLIB_HOME])
524
CLAMDSCAN_LIBS="$FRESHCLAM_LIBS"
526
AC_ARG_ENABLE([zlib-vcheck],
527
[ --disable-zlib-vcheck do not check for buggy zlib version ],
528
zlib_check=$enableval, zlib_check="yes")
530
if test ! -f "$ZLIB_HOME/include/zlib.h"
532
AC_MSG_ERROR([Please install zlib and zlib-devel packages])
535
vuln=`grep "ZLIB_VERSION \"1.2.0" $ZLIB_HOME/include/zlib.h`
536
if test -z "$vuln"; then
537
vuln=`grep "ZLIB_VERSION \"1.2.1" $ZLIB_HOME/include/zlib.h`
540
if test -n "$vuln"; then
541
if test "$zlib_check" = "yes"; then
542
AC_MSG_ERROR(The installed zlib version may contain a security bug. Please upgrade to 1.2.2 or later: http://www.zlib.net. You can omit this check with --disable-zlib-vcheck but DO NOT REPORT any stability issues then!)
544
AC_MSG_WARN([****** This ClamAV installation may be linked against])
545
AC_MSG_WARN([****** a broken zlib version. Please DO NOT report any])
546
AC_MSG_WARN([****** stability problems to the ClamAV developers!])
551
if test "$ZLIB_HOME" != "/usr"; then
552
CPPFLAGS="$CPPFLAGS -I$ZLIB_HOME/include"
553
save_LDFLAGS="$LDFLAGS"
554
LDFLAGS="$LDFLAGS -L$ZLIB_HOME/lib"
555
AC_CHECK_LIB([z], [inflateEnd], [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -L$ZLIB_HOME/lib -lz"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -L$ZLIB_HOME/lib -lz"], AC_MSG_ERROR([Please install zlib and zlib-devel packages]))
556
AC_CHECK_LIB([z], [gzopen], [], AC_MSG_ERROR([Your zlib is missing gzopen()]))
557
LDFLAGS="$save_LDFLAGS"
559
AC_CHECK_LIB([z], [inflateEnd], [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lz";FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lz"], AC_MSG_ERROR([Please install zlib and zlib-devel packages]))
560
AC_CHECK_LIB([z], [gzopen],[], AC_MSG_ERROR([Your zlib is missing gzopen()]))
565
AC_ARG_ENABLE([bzip2],
566
[ --disable-bzip2 disable bzip2 support],
567
want_bzip2=$enableval, want_bzip2="yes")
570
if test "$want_bzip2" = "yes"
572
AC_LIB_LINKFLAGS([bz2])
573
save_LDFLAGS="$LDFLAGS"
574
# Only add -L if prefix is not empty
575
test -z "$LIBBZ2_PREFIX" || LDFLAGS="$LDFLAGS -L$LIBBZ2_PREFIX/$acl_libdirstem";
578
AC_CHECK_LIB([bz2], [BZ2_bzDecompressInit], [have_bzprefix="yes"])
579
if test "x$have_bzprefix" = "xno"; then
580
AC_DEFINE([NOBZ2PREFIX],1,[bzip funtions do not have bz2 prefix])
582
LDFLAGS="$save_LDFLAGS"
583
if test "$HAVE_LIBBZ2" = "yes"; then
584
AC_CHECK_HEADER([bzlib.h],
585
[AC_C_CVE_2008_1372],
586
[ac_cv_c_cve_2008_1372="no"])
587
if test "$ac_cv_c_cve_2008_1372" = "bugged"; then
588
AC_MSG_WARN([****** bzip2 libraries are affected by the CVE-2008-1372 bug])
589
AC_MSG_WARN([****** We strongly suggest you to update to bzip2 1.0.5.])
590
AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!])
591
bzip_check="bugged (CVE-2008-1372)"
593
if test "$ac_cv_c_cve_2008_1372" = "linkfailed"; then
594
dnl This shouldn't happen
595
dnl We failed to link but libtool may still be able to link, so don't disable bzip2 just yet
596
AC_MSG_WARN([****** Unable to link bzip2 testcase])
597
AC_MSG_WARN([****** You may be affected by CVE-2008-1372 bug, but I need to be able to link a testcase to verify])
598
AC_MSG_WARN([****** It is recommended to fix your build environment so that we can run the testcase!])
599
AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!])
600
bzip_check="link failed (CVE-2008-1372)"
603
case "$ac_cv_c_cve_2008_1372" in
604
ok|bugged|linkfailed)
612
if test "$HAVE_LIBBZ2" = "yes"; then
614
if test "$ac_cv_c_cve_2010_0405" = "bugged"; then
615
AC_MSG_WARN([****** bzip2 libraries are affected by the CVE-2010-0405 bug])
616
AC_MSG_WARN([****** We strongly suggest you to update bzip2])
617
AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!])
618
bzip_check="bugged (CVE-2010-0405)"
620
if test "$ac_cv_c_cve_2010_0405" = "linkfailed"; then
621
dnl This shouldn't happen
622
dnl We failed to link but libtool may still be able to link, so don't disable bzip2 just yet
623
AC_MSG_WARN([****** Unable to link bzip2 testcase])
624
AC_MSG_WARN([****** You may be affected by CVE-2010-0405 bug, but I need to be able to link a testcase to verify])
625
AC_MSG_WARN([****** It is recommended to fix your build environment so that we can run the testcase!])
626
AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!])
627
bzip_check="link failed (CVE-2010-0405)"
630
case "$ac_cv_c_cve_2010_0405" in
631
ok|bugged|linkfailed)
632
LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS $LTLIBBZ2"
633
AC_DEFINE([HAVE_BZLIB_H],1,[have bzip2])
636
AC_MSG_WARN([****** bzip2 support disabled])
641
AC_MSG_WARN([****** bzip2 support disabled])
645
AM_CONDITIONAL([HAVE_LIBBZ2], test "x$HAVE_LIBBZ2" = "xyes")
647
AC_ARG_ENABLE([unrar],
648
[ --disable-unrar do not build libclamunrar and libclamunrar_iface ],
649
want_unrar=$enableval, want_unrar="yes")
650
AM_CONDITIONAL([ENABLE_UNRAR],[test "$want_unrar" = "yes"])
655
[ --disable-xml disable DMG and XAR support],
656
want_xml=$enableval, want_xml="auto")
659
if test "X$want_xml" != "Xno"; then
660
AC_MSG_CHECKING([for libxml2 installation])
662
[ --with-xml=DIR path to directory containing libxml2 library (default=
663
/usr/local or /usr if not found in /usr/local)],
668
AC_MSG_RESULT([using $XML_HOME])
670
AC_MSG_ERROR([cannot assign blank value to --with-xml])
674
if test ! -x "$XML_HOME/bin/xml2-config"
677
if test ! -x "$XML_HOME/bin/xml2-config"
682
if test "x$XML_HOME" != "x"; then
683
AC_MSG_RESULT([$XML_HOME])
685
AC_MSG_RESULT([not found])
694
if test "x$XML_HOME" != "x"; then
695
AC_MSG_CHECKING([xml2-config version])
696
XMLCONF_VERSION="`$XML_HOME/bin/xml2-config --version`"
697
if test "x%XMLCONF_VERSION" != "x"; then
698
AC_MSG_RESULT([$XMLCONF_VERSION])
700
XML_CPPFLAGS="`$XML_HOME/bin/xml2-config --cflags`"
701
XML_LIBS="`$XML_HOME/bin/xml2-config --libs`"
703
AC_MSG_ERROR([xml2-config failed])
708
if test "X$found_xml" != "Xno"; then
709
AC_MSG_CHECKING([for xmlreader.h in $XML_HOME])
711
if test ! -f "$XML_HOME/include/libxml2/libxml/xmlreader.h"; then
712
AC_MSG_RESULT([not found])
714
AC_MSG_RESULT([found])
716
save_CPPFLAGS="$CPPFLAGS"
717
CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
718
save_LDFLAGS="$LDFLAGS"
719
LDFLAGS="$LDFLAGS $XML_LIBS"
721
AC_CHECK_LIB([xml2], [xmlTextReaderRead], [working_xml="yes"], [working_xml="no"])
723
CPPFLAGS="$save_CPPFLAGS"
724
LDFLAGS="$save_LDFLAGS"
729
if test "$working_xml" = "yes"; then
730
AC_DEFINE([HAVE_LIBXML2],1,[Define to 1 if you have the 'libxml2' library (-lxml2).])
731
AC_SUBST(XML_CPPFLAGS)
733
AC_MSG_NOTICE([Compiling and linking with libxml2 from $XML_HOME])
735
if test "$want_xml" = "yes"; then
736
AC_MSG_ERROR([****** Please install libxml2 packages!])
738
if test "$want_xml" != "no"; then
739
AC_MSG_NOTICE([****** libxml2 support unavailable])
744
AC_SUBST(XML_CPPFLAGS)
748
AC_ARG_ENABLE([getaddrinfo],
749
[ --disable-getaddrinfo disable support for getaddrinfo],
750
want_getaddrinfo=$enableval, want_getaddrinfo="yes")
752
if test "$want_getaddrinfo" = "yes"
754
AC_MSG_CHECKING([for getaddrinfo])
755
AC_CACHE_VAL([have_cv_gai],[
757
#include <sys/types.h>
758
#include <sys/socket.h>
761
int main(int argc, char **argv)
763
struct addrinfo *res;
766
if(getaddrinfo("127.0.0.1", NULL, NULL, &res) < 0)
777
AC_MSG_RESULT([$have_cv_gai])
778
if test "$have_cv_gai" = yes; then
779
AC_DEFINE(HAVE_GETADDRINFO, 1, [have getaddrinfo()])
783
AC_ARG_ENABLE([ipv6],
784
[ --disable-ipv6 disable IPv6 support],
785
want_ipv6=$enableval, want_ipv6="yes")
787
if test "$want_ipv6" = "yes"
789
AC_MSG_CHECKING([for IPv6 support])
790
AC_CACHE_VAL([have_cv_ipv6],[
792
#include <sys/types.h>
793
#include <sys/socket.h>
796
int main(int argc, char **argv)
798
struct addrinfo *res, hints;
801
if((sd = socket(AF_INET6, SOCK_STREAM, 0)) < 0)
804
/* also check if getaddrinfo() handles AF_UNSPEC -- bb#1196 */
805
memset(&hints, 0, sizeof(hints));
806
hints.ai_family = AF_UNSPEC;
807
if(getaddrinfo("127.0.0.1", NULL, &hints, &res) < 0)
817
AC_MSG_RESULT([$have_cv_ipv6])
818
if test "$have_cv_ipv6" = yes; then
819
AC_DEFINE(SUPPORT_IPv6, 1, [Support for IPv6])
825
AC_ARG_ENABLE([fanotify],
826
[ --disable-fanotify disable fanotify support (Linux only)],
827
want_fanotify=$enableval, want_fanotify="yes")
829
dnl AC_FUNC_SETPGRP does not work when cross compiling
830
dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
831
dnl testcase from gdb/configure.ac
832
if test "$cross_compiling" = no; then
835
AC_CACHE_CHECK([whether setpgrp takes no argument], [ac_cv_func_setpgrp_void],
839
if (setpgrp(1,1) == -1)
843
], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
844
if test $ac_cv_func_setpgrp_void = yes; then
845
AC_DEFINE([SETPGRP_VOID], 1)
849
AC_ARG_ENABLE([milter],
850
[ --enable-milter build clamav-milter],
851
have_milter=$enableval, have_milter="no")
853
dnl we need to try to link with iconv, otherwise there could be a
854
dnl mismatch between a 32-bit and 64-bit lib. Detect this at configure time.
855
dnl we need to check after zlib/bzip2, because they can change the include path
856
AC_ARG_WITH([iconv], [ --with-iconv supports iconv() (default=auto)],
859
yes|no) wiconv="$withval";;
860
*) AC_MSG_ERROR([--with-iconv does not take an argument]);;
863
if test "X$wiconv" != "Xno"; then
864
AC_CHECK_LIB([iconv], [libiconv_open], LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -liconv")
865
AC_MSG_CHECKING([for iconv])
867
LIBS="$LIBCLAMAV_LIBS"
874
iconv_t iconv_struct = iconv_open("UTF-16BE","UTF-8");
875
rc = iconv(iconv_struct,xin,&il,xout,&ol);
876
iconv_close(iconv_struct);
879
AC_DEFINE([HAVE_ICONV], 1, [iconv() available])
886
AC_ARG_ENABLE([pthreads],
887
[ --disable-pthreads disable POSIX threads support],
888
have_pthreads=$enableval,)
891
[ --disable-cr do not link with C reentrant library (BSD) ],
894
AC_ARG_ENABLE([id-check],
895
[ --enable-id-check use id utility instead of /etc/passwd parsing],
896
use_id=$enableval, use_id="no")
898
AC_ARG_ENABLE([yp-check],
899
[ --enable-yp-check use ypmatch utility instead of /etc/passwd parsing],
900
use_yp=$enableval, use_yp="no")
903
[ --with-user=uid name of the clamav user (default=clamav)],
904
clamav_user="$withval", clamav_user="clamav")
907
[ --with-group=gid name of the clamav group (default=clamav)],
908
clamav_group="$withval", clamav_group="clamav")
910
AC_DEFINE_UNQUOTED([CLAMAVUSER],"$clamav_user",[name of the clamav user])
911
AC_DEFINE_UNQUOTED([CLAMAVGROUP],"$clamav_group",[name of the clamav group])
913
AC_ARG_ENABLE([clamav],
914
[ --disable-clamav disable test for clamav user/group],
915
test_clamav=$enableval, test_clamav=yes)
917
AC_ARG_ENABLE([debug],
918
[ --enable-debug enable debug code],
919
enable_debug=$enableval, enable_debug="no")
921
if test "$enable_debug" = "yes"; then
922
VERSION_SUFFIX="$VERSION_SUFFIX-debug"
923
AC_DEFINE([CL_DEBUG],1,[enable debugging])
925
AC_DEFINE([NDEBUG],1,[disable assertions])
928
AC_ARG_WITH([version],
929
[ --with-version=STR use custom version string (dev only)],
930
VERSION="$withval", )
932
AC_ARG_ENABLE([no-cache],
933
[ --enable-no-cache use "Cache-Control: no-cache" in freshclam],
934
enable_nocache=$enableval, enable_nocache="no")
936
if test "$enable_nocache" = "yes"; then
937
AC_DEFINE([FRESHCLAM_NO_CACHE],1,[use "Cache-Control: no-cache" in freshclam])
940
AC_ARG_ENABLE([dns-fix],
941
[ --enable-dns-fix enable workaround for broken DNS servers (as in SpeedTouch 510)],
942
enable_dnsfix=$enableval, enable_dnsfix="no")
944
if test "$enable_dnsfix" = "yes"; then
945
AC_DEFINE([FRESHCLAM_DNS_FIX],1,[enable workaround for broken DNS servers])
948
AC_ARG_ENABLE([bigstack],
949
[ --enable-bigstack increase thread stack size],
950
enable_bigstack=$enableval, enable_bigstack="no")
952
if test "$enable_bigstack" = "yes"; then
953
AC_DEFINE([C_BIGSTACK],1,[Increase thread stack size.])
957
[ --with-dbdir=path path to virus database directory],
958
db_dir="$withval", db_dir="_default_")
960
dnl I had problems with $pkgdatadir thus these funny checks
961
if test "$db_dir" = "_default_"
963
if test "$prefix" = "NONE"
965
db_dir="$ac_default_prefix/share/clamav"
967
db_dir="$prefix/share/clamav"
971
AC_DEFINE_UNQUOTED([DATADIR],"$db_dir", [Path to virus database directory.])
975
dnl configure config directory
976
cfg_dir=`echo $sysconfdir | grep prefix`
978
if test -n "$cfg_dir"; then
979
if test "$prefix" = "NONE"
981
cfg_dir="$ac_default_prefix/etc"
983
cfg_dir="$prefix/etc"
986
cfg_dir="$sysconfdir"
991
AC_DEFINE_UNQUOTED([CONFDIR],"$cfg_dir",[where to look for the config file])
993
dnl check for in_port_t definition
994
AC_MSG_CHECKING([whether in_port_t is defined])
996
#include <sys/types.h>
997
#include <netinet/in.h>
999
[in_port_t pt; pt = 0; return pt;],
1002
AC_DEFINE([HAVE_IN_PORT_T],1,[in_port_t is defined])
1006
dnl check for in_addr_t definition
1007
AC_MSG_CHECKING([for in_addr_t definition])
1009
#include <sys/types.h>
1010
#include <netinet/in.h>
1012
[ in_addr_t pt; pt = 0; return pt; ],
1015
AC_DEFINE([HAVE_IN_ADDR_T],1,[in_addr_t is defined])
1019
case "$target_os" in
1021
AC_DEFINE([C_LINUX],1,[target is linux])
1022
if test "$have_pthreads" = "yes"; then
1023
THREAD_LIBS="-lpthread"
1024
TH_SAFE="-thread-safe"
1025
if test "$want_fanotify" = "yes"; then
1026
AC_CHECK_HEADER([linux/fanotify.h],AC_DEFINE([FANOTIFY],1,[use fanotify]),)
1031
AC_DEFINE([C_KFREEBSD_GNU],1,[target is kfreebsd-gnu])
1032
if test "$have_pthreads" = "yes"; then
1033
THREAD_LIBS="-lpthread"
1034
TH_SAFE="-thread-safe"
1038
CLAMDSCAN_LIBS="$CLAMDSCAN_LIBS -lresolv"
1039
FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lresolv"
1040
if test "$have_pthreads" = "yes"; then
1041
THREAD_LIBS="-lpthread"
1042
CLAMD_LIBS="$CLAMD_LIBS -lresolv"
1043
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lresolv"
1044
TH_SAFE="-thread-safe"
1046
AC_DEFINE([C_SOLARIS],1,[os is solaris])
1049
if test "$have_pthreads" = "yes"; then
1050
THREAD_LIBS="-pthread -lc_r"
1051
TH_SAFE="-thread-safe"
1053
AC_DEFINE([C_BSD],1,[os is freebsd 4 or 5])
1056
if test "$have_pthreads" = "yes"; then
1058
TH_SAFE="-thread-safe"
1060
AC_DEFINE([C_BSD],1,[os is freebsd 6])
1063
if test "$have_pthreads" = "yes"; then
1064
THREAD_LIBS="-pthread"
1065
TH_SAFE="-thread-safe"
1067
AC_DEFINE([C_BSD],1,[os is dragonfly])
1070
if test "$have_pthreads" = "yes"; then
1071
THREAD_LIBS="-pthread"
1072
CLAMD_LIBS="$CLAMD_LIBS -pthread"
1073
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread"
1074
TH_SAFE="-thread-safe"
1076
AC_DEFINE([C_BSD],1,[os is OpenBSD])
1079
if test "$have_pthreads" = "yes"; then
1080
THREAD_LIBS="-pthread"
1081
TH_SAFE="-thread-safe"
1083
AC_DEFINE([C_BSD],1,[os is BSDI BSD/OS])
1086
if test "$have_pthreads" = "yes"; then
1087
THREAD_LIBS="-lpthread"
1089
AC_DEFINE([C_BSD],1,[os is NetBSD])
1092
AC_MSG_RESULT([Unknown BSD detected. Disabling thread support.])
1094
AC_DEFINE([C_BSD],1,[os is bsd flavor])
1097
AC_MSG_RESULT([BeOS detected. Disabling thread support.])
1099
AC_DEFINE([C_BEOS],1,[os is beos])
1102
AC_DEFINE([C_INTERIX],1,[os is Interix])
1105
AC_DEFINE([C_BSD],1,[os is bsd flavor])
1106
AC_DEFINE([C_DARWIN],1,[os is darwin])
1107
AC_DEFINE([BIND_8_COMPAT],1,[enable bind8 compatibility])
1108
AC_DEFINE([CLAMAUTH],1,[use ClamAuth])
1112
CLAMDSCAN_LIBS="$CLAMDSCAN_LIBS -lsyslog"
1113
FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lsyslog"
1114
CLAMD_LIBS="$CLAMD_LIBS -lsyslog"
1115
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsyslog"
1116
if test "$have_pthreads" = "yes"; then
1117
THREAD_LIBS="-lpthread"
1118
TH_SAFE="-thread-safe"
1120
AC_DEFINE([C_OS2],1,[os is OS/2])
1123
dnl njh@bandsman.sco.uk: SCO Unix port
1124
dnl FRESHCLAM_LIBS="-lsocket"
1125
dnl CLAMD_LIBS="-lsocket"
1126
dnl CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"
1129
if test "$have_pthreads" = "yes"; then
1130
THREAD_LIBS="-lpthread"
1131
TH_SAFE="-thread-safe"
1133
AC_DEFINE([C_HPUX],1,[os is hpux])
1134
if test "$have_mempool" = "yes"; then
1135
LDFLAGS="$LDFLAGS -Wl,+pd,1M"
1139
if test "$have_pthreads" = "yes"; then
1140
THREAD_LIBS="-lpthread"
1141
TH_SAFE="-thread-safe"
1142
AC_DEFINE([_THREAD_SAFE],1,[thread safe])
1144
AC_DEFINE([C_AIX],1,[os is aix])
1147
if test "$have_pthreads" = "yes"; then
1148
THREAD_LIBS="-pthread"
1149
TH_SAFE="-thread-safe"
1150
AC_DEFINE([_POSIX_PII_SOCKET],1,[POSIX compatibility])
1152
AC_DEFINE([C_OSF],1,[os is osf/tru64])
1155
AC_DEFINE([C_QNX6],1,[os is QNX 6.x.x])
1158
if test "$have_pthreads" = "yes"; then
1159
THREAD_LIBS="-lpthread"
1160
TH_SAFE="-thread-safe"
1163
AC_DEFINE([C_IRIX],1,[os is irix])
1166
AC_DEFINE([C_INTERIX],1,[os is interix])
1167
if test "$test_clamav" = "yes"; then
1168
if test ! -r /etc/passwd; then
1172
if test "$have_pthreads" = "yes"; then
1173
THREAD_LIBS="-lpthread"
1174
TH_SAFE="-thread-safe"
1178
AC_DEFINE([C_GNU_HURD],1,[target is gnu-hurd])
1179
if test "$have_pthreads" = "yes"; then
1180
THREAD_LIBS="-lpthread"
1181
TH_SAFE="-thread-safe"
1188
AC_SUBST([LIBCLAMAV_LIBS])
1189
AC_SUBST([CLAMD_LIBS])
1190
AC_SUBST([CLAMAV_MILTER_LIBS])
1191
AC_SUBST([FRESHCLAM_LIBS])
1192
AC_SUBST([CLAMDSCAN_LIBS])
1194
AC_SUBST([THREAD_LIBS])
1197
if test "$have_milter" = "yes"; then
1198
dnl libmilter checking code adapted from spamass-milter by
1199
dnl Tom G. Christensen <tgc@statsbiblioteket.dk>
1201
dnl Check for libmilter and it's header files in the usual locations
1203
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
1204
if test -d /usr/lib/libmilter ; then
1205
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -L/usr/lib/libmilter"
1207
LIBS="$LIBS -lmilter $CLAMAV_MILTER_LIBS"
1208
AC_CHECK_LIB([milter],[mi_stop],[CLAMAV_MILTER_LIBS="-lmilter $CLAMAV_MILTER_LIBS"],[
1209
dnl Older sendmails require libsm or libsmutil for support functions
1210
AC_SEARCH_LIBS([strlcpy], [sm smutil], [test "$ac_cv_search_strlcpy" = "none required" || CLAMAV_MILTER_XLIB="$ac_cv_search_strlcpy"])
1211
LIBS="$save_LIBS $CLAMAV_MILTER_LIBS $CLAMAV_MILTER_XLIB"
1212
$as_unset ac_cv_lib_milter_mi_stop
1213
AC_CHECK_LIB([milter],[mi_stop],[CLAMAV_MILTER_LIBS="-lmilter $CLAMAV_MILTER_XLIB $CLAMAV_MILTER_LIBS"],[
1214
AC_MSG_ERROR([Cannot find libmilter])
1218
AC_CHECK_HEADERS([libmilter/mfapi.h],[have_milter="yes"],[
1219
AC_MSG_ERROR([Please install mfapi.h from the sendmail distribution])
1223
AM_CONDITIONAL([BUILD_CLAMD],[test "$have_pthreads" = "yes"])
1224
AM_CONDITIONAL([HAVE_MILTER],[test "$have_milter" = "yes"])
1226
if test "$have_pthreads" = "yes"
1229
LIBS="$THREAD_LIBS $LIBS"
1230
AC_CHECK_FUNCS([sched_yield pthread_yield])
1232
AC_DEFINE([BUILD_CLAMD], 1, "build clamd")
1233
dnl define these here, so we don't forget any system
1234
AC_DEFINE([CL_THREAD_SAFE],1,[thread safe])
1235
AC_DEFINE([_REENTRANT],1,[thread safe])
1238
AC_CHECK_FUNCS([enable_extended_FILE_stdio])
1240
dnl Check for readdir_r and number of its arguments
1241
dnl Code from libwww/configure.in
1243
AC_MSG_CHECKING([for readdir_r])
1244
if test -z "$ac_cv_readdir_args"; then
1247
#include <sys/types.h>
1251
struct dirent dir, *dirp;
1253
dirp = readdir_r(mydir, &dir);
1254
], ac_cv_readdir_args=2)
1256
if test -z "$ac_cv_readdir_args"; then
1259
#include <sys/types.h>
1263
struct dirent dir, *dirp;
1266
rc = readdir_r(mydir, &dir, &dirp);
1267
], ac_cv_readdir_args=3)
1270
AC_ARG_ENABLE([readdir_r],
1271
[ --enable-readdir_r enable support for readdir_r],
1272
enable_readdir_r=$enableval, enable_readdir_r="no")
1274
if test "$enable_readdir_r" = "no"; then
1275
AC_MSG_RESULT(support disabled)
1276
elif test -z "$ac_cv_readdir_args"; then
1279
if test "$ac_cv_readdir_args" = 2; then
1280
AC_DEFINE([HAVE_READDIR_R_2],1,[readdir_r takes 2 arguments])
1281
elif test "$ac_cv_readdir_args" = 3; then
1282
AC_DEFINE([HAVE_READDIR_R_3],1,[readdir_r takes 3 arguments])
1284
AC_MSG_RESULT([yes, and it takes $ac_cv_readdir_args arguments])
1287
AC_MSG_CHECKING([for ctime_r])
1288
if test "$ac_cv_func_ctime_r" = "yes"; then
1294
ctime_r(&t, buf, 30);
1297
AC_DEFINE([HAVE_CTIME_R_3],1,[ctime_r takes 3 arguments])
1300
AC_DEFINE([HAVE_CTIME_R_2],1,[ctime_r takes 2 arguments])
1303
AC_MSG_RESULT([yes, and it takes $ac_cv_ctime_args arguments])
1306
dnl Determine socklen_t type. Code from lftp.
1307
AC_MSG_CHECKING([for socklen_t])
1308
AC_CACHE_VAL([ac_cv_socklen_t],
1312
#include <sys/types.h>
1313
#include <sys/socket.h>
1317
getpeername(0,0,&len);
1323
AC_MSG_RESULT([$ac_cv_socklen_t])
1324
if test $ac_cv_socklen_t = no; then
1325
AC_MSG_CHECKING([for socklen_t equivalent])
1326
AC_CACHE_VAL([ac_cv_socklen_t_equiv],
1328
ac_cv_socklen_t_equiv=int
1329
for t in int size_t unsigned long "unsigned long"; do
1331
#include <sys/types.h>
1332
#include <sys/socket.h>
1336
getpeername(0,0,&len);
1339
ac_cv_socklen_t_equiv="$t"
1344
AC_MSG_RESULT([$ac_cv_socklen_t_equiv])
1345
AC_DEFINE_UNQUOTED([socklen_t], $ac_cv_socklen_t_equiv, [Define to "int" if <sys/socket.h> does not define.])
1348
dnl Check for clamav in /etc/passwd
1349
if test "$test_clamav" = "yes"
1351
dnl parse /etc/passwd
1352
if test "$use_id" = "no"
1354
AC_MSG_CHECKING([for $clamav_user in /etc/passwd])
1355
if test -r /etc/passwd; then
1356
clamavuser=`cat /etc/passwd|grep "^$clamav_user:"`
1357
clamavgroup=`cat /etc/group|grep "^$clamav_group:"`
1360
AC_MSG_CHECKING([for $clamav_user using id])
1361
id $clamav_user > /dev/null 2>&1
1362
if test "$?" = 0 ; then
1364
AC_PATH_PROG(GETENT, getent)
1365
if test -n "$GETENT" ; then
1366
clamavgroup=`$GETENT group | grep "^${clamav_group}:"`
1368
clamavgroup=`cat /etc/group|grep $clamav_group`
1373
if test "$use_netinfo" = "yes"
1375
if test -x /usr/bin/dscl; then
1376
AC_MSG_CHECKING([for $clamav_user using dscl])
1377
clamavuser=`/usr/bin/dscl . -list /Users |grep ${clamav_user}`
1378
clamavgroup=`/usr/bin/dscl . -list /Groups |grep ${clamav_group}`
1380
AC_MSG_CHECKING([for $clamav_user using netinfo])
1381
clamavuser=`/usr/bin/nidump passwd . |grep ${clamav_user}`
1382
clamavgroup=`/usr/bin/nidump group . |grep ${clamav_group}`
1386
if test "$use_yp" = "yes"
1388
AC_MSG_CHECKING([for $clamav_user using ypmatch])
1389
clamavuser=`ypmatch ${clamav_user} passwd`
1390
clamavgroup=`ypmatch ${clamav_group} group`
1393
if test -z "$clamavuser" || test -z "$clamavgroup"
1396
AC_MSG_ERROR([User $clamav_user (and/or group $clamav_group) does not exist. Please read the documentation !])
1398
AC_MSG_RESULT([yes, user $clamav_user and group $clamav_group])
1399
CLAMAVUSER="$clamav_user"
1400
CLAMAVGROUP="$clamav_group"
1401
AC_SUBST([CLAMAVUSER])
1402
AC_SUBST([CLAMAVGROUP])
1406
dnl check for __attribute__((packed))
1407
dnl but only on compilers claiming to be gcc compatible
1408
dnl because for example Sun's compiler silently ignores the packed attribute.
1409
AC_MSG_CHECKING([for structure packing via __attribute__((packed))])
1410
AC_CACHE_VAL([have_cv_attrib_packed],[
1413
struct { int i __attribute__((packed)); } s;
1415
#error Only checking for packed attribute on gcc-like compilers
1417
[have_cv_attrib_packed=yes],
1418
[have_cv_attrib_packed=no])
1420
AC_MSG_RESULT([$have_cv_attrib_packed])
1422
if test "$have_cv_attrib_packed" = no; then
1423
AC_MSG_CHECKING([for structure packing via pragma])
1424
AC_CACHE_VAL([have_cv_pragma_pack],[
1426
int main(int argc, char **argv) {
1427
#pragma pack(1) /* has to be in column 1 ! */
1428
struct { char c; long l; } s;
1429
return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; } ],
1430
[have_cv_pragma_pack=yes],
1431
[have_cv_pragma_pack=no])
1433
AC_MSG_RESULT([$have_cv_pragma_pack])
1434
if test "$have_cv_pragma_pack" = yes; then
1435
AC_DEFINE([HAVE_PRAGMA_PACK], 1, "pragma pack")
1437
AC_MSG_CHECKING([for structure packing via hppa/hp-ux pragma])
1438
AC_CACHE_VAL([have_cv_pragma_pack_hpux],[
1440
/* hppa/hp-ux wants pragma outside of function */
1441
#pragma pack 1 /* has to be in column 1 ! */
1442
struct { char c; long l; } s;
1443
int main(int argc, char **argv) {
1444
return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; } ],
1445
[have_cv_pragma_pack_hpux=yes],
1446
[have_cv_pragma_pack_hpux=no])
1448
AC_MSG_RESULT([$have_cv_pragma_pack_hpux])
1449
AC_DEFINE([HAVE_PRAGMA_PACK_HPPA], 1, "pragma pack hppa/hp-ux style")
1453
dnl check for __attribute__((aligned))
1454
AC_MSG_CHECKING([for type aligning via __attribute__((aligned))])
1455
AC_CACHE_VAL([have_cv_attrib_aligned],[
1457
[typedef int cl_aligned_int __attribute__((aligned));],
1458
[have_cv_attrib_aligned=yes],
1459
[have_cv_attrib_aligned=no])
1461
AC_MSG_RESULT([$have_cv_attrib_aligned])
1463
if test "$have_cv_attrib_packed" = no -a "$have_cv_pragma_pack" = no -a "$have_cv_pragma_pack_hpux" = no; then
1464
AC_MSG_ERROR(Need to know how to pack structures with this compiler)
1467
if test "$have_cv_attrib_packed" = yes; then
1468
AC_DEFINE([HAVE_ATTRIB_PACKED], 1, [attrib packed])
1471
if test "$have_cv_attrib_aligned" = yes; then
1472
AC_DEFINE([HAVE_ATTRIB_ALIGNED], 1, [attrib aligned])
1475
dnl Sanity check that struct packing works
1476
AC_MSG_CHECKING([that structure packing works])
1477
AC_CACHE_VAL([have_cv_struct_pack],[
1479
#ifndef HAVE_ATTRIB_PACKED
1480
#define __attribute__(x)
1482
#ifdef HAVE_PRAGMA_PACK
1483
#pragma pack(1) /* has to be in column 1 ! */
1485
#ifdef HAVE_PRAGMA_PACK_HPPA
1486
#pragma pack 1 /* has to be in column 1 ! */
1489
struct { char c __attribute__((packed)); long l __attribute__((packed)); } s;
1491
#ifdef HAVE_PRAGMA_PACK
1494
#ifdef HAVE_PRAGMA_PACK_HPPA
1498
struct { char c; long l;} s2;
1500
#ifdef HAVE_PRAGMA_PACK
1501
#pragma pack(1) /* has to be in column 1 ! */
1503
#ifdef HAVE_PRAGMA_PACK_HPPA
1504
#pragma pack 1 /* has to be in column 1 ! */
1507
struct { char c; long l; } __attribute__((packed)) s3;
1509
#ifdef HAVE_PRAGMA_PACK
1512
#ifdef HAVE_PRAGMA_PACK_HPPA
1516
int main(int argc, char **argv) {
1517
if (sizeof(s)!=sizeof(s.c)+sizeof(s.l))
1519
if (sizeof(s) != sizeof(s3))
1521
return (sizeof(s2) >= sizeof(s)) ? 0 : 3;
1523
[have_cv_struct_pack=yes],
1524
[have_cv_struct_pack=no],
1525
[have_cv_struct_pack=yes])
1527
AC_MSG_RESULT([$have_cv_struct_pack])
1529
if test "$have_cv_struct_pack" = "no"; then
1530
AC_MSG_ERROR([Structure packing seems to be available, but is not working with this compiler])
1533
dnl Check if <sys/select.h> needs to be included for fd_set
1534
AC_MSG_CHECKING([for fd_set])
1535
AC_HEADER_EGREP([fd_mask], [sys/select.h], [have_fd_set=yes])
1536
if test "$have_fd_set" = yes; then
1537
AC_DEFINE([HAVE_SYS_SELECT_H], 1, "have <sys/select.h>")
1538
AC_MSG_RESULT([yes, found in sys/select.h])
1540
AC_TRY_COMPILE([#include <sys/time.h>
1541
#include <sys/types.h>
1542
#ifdef HAVE_UNISTD_H
1545
[fd_set readMask, writeMask;], have_fd_set=yes, have_fd_set=no)
1546
if test "$have_fd_set" = yes; then
1547
AC_MSG_RESULT([yes, found in sys/types.h])
1549
AC_DEFINE([NO_FD_SET], 1, "no fd_set")
1554
AC_MSG_CHECKING([default FD_SETSIZE value])
1558
#include <sys/time.h>
1559
#ifdef HAVE_SYS_SELECT_H
1560
#include <sys/select.h>
1562
#ifdef HAVE_SYS_TYPES_H
1563
#include <sys/types.h>
1567
FILE *fp = fopen("conftestval", "w");
1569
if(fprintf (fp, "%d\n", FD_SETSIZE) < 1) {
1570
perror("fprintf failed");
1574
perror("fopen failed");
1580
DEFAULT_FD_SETSIZE=`cat conftestval`,
1581
DEFAULT_FD_SETSIZE=256,
1582
DEFAULT_FD_SETSIZE=256)
1583
AC_MSG_RESULT([$DEFAULT_FD_SETSIZE])
1584
AC_DEFINE_UNQUOTED([DEFAULT_FD_SETSIZE], $DEFAULT_FD_SETSIZE, "default FD_SETSIZE value")
1586
AC_MSG_CHECKING([stat64])
1588
#define _LARGEFILE_SOURCE
1589
#define _LARGEFILE64_SOURCE
1591
#include <sys/types.h>
1592
#include <sys/stat.h>
1599
if (stat64(".", &sb) == -1)
1605
[enable_stat64=yes],
1610
if test "$enable_stat64" != "no"; then
1611
AC_DEFINE([HAVE_STAT64],1,[enable stat64])
1612
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
1614
AC_MSG_RESULT([$enable_stat64])
1616
dnl Check signed right shift implementation
1617
AC_MSG_CHECKING([whether signed right shift is sign extended])
1618
AC_TRY_RUN([int main(void){int a=-1;int b=a>>1;return(a!=b);}],
1619
[have_signed_rightshift_extended=yes],
1620
[have_signed_rightshift_extended=no],
1621
[have_signed_rightshift_extended=no])
1622
if test $have_signed_rightshift_extended = yes; then
1623
AC_DEFINE([HAVE_SAR], 1, [Define signed right shift implementation])
1625
AC_MSG_RESULT([$have_signed_rightshift_extended]);
1629
AC_DEFINE_UNQUOTED([VERSION],"$VERSION",[Version number of package])
1630
AC_DEFINE_UNQUOTED([VERSION_SUFFIX],"$VERSION_SUFFIX",[Version suffix for package])
1632
AC_ARG_ENABLE(clamdtop,
1633
AC_HELP_STRING([--enable-clamdtop],
1634
[Enable 'clamdtop' tool @<:@default=auto@:>@]),
1635
[enable_clamdtop=$enableval], [enable_clamdtop="auto"])
1637
if test "$enable_clamdtop" != "no"; then
1639
AC_LIB_FIND([ncurses], [ncurses/ncurses.h],
1640
AC_LANG_PROGRAM([#include <ncurses/ncurses.h>],
1641
[initscr(); KEY_RESIZE;]),
1642
[CURSES_CPPFLAGS="$INCNCURSES"; CURSES_LIBS="$LTLIBNCURSES";
1643
CURSES_INCLUDE="<ncurses/ncurses.h>"],
1646
if test "X$HAVE_LIBNCURSES" != "Xyes"; then
1648
AC_LIB_FIND([ncurses], [ncurses.h],
1649
AC_LANG_PROGRAM([#include <ncurses.h>],
1650
[initscr(); KEY_RESIZE;]),
1651
[CURSES_CPPFLAGS="$INCNCURSES"; CURSES_LIBS="$LTLIBNCURSES";
1652
CURSES_INCLUDE="<ncurses.h>"],
1656
if test "X$HAVE_LIBNCURSES" != "Xyes"; then
1657
AC_LIB_FIND([pdcurses],[curses.h],
1658
AC_LANG_PROGRAM([#include <curses.h>],
1659
[initscr(); KEY_RESIZE;]),
1660
[CURSES_CPPFLAGS="$INCPDCURSES";
1661
CURSES_LIBS="$LTLIBPDCURSES";
1662
CURSES_INCLUDE="<curses.h>"],
1663
[AC_MSG_WARN([****** not building clamdtop: ncurses not found])])
1666
if test "x$CURSES_LIBS" = "x" -a "$enable_clamdtop" = "yes"; then
1669
ERROR! Clamdtop was configured, but not found. You need to install libncurses5-dev.
1675
AC_DEFINE_UNQUOTED([CURSES_INCLUDE], $CURSES_INCLUDE, [curses header location])
1676
AC_SUBST([CURSES_CPPFLAGS])
1677
AC_SUBST([CURSES_LIBS])
1678
AM_CONDITIONAL([HAVE_CURSES],
1679
[test "X$HAVE_LIBNCURSES" = "Xyes" || test "X$HAVE_LIBPDCURSES" = "Xyes"])
1681
AC_ARG_ENABLE([distcheck-werror],
1682
AC_HELP_STRING([--enable-distcheck-werror],
1683
[enable warnings as error for distcheck
1684
@<:@default=no@:>@]),
1685
[enable_distcheckwerror=$enableval],[enable_distcheckwerror="no"])
1687
# Enable distcheck warnings and Werror only for gcc versions that support them,
1688
# and only after we've run the configure tests.
1689
# Some configure tests fail (like checking for cos in -lm) if we enable these
1690
# Werror flags for configure too (for example -Wstrict-prototypes makes
1691
# configure think that -lm doesn't have cos, hence its in libc).
1694
if test "x$enable_distcheckwerror" = "xyes"; then
1695
if test "$distcheck_enable_flags" = "1"; then
1696
WERR_COMMON="-Wno-pointer-sign -Werror-implicit-function-declaration -Werror -Wextra -Wall -Wno-error=strict-aliasing -Wno-error=bad-function-cast -Wbad-function-cast -Wcast-align -Wendif-labels -Wfloat-equal -Wformat=2 -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wno-error=missing-prototypes -Wnested-externs -Wno-error=nested-externs -Wpointer-arith -Wstrict-prototypes -Wno-error=strict-prototypes -Wno-switch -Wno-switch-enum -Wundef -Wstrict-overflow=1 -Winit-self -Wmissing-include-dirs -Wdeclaration-after-statement -Waggregate-return -Wmissing-format-attribute -Wno-error=missing-format-attribute -Wno-error=type-limits -Wno-error=unused-but-set-variable -Wno-error=unused-function -Wno-error=unused-value -Wno-error=unused-variable -Wcast-qual -Wno-error=cast-qual -Wno-error=sign-compare -Wshadow -Wno-error=shadow -Wno-error=uninitialized -fdiagnostics-show-option -Wno-unused-parameter -Wno-error=unreachable-code -Winvalid-pch -Wno-error=invalid-pch -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector -Wno-error=aggregate-return"
1697
WERR_CFLAGS="$WERR_COMMON -Wwrite-strings"
1698
WERR_CFLAGS_MILTER="$WERR_COMMON -Wno-error=format-nonliteral"
1701
AC_SUBST([WERR_CFLAGS])
1702
AC_SUBST([WERR_CFLAGS_MILTER])
1704
AC_ARG_ENABLE([llvm],AC_HELP_STRING([--enable-llvm],
1705
[Enable 'llvm' JIT/verifier support @<:@default=auto@:>@]),
1706
[enable_llvm=$enableval], [enable_llvm="auto"])
1708
if test "$enable_llvm" != "no"; then
1709
dnl Try to configure subdir, optionally
1710
AC_CONFIG_SUBDIRS_OPTIONAL([libclamav/c++])
1713
AC_ARG_ENABLE([sha-collector-for-internal-use], [], [enable_sha_collector="yes"], [enable_sha_collector="no"])
1714
if test "$enable_sha_collector" != "no"; then
1715
AC_DEFINE([HAVE__INTERNAL__SHA_COLLECT], 1, [For internal use only - DO NOT DEFINE])
85
m4_include([m4/reorganization/libs/libz.m4])
86
m4_include([m4/reorganization/libs/bzip.m4])
87
m4_include([m4/reorganization/libs/unrar.m4])
88
m4_include([m4/reorganization/code_checks/ipv6.m4])
89
m4_include([m4/reorganization/code_checks/dns.m4])
90
m4_include([m4/reorganization/code_checks/fanotify.m4])
91
m4_include([m4/reorganization/code_checks/setpgrp.m4])
92
m4_include([m4/reorganization/milter/enable.m4])
93
m4_include([m4/reorganization/code_checks/iconv.m4])
94
m4_include([m4/reorganization/code_checks/pthreads.m4])
95
m4_include([m4/reorganization/code_checks/reentrant.m4])
96
m4_include([m4/reorganization/utility_checks/id.m4])
97
m4_include([m4/reorganization/utility_checks/yp.m4])
98
m4_include([m4/reorganization/usergroup.m4])
99
m4_include([m4/reorganization/debug.m4])
100
m4_include([m4/reorganization/customversion.m4])
101
m4_include([m4/reorganization/nocache.m4])
102
m4_include([m4/reorganization/dns.m4])
103
m4_include([m4/reorganization/bigstack.m4])
104
m4_include([m4/reorganization/dbdir.m4])
105
m4_include([m4/reorganization/cfgdir.m4])
106
m4_include([m4/reorganization/code_checks/in_port_t.m4])
107
m4_include([m4/reorganization/code_checks/in_addr_t.m4])
108
m4_include([m4/reorganization/os_checks.m4])
109
m4_include([m4/reorganization/milter/check.m4])
110
m4_include([m4/reorganization/code_checks/pthread_02.m4])
111
m4_include([m4/reorganization/code_checks/readdir.m4])
112
m4_include([m4/reorganization/code_checks/ctime.m4])
113
m4_include([m4/reorganization/code_checks/socklen_t.m4])
114
m4_include([m4/reorganization/clamav_user.m4])
115
m4_include([m4/reorganization/code_checks/compiler_attribs.m4])
116
m4_include([m4/reorganization/code_checks/select.m4])
117
m4_include([m4/reorganization/code_checks/stat64.m4])
118
m4_include([m4/reorganization/code_checks/shift.m4])
119
m4_include([m4/reorganization/code_checks/features.m4])
120
m4_include([m4/reorganization/clamdtop.m4])
121
m4_include([m4/reorganization/distcheck.m4])
122
m4_include([m4/reorganization/llvm.m4])
123
m4_include([m4/reorganization/sha_collect.m4])
125
m4_include([m4/reorganization/bsd.m4])
127
dnl Freshclam dependencies
128
m4_include([m4/reorganization/libs/curl.m4])
130
m4_include([m4/reorganization/substitutions.m4])
132
AM_CONDITIONAL([ENABLE_CLAMSUBMIT], [test "$have_curl" = "yes"])
1719
135
clamscan/Makefile
1720
136
database/Makefile
1723
139
clamdscan/Makefile
1724
141
clamav-milter/Makefile
1725
142
freshclam/Makefile
1726
143
sigtool/Makefile