1
dnl Copyright (C) 2002 - 2006 Tomasz Kojm <tkojm@clamav.net>
2
dnl readdir_r checks (c) COPYRIGHT MIT 1995
3
dnl socklen_t check (c) Alexander V. Lukyanov <lav@yars.free.net>
5
dnl This program is free software; you can redistribute it and/or modify
6
dnl it under the terms of the GNU General Public License as published by
7
dnl the Free Software Foundation; either version 2 of the License, or
8
dnl (at your option) any later version.
10
dnl This program is distributed in the hope that it will be useful,
11
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
dnl GNU General Public License for more details.
15
dnl You should have received a copy of the GNU General Public License
16
dnl along with this program; if not, write to the Free Software
17
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
dnl MA 02110-1301, USA.
21
dnl For a release change [devel] to the real version [0.xy]
22
dnl also change VERSION below
23
AC_INIT([ClamAV], [0.98.1], [http://bugs.clamav.net/], [clamav], [http://www.clamav.net/])
25
AH_BOTTOM([#include "platform.h"])
26
dnl put configure auxiliary into config
27
AC_CONFIG_AUX_DIR([config])
28
AC_CONFIG_HEADER([clamav-config.h])
30
dnl safety check, this used to be a parameter to AC_INIT
31
AC_CONFIG_SRCDIR([clamscan/clamscan.c])
32
AC_CONFIG_MACRO_DIR([m4])
33
AC_CREATE_TARGET_H([target.h])
35
dnl -Wall and -Werror here are NOT CFLAGS, they refer to automake warnings
36
dnl enable stealth builds and psychedelic tests
37
AM_INIT_AUTOMAKE([1.11 -Wall -Wportability -Wno-override -Werror std-options foreign dist-bzip2 no-define color-tests parallel-tests tar-ustar])
38
AM_SILENT_RULES([yes])
40
dnl we told automake to not define these, since we want to include
41
dnl the date in the version
42
AC_DEFINE([PACKAGE], PACKAGE_NAME, [Name of package])
44
dnl change this on a release
45
dnl VERSION="devel-`date +%Y%m%d`"
51
LIBCLAMAV_VERSION="$LC_CURRENT":"$LC_REVISION":"$LC_AGE"
52
AC_SUBST([LIBCLAMAV_VERSION])
59
LT_CONFIG_LTDL_DIR([libltdl])
60
LT_INIT([dlopen disable-static])
61
LTDL_INIT([recursive])
62
AC_CONFIG_FILES([libltdl/Makefile])
64
major=`expr $LC_CURRENT - $LC_AGE`
65
AC_DEFINE_UNQUOTED([LIBCLAMAV_FULLVER], "$major.$LC_AGE.$LC_REVISION",
66
["Full library version number"])
67
AC_DEFINE_UNQUOTED([LIBCLAMAV_MAJORVER], $major,
68
["Major library version number"])
69
AC_DEFINE([SCANBUFF], 131072, [scan buffer size])
70
AC_DEFINE([FILEBUFF], 8192, [file i/o buffer size])
83
AC_ARG_ENABLE([gcc-vcheck],
84
[ --disable-gcc-vcheck do not check for buggy gcc version ],
85
gcc_check=$enableval, gcc_check="yes")
87
msg_gcc_check="use --disable-gcc-vcheck to disable this check. Before reporting any bugs check with a supported version of gcc"
89
dnl Check for gcc-4.1.0
90
if test "$gcc_check" = "yes"; then
91
if test "x$ac_compiler_gnu" = "xyes"; then
92
AC_MSG_CHECKING([for a supported version of gcc])
93
gcc_version=`${CC} -dumpversion`
94
case "${gcc_version}" in
96
AC_MSG_RESULT([no (${gcc_version})])
97
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)])
100
AC_MSG_RESULT([ok (${gcc_version})])
103
case "${gcc_version}" in
104
[[56789]].* | 4.[[3456789]].*)
105
# bb #1581 - temporarely add -fno-strict-aliasing so gcc 4.4.0
107
CFLAGS="$CFLAGS -fno-strict-aliasing"
115
VERSION_SUFFIX="$VERSION_SUFFIX-broken-compiler"
118
# add distcheck warning flags
119
distcheck_enable_flags=0
120
if test "x$ac_compiler_gnu" = "xyes"; then
121
gcc_version=`${CC} -dumpversion`
122
case "${gcc_version}" in
124
distcheck_enable_flags=1
127
distcheck_enable_flags=1
132
dnl Checks if compiler produces valid code, regardless of compiler
133
dnl we do these checks here to avoid receiving endless bugreports about
134
dnl breakages due to compiler bugs.
136
dnl Check if compiler produces invalid code on gcc PR27603 (affects upx.c)
137
dnl testcase from gcc testsuite
138
AC_MSG_CHECKING([for gcc bug PR27603])
141
/* (C) Richard Guenther */
148
for (j = 0; j < 6; j++)
150
if ((unsigned)j - 3 <= 1)
156
], [AC_MSG_RESULT([ok, bug not present])],
157
[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])])
159
dnl Check if compiler produces invalid code on gcc PR26763-2 (affects upx.c)
160
dnl testcase from gcc testsuite
161
AC_MSG_CHECKING([for gcc bug PR26763-2])
164
/* (C) Richard Guenther */
165
extern void abort(void);
167
static int try (char *a, int d)
176
if (try (bla + 50, -1))
181
], [AC_MSG_RESULT([ok, bug not present])],
182
[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])])
184
dnl Check if compiler produces invalid code on own testcase based on upx.c
185
AC_MSG_CHECKING([for valid code generation of CLI_ISCONTAINED])
193
unsigned int backsize;
194
signed int unp_offset;
196
{(char*)0xf78ab008, 0x2e000, 1, 4, -1594},
197
{(char*)0xb7af1008, 0x2e000, 1, 4, -1594}
200
extern void abort(void);
202
#define CLI_ISCONTAINED(bb, bb_size, sb, sb_size) \
203
((bb_size) > 0 && (sb_size) > 0 && (size_t)(sb_size) <= (size_t)(bb_size) \
204
&& (sb) >= (bb) && ((sb) + (sb_size)) <= ((bb) + (bb_size)) && ((sb) + (sb_size)) > (bb) && (sb) < ((bb) + (bb_size)))
208
unsigned int backsize, dcur;
209
int dval=0x12000, unp_offset;
211
char* dst = (char*)0x12000;
215
unp_offset=0x800002c7;
217
if (!CLI_ISCONTAINED(dst, *dsize, dst+dcur+unp_offset, backsize) || !CLI_ISCONTAINED(dst, *dsize, dst+dcur, backsize) || unp_offset >=0)
227
for(i=0;i<sizeof(values)/sizeof(values[0]);i++) {
228
struct v* v= &values[i];
230
unsigned int* dsize = &v->dsize;
231
unsigned int dcur = v->dcur;
232
unsigned int backsize = v->backsize-1;
233
signed int unp_offset = v->unp_offset;
235
if(!CLI_ISCONTAINED(dst, *dsize, dst+dcur+unp_offset, backsize) ||
236
!CLI_ISCONTAINED(dst, *dsize,dst+dcur,backsize) || unp_offset >= 0) {
244
], [AC_MSG_RESULT([ok, bug not present])],
245
[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])])
247
dnl Check if compiler produces invalid code on gcc PR28045 (affects upx.c)
248
dnl testcase from gcc testsuite
249
AC_MSG_CHECKING([for gcc bug PR28045])
252
/* (C) Andrew Pinski */
253
extern void abort(void);
256
unsigned int bits : 1;
257
signed long val : ((sizeof(long) * 8) - 1);
259
static int Fnegate (struct a b)
261
if ((-((long)b.val)) <= ((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL))
262
&& (-((long)b.val)) >= (-(((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL))) - 1))
272
], [AC_MSG_RESULT([ok, bug not present])],
273
[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])])
275
dnl Check if compiler produces invalid code on gcc PR37573 (affects autoit.c)
276
dnl this is a bug in gcc 4.4.0, but for some reason it affects gcc 4.1.2 too
277
dnl gcc 4.1.3 is OK. This bug occurs only at -O3.
278
AC_MSG_CHECKING([for gcc bug PR37573])
295
unsigned int *c = s->c;
298
for (i = 0; i < 227; i++)
300
((((c[i] ^ c[i + 1]) & 0x7ffffffe) ^ c[i]) >> 1) ^
301
((0 - (c[i + 1] & 1)) & 0x9908b0df) ^ c[i + 397];
304
((((c[i] ^ c[i + 1]) & 0x7ffffffe) ^ c[i]) >> 1) ^
305
((0 - (c[i + 1] & 1)) & 0x9908b0df) ^ c[i - 227];
307
((((c[623] ^ c[0]) & 0x7ffffffe) ^ c[623]) >> 1) ^ ((0 - (c[0] & 1)) &
314
r ^= ((r & 0xff3a58ad) << 7);
315
r ^= ((r & 0xffffdf8c) << 15);
317
return (unsigned char) (r >> 1);
321
bar (unsigned char *p, unsigned int q, unsigned int r)
325
unsigned int *c = s.c;
327
for (i = 1; i < 624; i++)
328
c[i] = i + 0x6c078965 * ((c[i - 1] >> 30) ^ c[i - 1]);
334
static unsigned char p[23] = {
335
0xc0, 0x49, 0x17, 0x32, 0x62, 0x1e, 0x2e, 0xd5, 0x4c, 0x19, 0x28, 0x49,
336
0x91, 0xe4, 0x72, 0x83, 0x91, 0x3d, 0x93, 0x83, 0xb3, 0x61, 0x38
339
static unsigned char q[23] = {
340
0x3e, 0x41, 0x55, 0x54, 0x4f, 0x49, 0x54, 0x20, 0x55, 0x4e, 0x49, 0x43,
341
0x4f, 0x44, 0x45, 0x20, 0x53, 0x43, 0x52, 0x49, 0x50, 0x54, 0x3c
349
bar (p, s, s + 0xa25e);
350
if (memcmp (p, q, s) != 0)
355
], [AC_MSG_RESULT([ok, bug not present])],
356
[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])])
358
dnl Linker feature checks
359
dnl check for version script support in the linker (GNU ld, or Solaris ld style)
360
AC_CACHE_CHECK([for ld --version-script], [ac_cv_ld_version_script], [dnl
361
cat > conftest.c <<EOF
362
void cl_symbol1(void) {}
363
void cli_symbol2(void) {}
365
cat > conftest.map <<EOF
381
dnl check for GNU ld style linker version script
382
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $pic_flag $LDFLAGS -shared
383
-o conftest.so conftest.c
384
-Wl,--version-script,conftest.map
385
1>&AS_MESSAGE_LOG_FD]);
387
VERSIONSCRIPTFLAG=--version-script
388
ac_cv_ld_version_script=yes
390
dnl check for Solaris ld style linker version script
391
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $pic_flag $LDFLAGS -shared
392
-o conftest.so conftest.c
394
1>&AS_MESSAGE_LOG_FD]);
397
ac_cv_ld_version_script=yes;
399
ac_cv_ld_version_script=no
403
AC_SUBST([VERSIONSCRIPTFLAG])
404
AM_CONDITIONAL([VERSIONSCRIPT], test "x$ac_cv_ld_version_script" = "xyes")
406
# it is not fatal if gperf is missing
407
AM_MISSING_PROG(GPERF, gperf)
410
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])
411
AC_CHECK_HEADER([syslog.h],AC_DEFINE([USE_SYSLOG],1,[use syslog]),)
414
AC_COMPILE_CHECK_SIZEOF([short])
415
AC_COMPILE_CHECK_SIZEOF([int])
416
AC_COMPILE_CHECK_SIZEOF([long])
417
AC_COMPILE_CHECK_SIZEOF([long long])
418
AC_COMPILE_CHECK_SIZEOF([void *])
420
AC_ARG_ENABLE([experimental],
421
[ --enable-experimental enable experimental code],
422
enable_experimental=$enableval, enable_experimental="no")
424
if test "$enable_experimental" = "yes"; then
425
AC_DEFINE([CL_EXPERIMENTAL],1,[enable experimental code])
426
VERSION_SUFFIX="$VERSION_SUFFIX-exp"
429
build_configure_args=`echo "$ac_configure_args" | sed -e 's/[\"]//g'`
430
AC_SUBST([BUILD_CONFIGURE_FLAGS], [$build_configure_args])
432
AX_CHECK_UNAME_SYSCALL
433
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"])
434
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")])
436
AC_CHECK_FUNCS([poll setsid memcpy snprintf vsnprintf strerror_r strlcpy strlcat strcasestr inet_ntop setgroups initgroups ctime_r mkstemp mallinfo madvise])
439
dnl Check if anon maps are available, check if we can determine the page size
440
AC_C_FUNC_MMAP_PRIVATE
442
AC_C_FUNC_MMAP_ANONYMOUS
443
AC_ARG_ENABLE([mempool],[ --disable-mempool disable memory pools], enable_mempool=$enableval, enable_mempool="yes")
445
if test "$enable_mempool" = "yes"; then
446
if test "$ac_cv_c_mmap_private" != "yes"; then
447
AC_MSG_NOTICE([****** mempool support disabled (mmap not available or not usable)])
449
if test "$ac_cv_c_can_get_pagesize" != "yes"; then
450
AC_MSG_NOTICE([****** mempool support disabled (pagesize cannot be determined)])
452
if test "$ac_cv_c_mmap_anonymous" = "no"; then
453
AC_MSG_NOTICE([****** mempool support disabled (anonymous mmap not available)])
455
AC_DEFINE([USE_MPOOL],1,[enable memory pools])
465
[ --enable-check Enable 'check' unit tests (default=auto)], enable_check_ut=$enableval, enable_check_ut="auto" )
467
if test "$enable_check_ut" != "no" ; then
468
AC_LIB_FIND([check],[check.h],
469
AC_LANG_PROGRAM([#include <check.h>],[srunner_create(0)]),
470
[CHECK_CPPFLAGS="$INCCHECK"; CHECK_LIBS="$LTLIBCHECK"],
473
AC_SUBST([CHECK_CPPFLAGS])
474
AC_SUBST([CHECK_LIBS])
475
AM_CONDITIONAL([HAVE_LIBCHECK],test "X$HAVE_LIBCHECK" = "Xyes")
477
if test "x$CHECK_LIBS" = "x" -a "$enable_check_ut" = "yes"; then
480
ERROR! Check was configured, but not found. Get it from http://check.sf.net/
484
AC_ARG_ENABLE(coverage,
485
AC_HELP_STRING([--enable-coverage],
486
[turn on test coverage
487
@<:@default=no@:>@]),
488
[enable_cov=$enableval],[enable_cov="no"])
490
if test "x$enable_coverage" = "xyes"; then
491
if test "x$CHECK_LIBS" = "x"; then
492
AC_MSG_ERROR([Coverage testing required, but unit tests not enabled!])
494
if test "x$ac_compiler_gnu" != "xyes"; then
495
AC_MSG_ERROR([coverage testing only works if gcc is used])
498
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
499
LDFLAGS="$LDFLAGS -lgcov"
500
AC_CHECK_PROGS(GCOV, gcov, false)
501
AC_CHECK_PROGS(LCOV, lcov, false)
502
AC_CHECK_PROGS(GENHTML, genhtml, false)
505
AM_CONDITIONAL(ENABLE_COVERAGE, test "x$enable_coverage" = "xyes")
508
AC_CHECK_HEADER([pthread.h],[have_pthreads=yes],)
512
AC_MSG_CHECKING([for zlib installation])
514
[ --with-zlib=DIR path to directory containing zlib library (default=
515
/usr/local or /usr if not found in /usr/local)],
517
if test "$withval"; then
519
AC_MSG_RESULT([using $ZLIB_HOME])
523
if test ! -f "$ZLIB_HOME/include/zlib.h"
527
AC_MSG_RESULT([$ZLIB_HOME])
530
CLAMDSCAN_LIBS="$FRESHCLAM_LIBS"
532
AC_ARG_ENABLE([zlib-vcheck],
533
[ --disable-zlib-vcheck do not check for buggy zlib version ],
534
zlib_check=$enableval, zlib_check="yes")
536
if test ! -f "$ZLIB_HOME/include/zlib.h"
538
AC_MSG_ERROR([Please install zlib and zlib-devel packages])
541
vuln=`grep "ZLIB_VERSION \"1.2.0" $ZLIB_HOME/include/zlib.h`
542
if test -z "$vuln"; then
543
vuln=`grep "ZLIB_VERSION \"1.2.1" $ZLIB_HOME/include/zlib.h`
546
if test -n "$vuln"; then
547
if test "$zlib_check" = "yes"; then
548
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!)
550
AC_MSG_WARN([****** This ClamAV installation may be linked against])
551
AC_MSG_WARN([****** a broken zlib version. Please DO NOT report any])
552
AC_MSG_WARN([****** stability problems to the ClamAV developers!])
557
if test "$ZLIB_HOME" != "/usr"; then
558
CPPFLAGS="$CPPFLAGS -I$ZLIB_HOME/include"
559
save_LDFLAGS="$LDFLAGS"
560
LDFLAGS="$LDFLAGS -L$ZLIB_HOME/lib"
561
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]))
562
AC_CHECK_LIB([z], [gzopen], [], AC_MSG_ERROR([Your zlib is missing gzopen()]))
563
LDFLAGS="$save_LDFLAGS"
565
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]))
566
AC_CHECK_LIB([z], [gzopen],[], AC_MSG_ERROR([Your zlib is missing gzopen()]))
571
AC_ARG_ENABLE([bzip2],
572
[ --disable-bzip2 disable bzip2 support],
573
want_bzip2=$enableval, want_bzip2="yes")
576
if test "$want_bzip2" = "yes"
578
AC_LIB_LINKFLAGS([bz2])
579
save_LDFLAGS="$LDFLAGS"
580
# Only add -L if prefix is not empty
581
test -z "$LIBBZ2_PREFIX" || LDFLAGS="$LDFLAGS -L$LIBBZ2_PREFIX/$acl_libdirstem";
584
AC_CHECK_LIB([bz2], [BZ2_bzDecompressInit], [have_bzprefix="yes"])
585
if test "x$have_bzprefix" = "xno"; then
586
AC_DEFINE([NOBZ2PREFIX],1,[bzip funtions do not have bz2 prefix])
588
LDFLAGS="$save_LDFLAGS"
589
if test "$HAVE_LIBBZ2" = "yes"; then
590
AC_CHECK_HEADER([bzlib.h],
591
[AC_C_CVE_2008_1372],
592
[ac_cv_c_cve_2008_1372="no"])
593
if test "$ac_cv_c_cve_2008_1372" = "bugged"; then
594
AC_MSG_WARN([****** bzip2 libraries are affected by the CVE-2008-1372 bug])
595
AC_MSG_WARN([****** We strongly suggest you to update to bzip2 1.0.5.])
596
AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!])
597
bzip_check="bugged (CVE-2008-1372)"
599
if test "$ac_cv_c_cve_2008_1372" = "linkfailed"; then
600
dnl This shouldn't happen
601
dnl We failed to link but libtool may still be able to link, so don't disable bzip2 just yet
602
AC_MSG_WARN([****** Unable to link bzip2 testcase])
603
AC_MSG_WARN([****** You may be affected by CVE-2008-1372 bug, but I need to be able to link a testcase to verify])
604
AC_MSG_WARN([****** It is recommended to fix your build environment so that we can run the testcase!])
605
AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!])
606
bzip_check="link failed (CVE-2008-1372)"
609
case "$ac_cv_c_cve_2008_1372" in
610
ok|bugged|linkfailed)
618
if test "$HAVE_LIBBZ2" = "yes"; then
620
if test "$ac_cv_c_cve_2010_0405" = "bugged"; then
621
AC_MSG_WARN([****** bzip2 libraries are affected by the CVE-2010-0405 bug])
622
AC_MSG_WARN([****** We strongly suggest you to update bzip2])
623
AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!])
624
bzip_check="bugged (CVE-2010-0405)"
626
if test "$ac_cv_c_cve_2010_0405" = "linkfailed"; then
627
dnl This shouldn't happen
628
dnl We failed to link but libtool may still be able to link, so don't disable bzip2 just yet
629
AC_MSG_WARN([****** Unable to link bzip2 testcase])
630
AC_MSG_WARN([****** You may be affected by CVE-2010-0405 bug, but I need to be able to link a testcase to verify])
631
AC_MSG_WARN([****** It is recommended to fix your build environment so that we can run the testcase!])
632
AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!])
633
bzip_check="link failed (CVE-2010-0405)"
636
case "$ac_cv_c_cve_2010_0405" in
637
ok|bugged|linkfailed)
638
LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS $LTLIBBZ2"
639
AC_DEFINE([HAVE_BZLIB_H],1,[have bzip2])
642
AC_MSG_WARN([****** bzip2 support disabled])
647
AC_MSG_WARN([****** bzip2 support disabled])
651
AM_CONDITIONAL([HAVE_LIBBZ2], test "x$HAVE_LIBBZ2" = "xyes")
653
AC_ARG_ENABLE([unrar],
654
[ --disable-unrar do not build libclamunrar and libclamunrar_iface ],
655
want_unrar=$enableval, want_unrar="yes")
656
AM_CONDITIONAL([ENABLE_UNRAR],[test "$want_unrar" = "yes"])
661
[ --disable-xml disable DMG and XAR support],
662
want_xml=$enableval, want_xml="auto")
665
if test "X$want_xml" != "Xno"; then
666
AC_MSG_CHECKING([for libxml2 installation])
668
[ --with-xml=DIR path to directory containing libxml2 library (default=
669
/usr/local or /usr if not found in /usr/local)],
674
AC_MSG_RESULT([using $XML_HOME])
676
AC_MSG_ERROR([cannot assign blank value to --with-xml])
680
if test ! -x "$XML_HOME/bin/xml2-config"
683
if test ! -x "$XML_HOME/bin/xml2-config"
688
if test "x$XML_HOME" != "x"; then
689
AC_MSG_RESULT([$XML_HOME])
691
AC_MSG_RESULT([not found])
700
if test "x$XML_HOME" != "x"; then
701
AC_MSG_CHECKING([xml2-config version])
702
XMLCONF_VERSION="`$XML_HOME/bin/xml2-config --version`"
703
if test "x%XMLCONF_VERSION" != "x"; then
704
AC_MSG_RESULT([$XMLCONF_VERSION])
706
XML_CPPFLAGS="`$XML_HOME/bin/xml2-config --cflags`"
707
XML_LIBS="`$XML_HOME/bin/xml2-config --libs`"
709
AC_MSG_ERROR([xml2-config failed])
714
if test "X$found_xml" != "Xno"; then
715
AC_MSG_CHECKING([for xmlreader.h in $XML_HOME])
717
if test ! -f "$XML_HOME/include/libxml2/libxml/xmlreader.h"; then
718
AC_MSG_RESULT([not found])
720
AC_MSG_RESULT([found])
722
save_CPPFLAGS="$CPPFLAGS"
723
CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
724
save_LDFLAGS="$LDFLAGS"
725
LDFLAGS="$LDFLAGS $XML_LIBS"
727
AC_CHECK_LIB([xml2], [xmlTextReaderRead], [working_xml="yes"], [working_xml="no"])
729
CPPFLAGS="$save_CPPFLAGS"
730
LDFLAGS="$save_LDFLAGS"
735
if test "$working_xml" = "yes"; then
736
AC_DEFINE([HAVE_LIBXML2],1,[Define to 1 if you have the 'libxml2' library (-lxml2).])
737
AC_SUBST(XML_CPPFLAGS)
739
AC_MSG_NOTICE([Compiling and linking with libxml2 from $XML_HOME])
741
if test "$want_xml" = "yes"; then
742
AC_MSG_ERROR([****** Please install libxml2 packages!])
744
if test "$want_xml" != "no"; then
745
AC_MSG_NOTICE([****** libxml2 support unavailable])
750
AC_SUBST(XML_CPPFLAGS)
754
AC_ARG_ENABLE([getaddrinfo],
755
[ --disable-getaddrinfo disable support for getaddrinfo],
756
want_getaddrinfo=$enableval, want_getaddrinfo="yes")
758
if test "$want_getaddrinfo" = "yes"
760
AC_MSG_CHECKING([for getaddrinfo])
761
AC_CACHE_VAL([have_cv_gai],[
763
#include <sys/types.h>
764
#include <sys/socket.h>
767
int main(int argc, char **argv)
769
struct addrinfo *res;
772
if(getaddrinfo("127.0.0.1", NULL, NULL, &res) < 0)
783
AC_MSG_RESULT([$have_cv_gai])
784
if test "$have_cv_gai" = yes; then
785
AC_DEFINE(HAVE_GETADDRINFO, 1, [have getaddrinfo()])
789
AC_ARG_ENABLE([ipv6],
790
[ --disable-ipv6 disable IPv6 support],
791
want_ipv6=$enableval, want_ipv6="yes")
793
if test "$want_ipv6" = "yes"
795
AC_MSG_CHECKING([for IPv6 support])
796
AC_CACHE_VAL([have_cv_ipv6],[
798
#include <sys/types.h>
799
#include <sys/socket.h>
802
int main(int argc, char **argv)
804
struct addrinfo *res, hints;
807
if((sd = socket(AF_INET6, SOCK_STREAM, 0)) < 0)
810
/* also check if getaddrinfo() handles AF_UNSPEC -- bb#1196 */
811
memset(&hints, 0, sizeof(hints));
812
hints.ai_family = AF_UNSPEC;
813
if(getaddrinfo("127.0.0.1", NULL, &hints, &res) < 0)
823
AC_MSG_RESULT([$have_cv_ipv6])
824
if test "$have_cv_ipv6" = yes; then
825
AC_DEFINE(SUPPORT_IPv6, 1, [Support for IPv6])
831
AC_ARG_ENABLE([fanotify],
832
[ --disable-fanotify disable fanotify support (Linux only)],
833
want_fanotify=$enableval, want_fanotify="yes")
835
dnl AC_FUNC_SETPGRP does not work when cross compiling
836
dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
837
dnl testcase from gdb/configure.ac
838
if test "$cross_compiling" = no; then
841
AC_CACHE_CHECK([whether setpgrp takes no argument], [ac_cv_func_setpgrp_void],
845
if (setpgrp(1,1) == -1)
849
], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
850
if test $ac_cv_func_setpgrp_void = yes; then
851
AC_DEFINE([SETPGRP_VOID], 1)
855
AC_ARG_ENABLE([milter],
856
[ --enable-milter build clamav-milter],
857
have_milter=$enableval, have_milter="no")
859
dnl we need to try to link with iconv, otherwise there could be a
860
dnl mismatch between a 32-bit and 64-bit lib. Detect this at configure time.
861
dnl we need to check after zlib/bzip2, because they can change the include path
862
AC_ARG_WITH([iconv], [ --with-iconv supports iconv() (default=auto)],
865
yes|no) wiconv="$withval";;
866
*) AC_MSG_ERROR([--with-iconv does not take an argument]);;
869
if test "X$wiconv" != "Xno"; then
870
AC_CHECK_LIB([iconv], [libiconv_open], LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -liconv")
871
AC_MSG_CHECKING([for iconv])
873
LIBS="$LIBCLAMAV_LIBS"
880
iconv_t iconv_struct = iconv_open("UTF-16BE","UTF-8");
881
rc = iconv(iconv_struct,xin,&il,xout,&ol);
882
iconv_close(iconv_struct);
885
AC_DEFINE([HAVE_ICONV], 1, [iconv() available])
892
AC_ARG_ENABLE([pthreads],
893
[ --disable-pthreads disable POSIX threads support],
894
have_pthreads=$enableval,)
897
[ --disable-cr do not link with C reentrant library (BSD) ],
900
AC_ARG_ENABLE([id-check],
901
[ --enable-id-check use id utility instead of /etc/passwd parsing],
902
use_id=$enableval, use_id="no")
904
AC_ARG_ENABLE([yp-check],
905
[ --enable-yp-check use ypmatch utility instead of /etc/passwd parsing],
906
use_yp=$enableval, use_yp="no")
909
[ --with-user=uid name of the clamav user (default=clamav)],
910
clamav_user="$withval", clamav_user="clamav")
913
[ --with-group=gid name of the clamav group (default=clamav)],
914
clamav_group="$withval", clamav_group="clamav")
916
AC_DEFINE_UNQUOTED([CLAMAVUSER],"$clamav_user",[name of the clamav user])
917
AC_DEFINE_UNQUOTED([CLAMAVGROUP],"$clamav_group",[name of the clamav group])
919
AC_ARG_ENABLE([clamav],
920
[ --disable-clamav disable test for clamav user/group],
921
test_clamav=$enableval, test_clamav=yes)
923
AC_ARG_ENABLE([debug],
924
[ --enable-debug enable debug code],
925
enable_debug=$enableval, enable_debug="no")
927
if test "$enable_debug" = "yes"; then
928
VERSION_SUFFIX="$VERSION_SUFFIX-debug"
929
AC_DEFINE([CL_DEBUG],1,[enable debugging])
931
AC_DEFINE([NDEBUG],1,[disable assertions])
934
AC_ARG_WITH([version],
935
[ --with-version=STR use custom version string (dev only)],
936
VERSION="$withval", )
938
AC_ARG_ENABLE([no-cache],
939
[ --enable-no-cache use "Cache-Control: no-cache" in freshclam],
940
enable_nocache=$enableval, enable_nocache="no")
942
if test "$enable_nocache" = "yes"; then
943
AC_DEFINE([FRESHCLAM_NO_CACHE],1,[use "Cache-Control: no-cache" in freshclam])
946
AC_ARG_ENABLE([dns-fix],
947
[ --enable-dns-fix enable workaround for broken DNS servers (as in SpeedTouch 510)],
948
enable_dnsfix=$enableval, enable_dnsfix="no")
950
if test "$enable_dnsfix" = "yes"; then
951
AC_DEFINE([FRESHCLAM_DNS_FIX],1,[enable workaround for broken DNS servers])
954
AC_ARG_ENABLE([bigstack],
955
[ --enable-bigstack increase thread stack size],
956
enable_bigstack=$enableval, enable_bigstack="no")
958
if test "$enable_bigstack" = "yes"; then
959
AC_DEFINE([C_BIGSTACK],1,[Increase thread stack size.])
963
[ --with-dbdir=path path to virus database directory],
964
db_dir="$withval", db_dir="_default_")
966
dnl I had problems with $pkgdatadir thus these funny checks
967
if test "$db_dir" = "_default_"
969
if test "$prefix" = "NONE"
971
db_dir="$ac_default_prefix/share/clamav"
973
db_dir="$prefix/share/clamav"
977
AC_DEFINE_UNQUOTED([DATADIR],"$db_dir", [Path to virus database directory.])
981
dnl configure config directory
982
cfg_dir=`echo $sysconfdir | grep prefix`
984
if test -n "$cfg_dir"; then
985
if test "$prefix" = "NONE"
987
cfg_dir="$ac_default_prefix/etc"
989
cfg_dir="$prefix/etc"
992
cfg_dir="$sysconfdir"
997
AC_DEFINE_UNQUOTED([CONFDIR],"$cfg_dir",[where to look for the config file])
999
dnl check for in_port_t definition
1000
AC_MSG_CHECKING([whether in_port_t is defined])
1002
#include <sys/types.h>
1003
#include <netinet/in.h>
1005
[in_port_t pt; pt = 0; return pt;],
1008
AC_DEFINE([HAVE_IN_PORT_T],1,[in_port_t is defined])
1012
dnl check for in_addr_t definition
1013
AC_MSG_CHECKING([for in_addr_t definition])
1015
#include <sys/types.h>
1016
#include <netinet/in.h>
1018
[ in_addr_t pt; pt = 0; return pt; ],
1021
AC_DEFINE([HAVE_IN_ADDR_T],1,[in_addr_t is defined])
1025
case "$target_os" in
1027
AC_DEFINE([C_LINUX],1,[target is linux])
1028
if test "$have_pthreads" = "yes"; then
1029
THREAD_LIBS="-lpthread"
1030
TH_SAFE="-thread-safe"
1031
if test "$want_fanotify" = "yes"; then
1032
AC_CHECK_HEADER([linux/fanotify.h],AC_DEFINE([FANOTIFY],1,[use fanotify]),)
1037
AC_DEFINE([C_KFREEBSD_GNU],1,[target is kfreebsd-gnu])
1038
if test "$have_pthreads" = "yes"; then
1039
THREAD_LIBS="-lpthread"
1040
TH_SAFE="-thread-safe"
1044
CLAMDSCAN_LIBS="$CLAMDSCAN_LIBS -lresolv"
1045
FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lresolv"
1046
if test "$have_pthreads" = "yes"; then
1047
THREAD_LIBS="-lpthread"
1048
CLAMD_LIBS="$CLAMD_LIBS -lresolv"
1049
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lresolv"
1050
TH_SAFE="-thread-safe"
1052
AC_DEFINE([C_SOLARIS],1,[os is solaris])
1055
if test "$have_pthreads" = "yes"; then
1056
THREAD_LIBS="-pthread -lc_r"
1057
TH_SAFE="-thread-safe"
1059
AC_DEFINE([C_BSD],1,[os is freebsd 4 or 5])
1062
if test "$have_pthreads" = "yes"; then
1064
TH_SAFE="-thread-safe"
1066
AC_DEFINE([C_BSD],1,[os is freebsd 6])
1069
if test "$have_pthreads" = "yes"; then
1070
THREAD_LIBS="-pthread"
1071
TH_SAFE="-thread-safe"
1073
AC_DEFINE([C_BSD],1,[os is dragonfly])
1076
if test "$have_pthreads" = "yes"; then
1077
THREAD_LIBS="-pthread"
1078
CLAMD_LIBS="$CLAMD_LIBS -pthread"
1079
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread"
1080
TH_SAFE="-thread-safe"
1082
AC_DEFINE([C_BSD],1,[os is OpenBSD])
1085
if test "$have_pthreads" = "yes"; then
1086
THREAD_LIBS="-pthread"
1087
TH_SAFE="-thread-safe"
1089
AC_DEFINE([C_BSD],1,[os is BSDI BSD/OS])
1092
if test "$have_pthreads" = "yes"; then
1093
THREAD_LIBS="-lpthread"
1095
AC_DEFINE([C_BSD],1,[os is NetBSD])
1098
AC_MSG_RESULT([Unknown BSD detected. Disabling thread support.])
1100
AC_DEFINE([C_BSD],1,[os is bsd flavor])
1103
AC_MSG_RESULT([BeOS detected. Disabling thread support.])
1105
AC_DEFINE([C_BEOS],1,[os is beos])
1108
AC_DEFINE([C_INTERIX],1,[os is Interix])
1111
AC_DEFINE([C_BSD],1,[os is bsd flavor])
1112
AC_DEFINE([C_DARWIN],1,[os is darwin])
1113
AC_DEFINE([BIND_8_COMPAT],1,[enable bind8 compatibility])
1114
AC_DEFINE([CLAMAUTH],1,[use ClamAuth])
1118
CLAMDSCAN_LIBS="$CLAMDSCAN_LIBS -lsyslog"
1119
FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lsyslog"
1120
CLAMD_LIBS="$CLAMD_LIBS -lsyslog"
1121
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsyslog"
1122
if test "$have_pthreads" = "yes"; then
1123
THREAD_LIBS="-lpthread"
1124
TH_SAFE="-thread-safe"
1126
AC_DEFINE([C_OS2],1,[os is OS/2])
1129
dnl njh@bandsman.sco.uk: SCO Unix port
1130
dnl FRESHCLAM_LIBS="-lsocket"
1131
dnl CLAMD_LIBS="-lsocket"
1132
dnl CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"
1135
if test "$have_pthreads" = "yes"; then
1136
THREAD_LIBS="-lpthread"
1137
TH_SAFE="-thread-safe"
1139
AC_DEFINE([C_HPUX],1,[os is hpux])
1140
if test "$have_mempool" = "yes"; then
1141
LDFLAGS="$LDFLAGS -Wl,+pd,1M"
1145
if test "$have_pthreads" = "yes"; then
1146
THREAD_LIBS="-lpthread"
1147
TH_SAFE="-thread-safe"
1148
AC_DEFINE([_THREAD_SAFE],1,[thread safe])
1150
AC_DEFINE([C_AIX],1,[os is aix])
1153
if test "$have_pthreads" = "yes"; then
1154
THREAD_LIBS="-pthread"
1155
TH_SAFE="-thread-safe"
1156
AC_DEFINE([_POSIX_PII_SOCKET],1,[POSIX compatibility])
1158
AC_DEFINE([C_OSF],1,[os is osf/tru64])
1161
AC_DEFINE([C_QNX6],1,[os is QNX 6.x.x])
1164
if test "$have_pthreads" = "yes"; then
1165
THREAD_LIBS="-lpthread"
1166
TH_SAFE="-thread-safe"
1169
AC_DEFINE([C_IRIX],1,[os is irix])
1172
AC_DEFINE([C_INTERIX],1,[os is interix])
1173
if test "$test_clamav" = "yes"; then
1174
if test ! -r /etc/passwd; then
1178
if test "$have_pthreads" = "yes"; then
1179
THREAD_LIBS="-lpthread"
1180
TH_SAFE="-thread-safe"
1184
AC_DEFINE([C_GNU_HURD],1,[target is gnu-hurd])
1185
if test "$have_pthreads" = "yes"; then
1186
THREAD_LIBS="-lpthread"
1187
TH_SAFE="-thread-safe"
1194
AC_SUBST([LIBCLAMAV_LIBS])
1195
AC_SUBST([CLAMD_LIBS])
1196
AC_SUBST([CLAMAV_MILTER_LIBS])
1197
AC_SUBST([FRESHCLAM_LIBS])
1198
AC_SUBST([CLAMDSCAN_LIBS])
1200
AC_SUBST([THREAD_LIBS])
1203
if test "$have_milter" = "yes"; then
1204
dnl libmilter checking code adapted from spamass-milter by
1205
dnl Tom G. Christensen <tgc@statsbiblioteket.dk>
1207
dnl Check for libmilter and it's header files in the usual locations
1209
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
1210
if test -d /usr/lib/libmilter ; then
1211
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -L/usr/lib/libmilter"
1213
LIBS="$LIBS -lmilter $CLAMAV_MILTER_LIBS"
1214
AC_CHECK_LIB([milter],[mi_stop],[CLAMAV_MILTER_LIBS="-lmilter $CLAMAV_MILTER_LIBS"],[
1215
dnl Older sendmails require libsm or libsmutil for support functions
1216
AC_SEARCH_LIBS([strlcpy], [sm smutil], [test "$ac_cv_search_strlcpy" = "none required" || CLAMAV_MILTER_XLIB="$ac_cv_search_strlcpy"])
1217
LIBS="$save_LIBS $CLAMAV_MILTER_LIBS $CLAMAV_MILTER_XLIB"
1218
$as_unset ac_cv_lib_milter_mi_stop
1219
AC_CHECK_LIB([milter],[mi_stop],[CLAMAV_MILTER_LIBS="-lmilter $CLAMAV_MILTER_XLIB $CLAMAV_MILTER_LIBS"],[
1220
AC_MSG_ERROR([Cannot find libmilter])
1224
AC_CHECK_HEADERS([libmilter/mfapi.h],[have_milter="yes"],[
1225
AC_MSG_ERROR([Please install mfapi.h from the sendmail distribution])
1229
AM_CONDITIONAL([BUILD_CLAMD],[test "$have_pthreads" = "yes"])
1230
AM_CONDITIONAL([HAVE_MILTER],[test "$have_milter" = "yes"])
1232
if test "$have_pthreads" = "yes"
1235
LIBS="$THREAD_LIBS $LIBS"
1236
AC_CHECK_FUNCS([sched_yield pthread_yield])
1238
AC_DEFINE([BUILD_CLAMD], 1, "build clamd")
1239
dnl define these here, so we don't forget any system
1240
AC_DEFINE([CL_THREAD_SAFE],1,[thread safe])
1241
AC_DEFINE([_REENTRANT],1,[thread safe])
1244
AC_CHECK_FUNCS([enable_extended_FILE_stdio])
1246
dnl Check for readdir_r and number of its arguments
1247
dnl Code from libwww/configure.in
1249
AC_MSG_CHECKING([for readdir_r])
1250
if test -z "$ac_cv_readdir_args"; then
1253
#include <sys/types.h>
1257
struct dirent dir, *dirp;
1259
dirp = readdir_r(mydir, &dir);
1260
], ac_cv_readdir_args=2)
1262
if test -z "$ac_cv_readdir_args"; then
1265
#include <sys/types.h>
1269
struct dirent dir, *dirp;
1272
rc = readdir_r(mydir, &dir, &dirp);
1273
], ac_cv_readdir_args=3)
1276
AC_ARG_ENABLE([readdir_r],
1277
[ --enable-readdir_r enable support for readdir_r],
1278
enable_readdir_r=$enableval, enable_readdir_r="no")
1280
if test "$enable_readdir_r" = "no"; then
1281
AC_MSG_RESULT(support disabled)
1282
elif test -z "$ac_cv_readdir_args"; then
1285
if test "$ac_cv_readdir_args" = 2; then
1286
AC_DEFINE([HAVE_READDIR_R_2],1,[readdir_r takes 2 arguments])
1287
elif test "$ac_cv_readdir_args" = 3; then
1288
AC_DEFINE([HAVE_READDIR_R_3],1,[readdir_r takes 3 arguments])
1290
AC_MSG_RESULT([yes, and it takes $ac_cv_readdir_args arguments])
1293
AC_MSG_CHECKING([for ctime_r])
1294
if test "$ac_cv_func_ctime_r" = "yes"; then
1300
ctime_r(&t, buf, 30);
1303
AC_DEFINE([HAVE_CTIME_R_3],1,[ctime_r takes 3 arguments])
1306
AC_DEFINE([HAVE_CTIME_R_2],1,[ctime_r takes 2 arguments])
1309
AC_MSG_RESULT([yes, and it takes $ac_cv_ctime_args arguments])
1312
dnl Determine socklen_t type. Code from lftp.
1313
AC_MSG_CHECKING([for socklen_t])
1314
AC_CACHE_VAL([ac_cv_socklen_t],
1318
#include <sys/types.h>
1319
#include <sys/socket.h>
1323
getpeername(0,0,&len);
1329
AC_MSG_RESULT([$ac_cv_socklen_t])
1330
if test $ac_cv_socklen_t = no; then
1331
AC_MSG_CHECKING([for socklen_t equivalent])
1332
AC_CACHE_VAL([ac_cv_socklen_t_equiv],
1334
ac_cv_socklen_t_equiv=int
1335
for t in int size_t unsigned long "unsigned long"; do
1337
#include <sys/types.h>
1338
#include <sys/socket.h>
1342
getpeername(0,0,&len);
1345
ac_cv_socklen_t_equiv="$t"
1350
AC_MSG_RESULT([$ac_cv_socklen_t_equiv])
1351
AC_DEFINE_UNQUOTED([socklen_t], $ac_cv_socklen_t_equiv, [Define to "int" if <sys/socket.h> does not define.])
1354
dnl Check for clamav in /etc/passwd
1355
if test "$test_clamav" = "yes"
1357
dnl parse /etc/passwd
1358
if test "$use_id" = "no"
1360
AC_MSG_CHECKING([for $clamav_user in /etc/passwd])
1361
if test -r /etc/passwd; then
1362
clamavuser=`cat /etc/passwd|grep "^$clamav_user:"`
1363
clamavgroup=`cat /etc/group|grep "^$clamav_group:"`
1366
AC_MSG_CHECKING([for $clamav_user using id])
1367
id $clamav_user > /dev/null 2>&1
1368
if test "$?" = 0 ; then
1370
AC_PATH_PROG(GETENT, getent)
1371
if test -n "$GETENT" ; then
1372
clamavgroup=`$GETENT group | grep "^${clamav_group}:"`
1374
clamavgroup=`cat /etc/group|grep $clamav_group`
1379
if test "$use_netinfo" = "yes"
1381
if test -x /usr/bin/dscl; then
1382
AC_MSG_CHECKING([for $clamav_user using dscl])
1383
clamavuser=`/usr/bin/dscl . -list /Users |grep ${clamav_user}`
1384
clamavgroup=`/usr/bin/dscl . -list /Groups |grep ${clamav_group}`
1386
AC_MSG_CHECKING([for $clamav_user using netinfo])
1387
clamavuser=`/usr/bin/nidump passwd . |grep ${clamav_user}`
1388
clamavgroup=`/usr/bin/nidump group . |grep ${clamav_group}`
1392
if test "$use_yp" = "yes"
1394
AC_MSG_CHECKING([for $clamav_user using ypmatch])
1395
clamavuser=`ypmatch ${clamav_user} passwd`
1396
clamavgroup=`ypmatch ${clamav_group} group`
1399
if test -z "$clamavuser" || test -z "$clamavgroup"
1402
AC_MSG_ERROR([User $clamav_user (and/or group $clamav_group) does not exist. Please read the documentation !])
1404
AC_MSG_RESULT([yes, user $clamav_user and group $clamav_group])
1405
CLAMAVUSER="$clamav_user"
1406
CLAMAVGROUP="$clamav_group"
1407
AC_SUBST([CLAMAVUSER])
1408
AC_SUBST([CLAMAVGROUP])
1412
dnl check for __attribute__((packed))
1413
dnl but only on compilers claiming to be gcc compatible
1414
dnl because for example Sun's compiler silently ignores the packed attribute.
1415
AC_MSG_CHECKING([for structure packing via __attribute__((packed))])
1416
AC_CACHE_VAL([have_cv_attrib_packed],[
1419
struct { int i __attribute__((packed)); } s;
1421
#error Only checking for packed attribute on gcc-like compilers
1423
[have_cv_attrib_packed=yes],
1424
[have_cv_attrib_packed=no])
1426
AC_MSG_RESULT([$have_cv_attrib_packed])
1428
if test "$have_cv_attrib_packed" = no; then
1429
AC_MSG_CHECKING([for structure packing via pragma])
1430
AC_CACHE_VAL([have_cv_pragma_pack],[
1432
int main(int argc, char **argv) {
1433
#pragma pack(1) /* has to be in column 1 ! */
1434
struct { char c; long l; } s;
1435
return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; } ],
1436
[have_cv_pragma_pack=yes],
1437
[have_cv_pragma_pack=no])
1439
AC_MSG_RESULT([$have_cv_pragma_pack])
1440
if test "$have_cv_pragma_pack" = yes; then
1441
AC_DEFINE([HAVE_PRAGMA_PACK], 1, "pragma pack")
1443
AC_MSG_CHECKING([for structure packing via hppa/hp-ux pragma])
1444
AC_CACHE_VAL([have_cv_pragma_pack_hpux],[
1446
/* hppa/hp-ux wants pragma outside of function */
1447
#pragma pack 1 /* has to be in column 1 ! */
1448
struct { char c; long l; } s;
1449
int main(int argc, char **argv) {
1450
return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; } ],
1451
[have_cv_pragma_pack_hpux=yes],
1452
[have_cv_pragma_pack_hpux=no])
1454
AC_MSG_RESULT([$have_cv_pragma_pack_hpux])
1455
AC_DEFINE([HAVE_PRAGMA_PACK_HPPA], 1, "pragma pack hppa/hp-ux style")
1459
dnl check for __attribute__((aligned))
1460
AC_MSG_CHECKING([for type aligning via __attribute__((aligned))])
1461
AC_CACHE_VAL([have_cv_attrib_aligned],[
1463
[typedef int cl_aligned_int __attribute__((aligned));],
1464
[have_cv_attrib_aligned=yes],
1465
[have_cv_attrib_aligned=no])
1467
AC_MSG_RESULT([$have_cv_attrib_aligned])
1469
if test "$have_cv_attrib_packed" = no -a "$have_cv_pragma_pack" = no -a "$have_cv_pragma_pack_hpux" = no; then
1470
AC_MSG_ERROR(Need to know how to pack structures with this compiler)
1473
if test "$have_cv_attrib_packed" = yes; then
1474
AC_DEFINE([HAVE_ATTRIB_PACKED], 1, [attrib packed])
1477
if test "$have_cv_attrib_aligned" = yes; then
1478
AC_DEFINE([HAVE_ATTRIB_ALIGNED], 1, [attrib aligned])
1481
dnl Sanity check that struct packing works
1482
AC_MSG_CHECKING([that structure packing works])
1483
AC_CACHE_VAL([have_cv_struct_pack],[
1485
#ifndef HAVE_ATTRIB_PACKED
1486
#define __attribute__(x)
1488
#ifdef HAVE_PRAGMA_PACK
1489
#pragma pack(1) /* has to be in column 1 ! */
1491
#ifdef HAVE_PRAGMA_PACK_HPPA
1492
#pragma pack 1 /* has to be in column 1 ! */
1495
struct { char c __attribute__((packed)); long l __attribute__((packed)); } s;
1497
#ifdef HAVE_PRAGMA_PACK
1500
#ifdef HAVE_PRAGMA_PACK_HPPA
1504
struct { char c; long l;} s2;
1506
#ifdef HAVE_PRAGMA_PACK
1507
#pragma pack(1) /* has to be in column 1 ! */
1509
#ifdef HAVE_PRAGMA_PACK_HPPA
1510
#pragma pack 1 /* has to be in column 1 ! */
1513
struct { char c; long l; } __attribute__((packed)) s3;
1515
#ifdef HAVE_PRAGMA_PACK
1518
#ifdef HAVE_PRAGMA_PACK_HPPA
1522
int main(int argc, char **argv) {
1523
if (sizeof(s)!=sizeof(s.c)+sizeof(s.l))
1525
if (sizeof(s) != sizeof(s3))
1527
return (sizeof(s2) >= sizeof(s)) ? 0 : 3;
1529
[have_cv_struct_pack=yes],
1530
[have_cv_struct_pack=no],
1531
[have_cv_struct_pack=yes])
1533
AC_MSG_RESULT([$have_cv_struct_pack])
1535
if test "$have_cv_struct_pack" = "no"; then
1536
AC_MSG_ERROR([Structure packing seems to be available, but is not working with this compiler])
1539
dnl Check if <sys/select.h> needs to be included for fd_set
1540
AC_MSG_CHECKING([for fd_set])
1541
AC_HEADER_EGREP([fd_mask], [sys/select.h], [have_fd_set=yes])
1542
if test "$have_fd_set" = yes; then
1543
AC_DEFINE([HAVE_SYS_SELECT_H], 1, "have <sys/select.h>")
1544
AC_MSG_RESULT([yes, found in sys/select.h])
1546
AC_TRY_COMPILE([#include <sys/time.h>
1547
#include <sys/types.h>
1548
#ifdef HAVE_UNISTD_H
1551
[fd_set readMask, writeMask;], have_fd_set=yes, have_fd_set=no)
1552
if test "$have_fd_set" = yes; then
1553
AC_MSG_RESULT([yes, found in sys/types.h])
1555
AC_DEFINE([NO_FD_SET], 1, "no fd_set")
1560
AC_MSG_CHECKING([default FD_SETSIZE value])
1564
#include <sys/time.h>
1565
#ifdef HAVE_SYS_SELECT_H
1566
#include <sys/select.h>
1568
#ifdef HAVE_SYS_TYPES_H
1569
#include <sys/types.h>
1573
FILE *fp = fopen("conftestval", "w");
1575
if(fprintf (fp, "%d\n", FD_SETSIZE) < 1) {
1576
perror("fprintf failed");
1580
perror("fopen failed");
1586
DEFAULT_FD_SETSIZE=`cat conftestval`,
1587
DEFAULT_FD_SETSIZE=256,
1588
DEFAULT_FD_SETSIZE=256)
1589
AC_MSG_RESULT([$DEFAULT_FD_SETSIZE])
1590
AC_DEFINE_UNQUOTED([DEFAULT_FD_SETSIZE], $DEFAULT_FD_SETSIZE, "default FD_SETSIZE value")
1592
AC_MSG_CHECKING([stat64])
1594
#define _LARGEFILE_SOURCE
1595
#define _LARGEFILE64_SOURCE
1597
#include <sys/types.h>
1598
#include <sys/stat.h>
1605
if (stat64(".", &sb) == -1)
1611
[enable_stat64=yes],
1616
if test "$enable_stat64" != "no"; then
1617
AC_DEFINE([HAVE_STAT64],1,[enable stat64])
1618
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
1620
AC_MSG_RESULT([$enable_stat64])
1622
dnl Check signed right shift implementation
1623
AC_MSG_CHECKING([whether signed right shift is sign extended])
1624
AC_TRY_RUN([int main(void){int a=-1;int b=a>>1;return(a!=b);}],
1625
[have_signed_rightshift_extended=yes],
1626
[have_signed_rightshift_extended=no],
1627
[have_signed_rightshift_extended=no])
1628
if test $have_signed_rightshift_extended = yes; then
1629
AC_DEFINE([HAVE_SAR], 1, [Define signed right shift implementation])
1631
AC_MSG_RESULT([$have_signed_rightshift_extended]);
1635
AC_DEFINE_UNQUOTED([VERSION],"$VERSION",[Version number of package])
1636
AC_DEFINE_UNQUOTED([VERSION_SUFFIX],"$VERSION_SUFFIX",[Version suffix for package])
1638
AC_ARG_ENABLE(clamdtop,
1639
AC_HELP_STRING([--enable-clamdtop],
1640
[Enable 'clamdtop' tool @<:@default=auto@:>@]),
1641
[enable_clamdtop=$enableval], [enable_clamdtop="auto"])
1643
if test "$enable_clamdtop" != "no"; then
1645
AC_LIB_FIND([ncurses], [ncurses/ncurses.h],
1646
AC_LANG_PROGRAM([#include <ncurses/ncurses.h>],
1647
[initscr(); KEY_RESIZE;]),
1648
[CURSES_CPPFLAGS="$INCNCURSES"; CURSES_LIBS="$LTLIBNCURSES";
1649
CURSES_INCLUDE="<ncurses/ncurses.h>"],
1652
if test "X$HAVE_LIBNCURSES" != "Xyes"; then
1654
AC_LIB_FIND([ncurses], [ncurses.h],
1655
AC_LANG_PROGRAM([#include <ncurses.h>],
1656
[initscr(); KEY_RESIZE;]),
1657
[CURSES_CPPFLAGS="$INCNCURSES"; CURSES_LIBS="$LTLIBNCURSES";
1658
CURSES_INCLUDE="<ncurses.h>"],
1662
if test "X$HAVE_LIBNCURSES" != "Xyes"; then
1663
AC_LIB_FIND([pdcurses],[curses.h],
1664
AC_LANG_PROGRAM([#include <curses.h>],
1665
[initscr(); KEY_RESIZE;]),
1666
[CURSES_CPPFLAGS="$INCPDCURSES";
1667
CURSES_LIBS="$LTLIBPDCURSES";
1668
CURSES_INCLUDE="<curses.h>"],
1669
[AC_MSG_WARN([****** not building clamdtop: ncurses not found])])
1672
if test "x$CURSES_LIBS" = "x" -a "$enable_clamdtop" = "yes"; then
1675
ERROR! Clamdtop was configured, but not found. You need to install libncurses5-dev.
1681
AC_DEFINE_UNQUOTED([CURSES_INCLUDE], $CURSES_INCLUDE, [curses header location])
1682
AC_SUBST([CURSES_CPPFLAGS])
1683
AC_SUBST([CURSES_LIBS])
1684
AM_CONDITIONAL([HAVE_CURSES],
1685
[test "X$HAVE_LIBNCURSES" = "Xyes" || test "X$HAVE_LIBPDCURSES" = "Xyes"])
1687
AC_ARG_ENABLE([distcheck-werror],
1688
AC_HELP_STRING([--enable-distcheck-werror],
1689
[enable warnings as error for distcheck
1690
@<:@default=no@:>@]),
1691
[enable_distcheckwerror=$enableval],[enable_distcheckwerror="no"])
1693
# Enable distcheck warnings and Werror only for gcc versions that support them,
1694
# and only after we've run the configure tests.
1695
# Some configure tests fail (like checking for cos in -lm) if we enable these
1696
# Werror flags for configure too (for example -Wstrict-prototypes makes
1697
# configure think that -lm doesn't have cos, hence its in libc).
1700
if test "x$enable_distcheckwerror" = "xyes"; then
1701
if test "$distcheck_enable_flags" = "1"; then
1702
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"
1703
WERR_CFLAGS="$WERR_COMMON -Wwrite-strings"
1704
WERR_CFLAGS_MILTER="$WERR_COMMON -Wno-error=format-nonliteral"
1707
AC_SUBST([WERR_CFLAGS])
1708
AC_SUBST([WERR_CFLAGS_MILTER])
1710
AC_ARG_ENABLE([llvm],AC_HELP_STRING([--enable-llvm],
1711
[Enable 'llvm' JIT/verifier support @<:@default=auto@:>@]),
1712
[enable_llvm=$enableval], [enable_llvm="auto"])
1714
if test "$enable_llvm" != "no"; then
1715
dnl Try to configure subdir, optionally
1716
AC_CONFIG_SUBDIRS_OPTIONAL([libclamav/c++])
1719
AC_ARG_ENABLE([sha-collector-for-internal-use], [], [enable_sha_collector="yes"], [enable_sha_collector="no"])
1720
if test "$enable_sha_collector" != "no"; then
1721
AC_DEFINE([HAVE__INTERNAL__SHA_COLLECT], 1, [For internal use only - DO NOT DEFINE])
1730
clamav-milter/Makefile
1743
docs/man/clamav-milter.8
1744
docs/man/clamav-milter.conf.5
1748
docs/man/clamd.conf.5
1749
docs/man/clamdscan.1
1751
docs/man/freshclam.1
1752
docs/man/freshclam.conf.5
1757
if test "$enable_llvm" = "yes" && test "$subdirfailed" != "no"; then
1758
AC_MSG_ERROR([Failed to configure LLVM, and LLVM was explicitly requested])
1760
AM_CONDITIONAL([ENABLE_LLVM],
1761
[test "$subdirfailed" != "yes" && test "$enable_llvm" != "no"])
1763
AC_OUTPUT([libclamav/Makefile])
1765
# Print a summary of what features we enabled
1766
AC_MSG_NOTICE([Summary of detected features follows])
1770
pthreads : $have_pthreads ($THREAD_LIBS)
1773
AC_MSG_NOTICE([Summary of miscellaneous features])
1774
if test "x$CHECK_LIBS" = "x"; then
1777
check_libs="$CHECK_LIBS"
1779
CL_MSG_STATUS([check ],[$check_libs],[$enable_check_ut])
1780
CL_MSG_STATUS([fanotify ],[$want_fanotify],[$want_fanotify])
1781
if test "x$ac_cv_have_control_in_msghdr" = "xyes"; then
1782
CL_MSG_STATUS([fdpassing ],[$have_fdpass],[$want_fdpassing])
1784
CL_MSG_STATUS([fdpassing ],[n/a],[])
1786
CL_MSG_STATUS([IPv6 ],[$have_cv_ipv6],[$want_ipv6])
1788
AC_MSG_NOTICE([Summary of optional tools])
1789
CL_MSG_STATUS([clamdtop ],[$CURSES_LIBS],[$enable_clamdtop])
1790
CL_MSG_STATUS([milter ],[yes],[$have_milter])
1792
AC_MSG_NOTICE([Summary of engine performance features)])
1793
if test "x$enable_debug" = "xyes"; then
1794
CL_MSG_STATUS([release mode],[no],[debug build])
1796
CL_MSG_STATUS([release mode],[yes],[yes])
1799
if test "$subdirfailed" = "no"; then
1802
CL_MSG_STATUS([jit ],[$have_jit],[$enable_llvm])
1803
CL_MSG_STATUS([mempool ],[$have_mempool],[$enable_mempool])
1805
AC_MSG_NOTICE([Summary of engine detection features])
1806
CL_MSG_STATUS([autoit_ea06 ],[$have_autoitea06],[])
1807
CL_MSG_STATUS([bzip2 ],[$bzip_check],[$want_bzip2])
1808
CL_MSG_STATUS([zlib ],[$ZLIB_HOME],[yes])
1809
CL_MSG_STATUS([unrar ],[$want_unrar],[$want_unrar])
1810
if test "x$XML_LIBS" = "x"; then
1811
CL_MSG_STATUS([dmg and xar ],[no],[])
1813
CL_MSG_STATUS([dmg and xar ],[yes, from $XML_HOME],[])
1816
# Yep, downgrading the compiler avoids the bug too:
1817
# 4.0.x, and 4.1.0 are the known buggy versions
1818
# 3.4 doesn't have the bug
1819
if test "x$gcc_check" != "xyes"; then
1821
****** Optimizations disabled to avoid compiler bugs
1822
****** The resulting binaries will be slow!
1823
****** It is recommended to either upgrade or downgrade your compiler
1827
if test "x$cross_compiling" != "xno" || test "x$gcc_check" != "xyes" || test "x$zlib_check" = "xno" || test "x$bzip_check" != "xok" ; then
1830
****** You are cross compiling to a different host or you are
1831
****** linking to bugged system libraries or you have manually
1832
****** disabled important configure checks.
1833
****** Please be aware that this build may be badly broken.
1834
****** DO NOT REPORT BUGS BASED ON THIS BUILD !!!