~vcs-imports/clamav/main-old

« back to all changes in this revision

Viewing changes to configure.in

  • Committer: nervoso
  • Date: 2006-05-21 15:16:39 UTC
  • Revision ID: Arch-1:clamav@arch.ubuntu.com%clamav--MAIN--0--patch-1959
repository moved to cvs.clamav.net

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl
2
 
dnl   Copyright (C) 2002 - 2006 Tomasz Kojm <tkojm@clamav.net>
3
 
dnl   gethostbyname_r and readdir_r checks (c) COPYRIGHT MIT 1995
4
 
dnl
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.
9
 
dnl
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.
14
 
dnl
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.
19
 
 
20
 
AC_INIT(clamscan/clamscan.c)
21
 
AC_CREATE_TARGET_H(target.h)
22
 
AM_INIT_AUTOMAKE(clamav, "devel-`date +%Y%m%d`")
23
 
AM_CONFIG_HEADER(clamav-config.h)
24
 
 
25
 
LC_CURRENT=1
26
 
LC_REVISION=10
27
 
LC_AGE=0
28
 
LIBCLAMAV_VERSION="$LC_CURRENT":"$LC_REVISION":"$LC_AGE"
29
 
AC_SUBST(LIBCLAMAV_VERSION)
30
 
 
31
 
AC_PROG_AWK
32
 
AC_PROG_CC
33
 
AC_PROG_INSTALL
34
 
AC_PROG_LN_S
35
 
AC_PROG_MAKE_SET
36
 
AC_PROG_LIBTOOL
37
 
 
38
 
AC_DEFINE(SCANBUFF, 131072, [scan buffer size])
39
 
AC_DEFINE(FILEBUFF, 8192,   [file i/o buffer size])
40
 
 
41
 
AC_HEADER_STDC
42
 
AC_CHECK_HEADERS(stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.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 regex.h limits.h sys/filio.h sys/uio.h)
43
 
AC_CHECK_HEADER(syslog.h,AC_DEFINE(USE_SYSLOG,1,[use syslog]),)
44
 
 
45
 
AC_TYPE_OFF_T
46
 
AC_COMPILE_CHECK_SIZEOF(short)
47
 
AC_COMPILE_CHECK_SIZEOF(int)
48
 
AC_COMPILE_CHECK_SIZEOF(long)
49
 
AC_COMPILE_CHECK_SIZEOF(long long)
50
 
 
51
 
AC_CHECK_LIB(socket, bind, [LIBS="$LIBS -lsocket"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"; LDFLAGS="$LDFLAGS -lsocket"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lsocket"; CLAMD_LIBS="$CLAMD_LIBS -lsocket"])
52
 
AC_CHECK_LIB(nsl, gethostent, [LIBS="$LIBS -lnsl"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lnsl"; LDFLAGS="$LDFLAGS -lnsl"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lnsl"; CLAMD_LIBS="$CLAMD_LIBS -lnsl"])
53
 
 
54
 
AC_CHECK_FUNCS(poll setsid memcpy snprintf vsnprintf strerror_r strlcpy strlcat inet_ntop setgroups initgroups ctime_r)
55
 
AC_FUNC_MMAP
56
 
AC_FUNC_FSEEKO
57
 
 
58
 
dnl Check for broken snprintf (code by Phil Oleson <oz*nixil.net>)
59
 
if test "x$ac_cv_func_snprintf" = "xyes" ; then
60
 
        AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
61
 
        AC_TRY_RUN(
62
 
                [
63
 
#include <stdio.h>
64
 
int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
65
 
                ],
66
 
                [AC_MSG_RESULT(yes)],
67
 
                [
68
 
                        AC_MSG_RESULT(no)
69
 
                        AC_DEFINE(BROKEN_SNPRINTF,1,[Define if your snprintf is busted])
70
 
                        AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
71
 
                ]
72
 
        )
73
 
fi
74
 
 
75
 
have_pthreads=no
76
 
AC_CHECK_HEADER(pthread.h,[have_pthreads=yes],)
77
 
 
78
 
AM_MAINTAINER_MODE
79
 
dnl Check for zlib
80
 
AC_MSG_CHECKING(for zlib installation)
81
 
AC_ARG_WITH(zlib,
82
 
[  --with-zlib=DIR        path to directory containing zlib library (default=
83
 
                          /usr/local or /usr if not found in /usr/local)],
84
 
[
85
 
if test "$withval"; then
86
 
  ZLIB_HOME="$withval"
87
 
  AC_MSG_RESULT(using $ZLIB_HOME)
88
 
fi
89
 
], [
90
 
ZLIB_HOME=/usr/local
91
 
if test ! -f "$ZLIB_HOME/include/zlib.h"
92
 
then
93
 
  ZLIB_HOME=/usr
94
 
fi
95
 
AC_MSG_RESULT($ZLIB_HOME)
96
 
])
97
 
 
98
 
AC_ARG_ENABLE(zlib-vcheck,
99
 
[  --disable-zlib-vcheck          do not check for buggy zlib version ],
100
 
zlib_check=$enableval, zlib_check="yes")
101
 
 
102
 
if test ! -f "$ZLIB_HOME/include/zlib.h"
103
 
then
104
 
    AC_MSG_ERROR(Please install zlib and zlib-devel packages)
105
 
else
106
 
 
107
 
    vuln=`grep "ZLIB_VERSION \"1.2.0" $ZLIB_HOME/include/zlib.h`
108
 
    if test -z "$vuln"; then
109
 
        vuln=`grep "ZLIB_VERSION \"1.2.1" $ZLIB_HOME/include/zlib.h`
110
 
    fi
111
 
 
112
 
    if test -n "$vuln"; then
113
 
        if test "$zlib_check" = "yes"; then
114
 
            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!)
115
 
        else
116
 
            AC_MSG_WARN([****** This ClamAV installation may be linked against])
117
 
            AC_MSG_WARN([****** a broken zlib version. Please DO NOT report any])
118
 
            AC_MSG_WARN([****** stability problems to the ClamAV developers!])
119
 
        fi
120
 
    fi
121
 
 
122
 
    if test "$ZLIB_HOME" != "/usr"; then
123
 
        LDFLAGS="$LDFLAGS -L$ZLIB_HOME/lib"
124
 
        CPPFLAGS="$CPPFLAGS -I$ZLIB_HOME/include"
125
 
        AC_CHECK_LIB(z, inflateEnd, [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -L$ZLIB_HOME/lib -lz"; AC_DEFINE(HAVE_ZLIB_H,1,zlib installed)], AC_MSG_ERROR(Please install zlib and zlib-devel packages))
126
 
    else
127
 
        AC_CHECK_LIB(z, inflateEnd, [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lz"; AC_DEFINE(HAVE_ZLIB_H,1,zlib installed)], AC_MSG_ERROR(Please install zlib and zlib-devel packages))
128
 
    fi
129
 
fi
130
 
 
131
 
AC_ARG_ENABLE(bzip2,
132
 
[  --disable-bzip2        disable bzip2 support],
133
 
want_bzip2=$enableval, want_bzip2="yes")
134
 
 
135
 
if test "$want_bzip2" = "yes"
136
 
then
137
 
    AC_CHECK_LIB(bz2, bzReadOpen, AC_DEFINE(NOBZ2PREFIX,1,bzip funtions do not have bz2 prefix),)
138
 
    AC_CHECK_HEADER(bzlib.h,[LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lbz2"; AC_DEFINE(HAVE_BZLIB_H,1,have bzip2)], AC_MSG_WARN([****** bzip2 support disabled]))
139
 
fi
140
 
 
141
 
AC_ARG_ENABLE(hwaccel,
142
 
[  --disable-hwaccel      disable support for hardware acceleration],
143
 
want_hwaccel=$enableval, want_hwaccel="yes")
144
 
 
145
 
if test "$want_hwaccel" = "yes"
146
 
then
147
 
    AC_CHECK_LIB(sn_sigscan, sn_sigscan_initdb, have_sigscan=yes,)
148
 
    if test "$have_sigscan" = "yes"
149
 
    then
150
 
        AC_CHECK_HEADER(sn_sigscan/sn_sigscan.h,[LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lsn_sigscan"; AC_DEFINE(HAVE_HWACCEL,1,hardware acceleration)], AC_MSG_WARN([****** hardware acceleration support disabled -- please install libsigscan-devel ]))
151
 
    fi
152
 
fi
153
 
 
154
 
AC_ARG_ENABLE(dns,
155
 
    AC_HELP_STRING([--disable-dns], [disable support for database verification through DNS]),
156
 
    [want_dns=$enableval], [want_dns=yes]
157
 
)
158
 
if test $want_dns = yes; then
159
 
    AC_CHECK_LIB(resolv, __dn_expand, resolv_lib="-lresolv",)
160
 
    if test -z "$resolv_lib"; then
161
 
        AC_CHECK_LIB(resolv, dn_expand, resolv_lib="-lresolv",)
162
 
    fi
163
 
    AC_CHECK_HEADER(resolv.h,[FRESHCLAM_LIBS="$FRESHCLAM_LIBS $resolv_lib"; AC_DEFINE(HAVE_RESOLV_H,1,have resolv.h)], AC_MSG_WARN([****** DNS support disabled]))
164
 
fi
165
 
 
166
 
AC_ARG_ENABLE(clamuko,
167
 
[  --disable-clamuko      disable clamuko support (Linux, DragonFly and FreeBSD only)],
168
 
want_clamuko=$enableval, want_clamuko="yes")
169
 
 
170
 
AC_FUNC_SETPGRP
171
 
 
172
 
AC_ARG_ENABLE(milter,
173
 
[  --enable-milter        build clamav-milter],
174
 
have_milter=$enableval, have_milter="no")
175
 
 
176
 
if test "$have_milter" = "yes"; then
177
 
  sendmailprog=no
178
 
  AC_ARG_WITH(sendmail,
179
 
  [  --with-sendmail=PATH    specify location of Sendmail binary (default=auto find)],
180
 
  sendmailprog=$with_sendmail, sendmailprog=no)
181
 
 
182
 
  if test "$sendmailprog" = "no" ; then
183
 
    AC_PATH_PROG(sendmailprog, sendmail, no, $PATH:/sbin:/usr/sbin:/usr/lib:/usr/libexec)
184
 
  fi
185
 
 
186
 
  AC_DEFINE_UNQUOTED(SENDMAIL_BIN, "$sendmailprog", [location of Sendmail binary])
187
 
 
188
 
  sendmailver=`$sendmailprog -d0 < /dev/null | head -1 | awk '{print $2}'`
189
 
 
190
 
  if test -n "$sendmailver"; then
191
 
    sendmailver_a=`echo $sendmailver | awk -F. '{printf $1}'`
192
 
    sendmailver_b=`echo $sendmailver | awk -F. '{printf $2}'`
193
 
    sendmailver_c=`echo $sendmailver | awk -F. '{printf $3}'`
194
 
 
195
 
    AC_DEFINE_UNQUOTED(SENDMAIL_VERSION_A, $sendmailver_a, [major version of Sendmail])
196
 
    AC_DEFINE_UNQUOTED(SENDMAIL_VERSION_B, $sendmailver_b, [minor version of Sendmail])
197
 
    AC_DEFINE_UNQUOTED(SENDMAIL_VERSION_C, $sendmailver_c, [subversion of Sendmail])
198
 
  fi
199
 
fi
200
 
 
201
 
AC_ARG_ENABLE(dsig,
202
 
[  --disable-dsig         disable support for digital signatures],
203
 
want_dsig=$enableval, want_dsig="yes")
204
 
 
205
 
if test "$want_dsig" = "yes"
206
 
then
207
 
    AC_CHECK_LIB(gmp, __gmpz_init, [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lgmp"; AC_DEFINE(HAVE_GMP,1,have gmp installed)], [AC_CHECK_LIB(gmp, mpz_init, [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lgmp"; AC_DEFINE(HAVE_GMP,1,have gmp installed)], AC_MSG_WARN([****** GNU MP 2 or newer NOT FOUND - digital signature support will be disabled !]); want_dsig="no")])
208
 
fi
209
 
 
210
 
dnl libcurl
211
 
AC_ARG_WITH(libcurl,
212
 
[  --with-libcurl         support URLs downloading with libcurl (default=auto)],
213
 
[ case "$withval" in
214
 
  yes|no) lcurl="$withval" ;;
215
 
  *)      AC_MSG_ERROR([--with-libcurl does not take an argument]) ;;
216
 
  esac],
217
 
[ lcurl=auto ])
218
 
 
219
 
dnl Based on http://curl.signal42.com/libcurl/using/autoconf.html
220
 
if test "$lcurl" != "no"
221
 
then
222
 
    my_cv_curl_vers=NONE
223
 
    dnl check is the plain-text version of the required version
224
 
    check="7.10.0"
225
 
    dnl check_hex must be UPPERCASE if any hex letters are present
226
 
    check_hex="070A00"
227
 
 
228
 
    AC_MSG_CHECKING([for curl >= $check])
229
 
 
230
 
    if eval curl-config --version 2>/dev/null >/dev/null; then
231
 
        ver=`curl-config --version | sed -e "s/libcurl //g"`
232
 
        hex_ver=`curl-config --vernum | tr 'a-f' 'A-F'`
233
 
        fail=`echo "ibase=16; if($hex_ver<$check_hex) 1" | bc`
234
 
 
235
 
        if test x$fail != x1; then
236
 
            curl_libs=`curl-config --libs`
237
 
            # openssl libs are required to link libcurl
238
 
            openssl_libs="`pkg-config --libs openssl`"
239
 
            curl_flags=`curl-config --cflags`
240
 
            LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS $curl_libs $openssl_libs"
241
 
            CPPFLAGS="$CPPFLAGS -I$ZLIB_HOME/include $curl_flags"
242
 
            my_cv_curl_vers="$ver"
243
 
            AC_MSG_RESULT([$my_cv_curl_vers])
244
 
            AC_DEFINE(WITH_CURL,1,use libcurl in mbox code)
245
 
        else
246
 
            AC_MSG_RESULT(FAILED)
247
 
            AC_MSG_WARN([$ver is too old. Need version $check or higher.])
248
 
        fi
249
 
    else
250
 
        AC_MSG_RESULT(FAILED)
251
 
        AC_MSG_WARN([curl-config was not found])
252
 
    fi
253
 
fi
254
 
 
255
 
AC_ARG_ENABLE(pthreads,
256
 
[  --disable-pthreads      disable POSIX threads support],
257
 
have_pthreads=$enableval,)
258
 
 
259
 
AC_ARG_ENABLE(cr,
260
 
[  --disable-cr           don't link with C reentrant library (BSD) ],
261
 
use_cr=$enableval,)
262
 
 
263
 
AC_ARG_ENABLE(id-check,
264
 
[  --enable-id-check      use id utility instead of /etc/passwd parsing],
265
 
use_id=$enableval, use_id="no")
266
 
 
267
 
AC_ARG_ENABLE(yp-check,
268
 
[  --enable-yp-check      use ypmatch utility instead of /etc/passwd parsing],
269
 
use_yp=$enableval, use_yp="no")
270
 
 
271
 
AC_ARG_WITH(user, 
272
 
[  --with-user=uid        name of the clamav user (default=clamav)],
273
 
clamav_user="$withval", clamav_user="clamav")
274
 
 
275
 
AC_ARG_WITH(group, 
276
 
[  --with-group=gid       name of the clamav group (default=clamav)],
277
 
clamav_group="$withval", clamav_group="clamav")
278
 
 
279
 
AC_DEFINE_UNQUOTED(CLAMAVUSER,"$clamav_user",[name of the clamav user])
280
 
AC_DEFINE_UNQUOTED(CLAMAVGROUP,"$clamav_group",[name of the clamav group])
281
 
 
282
 
AC_ARG_ENABLE(clamav,
283
 
[  --disable-clamav       disable test for clamav user/group],
284
 
test_clamav=$enableval, test_clamav=yes)
285
 
 
286
 
AC_ARG_ENABLE(debug,
287
 
[  --enable-debug         enable debug code],
288
 
enable_debug=$enableval, enable_debug="no")
289
 
 
290
 
if test "$enable_debug" = "yes"; then
291
 
  AC_DEFINE(CL_DEBUG,1,[enable debugging])
292
 
fi
293
 
 
294
 
AC_ARG_ENABLE(bigstack,
295
 
[  --enable-bigstack      increase thread stack size],
296
 
enable_bigstack=$enableval, enable_bigstack="no")
297
 
 
298
 
if test "$enable_bigstack" = "yes"; then
299
 
  AC_DEFINE(C_BIGSTACK,1,[Increase thread stack size.])
300
 
fi
301
 
 
302
 
AC_ARG_WITH(dbdir, 
303
 
[  --with-dbdir=path      path to virus database directory],
304
 
db_dir="$withval", db_dir="_default_")
305
 
 
306
 
AC_ARG_WITH(db1, 
307
 
[  --with-db1=name        name of the main database (default=main.cvd)],
308
 
AC_DEFINE_UNQUOTED(DB1NAME,"$withval",[Name of the main database]), AC_DEFINE(DB1NAME, "main.cvd",[Name of the main database]))
309
 
 
310
 
AC_ARG_WITH(db2, 
311
 
[  --with-db2=name        name of the daily database (default=daily.cvd)],
312
 
AC_DEFINE_UNQUOTED(DB2NAME,"$withval",[Name of the daily database]), AC_DEFINE(DB2NAME, "daily.cvd",[Name of the daily database]))
313
 
 
314
 
dnl I had problems with $pkgdatadir thus these funny checks
315
 
if test "$db_dir" = "_default_"
316
 
then
317
 
    if test "$prefix" = "NONE"
318
 
    then
319
 
        db_dir="$ac_default_prefix/share/clamav"
320
 
    else
321
 
        db_dir="$prefix/share/clamav"
322
 
    fi
323
 
fi
324
 
 
325
 
AC_DEFINE_UNQUOTED(DATADIR,"$db_dir", [Path to virus database directory.])
326
 
DBDIR="$db_dir"
327
 
AC_SUBST(DBDIR)
328
 
 
329
 
dnl configure config directory
330
 
cfg_dir=`echo $sysconfdir | grep prefix`
331
 
 
332
 
if test -n "$cfg_dir"; then
333
 
    if test "$prefix" = "NONE"
334
 
    then
335
 
        cfg_dir="$ac_default_prefix/etc"
336
 
    else
337
 
        cfg_dir="$prefix/etc"
338
 
    fi
339
 
else
340
 
    cfg_dir="$sysconfdir"
341
 
fi
342
 
 
343
 
CFGDIR=$cfg_dir
344
 
AC_SUBST(CFGDIR)
345
 
AC_DEFINE_UNQUOTED(CONFDIR,"$cfg_dir",[where to look for the config file])
346
 
 
347
 
dnl check for in_port_t definition
348
 
AC_TRY_RUN([
349
 
#include <sys/types.h>
350
 
#include <netinet/in.h>
351
 
int main(int argc, char **argv) { in_port_t pt; pt = 0; return pt; }
352
 
], AC_DEFINE(HAVE_IN_PORT_T,1,[in_port_t is defined]), AC_MSG_RESULT(in_port_t is not defined))
353
 
 
354
 
dnl check for in_addr_t definition
355
 
AC_TRY_RUN([
356
 
#include <sys/types.h>
357
 
#include <netinet/in.h>
358
 
int main(int argc, char **argv) { in_addr_t pt; pt = 0; return pt; }
359
 
], AC_DEFINE(HAVE_IN_ADDR_T,1,[in_addr_t is defined]), AC_MSG_RESULT(in_addr_t is not defined))
360
 
 
361
 
case "$target_os" in
362
 
linux*)
363
 
    AC_DEFINE(C_LINUX,1,[target is linux])
364
 
    if test "$have_pthreads" = "yes"; then
365
 
        LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
366
 
        TH_SAFE="-thread-safe"
367
 
        AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
368
 
        AC_DEFINE(_REENTRANT,1,[thread safe])
369
 
        CLAMD_LIBS="$CLAMD_LIBS -lpthread"
370
 
        CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
371
 
        if test "$want_clamuko" = "yes"; then
372
 
            AC_DEFINE(CLAMUKO,1,[enable clamuko])
373
 
        fi
374
 
        CLAMSCAN_LIBS="$CLAMSCAN_LIBS -lpthread"
375
 
    fi
376
 
    case `uname -r` in
377
 
    1.*|2.0.*)
378
 
       AC_DEFINE(INCOMPLETE_CMSG,1,[Early Linux doesn't set cmsg fields])
379
 
       ;;
380
 
    esac
381
 
    ;;
382
 
cygwin*)
383
 
    AC_DEFINE(C_CYGWIN,1,[os is cygwin])
384
 
    if test "$test_clamav" = "yes"; then
385
 
        if test ! -r /etc/passwd; then
386
 
           test_clamav="no"
387
 
        fi
388
 
    fi
389
 
    if test "$have_pthreads" = "yes"; then
390
 
        LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
391
 
        TH_SAFE="-thread-safe"
392
 
        AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
393
 
        AC_DEFINE(_REENTRANT,1,[thread safe])
394
 
    fi
395
 
    use_gethostbyname_r="no"
396
 
    ;;
397
 
solaris*)
398
 
    FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lresolv"
399
 
    if test "$have_pthreads" = "yes"; then
400
 
        LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
401
 
        CLAMD_LIBS="$CLAMD_LIBS -lpthread -lresolv"
402
 
        CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread -lresolv"
403
 
        TH_SAFE="-thread-safe"
404
 
        AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
405
 
        AC_DEFINE(_REENTRANT,1,[thread safe])
406
 
    fi
407
 
    AC_DEFINE(C_SOLARIS,1,[os is solaris])
408
 
    ;;
409
 
freebsd*)
410
 
    if test "$have_pthreads" = "yes"; then
411
 
        LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -pthread -lc_r"
412
 
        CLAMD_LIBS="$CLAMD_LIBS -pthread -lc_r"
413
 
        CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread -lc_r"
414
 
        TH_SAFE="-thread-safe"
415
 
        AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
416
 
        AC_DEFINE(_REENTRANT,1,[thread safe])
417
 
        if test "$want_clamuko" = "yes"; then
418
 
            AC_DEFINE(CLAMUKO,1,[enable clamuko])
419
 
        fi
420
 
    fi
421
 
    AC_DEFINE(C_BSD,1,[os is freebsd])
422
 
    use_gethostbyname_r="no"
423
 
    ;;
424
 
dragonfly*)
425
 
    if test "$have_pthreads" = "yes"; then
426
 
        LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -pthread"
427
 
        CLAMD_LIBS="$CLAMD_LIBS -pthread"
428
 
        CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread"
429
 
        TH_SAFE="-thread-safe"
430
 
        AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
431
 
        AC_DEFINE(_REENTRANT,1,[thread safe])
432
 
        if test "$want_clamuko" = "yes"; then
433
 
            AC_DEFINE(CLAMUKO,1,[enable clamuko])
434
 
        fi
435
 
    fi
436
 
    AC_DEFINE(C_BSD,1,[os is dragonfly])
437
 
    use_gethostbyname_r="no"
438
 
    ;;
439
 
openbsd*)
440
 
    if test "$have_pthreads" = "yes"; then
441
 
        LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -pthread"
442
 
        if test "$use_cr" = "no"; then
443
 
            CLAMD_LIBS="$CLAMD_LIBS -pthread"
444
 
            CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread"
445
 
        else
446
 
            CLAMD_LIBS="$CLAMD_LIBS -pthread -lc_r"
447
 
            CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread -lc_r"
448
 
        fi
449
 
        TH_SAFE="-thread-safe"
450
 
        AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
451
 
        AC_DEFINE(_REENTRANT,1,[thread safe])
452
 
    fi
453
 
    AC_DEFINE(C_BSD,1,[os is OpenBSD])
454
 
    use_gethostbyname_r="no"
455
 
    ;;
456
 
bsdi*)
457
 
    if test "$have_pthreads" = "yes"; then
458
 
        LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -pthread"
459
 
        CLAMD_LIBS="$CLAMD_LIBS -pthread"
460
 
        CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -pthread"
461
 
        TH_SAFE="-thread-safe"
462
 
        AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
463
 
        AC_DEFINE(_REENTRANT,1,[thread safe])
464
 
    fi
465
 
    AC_DEFINE(C_BSD,1,[os is BSDI BSD/OS])
466
 
    use_gethostbyname_r="no"
467
 
    ;;
468
 
netbsd*)
469
 
     if test "$have_pthreads" = "yes"; then
470
 
        LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
471
 
        CLAMD_LIBS="-lpthread"
472
 
        CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
473
 
        AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
474
 
        AC_DEFINE(_REENTRANT,1,[thread safe])
475
 
        ADDITIONAL_LIBS="$LIBS -lpthread"
476
 
     fi
477
 
    AC_DEFINE(C_BSD,1,[os is NetBSD])
478
 
    use_gethostbyname_r="no"
479
 
    ;;
480
 
bsd*)
481
 
    AC_MSG_RESULT(Unknown BSD detected. Disabling thread support.)
482
 
    have_pthreads="no"
483
 
    AC_DEFINE(C_BSD,1,[os is bsd flavor])
484
 
    use_gethostbyname_r="no"
485
 
    ;;
486
 
beos*)
487
 
    AC_MSG_RESULT(BeOS detected. Disabling thread support.)
488
 
    have_pthreads="no"
489
 
    AC_DEFINE(C_BEOS,1,[os is beos])
490
 
    ;;
491
 
darwin*)
492
 
    AC_DEFINE(C_BSD,1,[os is bsd flavor])
493
 
    AC_DEFINE(C_DARWIN,1,[os is darwin])
494
 
    AC_DEFINE(BIND_8_COMPAT,1,[enable bind8 compatibility])
495
 
    use_netinfo="yes"
496
 
    use_gethostbyname_r="no"
497
 
    ;;
498
 
os2*)
499
 
    FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lsyslog"
500
 
    CLAMD_LIBS="$CLAMD_LIBS -lsyslog"
501
 
    CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsyslog"
502
 
    if test "$have_pthreads" = "yes"; then
503
 
        LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
504
 
        CLAMD_LIBS="$CLAMD_LIBS -lpthread"
505
 
        CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
506
 
        TH_SAFE="-thread-safe"
507
 
        AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
508
 
        AC_DEFINE(_REENTRANT,1,[thread safe])
509
 
    fi
510
 
    AC_DEFINE(C_OS2,1,[os is OS/2])
511
 
    ;;
512
 
sco*)
513
 
    dnl njh@bandsman.sco.uk: SCO Unix port
514
 
    dnl FRESHCLAM_LIBS="-lsocket"
515
 
    dnl CLAMD_LIBS="-lsocket"
516
 
    dnl CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket"
517
 
    ;;
518
 
hpux*)
519
 
    if test "$have_pthreads" = "yes"; then
520
 
        LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
521
 
        CLAMD_LIBS="$CLAMD_LIBS -lpthread"
522
 
        CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
523
 
        TH_SAFE="-thread-safe"
524
 
        AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
525
 
        AC_DEFINE(_REENTRANT,1,[thread safe])
526
 
    fi
527
 
    AC_DEFINE(C_HPUX,1,[os is hpux])
528
 
    ;;
529
 
aix*)
530
 
    if test "$have_pthreads" = "yes"; then
531
 
        LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
532
 
        CLAMD_LIBS="$CLAMD_LIBS -lpthread"
533
 
        CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
534
 
        TH_SAFE="-thread-safe"
535
 
        AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
536
 
        AC_DEFINE(_REENTRANT,1,[thread safe])
537
 
    fi
538
 
    AC_DEFINE(C_AIX,1,[os is aix])
539
 
    ;;
540
 
nto-qnx*)
541
 
     if test "$have_pthreads" = "yes"; then
542
 
       AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
543
 
       AC_DEFINE(_REENTRANT,1,[thread safe])
544
 
     fi
545
 
    AC_DEFINE(C_QNX6,1,[os is QNX 6.x.x])
546
 
    ;;
547
 
irix*)
548
 
    if test "$have_pthreads" = "yes"; then
549
 
        LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
550
 
        CLAMD_LIBS="$CLAMD_LIBS -lpthread"
551
 
        CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread"
552
 
        TH_SAFE="-thread-safe"
553
 
        AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
554
 
        AC_DEFINE(_REENTRANT,1,[thread safe])
555
 
    fi
556
 
    AC_DEFINE(C_IRIX,1,[os is irix])
557
 
    ;;
558
 
interix*)
559
 
    AC_DEFINE(C_INTERIX,1,[os is interix])
560
 
    if test "$test_clamav" = "yes"; then
561
 
        if test ! -r /etc/passwd; then
562
 
           test_clamav="no"
563
 
        fi
564
 
    fi
565
 
    if test "$have_pthreads" = "yes"; then
566
 
        LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread"
567
 
        TH_SAFE="-thread-safe"
568
 
        AC_DEFINE(CL_THREAD_SAFE,1,[thread safe])
569
 
        AC_DEFINE(_REENTRANT,1,[thread safe])
570
 
    fi
571
 
    ;;
572
 
*)
573
 
    ;;
574
 
esac
575
 
 
576
 
AC_SUBST(LIBCLAMAV_LIBS)
577
 
AC_SUBST(CLAMD_LIBS)
578
 
AC_SUBST(CLAMAV_MILTER_LIBS)
579
 
AC_SUBST(FRESHCLAM_LIBS)
580
 
AC_SUBST(TH_SAFE)
581
 
AC_SUBST(ADDITIONAL_LIBS)
582
 
 
583
 
dnl --enable-milter
584
 
if test "$have_milter" = "yes"; then
585
 
    dnl libmilter checking code adapted from spamass-milter by
586
 
    dnl Tom G. Christensen <tgc@statsbiblioteket.dk>
587
 
 
588
 
    dnl Check for libmilter and it's header files in the usual locations
589
 
    save_LDFLAGS="$LDFLAGS"
590
 
    if test -d /usr/lib/libmilter ; then
591
 
        CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -L/usr/lib/libmilter"
592
 
    fi
593
 
    LDFLAGS="$LDFLAGS -lmilter $CLAMAV_MILTER_LIBS"
594
 
    AC_CHECK_LIB(milter, mi_stop,[CLAMAV_MILTER_LIBS="-lmilter $CLAMAV_MILTER_LIBS"],[
595
 
        dnl Older sendmails require libsm or libsmutil for support functions
596
 
        AC_SEARCH_LIBS(strlcpy, [sm smutil], [test "$ac_cv_search_strlcpy" = "none required" || CLAMAV_MILTER_XLIB="$ac_cv_search_strlcpy"])
597
 
        LDFLAGS="$save_LDFLAGS $CLAMAV_MILTER_LIBS $CLAMAV_MILTER_XLIB"
598
 
        $as_unset ac_cv_lib_milter_mi_stop
599
 
        AC_CHECK_LIB(milter, mi_stop,[CLAMAV_MILTER_LIBS="-lmilter $CLAMAV_MILTER_XLIB $CLAMAV_MILTER_LIBS"],[
600
 
            AC_MSG_ERROR([Cannot find libmilter])
601
 
        ])
602
 
    ])
603
 
    LDFLAGS="$save_LDFLAGS"
604
 
    AC_CHECK_HEADERS(libmilter/mfapi.h,have_milter="yes",[
605
 
        AC_MSG_ERROR([Please install mfapi.h from the sendmail distribution])
606
 
    ])
607
 
fi
608
 
 
609
 
AM_CONDITIONAL(BUILD_CLAMD, test "$have_pthreads" = "yes")
610
 
AM_CONDITIONAL(HAVE_MILTER, test "$have_milter" = "yes")
611
 
 
612
 
if test "$have_pthreads" = "yes"
613
 
then
614
 
    AC_DEFINE(BUILD_CLAMD, 1, "build clamd")
615
 
fi
616
 
 
617
 
dnl Check if we can do fd passing
618
 
dnl Submitted by Richard Lyons <frob-clamav@webcentral.com.au>
619
 
AC_CHECK_FUNCS(recvmsg sendmsg)
620
 
AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
621
 
        ac_cv_have_accrights_in_msghdr, [
622
 
    AC_TRY_RUN(
623
 
        [
624
 
#include <sys/types.h>
625
 
#include <sys/socket.h>
626
 
#include <sys/uio.h>
627
 
int main() {
628
 
#ifdef msg_accrights
629
 
exit(1);
630
 
#endif
631
 
struct msghdr m;
632
 
m.msg_accrights = 0;
633
 
exit(0);
634
 
}
635
 
        ],
636
 
        [ ac_cv_have_accrights_in_msghdr="yes" ],
637
 
        [ ac_cv_have_accrights_in_msghdr="no" ]
638
 
    )
639
 
])
640
 
if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
641
 
    AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR,1,[access rights in msghdr])
642
 
fi
643
 
 
644
 
AC_CACHE_CHECK([for msg_control field in struct msghdr],
645
 
        ac_cv_have_control_in_msghdr, [
646
 
    AC_TRY_RUN(
647
 
        [
648
 
#include <sys/types.h>
649
 
#include <sys/socket.h>
650
 
#include <sys/uio.h>
651
 
int main() {
652
 
#ifdef msg_control
653
 
exit(1);
654
 
#endif
655
 
struct msghdr m;
656
 
m.msg_control = 0;
657
 
exit(0);
658
 
}
659
 
        ],
660
 
        [ ac_cv_have_control_in_msghdr="yes" ],
661
 
        [ ac_cv_have_control_in_msghdr="no" ]
662
 
    )
663
 
])
664
 
if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
665
 
    AC_DEFINE(HAVE_CONTROL_IN_MSGHDR,1,[ancillary data style fd pass])
666
 
fi
667
 
 
668
 
dnl tcpwrappers support
669
 
dnl rules from http://ma.ph-freiburg.de/tng/tng-technical/2002-01/msg00094.html
670
 
AC_ARG_WITH(tcpwrappers,
671
 
[  --with-tcpwrappers      support hosts.allow / hosts.deny (default=auto)],
672
 
[ case "$withval" in
673
 
  yes|no) tcpw="$withval" ;;
674
 
  *)      AC_MSG_ERROR([--with-tcpwrappers does not take an argument]) ;;
675
 
  esac],
676
 
[ tcpw=auto ])
677
 
 
678
 
if test "$tcpw" != "no" && test "$have_milter" = "yes" ; then
679
 
        AC_CHECK_HEADERS(tcpd.h,[
680
 
                AC_MSG_CHECKING([for TCP wrappers library])
681
 
                save_LIBS="$LIBS"
682
 
                LIBS="$LIBS -lwrap $FRESHCLAM_LIBS"
683
 
                AC_TRY_LINK([
684
 
#include <tcpd.h>
685
 
int allow_severity = 0;
686
 
int deny_severity  = 0;
687
 
 
688
 
struct request_info *req;
689
 
                ],[
690
 
hosts_access(req)
691
 
                ],[AC_MSG_RESULT([-lwrap])
692
 
                have_wrappers=yes
693
 
                LIBS="$save_LIBS"
694
 
                CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lwrap"],[
695
 
                dnl try with -lnsl
696
 
                LIBS="$LIBS -lnsl $FRESHCLAM_LIBS"
697
 
                AC_TRY_LINK([
698
 
#include <tcpd.h>
699
 
int allow_severity = 0;
700
 
int deny_severity  = 0;
701
 
 
702
 
struct request_info *req;
703
 
                ],[
704
 
hosts_access(req)
705
 
                ],[AC_MSG_RESULT([-lwrap -lnsl])
706
 
                have_wrappers=yes
707
 
                CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lwrap"],[
708
 
                AC_MSG_RESULT(no)
709
 
                have_wrappers=no
710
 
                LIBS=$save_LIBS])],[
711
 
                have_wrappers=no])],[have_wrappers=no])
712
 
 
713
 
        if test $have_wrappers = yes ; then
714
 
                AC_DEFINE(WITH_TCPWRAP,1, [tcpwrappers support])
715
 
        elif test $tcpw = yes ; then
716
 
                AC_MSG_ERROR([could not find TCP wrappers])
717
 
        else
718
 
                AC_MSG_WARN([could not find TCP wrappers, support disabled])
719
 
        fi
720
 
fi
721
 
 
722
 
dnl Check for gethostbyname_r and number of its arguments
723
 
dnl Code from libwww/configure.in
724
 
AC_MSG_CHECKING(for gethostbyname_r)
725
 
if test -z "$ac_cv_gethostbyname_args"; then
726
 
AC_TRY_COMPILE(
727
 
[
728
 
#include <sys/types.h>
729
 
#include <netdb.h>
730
 
],[
731
 
struct hostent *hp;
732
 
struct hostent h;
733
 
char *name;
734
 
char buffer[10];
735
 
int  h_errno;
736
 
hp = gethostbyname_r(name, &h, buffer, 10, &h_errno);
737
 
], ac_cv_gethostbyname_args=5)
738
 
fi
739
 
if test -z "$ac_cv_gethostbyname_args"; then
740
 
AC_TRY_COMPILE(
741
 
[
742
 
#include <sys/types.h>
743
 
#include <netdb.h>
744
 
],[
745
 
struct hostent h;
746
 
struct hostent_data hdata;
747
 
char *name;
748
 
int  rc;
749
 
rc = gethostbyname_r(name, &h, &hdata);
750
 
], ac_cv_gethostbyname_args=3)
751
 
fi
752
 
if test -z "$ac_cv_gethostbyname_args"; then
753
 
AC_TRY_COMPILE(
754
 
[
755
 
#include <sys/types.h>
756
 
#include <netdb.h>
757
 
], [
758
 
struct hostent h;
759
 
struct hostent *hp;
760
 
char *name;
761
 
char buf[10];
762
 
int rc;
763
 
int h_errno;
764
 
 
765
 
rc = gethostbyname_r(name, &h, buf, 10, &hp, &h_errno);
766
 
], ac_cv_gethostbyname_args=6)
767
 
fi
768
 
 
769
 
AC_ARG_ENABLE(gethostbyname_r,
770
 
[  --disable-gethostbyname_r      disable support for gethostbyname_r],
771
 
use_gethostbyname_r=$enableval,)
772
 
 
773
 
if test "$use_gethostbyname_r" = "no"; then
774
 
    AC_MSG_RESULT(support disabled)
775
 
elif test -z "$ac_cv_gethostbyname_args"; then
776
 
    AC_MSG_RESULT(no)
777
 
else
778
 
    if test "$ac_cv_gethostbyname_args" = 3; then
779
 
        AC_DEFINE(HAVE_GETHOSTBYNAME_R_3,1,[gethostbyname_r takes 3 arguments])
780
 
    elif test "$ac_cv_gethostbyname_args" = 5; then
781
 
        AC_DEFINE(HAVE_GETHOSTBYNAME_R_5,1,[gethostbyname_r takes 5 arguments])
782
 
    elif test "$ac_cv_gethostbyname_args" = 6; then
783
 
        AC_DEFINE(HAVE_GETHOSTBYNAME_R_6,1,[gethostbyname_r takes 6 arguments])
784
 
    fi
785
 
    AC_MSG_RESULT([yes, and it takes $ac_cv_gethostbyname_args arguments])
786
 
fi
787
 
 
788
 
dnl Check for readdir_r and number of its arguments
789
 
dnl Code from libwww/configure.in
790
 
 
791
 
AC_MSG_CHECKING(for readdir_r)
792
 
if test -z "$ac_cv_readdir_args"; then
793
 
    AC_TRY_COMPILE(
794
 
    [
795
 
#include <sys/types.h>
796
 
#include <dirent.h>
797
 
    ],
798
 
    [
799
 
    struct dirent dir, *dirp;
800
 
    DIR *mydir;
801
 
    dirp = readdir_r(mydir, &dir);
802
 
    ], ac_cv_readdir_args=2)
803
 
fi
804
 
if test -z "$ac_cv_readdir_args"; then
805
 
    AC_TRY_COMPILE(
806
 
        [
807
 
#include <sys/types.h>
808
 
#include <dirent.h>
809
 
    ],
810
 
    [
811
 
        struct dirent dir, *dirp;
812
 
        DIR *mydir;
813
 
        int rc;
814
 
        rc = readdir_r(mydir, &dir, &dirp);
815
 
    ], ac_cv_readdir_args=3)
816
 
fi
817
 
 
818
 
AC_ARG_ENABLE(readdir_r,
819
 
[  --enable-readdir_r               enable support for readdir_r],
820
 
enable_readdir_r=$enableval, enable_readdir_r="no")
821
 
 
822
 
if test "$enable_readdir_r" = "no"; then
823
 
    AC_MSG_RESULT(support disabled)
824
 
elif test -z "$ac_cv_readdir_args"; then
825
 
    AC_MSG_RESULT(no)
826
 
else
827
 
    if test "$ac_cv_readdir_args" = 2; then
828
 
        AC_DEFINE(HAVE_READDIR_R_2,1,[readdir_r takes 2 arguments])
829
 
    elif test "$ac_cv_readdir_args" = 3; then
830
 
        AC_DEFINE(HAVE_READDIR_R_3,1,[readdir_r takes 3 arguments])
831
 
    fi
832
 
    AC_MSG_RESULT([yes, and it takes $ac_cv_readdir_args arguments])
833
 
fi
834
 
 
835
 
AC_MSG_CHECKING(for ctime_r)
836
 
if test "$ac_cv_func_ctime_r" = "yes"; then
837
 
    AC_TRY_COMPILE([
838
 
        #include <time.h>
839
 
    ],[
840
 
        char buf[31];
841
 
        time_t t;
842
 
        ctime_r(&t, buf, 30);
843
 
    ],[
844
 
        ac_cv_ctime_args=3
845
 
        AC_DEFINE(HAVE_CTIME_R_3,1,[ctime_r takes 3 arguments])
846
 
    ],[
847
 
        ac_cv_ctime_args=2
848
 
        AC_DEFINE(HAVE_CTIME_R_2,1,[ctime_r takes 2 arguments])
849
 
    ])
850
 
 
851
 
    AC_MSG_RESULT([yes, and it takes $ac_cv_ctime_args arguments])
852
 
fi
853
 
 
854
 
dnl Check for clamav in /etc/passwd
855
 
if test "$test_clamav" = "yes"
856
 
then
857
 
    dnl parse /etc/passwd
858
 
    if test "$use_id" = "no"
859
 
    then
860
 
        AC_MSG_CHECKING(for $clamav_user in /etc/passwd)
861
 
        if test -r /etc/passwd; then
862
 
            clamavuser=`cat /etc/passwd|grep $clamav_user`
863
 
            clamavgroup=`cat /etc/group|grep $clamav_group`
864
 
        fi
865
 
    else
866
 
        AC_MSG_CHECKING(for $clamav_user using id)
867
 
        id $clamav_user > /dev/null 2>&1
868
 
        if test "$?" = 0 ; then
869
 
            clamavuser=1
870
 
            AC_PATH_PROG(GETENT, getent)
871
 
            if test -n "$GETENT" ; then
872
 
                clamavgroup=`$GETENT group | grep "^${clamav_group}:"`
873
 
            else
874
 
                clamavgroup=`cat /etc/group|grep $clamav_group`
875
 
            fi
876
 
        fi
877
 
    fi
878
 
 
879
 
    if test "$use_netinfo" = "yes"
880
 
    then
881
 
        AC_MSG_CHECKING(for $clamav_user using netinfo)
882
 
        clamavuser=`/usr/bin/nidump passwd . |grep ${clamav_user}`
883
 
        clamavgroup=`/usr/bin/nidump group . |grep ${clamav_group}`
884
 
    fi
885
 
 
886
 
    if test "$use_yp" = "yes"
887
 
    then
888
 
        AC_MSG_CHECKING(for $clamav_user using ypmatch)
889
 
        clamavuser=`ypmatch ${clamav_user} passwd`
890
 
        clamavgroup=`ypmatch ${clamav_group} group`
891
 
    fi
892
 
 
893
 
    if test -z "$clamavuser" || test -z "$clamavgroup"
894
 
    then
895
 
        AC_MSG_RESULT(no)
896
 
        AC_MSG_ERROR(User $clamav_user (and/or group $clamav_group) doesn't exist. Please read the documentation !)
897
 
    else
898
 
        AC_MSG_RESULT([yes, user $clamav_user and group $clamav_group])
899
 
        CLAMAVUSER="$clamav_user"
900
 
        CLAMAVGROUP="$clamav_group"
901
 
        AC_SUBST(CLAMAVUSER)
902
 
        AC_SUBST(CLAMAVGROUP)
903
 
    fi
904
 
fi
905
 
 
906
 
AC_C_CONST
907
 
AC_C_INLINE
908
 
AC_C_BIGENDIAN
909
 
if test $ac_cv_c_bigendian = yes; then
910
 
  AC_DEFINE(WORDS_BIGENDIAN,1,endianess)
911
 
else
912
 
  AC_DEFINE(WORDS_BIGENDIAN,0,endianess)
913
 
fi
914
 
 
915
 
dnl check for __attribute__((packed))
916
 
AC_MSG_CHECKING([for structure packing via __attribute__((packed))])
917
 
AC_CACHE_VAL(have_attrib_packed,[
918
 
        AC_TRY_COMPILE(,
919
 
                [struct { int i __attribute__((packed)); } s; ],
920
 
                [have_attrib_packed=yes],
921
 
                [have_attrib_packed=no])
922
 
        ])
923
 
AC_MSG_RESULT($have_attrib_packed)
924
 
 
925
 
if test "$have_attrib_packed" = no; then
926
 
        AC_MSG_CHECKING(for structure packing via pragma)
927
 
        AC_CACHE_VAL(have_pragma_pack,[
928
 
                AC_TRY_RUN([int main(int argc, char **argv) {
929
 
#pragma pack(1)                 /* has to be in column 1 ! */
930
 
                        struct { char c; long l; } s;
931
 
                        return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; } ],
932
 
                        [have_pragma_pack=yes],
933
 
                        [have_pragma_pack=no])
934
 
                ])
935
 
        AC_MSG_RESULT($have_pragma_pack)
936
 
        AC_DEFINE(HAVE_PRAGMA_PACK, 1, "pragma pack")
937
 
fi
938
 
 
939
 
dnl check for __attribute__((aligned))
940
 
AC_MSG_CHECKING([for type aligning via __attribute__((aligned))])
941
 
AC_CACHE_VAL(have_attrib_aligned,[
942
 
        AC_TRY_COMPILE(,
943
 
                [typedef int cl_aligned_int __attribute__((aligned));],
944
 
                [have_attrib_aligned=yes],
945
 
                [have_attrib_aligned=no])
946
 
        ])
947
 
AC_MSG_RESULT($have_attrib_aligned)
948
 
 
949
 
if test "$have_attrib_packed" = no -a "$have_pragma_pack" = no ; then
950
 
        AC_MSG_ERROR(Need to know how to pack structures with this compiler)
951
 
fi
952
 
 
953
 
if test "$have_attrib_packed" = yes; then
954
 
        AC_DEFINE(HAVE_ATTRIB_PACKED, 1, [attrib packed])
955
 
fi
956
 
 
957
 
if test "$have_attrib_aligned" = yes; then
958
 
        AC_DEFINE(HAVE_ATTRIB_ALIGNED, 1, [attrib aligned])
959
 
fi
960
 
 
961
 
dnl Check if <sys/select.h> needs to be included for fd_set
962
 
AC_MSG_CHECKING([for fd_set])
963
 
AC_TRY_COMPILE([#include <sys/types.h>],
964
 
        [fd_set readMask, writeMask;], have_fd_set=yes, have_fd_set=no)
965
 
if test $have_fd_set = yes; then
966
 
    AC_MSG_RESULT([yes, found in sys/types.h])
967
 
else
968
 
    AC_HEADER_EGREP(fd_mask, sys/select.h, have_fd_set=yes)
969
 
    if test $have_fd_set = yes; then
970
 
        AC_DEFINE(HAVE_SYS_SELECT_H, 1, "have <sys/select.h>")
971
 
        AC_MSG_RESULT([yes, found in sys/select.h])
972
 
    else
973
 
        AC_DEFINE(NO_FD_SET, 1, "no fd_set")
974
 
        AC_MSG_RESULT(no)
975
 
    fi
976
 
fi
977
 
 
978
 
AC_MSG_CHECKING(default FD_SETSIZE value)
979
 
AC_TRY_RUN([
980
 
#include <stdio.h>
981
 
#include <unistd.h>
982
 
#include <sys/time.h>
983
 
#include <sys/select.h>
984
 
#include <sys/types.h>
985
 
main() {
986
 
        FILE *fp = fopen("conftestval", "w");
987
 
        fprintf (fp, "%d\n", FD_SETSIZE);
988
 
        exit(0);
989
 
}
990
 
],
991
 
DEFAULT_FD_SETSIZE=`cat conftestval`,
992
 
DEFAULT_FD_SETSIZE=256,
993
 
DEFAULT_FD_SETSIZE=256)
994
 
AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
995
 
AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, "default FD_SETSIZE value")
996
 
 
997
 
AC_OUTPUT([
998
 
libclamav/Makefile
999
 
clamscan/Makefile
1000
 
database/Makefile
1001
 
docs/Makefile
1002
 
clamd/Makefile
1003
 
clamdscan/Makefile
1004
 
clamav-milter/Makefile
1005
 
freshclam/Makefile
1006
 
sigtool/Makefile
1007
 
clamconf/Makefile
1008
 
etc/Makefile
1009
 
Makefile
1010
 
clamav-config
1011
 
libclamav.pc
1012
 
docs/man/clamd.8
1013
 
docs/man/clamd.conf.5
1014
 
docs/man/freshclam.1
1015
 
docs/man/freshclam.conf.5
1016
 
])