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" = "auto" ; then
468
PKG_CHECK_EXISTS([check], [enable_check_ut="yes"],
469
[enable_check_ut="no"])
472
if test "$enable_check_ut" = "yes" ; then
473
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
475
AM_CONDITIONAL([HAVE_LIBCHECK],test "X$CHECK_LIBS" != "X")
477
AC_ARG_ENABLE(coverage,
478
AC_HELP_STRING([--enable-coverage],
479
[turn on test coverage
480
@<:@default=no@:>@]),
481
[enable_cov=$enableval],[enable_cov="no"])
483
if test "x$enable_coverage" = "xyes"; then
484
if test "x$CHECK_LIBS" = "x"; then
485
AC_MSG_ERROR([Coverage testing required, but unit tests not enabled!])
487
if test "x$ac_compiler_gnu" != "xyes"; then
488
AC_MSG_ERROR([coverage testing only works if gcc is used])
491
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
492
LDFLAGS="$LDFLAGS -lgcov"
493
AC_CHECK_PROGS(GCOV, gcov, false)
494
AC_CHECK_PROGS(LCOV, lcov, false)
495
AC_CHECK_PROGS(GENHTML, genhtml, false)
498
AM_CONDITIONAL(ENABLE_COVERAGE, test "x$enable_coverage" = "xyes")
501
AC_CHECK_HEADER([pthread.h],[have_pthreads=yes],)
505
AC_MSG_CHECKING([for zlib installation])
507
[ --with-zlib=DIR path to directory containing zlib library (default=
508
/usr/local or /usr if not found in /usr/local)],
510
if test "$withval"; then
512
AC_MSG_RESULT([using $ZLIB_HOME])
516
if test ! -f "$ZLIB_HOME/include/zlib.h"
520
AC_MSG_RESULT([$ZLIB_HOME])
523
CLAMDSCAN_LIBS="$FRESHCLAM_LIBS"
525
AC_ARG_ENABLE([zlib-vcheck],
526
[ --disable-zlib-vcheck do not check for buggy zlib version ],
527
zlib_check=$enableval, zlib_check="yes")
529
if test ! -f "$ZLIB_HOME/include/zlib.h"
531
AC_MSG_ERROR([Please install zlib and zlib-devel packages])
534
vuln=`grep "ZLIB_VERSION \"1.2.0" $ZLIB_HOME/include/zlib.h`
535
if test -z "$vuln"; then
536
vuln=`grep "ZLIB_VERSION \"1.2.1" $ZLIB_HOME/include/zlib.h`
539
if test -n "$vuln"; then
540
if test "$zlib_check" = "yes"; then
541
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!)
543
AC_MSG_WARN([****** This ClamAV installation may be linked against])
544
AC_MSG_WARN([****** a broken zlib version. Please DO NOT report any])
545
AC_MSG_WARN([****** stability problems to the ClamAV developers!])
550
if test "$ZLIB_HOME" != "/usr"; then
551
CPPFLAGS="$CPPFLAGS -I$ZLIB_HOME/include"
552
save_LDFLAGS="$LDFLAGS"
553
LDFLAGS="$LDFLAGS -L$ZLIB_HOME/lib"
554
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]))
555
AC_CHECK_LIB([z], [gzopen], [], AC_MSG_ERROR([Your zlib is missing gzopen()]))
556
LDFLAGS="$save_LDFLAGS"
558
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]))
559
AC_CHECK_LIB([z], [gzopen],[], AC_MSG_ERROR([Your zlib is missing gzopen()]))
564
AC_ARG_ENABLE([bzip2],
565
[ --disable-bzip2 disable bzip2 support],
566
want_bzip2=$enableval, want_bzip2="yes")
569
if test "$want_bzip2" = "yes"
571
AC_LIB_LINKFLAGS([bz2])
572
save_LDFLAGS="$LDFLAGS"
573
# Only add -L if prefix is not empty
574
test -z "$LIBBZ2_PREFIX" || LDFLAGS="$LDFLAGS -L$LIBBZ2_PREFIX/$acl_libdirstem";
577
AC_CHECK_LIB([bz2], [BZ2_bzDecompressInit], [have_bzprefix="yes"])
578
if test "x$have_bzprefix" = "xno"; then
579
AC_DEFINE([NOBZ2PREFIX],1,[bzip funtions do not have bz2 prefix])
581
LDFLAGS="$save_LDFLAGS"
582
if test "$HAVE_LIBBZ2" = "yes"; then
583
AC_CHECK_HEADER([bzlib.h],
584
[AC_C_CVE_2008_1372],
585
[ac_cv_c_cve_2008_1372="no"])
586
if test "$ac_cv_c_cve_2008_1372" = "bugged"; then
587
AC_MSG_WARN([****** bzip2 libraries are affected by the CVE-2008-1372 bug])
588
AC_MSG_WARN([****** We strongly suggest you to update to bzip2 1.0.5.])
589
AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!])
590
bzip_check="bugged (CVE-2008-1372)"
592
if test "$ac_cv_c_cve_2008_1372" = "linkfailed"; then
593
dnl This shouldn't happen
594
dnl We failed to link but libtool may still be able to link, so don't disable bzip2 just yet
595
AC_MSG_WARN([****** Unable to link bzip2 testcase])
596
AC_MSG_WARN([****** You may be affected by CVE-2008-1372 bug, but I need to be able to link a testcase to verify])
597
AC_MSG_WARN([****** It is recommended to fix your build environment so that we can run the testcase!])
598
AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!])
599
bzip_check="link failed (CVE-2008-1372)"
602
case "$ac_cv_c_cve_2008_1372" in
603
ok|bugged|linkfailed)
611
if test "$HAVE_LIBBZ2" = "yes"; then
613
if test "$ac_cv_c_cve_2010_0405" = "bugged"; then
614
AC_MSG_WARN([****** bzip2 libraries are affected by the CVE-2010-0405 bug])
615
AC_MSG_WARN([****** We strongly suggest you to update bzip2])
616
AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!])
617
bzip_check="bugged (CVE-2010-0405)"
619
if test "$ac_cv_c_cve_2010_0405" = "linkfailed"; then
620
dnl This shouldn't happen
621
dnl We failed to link but libtool may still be able to link, so don't disable bzip2 just yet
622
AC_MSG_WARN([****** Unable to link bzip2 testcase])
623
AC_MSG_WARN([****** You may be affected by CVE-2010-0405 bug, but I need to be able to link a testcase to verify])
624
AC_MSG_WARN([****** It is recommended to fix your build environment so that we can run the testcase!])
625
AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!])
626
bzip_check="link failed (CVE-2010-0405)"
629
case "$ac_cv_c_cve_2010_0405" in
630
ok|bugged|linkfailed)
631
LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS $LTLIBBZ2"
632
AC_DEFINE([HAVE_BZLIB_H],1,[have bzip2])
635
AC_MSG_WARN([****** bzip2 support disabled])
640
AC_MSG_WARN([****** bzip2 support disabled])
644
AM_CONDITIONAL([HAVE_LIBBZ2], test "x$HAVE_LIBBZ2" = "xyes")
646
AC_ARG_ENABLE([unrar],
647
[ --disable-unrar do not build libclamunrar and libclamunrar_iface ],
648
want_unrar=$enableval, want_unrar="yes")
649
AM_CONDITIONAL([ENABLE_UNRAR],[test "$want_unrar" = "yes"])
654
[ --disable-xml disable DMG and XAR support],
655
want_xml=$enableval, want_xml="auto")
658
if test "X$want_xml" != "Xno"; then
659
AC_MSG_CHECKING([for libxml2 installation])
661
[ --with-xml=DIR path to directory containing libxml2 library (default=
662
/usr/local or /usr if not found in /usr/local)],
667
AC_MSG_RESULT([using $XML_HOME])
669
AC_MSG_ERROR([cannot assign blank value to --with-xml])
673
if test ! -x "$XML_HOME/bin/xml2-config"
676
if test ! -x "$XML_HOME/bin/xml2-config"
681
if test "x$XML_HOME" != "x"; then
682
AC_MSG_RESULT([$XML_HOME])
684
AC_MSG_RESULT([not found])
693
if test "x$XML_HOME" != "x"; then
694
AC_MSG_CHECKING([xml2-config version])
695
XMLCONF_VERSION="`$XML_HOME/bin/xml2-config --version`"
696
if test "x%XMLCONF_VERSION" != "x"; then
697
AC_MSG_RESULT([$XMLCONF_VERSION])
699
XML_CPPFLAGS="`$XML_HOME/bin/xml2-config --cflags`"
700
XML_LIBS="`$XML_HOME/bin/xml2-config --libs`"
702
AC_MSG_ERROR([xml2-config failed])
707
if test "X$found_xml" != "Xno"; then
708
AC_MSG_CHECKING([for xmlreader.h in $XML_HOME])
710
if test ! -f "$XML_HOME/include/libxml2/libxml/xmlreader.h"; then
711
AC_MSG_RESULT([not found])
713
AC_MSG_RESULT([found])
715
save_CPPFLAGS="$CPPFLAGS"
716
CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
717
save_LDFLAGS="$LDFLAGS"
718
LDFLAGS="$LDFLAGS $XML_LIBS"
720
AC_CHECK_LIB([xml2], [xmlTextReaderRead], [working_xml="yes"], [working_xml="no"])
722
CPPFLAGS="$save_CPPFLAGS"
723
LDFLAGS="$save_LDFLAGS"
728
if test "$working_xml" = "yes"; then
729
AC_DEFINE([HAVE_LIBXML2],1,[Define to 1 if you have the 'libxml2' library (-lxml2).])
730
AC_SUBST(XML_CPPFLAGS)
732
AC_MSG_NOTICE([Compiling and linking with libxml2 from $XML_HOME])
734
if test "$want_xml" = "yes"; then
735
AC_MSG_ERROR([****** Please install libxml2 packages!])
737
if test "$want_xml" != "no"; then
738
AC_MSG_NOTICE([****** libxml2 support unavailable])
743
AC_SUBST(XML_CPPFLAGS)
747
AC_ARG_ENABLE([getaddrinfo],
748
[ --disable-getaddrinfo disable support for getaddrinfo],
749
want_getaddrinfo=$enableval, want_getaddrinfo="yes")
751
if test "$want_getaddrinfo" = "yes"
753
AC_MSG_CHECKING([for getaddrinfo])
754
AC_CACHE_VAL([have_cv_gai],[
756
#include <sys/types.h>
757
#include <sys/socket.h>
760
int main(int argc, char **argv)
762
struct addrinfo *res;
765
if(getaddrinfo("127.0.0.1", NULL, NULL, &res) < 0)
776
AC_MSG_RESULT([$have_cv_gai])
777
if test "$have_cv_gai" = yes; then
778
AC_DEFINE(HAVE_GETADDRINFO, 1, [have getaddrinfo()])
782
AC_ARG_ENABLE([ipv6],
783
[ --disable-ipv6 disable IPv6 support],
784
want_ipv6=$enableval, want_ipv6="yes")
786
if test "$want_ipv6" = "yes"
788
AC_MSG_CHECKING([for IPv6 support])
789
AC_CACHE_VAL([have_cv_ipv6],[
791
#include <sys/types.h>
792
#include <sys/socket.h>
795
int main(int argc, char **argv)
797
struct addrinfo *res, hints;
800
if((sd = socket(AF_INET6, SOCK_STREAM, 0)) < 0)
803
/* also check if getaddrinfo() handles AF_UNSPEC -- bb#1196 */
804
memset(&hints, 0, sizeof(hints));
805
hints.ai_family = AF_UNSPEC;
806
if(getaddrinfo("127.0.0.1", NULL, &hints, &res) < 0)
816
AC_MSG_RESULT([$have_cv_ipv6])
817
if test "$have_cv_ipv6" = yes; then
818
AC_DEFINE(SUPPORT_IPv6, 1, [Support for IPv6])
824
AC_ARG_ENABLE([fanotify],
825
[ --disable-fanotify disable fanotify support (Linux only)],
826
want_fanotify=$enableval, want_fanotify="yes")
828
dnl AC_FUNC_SETPGRP does not work when cross compiling
829
dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
830
dnl testcase from gdb/configure.ac
831
if test "$cross_compiling" = no; then
834
AC_CACHE_CHECK([whether setpgrp takes no argument], [ac_cv_func_setpgrp_void],
838
if (setpgrp(1,1) == -1)
842
], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
843
if test $ac_cv_func_setpgrp_void = yes; then
844
AC_DEFINE([SETPGRP_VOID], 1)
848
AC_ARG_ENABLE([milter],
849
[ --enable-milter build clamav-milter],
850
have_milter=$enableval, have_milter="no")
852
dnl we need to try to link with iconv, otherwise there could be a
853
dnl mismatch between a 32-bit and 64-bit lib. Detect this at configure time.
854
dnl we need to check after zlib/bzip2, because they can change the include path
855
AC_ARG_WITH([iconv], [ --with-iconv supports iconv() (default=auto)],
858
yes|no) wiconv="$withval";;
859
*) AC_MSG_ERROR([--with-iconv does not take an argument]);;
862
if test "X$wiconv" != "Xno"; then
863
AC_CHECK_LIB([iconv], [libiconv_open], LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -liconv")
864
AC_MSG_CHECKING([for iconv])
866
LIBS="$LIBCLAMAV_LIBS"
873
iconv_t iconv_struct = iconv_open("UTF-16BE","UTF-8");
874
rc = iconv(iconv_struct,xin,&il,xout,&ol);
875
iconv_close(iconv_struct);
878
AC_DEFINE([HAVE_ICONV], 1, [iconv() available])
885
AC_ARG_ENABLE([pthreads],
886
[ --disable-pthreads disable POSIX threads support],
887
have_pthreads=$enableval,)
890
[ --disable-cr do not link with C reentrant library (BSD) ],
893
AC_ARG_ENABLE([id-check],
894
[ --enable-id-check use id utility instead of /etc/passwd parsing],
895
use_id=$enableval, use_id="no")
897
AC_ARG_ENABLE([yp-check],
898
[ --enable-yp-check use ypmatch utility instead of /etc/passwd parsing],
899
use_yp=$enableval, use_yp="no")
902
[ --with-user=uid name of the clamav user (default=clamav)],
903
clamav_user="$withval", clamav_user="clamav")
906
[ --with-group=gid name of the clamav group (default=clamav)],
907
clamav_group="$withval", clamav_group="clamav")
909
AC_DEFINE_UNQUOTED([CLAMAVUSER],"$clamav_user",[name of the clamav user])
910
AC_DEFINE_UNQUOTED([CLAMAVGROUP],"$clamav_group",[name of the clamav group])
912
AC_ARG_ENABLE([clamav],
913
[ --disable-clamav disable test for clamav user/group],
914
test_clamav=$enableval, test_clamav=yes)
916
AC_ARG_ENABLE([debug],
917
[ --enable-debug enable debug code],
918
enable_debug=$enableval, enable_debug="no")
920
if test "$enable_debug" = "yes"; then
921
VERSION_SUFFIX="$VERSION_SUFFIX-debug"
922
AC_DEFINE([CL_DEBUG],1,[enable debugging])
924
AC_DEFINE([NDEBUG],1,[disable assertions])
927
AC_ARG_WITH([version],
928
[ --with-version=STR use custom version string (dev only)],
929
VERSION="$withval", )
931
AC_ARG_ENABLE([no-cache],
932
[ --enable-no-cache use "Cache-Control: no-cache" in freshclam],
933
enable_nocache=$enableval, enable_nocache="no")
935
if test "$enable_nocache" = "yes"; then
936
AC_DEFINE([FRESHCLAM_NO_CACHE],1,[use "Cache-Control: no-cache" in freshclam])
939
AC_ARG_ENABLE([dns-fix],
940
[ --enable-dns-fix enable workaround for broken DNS servers (as in SpeedTouch 510)],
941
enable_dnsfix=$enableval, enable_dnsfix="no")
943
if test "$enable_dnsfix" = "yes"; then
944
AC_DEFINE([FRESHCLAM_DNS_FIX],1,[enable workaround for broken DNS servers])
947
AC_ARG_ENABLE([bigstack],
948
[ --enable-bigstack increase thread stack size],
949
enable_bigstack=$enableval, enable_bigstack="no")
951
if test "$enable_bigstack" = "yes"; then
952
AC_DEFINE([C_BIGSTACK],1,[Increase thread stack size.])
956
[ --with-dbdir=path path to virus database directory],
957
db_dir="$withval", db_dir="_default_")
959
dnl I had problems with $pkgdatadir thus these funny checks
960
if test "$db_dir" = "_default_"
962
if test "$prefix" = "NONE"
964
db_dir="$ac_default_prefix/share/clamav"
966
db_dir="$prefix/share/clamav"
970
AC_DEFINE_UNQUOTED([DATADIR],"$db_dir", [Path to virus database directory.])
974
dnl configure config directory
975
cfg_dir=`echo $sysconfdir | grep prefix`
977
if test -n "$cfg_dir"; then
978
if test "$prefix" = "NONE"
980
cfg_dir="$ac_default_prefix/etc"
982
cfg_dir="$prefix/etc"
985
cfg_dir="$sysconfdir"
990
AC_DEFINE_UNQUOTED([CONFDIR],"$cfg_dir",[where to look for the config file])
992
dnl check for in_port_t definition
993
AC_MSG_CHECKING([whether in_port_t is defined])
995
#include <sys/types.h>
996
#include <netinet/in.h>
998
[in_port_t pt; pt = 0; return pt;],
1001
AC_DEFINE([HAVE_IN_PORT_T],1,[in_port_t is defined])
1005
dnl check for in_addr_t definition
1006
AC_MSG_CHECKING([for in_addr_t definition])
1008
#include <sys/types.h>
1009
#include <netinet/in.h>
1011
[ in_addr_t pt; pt = 0; return pt; ],
1014
AC_DEFINE([HAVE_IN_ADDR_T],1,[in_addr_t is defined])
1018
case "$target_os" in
1020
AC_DEFINE([C_LINUX],1,[target is linux])
1021
if test "$have_pthreads" = "yes"; then
1022
THREAD_LIBS="-lpthread"
1023
TH_SAFE="-thread-safe"
1024
if test "$want_fanotify" = "yes"; then
1025
AC_CHECK_HEADER([linux/fanotify.h],AC_DEFINE([FANOTIFY],1,[use fanotify]),)
1030
AC_DEFINE([C_KFREEBSD_GNU],1,[target is kfreebsd-gnu])
1031
if test "$have_pthreads" = "yes"; then
1032
THREAD_LIBS="-lpthread"
1033
TH_SAFE="-thread-safe"
1037
CLAMDSCAN_LIBS="$CLAMDSCAN_LIBS -lresolv"
1038
FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lresolv"
1039
if test "$have_pthreads" = "yes"; then
1040
THREAD_LIBS="-lpthread"
1041
CLAMD_LIBS="$CLAMD_LIBS -lresolv"
1042
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lresolv"
1043
TH_SAFE="-thread-safe"
1045
AC_DEFINE([C_SOLARIS],1,[os is solaris])
1048
if test "$have_pthreads" = "yes"; then
1049
THREAD_LIBS="-pthread -lc_r"
1050
TH_SAFE="-thread-safe"
1052
AC_DEFINE([C_BSD],1,[os is freebsd 4 or 5])
1055
if test "$have_pthreads" = "yes"; then
1057
TH_SAFE="-thread-safe"
1059
AC_DEFINE([C_BSD],1,[os is freebsd 6])
1062
if test "$have_pthreads" = "yes"; then
1063
THREAD_LIBS="-pthread"
1064
TH_SAFE="-thread-safe"
1066
AC_DEFINE([C_BSD],1,[os is dragonfly])
1069
if test "$have_pthreads" = "yes"; then
1070
THREAD_LIBS="-pthread"
1071
CLAMD_LIBS="$CLAMD_LIBS -pthread"
1072
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread"
1073
TH_SAFE="-thread-safe"
1075
AC_DEFINE([C_BSD],1,[os is OpenBSD])
1078
if test "$have_pthreads" = "yes"; then
1079
THREAD_LIBS="-pthread"
1080
TH_SAFE="-thread-safe"
1082
AC_DEFINE([C_BSD],1,[os is BSDI BSD/OS])
1085
if test "$have_pthreads" = "yes"; then
1086
THREAD_LIBS="-lpthread"
1088
AC_DEFINE([C_BSD],1,[os is NetBSD])
1091
AC_MSG_RESULT([Unknown BSD detected. Disabling thread support.])
1093
AC_DEFINE([C_BSD],1,[os is bsd flavor])
1096
AC_MSG_RESULT([BeOS detected. Disabling thread support.])
1098
AC_DEFINE([C_BEOS],1,[os is beos])
1101
AC_DEFINE([C_INTERIX],1,[os is Interix])
1104
AC_DEFINE([C_BSD],1,[os is bsd flavor])
1105
AC_DEFINE([C_DARWIN],1,[os is darwin])
1106
AC_DEFINE([BIND_8_COMPAT],1,[enable bind8 compatibility])
1107
AC_DEFINE([CLAMAUTH],1,[use ClamAuth])
1111
CLAMDSCAN_LIBS="$CLAMDSCAN_LIBS -lsyslog"
1112
FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lsyslog"
1113
CLAMD_LIBS="$CLAMD_LIBS -lsyslog"
1114
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsyslog"
1115
if test "$have_pthreads" = "yes"; then
1116
THREAD_LIBS="-lpthread"
1117
TH_SAFE="-thread-safe"
1119
AC_DEFINE([C_OS2],1,[os is OS/2])
1122
dnl njh@bandsman.sco.uk: SCO Unix port
1123
dnl FRESHCLAM_LIBS="-lsocket"
1124
dnl CLAMD_LIBS="-lsocket"
1125
dnl CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"
1128
if test "$have_pthreads" = "yes"; then
1129
THREAD_LIBS="-lpthread"
1130
TH_SAFE="-thread-safe"
1132
AC_DEFINE([C_HPUX],1,[os is hpux])
1133
if test "$have_mempool" = "yes"; then
1134
LDFLAGS="$LDFLAGS -Wl,+pd,1M"
1138
if test "$have_pthreads" = "yes"; then
1139
THREAD_LIBS="-lpthread"
1140
TH_SAFE="-thread-safe"
1141
AC_DEFINE([_THREAD_SAFE],1,[thread safe])
1143
AC_DEFINE([C_AIX],1,[os is aix])
1146
if test "$have_pthreads" = "yes"; then
1147
THREAD_LIBS="-pthread"
1148
TH_SAFE="-thread-safe"
1149
AC_DEFINE([_POSIX_PII_SOCKET],1,[POSIX compatibility])
1151
AC_DEFINE([C_OSF],1,[os is osf/tru64])
1154
AC_DEFINE([C_QNX6],1,[os is QNX 6.x.x])
1157
if test "$have_pthreads" = "yes"; then
1158
THREAD_LIBS="-lpthread"
1159
TH_SAFE="-thread-safe"
1162
AC_DEFINE([C_IRIX],1,[os is irix])
1165
AC_DEFINE([C_INTERIX],1,[os is interix])
1166
if test "$test_clamav" = "yes"; then
1167
if test ! -r /etc/passwd; then
1171
if test "$have_pthreads" = "yes"; then
1172
THREAD_LIBS="-lpthread"
1173
TH_SAFE="-thread-safe"
1177
AC_DEFINE([C_GNU_HURD],1,[target is gnu-hurd])
1178
if test "$have_pthreads" = "yes"; then
1179
THREAD_LIBS="-lpthread"
1180
TH_SAFE="-thread-safe"
1187
AC_SUBST([LIBCLAMAV_LIBS])
1188
AC_SUBST([CLAMD_LIBS])
1189
AC_SUBST([CLAMAV_MILTER_LIBS])
1190
AC_SUBST([FRESHCLAM_LIBS])
1191
AC_SUBST([CLAMDSCAN_LIBS])
1193
AC_SUBST([THREAD_LIBS])
1196
if test "$have_milter" = "yes"; then
1197
dnl libmilter checking code adapted from spamass-milter by
1198
dnl Tom G. Christensen <tgc@statsbiblioteket.dk>
1200
dnl Check for libmilter and it's header files in the usual locations
1202
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
1203
if test -d /usr/lib/libmilter ; then
1204
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -L/usr/lib/libmilter"
1206
LIBS="$LIBS -lmilter $CLAMAV_MILTER_LIBS"
1207
AC_CHECK_LIB([milter],[mi_stop],[CLAMAV_MILTER_LIBS="-lmilter $CLAMAV_MILTER_LIBS"],[
1208
dnl Older sendmails require libsm or libsmutil for support functions
1209
AC_SEARCH_LIBS([strlcpy], [sm smutil], [test "$ac_cv_search_strlcpy" = "none required" || CLAMAV_MILTER_XLIB="$ac_cv_search_strlcpy"])
1210
LIBS="$save_LIBS $CLAMAV_MILTER_LIBS $CLAMAV_MILTER_XLIB"
1211
$as_unset ac_cv_lib_milter_mi_stop
1212
AC_CHECK_LIB([milter],[mi_stop],[CLAMAV_MILTER_LIBS="-lmilter $CLAMAV_MILTER_XLIB $CLAMAV_MILTER_LIBS"],[
1213
AC_MSG_ERROR([Cannot find libmilter])
1217
AC_CHECK_HEADERS([libmilter/mfapi.h],[have_milter="yes"],[
1218
AC_MSG_ERROR([Please install mfapi.h from the sendmail distribution])
1222
AM_CONDITIONAL([BUILD_CLAMD],[test "$have_pthreads" = "yes"])
1223
AM_CONDITIONAL([HAVE_MILTER],[test "$have_milter" = "yes"])
1225
if test "$have_pthreads" = "yes"
1228
LIBS="$THREAD_LIBS $LIBS"
1229
AC_CHECK_FUNCS([sched_yield pthread_yield])
1231
AC_DEFINE([BUILD_CLAMD], 1, "build clamd")
1232
dnl define these here, so we don't forget any system
1233
AC_DEFINE([CL_THREAD_SAFE],1,[thread safe])
1234
AC_DEFINE([_REENTRANT],1,[thread safe])
1237
AC_CHECK_FUNCS([enable_extended_FILE_stdio])
1239
dnl Check for readdir_r and number of its arguments
1240
dnl Code from libwww/configure.in
1242
AC_MSG_CHECKING([for readdir_r])
1243
if test -z "$ac_cv_readdir_args"; then
1246
#include <sys/types.h>
1250
struct dirent dir, *dirp;
1252
dirp = readdir_r(mydir, &dir);
1253
], ac_cv_readdir_args=2)
1255
if test -z "$ac_cv_readdir_args"; then
1258
#include <sys/types.h>
1262
struct dirent dir, *dirp;
1265
rc = readdir_r(mydir, &dir, &dirp);
1266
], ac_cv_readdir_args=3)
1269
AC_ARG_ENABLE([readdir_r],
1270
[ --enable-readdir_r enable support for readdir_r],
1271
enable_readdir_r=$enableval, enable_readdir_r="no")
1273
if test "$enable_readdir_r" = "no"; then
1274
AC_MSG_RESULT(support disabled)
1275
elif test -z "$ac_cv_readdir_args"; then
1278
if test "$ac_cv_readdir_args" = 2; then
1279
AC_DEFINE([HAVE_READDIR_R_2],1,[readdir_r takes 2 arguments])
1280
elif test "$ac_cv_readdir_args" = 3; then
1281
AC_DEFINE([HAVE_READDIR_R_3],1,[readdir_r takes 3 arguments])
1283
AC_MSG_RESULT([yes, and it takes $ac_cv_readdir_args arguments])
1286
AC_MSG_CHECKING([for ctime_r])
1287
if test "$ac_cv_func_ctime_r" = "yes"; then
1293
ctime_r(&t, buf, 30);
1296
AC_DEFINE([HAVE_CTIME_R_3],1,[ctime_r takes 3 arguments])
1299
AC_DEFINE([HAVE_CTIME_R_2],1,[ctime_r takes 2 arguments])
1302
AC_MSG_RESULT([yes, and it takes $ac_cv_ctime_args arguments])
1305
dnl Determine socklen_t type. Code from lftp.
1306
AC_MSG_CHECKING([for socklen_t])
1307
AC_CACHE_VAL([ac_cv_socklen_t],
1311
#include <sys/types.h>
1312
#include <sys/socket.h>
1316
getpeername(0,0,&len);
1322
AC_MSG_RESULT([$ac_cv_socklen_t])
1323
if test $ac_cv_socklen_t = no; then
1324
AC_MSG_CHECKING([for socklen_t equivalent])
1325
AC_CACHE_VAL([ac_cv_socklen_t_equiv],
1327
ac_cv_socklen_t_equiv=int
1328
for t in int size_t unsigned long "unsigned long"; do
1330
#include <sys/types.h>
1331
#include <sys/socket.h>
1335
getpeername(0,0,&len);
1338
ac_cv_socklen_t_equiv="$t"
1343
AC_MSG_RESULT([$ac_cv_socklen_t_equiv])
1344
AC_DEFINE_UNQUOTED([socklen_t], $ac_cv_socklen_t_equiv, [Define to "int" if <sys/socket.h> does not define.])
1347
dnl Check for clamav in /etc/passwd
1348
if test "$test_clamav" = "yes"
1350
dnl parse /etc/passwd
1351
if test "$use_id" = "no"
1353
AC_MSG_CHECKING([for $clamav_user in /etc/passwd])
1354
if test -r /etc/passwd; then
1355
clamavuser=`cat /etc/passwd|grep "^$clamav_user:"`
1356
clamavgroup=`cat /etc/group|grep "^$clamav_group:"`
1359
AC_MSG_CHECKING([for $clamav_user using id])
1360
id $clamav_user > /dev/null 2>&1
1361
if test "$?" = 0 ; then
1363
AC_PATH_PROG(GETENT, getent)
1364
if test -n "$GETENT" ; then
1365
clamavgroup=`$GETENT group | grep "^${clamav_group}:"`
1367
clamavgroup=`cat /etc/group|grep $clamav_group`
1372
if test "$use_netinfo" = "yes"
1374
if test -x /usr/bin/dscl; then
1375
AC_MSG_CHECKING([for $clamav_user using dscl])
1376
clamavuser=`/usr/bin/dscl . -list /Users |grep ${clamav_user}`
1377
clamavgroup=`/usr/bin/dscl . -list /Groups |grep ${clamav_group}`
1379
AC_MSG_CHECKING([for $clamav_user using netinfo])
1380
clamavuser=`/usr/bin/nidump passwd . |grep ${clamav_user}`
1381
clamavgroup=`/usr/bin/nidump group . |grep ${clamav_group}`
1385
if test "$use_yp" = "yes"
1387
AC_MSG_CHECKING([for $clamav_user using ypmatch])
1388
clamavuser=`ypmatch ${clamav_user} passwd`
1389
clamavgroup=`ypmatch ${clamav_group} group`
1392
if test -z "$clamavuser" || test -z "$clamavgroup"
1395
AC_MSG_ERROR([User $clamav_user (and/or group $clamav_group) does not exist. Please read the documentation !])
1397
AC_MSG_RESULT([yes, user $clamav_user and group $clamav_group])
1398
CLAMAVUSER="$clamav_user"
1399
CLAMAVGROUP="$clamav_group"
1400
AC_SUBST([CLAMAVUSER])
1401
AC_SUBST([CLAMAVGROUP])
1405
dnl check for __attribute__((packed))
1406
dnl but only on compilers claiming to be gcc compatible
1407
dnl because for example Sun's compiler silently ignores the packed attribute.
1408
AC_MSG_CHECKING([for structure packing via __attribute__((packed))])
1409
AC_CACHE_VAL([have_cv_attrib_packed],[
1412
struct { int i __attribute__((packed)); } s;
1414
#error Only checking for packed attribute on gcc-like compilers
1416
[have_cv_attrib_packed=yes],
1417
[have_cv_attrib_packed=no])
1419
AC_MSG_RESULT([$have_cv_attrib_packed])
1421
if test "$have_cv_attrib_packed" = no; then
1422
AC_MSG_CHECKING([for structure packing via pragma])
1423
AC_CACHE_VAL([have_cv_pragma_pack],[
1425
int main(int argc, char **argv) {
1426
#pragma pack(1) /* has to be in column 1 ! */
1427
struct { char c; long l; } s;
1428
return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; } ],
1429
[have_cv_pragma_pack=yes],
1430
[have_cv_pragma_pack=no])
1432
AC_MSG_RESULT([$have_cv_pragma_pack])
1433
if test "$have_cv_pragma_pack" = yes; then
1434
AC_DEFINE([HAVE_PRAGMA_PACK], 1, "pragma pack")
1436
AC_MSG_CHECKING([for structure packing via hppa/hp-ux pragma])
1437
AC_CACHE_VAL([have_cv_pragma_pack_hpux],[
1439
/* hppa/hp-ux wants pragma outside of function */
1440
#pragma pack 1 /* has to be in column 1 ! */
1441
struct { char c; long l; } s;
1442
int main(int argc, char **argv) {
1443
return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; } ],
1444
[have_cv_pragma_pack_hpux=yes],
1445
[have_cv_pragma_pack_hpux=no])
1447
AC_MSG_RESULT([$have_cv_pragma_pack_hpux])
1448
AC_DEFINE([HAVE_PRAGMA_PACK_HPPA], 1, "pragma pack hppa/hp-ux style")
1452
dnl check for __attribute__((aligned))
1453
AC_MSG_CHECKING([for type aligning via __attribute__((aligned))])
1454
AC_CACHE_VAL([have_cv_attrib_aligned],[
1456
[typedef int cl_aligned_int __attribute__((aligned));],
1457
[have_cv_attrib_aligned=yes],
1458
[have_cv_attrib_aligned=no])
1460
AC_MSG_RESULT([$have_cv_attrib_aligned])
1462
if test "$have_cv_attrib_packed" = no -a "$have_cv_pragma_pack" = no -a "$have_cv_pragma_pack_hpux" = no; then
1463
AC_MSG_ERROR(Need to know how to pack structures with this compiler)
1466
if test "$have_cv_attrib_packed" = yes; then
1467
AC_DEFINE([HAVE_ATTRIB_PACKED], 1, [attrib packed])
1470
if test "$have_cv_attrib_aligned" = yes; then
1471
AC_DEFINE([HAVE_ATTRIB_ALIGNED], 1, [attrib aligned])
1474
dnl Sanity check that struct packing works
1475
AC_MSG_CHECKING([that structure packing works])
1476
AC_CACHE_VAL([have_cv_struct_pack],[
1478
#ifndef HAVE_ATTRIB_PACKED
1479
#define __attribute__(x)
1481
#ifdef HAVE_PRAGMA_PACK
1482
#pragma pack(1) /* has to be in column 1 ! */
1484
#ifdef HAVE_PRAGMA_PACK_HPPA
1485
#pragma pack 1 /* has to be in column 1 ! */
1488
struct { char c __attribute__((packed)); long l __attribute__((packed)); } s;
1490
#ifdef HAVE_PRAGMA_PACK
1493
#ifdef HAVE_PRAGMA_PACK_HPPA
1497
struct { char c; long l;} s2;
1499
#ifdef HAVE_PRAGMA_PACK
1500
#pragma pack(1) /* has to be in column 1 ! */
1502
#ifdef HAVE_PRAGMA_PACK_HPPA
1503
#pragma pack 1 /* has to be in column 1 ! */
1506
struct { char c; long l; } __attribute__((packed)) s3;
1508
#ifdef HAVE_PRAGMA_PACK
1511
#ifdef HAVE_PRAGMA_PACK_HPPA
1515
int main(int argc, char **argv) {
1516
if (sizeof(s)!=sizeof(s.c)+sizeof(s.l))
1518
if (sizeof(s) != sizeof(s3))
1520
return (sizeof(s2) >= sizeof(s)) ? 0 : 3;
1522
[have_cv_struct_pack=yes],
1523
[have_cv_struct_pack=no],
1524
[have_cv_struct_pack=yes])
1526
AC_MSG_RESULT([$have_cv_struct_pack])
1528
if test "$have_cv_struct_pack" = "no"; then
1529
AC_MSG_ERROR([Structure packing seems to be available, but is not working with this compiler])
1532
dnl Check if <sys/select.h> needs to be included for fd_set
1533
AC_MSG_CHECKING([for fd_set])
1534
AC_HEADER_EGREP([fd_mask], [sys/select.h], [have_fd_set=yes])
1535
if test "$have_fd_set" = yes; then
1536
AC_DEFINE([HAVE_SYS_SELECT_H], 1, "have <sys/select.h>")
1537
AC_MSG_RESULT([yes, found in sys/select.h])
1539
AC_TRY_COMPILE([#include <sys/time.h>
1540
#include <sys/types.h>
1541
#ifdef HAVE_UNISTD_H
1544
[fd_set readMask, writeMask;], have_fd_set=yes, have_fd_set=no)
1545
if test "$have_fd_set" = yes; then
1546
AC_MSG_RESULT([yes, found in sys/types.h])
1548
AC_DEFINE([NO_FD_SET], 1, "no fd_set")
1553
AC_MSG_CHECKING([default FD_SETSIZE value])
1557
#include <sys/time.h>
1558
#ifdef HAVE_SYS_SELECT_H
1559
#include <sys/select.h>
1561
#ifdef HAVE_SYS_TYPES_H
1562
#include <sys/types.h>
1566
FILE *fp = fopen("conftestval", "w");
1568
if(fprintf (fp, "%d\n", FD_SETSIZE) < 1) {
1569
perror("fprintf failed");
1573
perror("fopen failed");
1579
DEFAULT_FD_SETSIZE=`cat conftestval`,
1580
DEFAULT_FD_SETSIZE=256,
1581
DEFAULT_FD_SETSIZE=256)
1582
AC_MSG_RESULT([$DEFAULT_FD_SETSIZE])
1583
AC_DEFINE_UNQUOTED([DEFAULT_FD_SETSIZE], $DEFAULT_FD_SETSIZE, "default FD_SETSIZE value")
1585
AC_MSG_CHECKING([stat64])
1587
#define _LARGEFILE_SOURCE
1588
#define _LARGEFILE64_SOURCE
1590
#include <sys/types.h>
1591
#include <sys/stat.h>
1598
if (stat64(".", &sb) == -1)
1604
[enable_stat64=yes],
1609
if test "$enable_stat64" != "no"; then
1610
AC_DEFINE([HAVE_STAT64],1,[enable stat64])
1611
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
1613
AC_MSG_RESULT([$enable_stat64])
1615
dnl Check signed right shift implementation
1616
AC_MSG_CHECKING([whether signed right shift is sign extended])
1617
AC_TRY_RUN([int main(void){int a=-1;int b=a>>1;return(a!=b);}],
1618
[have_signed_rightshift_extended=yes],
1619
[have_signed_rightshift_extended=no],
1620
[have_signed_rightshift_extended=no])
1621
if test $have_signed_rightshift_extended = yes; then
1622
AC_DEFINE([HAVE_SAR], 1, [Define signed right shift implementation])
1624
AC_MSG_RESULT([$have_signed_rightshift_extended]);
1628
AC_DEFINE_UNQUOTED([VERSION],"$VERSION",[Version number of package])
1629
AC_DEFINE_UNQUOTED([VERSION_SUFFIX],"$VERSION_SUFFIX",[Version suffix for package])
1631
AC_ARG_ENABLE(clamdtop,
1632
AC_HELP_STRING([--enable-clamdtop],
1633
[Enable 'clamdtop' tool @<:@default=auto@:>@]),
1634
[enable_clamdtop=$enableval], [enable_clamdtop="auto"])
1636
if test "$enable_clamdtop" != "no"; then
1638
AC_LIB_FIND([ncurses], [ncurses/ncurses.h],
1639
AC_LANG_PROGRAM([#include <ncurses/ncurses.h>],
1640
[initscr(); KEY_RESIZE;]),
1641
[CURSES_CPPFLAGS="$INCNCURSES"; CURSES_LIBS="$LTLIBNCURSES";
1642
CURSES_INCLUDE="<ncurses/ncurses.h>"],
1645
if test "X$HAVE_LIBNCURSES" != "Xyes"; then
1647
AC_LIB_FIND([ncurses], [ncurses.h],
1648
AC_LANG_PROGRAM([#include <ncurses.h>],
1649
[initscr(); KEY_RESIZE;]),
1650
[CURSES_CPPFLAGS="$INCNCURSES"; CURSES_LIBS="$LTLIBNCURSES";
1651
CURSES_INCLUDE="<ncurses.h>"],
1655
if test "X$HAVE_LIBNCURSES" != "Xyes"; then
1656
AC_LIB_FIND([pdcurses],[curses.h],
1657
AC_LANG_PROGRAM([#include <curses.h>],
1658
[initscr(); KEY_RESIZE;]),
1659
[CURSES_CPPFLAGS="$INCPDCURSES";
1660
CURSES_LIBS="$LTLIBPDCURSES";
1661
CURSES_INCLUDE="<curses.h>"],
1662
[AC_MSG_WARN([****** not building clamdtop: ncurses not found])])
1665
if test "x$CURSES_LIBS" = "x" -a "$enable_clamdtop" = "yes"; then
1668
ERROR! Clamdtop was configured, but not found. You need to install libncurses5-dev.
1674
AC_DEFINE_UNQUOTED([CURSES_INCLUDE], $CURSES_INCLUDE, [curses header location])
1675
AC_SUBST([CURSES_CPPFLAGS])
1676
AC_SUBST([CURSES_LIBS])
1677
AM_CONDITIONAL([HAVE_CURSES],
1678
[test "X$HAVE_LIBNCURSES" = "Xyes" || test "X$HAVE_LIBPDCURSES" = "Xyes"])
1680
AC_ARG_ENABLE([distcheck-werror],
1681
AC_HELP_STRING([--enable-distcheck-werror],
1682
[enable warnings as error for distcheck
1683
@<:@default=no@:>@]),
1684
[enable_distcheckwerror=$enableval],[enable_distcheckwerror="no"])
1686
# Enable distcheck warnings and Werror only for gcc versions that support them,
1687
# and only after we've run the configure tests.
1688
# Some configure tests fail (like checking for cos in -lm) if we enable these
1689
# Werror flags for configure too (for example -Wstrict-prototypes makes
1690
# configure think that -lm doesn't have cos, hence its in libc).
1693
if test "x$enable_distcheckwerror" = "xyes"; then
1694
if test "$distcheck_enable_flags" = "1"; then
1695
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"
1696
WERR_CFLAGS="$WERR_COMMON -Wwrite-strings"
1697
WERR_CFLAGS_MILTER="$WERR_COMMON -Wno-error=format-nonliteral"
1700
AC_SUBST([WERR_CFLAGS])
1701
AC_SUBST([WERR_CFLAGS_MILTER])
1703
AC_ARG_ENABLE([llvm],AC_HELP_STRING([--enable-llvm],
1704
[Enable 'llvm' JIT/verifier support @<:@default=auto@:>@]),
1705
[enable_llvm=$enableval], [enable_llvm="auto"])
1707
if test "$enable_llvm" != "no"; then
1708
dnl Try to configure subdir, optionally
1709
AC_CONFIG_SUBDIRS_OPTIONAL([libclamav/c++])
1712
AC_ARG_ENABLE([sha-collector-for-internal-use], [], [enable_sha_collector="yes"], [enable_sha_collector="no"])
1713
if test "$enable_sha_collector" != "no"; then
1714
AC_DEFINE([HAVE__INTERNAL__SHA_COLLECT], 1, [For internal use only - DO NOT DEFINE])
1723
clamav-milter/Makefile
1736
docs/man/clamav-milter.8
1737
docs/man/clamav-milter.conf.5
1741
docs/man/clamd.conf.5
1742
docs/man/clamdscan.1
1744
docs/man/freshclam.1
1745
docs/man/freshclam.conf.5
1750
if test "$enable_llvm" = "yes" && test "$subdirfailed" != "no"; then
1751
AC_MSG_ERROR([Failed to configure LLVM, and LLVM was explicitly requested])
1753
AM_CONDITIONAL([ENABLE_LLVM],
1754
[test "$subdirfailed" != "yes" && test "$enable_llvm" != "no"])
1756
AC_OUTPUT([libclamav/Makefile])
1758
# Print a summary of what features we enabled
1759
AC_MSG_NOTICE([Summary of detected features follows])
1763
pthreads : $have_pthreads ($THREAD_LIBS)
1766
AC_MSG_NOTICE([Summary of miscellaneous features])
1767
if test "x$CHECK_LIBS" = "x"; then
1770
check_libs="$CHECK_LIBS"
1772
CL_MSG_STATUS([check ],[$check_libs],[$enable_check_ut])
1773
CL_MSG_STATUS([fanotify ],[$want_fanotify],[$want_fanotify])
1774
if test "x$ac_cv_have_control_in_msghdr" = "xyes"; then
1775
CL_MSG_STATUS([fdpassing ],[$have_fdpass],[$want_fdpassing])
1777
CL_MSG_STATUS([fdpassing ],[n/a],[])
1779
CL_MSG_STATUS([IPv6 ],[$have_cv_ipv6],[$want_ipv6])
1781
AC_MSG_NOTICE([Summary of optional tools])
1782
CL_MSG_STATUS([clamdtop ],[$CURSES_LIBS],[$enable_clamdtop])
1783
CL_MSG_STATUS([milter ],[yes],[$have_milter])
1785
AC_MSG_NOTICE([Summary of engine performance features)])
1786
if test "x$enable_debug" = "xyes"; then
1787
CL_MSG_STATUS([release mode],[no],[debug build])
1789
CL_MSG_STATUS([release mode],[yes],[yes])
1792
if test "$subdirfailed" = "no"; then
1795
CL_MSG_STATUS([jit ],[$have_jit],[$enable_llvm])
1796
CL_MSG_STATUS([mempool ],[$have_mempool],[$enable_mempool])
1798
AC_MSG_NOTICE([Summary of engine detection features])
1799
CL_MSG_STATUS([autoit_ea06 ],[$have_autoitea06],[])
1800
CL_MSG_STATUS([bzip2 ],[$bzip_check],[$want_bzip2])
1801
CL_MSG_STATUS([zlib ],[$ZLIB_HOME],[yes])
1802
CL_MSG_STATUS([unrar ],[$want_unrar],[$want_unrar])
1803
if test "x$XML_LIBS" = "x"; then
1804
CL_MSG_STATUS([dmg and xar ],[no],[])
1806
CL_MSG_STATUS([dmg and xar ],[yes, from $XML_HOME],[])
1809
# Yep, downgrading the compiler avoids the bug too:
1810
# 4.0.x, and 4.1.0 are the known buggy versions
1811
# 3.4 doesn't have the bug
1812
if test "x$gcc_check" != "xyes"; then
1814
****** Optimizations disabled to avoid compiler bugs
1815
****** The resulting binaries will be slow!
1816
****** It is recommended to either upgrade or downgrade your compiler
1820
if test "x$cross_compiling" != "xno" || test "x$gcc_check" != "xyes" || test "x$zlib_check" = "xno" || test "x$bzip_check" != "xok" ; then
1823
****** You are cross compiling to a different host or you are
1824
****** linking to bugged system libraries or you have manually
1825
****** disabled important configure checks.
1826
****** Please be aware that this build may be badly broken.
1827
****** DO NOT REPORT BUGS BASED ON THIS BUILD !!!