Browse code

improve libmilter test

git-svn: trunk@655

Tomasz Kojm authored on 2004/07/06 22:21:00
Showing 7 changed files
... ...
@@ -1,3 +1,8 @@
1
+Tue Jul  6 15:15:18 CEST 2004 (tk)
2
+----------------------------------
3
+  * configure: improve libmilter test (patch by Tom G. Christensen
4
+	       <tgc*statsbiblioteket.dk>)
5
+
1 6
 Tue Jul  6 10:37:15 BST 2004 (njh)
2 7
 ----------------------------------
3 8
   * libclamav/mbox.c:	Better handling of Gibe.3 boundary exploit improves
... ...
@@ -46,7 +46,7 @@ while test $# -gt 0; do
46 46
 	;;
47 47
 
48 48
     --version)
49
-	echo devel-20040704
49
+	echo devel-20040706
50 50
 	exit 0
51 51
 	;;
52 52
 
... ...
@@ -102,6 +102,9 @@
102 102
 /* in_port_t is defined */
103 103
 #undef HAVE_IN_PORT_T
104 104
 
105
+/* Define to 1 if you have the <libmilter/mfapi.h> header file. */
106
+#undef HAVE_LIBMILTER_MFAPI_H
107
+
105 108
 /* Define to 1 if you have the <limits.h> header file. */
106 109
 #undef HAVE_LIMITS_H
107 110
 
... ...
@@ -36,6 +36,6 @@ endif
36 36
 endif
37 37
 
38 38
 AM_CFLAGS = -DSENDMAIL_BIN=\"$(SENDMAIL)\"
39
-LIBS = $(top_builddir)/libclamav/libclamav.la -L/usr/lib/libmilter -lmilter @CLAMAV_MILTER_LIBS@
39
+LIBS = $(top_builddir)/libclamav/libclamav.la @CLAMAV_MILTER_LIBS@
40 40
 INCLUDES = -I$(top_srcdir)/clamd -I$(top_srcdir)/libclamav -I$(top_srcdir)/shared
41 41
 EXTRA_DIST = clamav-milter.c INSTALL
... ...
@@ -151,7 +151,7 @@ LDFLAGS = @LDFLAGS@
151 151
 LIBCLAMAV_LIBS = @LIBCLAMAV_LIBS@
152 152
 LIBCLAMAV_VERSION = @LIBCLAMAV_VERSION@
153 153
 LIBOBJS = @LIBOBJS@
154
-LIBS = $(top_builddir)/libclamav/libclamav.la -L/usr/lib/libmilter -lmilter @CLAMAV_MILTER_LIBS@
154
+LIBS = $(top_builddir)/libclamav/libclamav.la @CLAMAV_MILTER_LIBS@
155 155
 LIBTOOL = @LIBTOOL@
156 156
 LN_S = @LN_S@
157 157
 LTLIBOBJS = @LTLIBOBJS@
... ...
@@ -1017,7 +1017,7 @@ Optional Features:
1017 1017
   --disable-libtool-lock  avoid locking (might break parallel builds)
1018 1018
   --disable-bzip2	  Disable bzip2 support.
1019 1019
   --disable-clamuko	  Disable clamuko support (Linux and FreeBSD only)
1020
-  --enable-milter	  Build clamav-milter (if milter library found)
1020
+  --enable-milter	  Build clamav-milter
1021 1021
   --disable-dsig	  Disable digital signature support.
1022 1022
   --disable-pthreads      Disable POSIX threads support
1023 1023
   --disable-cr      Don't link with C reentrant library (BSD)
... ...
@@ -10323,153 +10323,10 @@ _ACEOF
10323 10323
 fi
10324 10324
 
10325 10325
 
10326
-have_milter="no"
10327
-if test "${ac_cv_header_libmilter_mfapi_h+set}" = set; then
10328
-  echo "$as_me:$LINENO: checking for libmilter/mfapi.h" >&5
10329
-echo $ECHO_N "checking for libmilter/mfapi.h... $ECHO_C" >&6
10330
-if test "${ac_cv_header_libmilter_mfapi_h+set}" = set; then
10331
-  echo $ECHO_N "(cached) $ECHO_C" >&6
10332
-fi
10333
-echo "$as_me:$LINENO: result: $ac_cv_header_libmilter_mfapi_h" >&5
10334
-echo "${ECHO_T}$ac_cv_header_libmilter_mfapi_h" >&6
10335
-else
10336
-  # Is the header compilable?
10337
-echo "$as_me:$LINENO: checking libmilter/mfapi.h usability" >&5
10338
-echo $ECHO_N "checking libmilter/mfapi.h usability... $ECHO_C" >&6
10339
-cat >conftest.$ac_ext <<_ACEOF
10340
-/* confdefs.h.  */
10341
-_ACEOF
10342
-cat confdefs.h >>conftest.$ac_ext
10343
-cat >>conftest.$ac_ext <<_ACEOF
10344
-/* end confdefs.h.  */
10345
-$ac_includes_default
10346
-#include <libmilter/mfapi.h>
10347
-_ACEOF
10348
-rm -f conftest.$ac_objext
10349
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
10350
-  (eval $ac_compile) 2>conftest.er1
10351
-  ac_status=$?
10352
-  grep -v '^ *+' conftest.er1 >conftest.err
10353
-  rm -f conftest.er1
10354
-  cat conftest.err >&5
10355
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10356
-  (exit $ac_status); } &&
10357
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
10358
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10359
-  (eval $ac_try) 2>&5
10360
-  ac_status=$?
10361
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10362
-  (exit $ac_status); }; } &&
10363
-	 { ac_try='test -s conftest.$ac_objext'
10364
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10365
-  (eval $ac_try) 2>&5
10366
-  ac_status=$?
10367
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10368
-  (exit $ac_status); }; }; then
10369
-  ac_header_compiler=yes
10370
-else
10371
-  echo "$as_me: failed program was:" >&5
10372
-sed 's/^/| /' conftest.$ac_ext >&5
10373
-
10374
-ac_header_compiler=no
10375
-fi
10376
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
10377
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
10378
-echo "${ECHO_T}$ac_header_compiler" >&6
10379
-
10380
-# Is the header present?
10381
-echo "$as_me:$LINENO: checking libmilter/mfapi.h presence" >&5
10382
-echo $ECHO_N "checking libmilter/mfapi.h presence... $ECHO_C" >&6
10383
-cat >conftest.$ac_ext <<_ACEOF
10384
-/* confdefs.h.  */
10385
-_ACEOF
10386
-cat confdefs.h >>conftest.$ac_ext
10387
-cat >>conftest.$ac_ext <<_ACEOF
10388
-/* end confdefs.h.  */
10389
-#include <libmilter/mfapi.h>
10390
-_ACEOF
10391
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
10392
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
10393
-  ac_status=$?
10394
-  grep -v '^ *+' conftest.er1 >conftest.err
10395
-  rm -f conftest.er1
10396
-  cat conftest.err >&5
10397
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10398
-  (exit $ac_status); } >/dev/null; then
10399
-  if test -s conftest.err; then
10400
-    ac_cpp_err=$ac_c_preproc_warn_flag
10401
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
10402
-  else
10403
-    ac_cpp_err=
10404
-  fi
10405
-else
10406
-  ac_cpp_err=yes
10407
-fi
10408
-if test -z "$ac_cpp_err"; then
10409
-  ac_header_preproc=yes
10410
-else
10411
-  echo "$as_me: failed program was:" >&5
10412
-sed 's/^/| /' conftest.$ac_ext >&5
10413
-
10414
-  ac_header_preproc=no
10415
-fi
10416
-rm -f conftest.err conftest.$ac_ext
10417
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
10418
-echo "${ECHO_T}$ac_header_preproc" >&6
10419
-
10420
-# So?  What about this header?
10421
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
10422
-  yes:no: )
10423
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h: accepted by the compiler, rejected by the preprocessor!" >&5
10424
-echo "$as_me: WARNING: libmilter/mfapi.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
10425
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h: proceeding with the compiler's result" >&5
10426
-echo "$as_me: WARNING: libmilter/mfapi.h: proceeding with the compiler's result" >&2;}
10427
-    ac_header_preproc=yes
10428
-    ;;
10429
-  no:yes:* )
10430
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h: present but cannot be compiled" >&5
10431
-echo "$as_me: WARNING: libmilter/mfapi.h: present but cannot be compiled" >&2;}
10432
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h:     check for missing prerequisite headers?" >&5
10433
-echo "$as_me: WARNING: libmilter/mfapi.h:     check for missing prerequisite headers?" >&2;}
10434
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h: see the Autoconf documentation" >&5
10435
-echo "$as_me: WARNING: libmilter/mfapi.h: see the Autoconf documentation" >&2;}
10436
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h:     section \"Present But Cannot Be Compiled\"" >&5
10437
-echo "$as_me: WARNING: libmilter/mfapi.h:     section \"Present But Cannot Be Compiled\"" >&2;}
10438
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h: proceeding with the preprocessor's result" >&5
10439
-echo "$as_me: WARNING: libmilter/mfapi.h: proceeding with the preprocessor's result" >&2;}
10440
-    { echo "$as_me:$LINENO: WARNING: libmilter/mfapi.h: in the future, the compiler will take precedence" >&5
10441
-echo "$as_me: WARNING: libmilter/mfapi.h: in the future, the compiler will take precedence" >&2;}
10442
-    (
10443
-      cat <<\_ASBOX
10444
-## ------------------------------------------ ##
10445
-## Report this to the AC_PACKAGE_NAME lists.  ##
10446
-## ------------------------------------------ ##
10447
-_ASBOX
10448
-    ) |
10449
-      sed "s/^/$as_me: WARNING:     /" >&2
10450
-    ;;
10451
-esac
10452
-echo "$as_me:$LINENO: checking for libmilter/mfapi.h" >&5
10453
-echo $ECHO_N "checking for libmilter/mfapi.h... $ECHO_C" >&6
10454
-if test "${ac_cv_header_libmilter_mfapi_h+set}" = set; then
10455
-  echo $ECHO_N "(cached) $ECHO_C" >&6
10456
-else
10457
-  ac_cv_header_libmilter_mfapi_h=$ac_header_preproc
10458
-fi
10459
-echo "$as_me:$LINENO: result: $ac_cv_header_libmilter_mfapi_h" >&5
10460
-echo "${ECHO_T}$ac_cv_header_libmilter_mfapi_h" >&6
10461
-
10462
-fi
10463
-if test $ac_cv_header_libmilter_mfapi_h = yes; then
10464
-  have_milter="yes"
10465
-fi
10466
-
10467
-
10468
-
10469 10326
 # Check whether --enable-milter or --disable-milter was given.
10470 10327
 if test "${enable_milter+set}" = set; then
10471 10328
   enableval="$enable_milter"
10472
-
10329
+  have_milter=$enableval
10473 10330
 else
10474 10331
   have_milter="no"
10475 10332
 fi;
... ...
@@ -11351,6 +11208,445 @@ esac
11351 11351
 
11352 11352
 
11353 11353
 
11354
+# --enable-milter
11355
+if test "$have_milter" = "yes"; then
11356
+    # libmilter checking code adapted from spamass-milter by
11357
+    # Tom G. Christensen <tgc@statsbiblioteket.dk>
11358
+
11359
+    # Check for libmilter and it's header files in the usual locations
11360
+    save_LDFLAGS="$LDFLAGS"
11361
+    if test -d /usr/lib/libmilter ; then
11362
+	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -L/usr/lib/libmilter"
11363
+    fi
11364
+    LDFLAGS="$LDFLAGS $CLAMAV_MILTER_LIBS"
11365
+    echo "$as_me:$LINENO: checking for mi_stop in -lmilter" >&5
11366
+echo $ECHO_N "checking for mi_stop in -lmilter... $ECHO_C" >&6
11367
+if test "${ac_cv_lib_milter_mi_stop+set}" = set; then
11368
+  echo $ECHO_N "(cached) $ECHO_C" >&6
11369
+else
11370
+  ac_check_lib_save_LIBS=$LIBS
11371
+LIBS="-lmilter  $LIBS"
11372
+cat >conftest.$ac_ext <<_ACEOF
11373
+/* confdefs.h.  */
11374
+_ACEOF
11375
+cat confdefs.h >>conftest.$ac_ext
11376
+cat >>conftest.$ac_ext <<_ACEOF
11377
+/* end confdefs.h.  */
11378
+
11379
+/* Override any gcc2 internal prototype to avoid an error.  */
11380
+#ifdef __cplusplus
11381
+extern "C"
11382
+#endif
11383
+/* We use char because int might match the return type of a gcc2
11384
+   builtin and then its argument prototype would still apply.  */
11385
+char mi_stop ();
11386
+int
11387
+main ()
11388
+{
11389
+mi_stop ();
11390
+  ;
11391
+  return 0;
11392
+}
11393
+_ACEOF
11394
+rm -f conftest.$ac_objext conftest$ac_exeext
11395
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
11396
+  (eval $ac_link) 2>conftest.er1
11397
+  ac_status=$?
11398
+  grep -v '^ *+' conftest.er1 >conftest.err
11399
+  rm -f conftest.er1
11400
+  cat conftest.err >&5
11401
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11402
+  (exit $ac_status); } &&
11403
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11404
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11405
+  (eval $ac_try) 2>&5
11406
+  ac_status=$?
11407
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11408
+  (exit $ac_status); }; } &&
11409
+	 { ac_try='test -s conftest$ac_exeext'
11410
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11411
+  (eval $ac_try) 2>&5
11412
+  ac_status=$?
11413
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11414
+  (exit $ac_status); }; }; then
11415
+  ac_cv_lib_milter_mi_stop=yes
11416
+else
11417
+  echo "$as_me: failed program was:" >&5
11418
+sed 's/^/| /' conftest.$ac_ext >&5
11419
+
11420
+ac_cv_lib_milter_mi_stop=no
11421
+fi
11422
+rm -f conftest.err conftest.$ac_objext \
11423
+      conftest$ac_exeext conftest.$ac_ext
11424
+LIBS=$ac_check_lib_save_LIBS
11425
+fi
11426
+echo "$as_me:$LINENO: result: $ac_cv_lib_milter_mi_stop" >&5
11427
+echo "${ECHO_T}$ac_cv_lib_milter_mi_stop" >&6
11428
+if test $ac_cv_lib_milter_mi_stop = yes; then
11429
+  CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lmilter"
11430
+else
11431
+
11432
+	# Older sendmails require libsm or libsmutil for support functions
11433
+	echo "$as_me:$LINENO: checking for library containing strlcpy" >&5
11434
+echo $ECHO_N "checking for library containing strlcpy... $ECHO_C" >&6
11435
+if test "${ac_cv_search_strlcpy+set}" = set; then
11436
+  echo $ECHO_N "(cached) $ECHO_C" >&6
11437
+else
11438
+  ac_func_search_save_LIBS=$LIBS
11439
+ac_cv_search_strlcpy=no
11440
+cat >conftest.$ac_ext <<_ACEOF
11441
+/* confdefs.h.  */
11442
+_ACEOF
11443
+cat confdefs.h >>conftest.$ac_ext
11444
+cat >>conftest.$ac_ext <<_ACEOF
11445
+/* end confdefs.h.  */
11446
+
11447
+/* Override any gcc2 internal prototype to avoid an error.  */
11448
+#ifdef __cplusplus
11449
+extern "C"
11450
+#endif
11451
+/* We use char because int might match the return type of a gcc2
11452
+   builtin and then its argument prototype would still apply.  */
11453
+char strlcpy ();
11454
+int
11455
+main ()
11456
+{
11457
+strlcpy ();
11458
+  ;
11459
+  return 0;
11460
+}
11461
+_ACEOF
11462
+rm -f conftest.$ac_objext conftest$ac_exeext
11463
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
11464
+  (eval $ac_link) 2>conftest.er1
11465
+  ac_status=$?
11466
+  grep -v '^ *+' conftest.er1 >conftest.err
11467
+  rm -f conftest.er1
11468
+  cat conftest.err >&5
11469
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11470
+  (exit $ac_status); } &&
11471
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11472
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11473
+  (eval $ac_try) 2>&5
11474
+  ac_status=$?
11475
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11476
+  (exit $ac_status); }; } &&
11477
+	 { ac_try='test -s conftest$ac_exeext'
11478
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11479
+  (eval $ac_try) 2>&5
11480
+  ac_status=$?
11481
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11482
+  (exit $ac_status); }; }; then
11483
+  ac_cv_search_strlcpy="none required"
11484
+else
11485
+  echo "$as_me: failed program was:" >&5
11486
+sed 's/^/| /' conftest.$ac_ext >&5
11487
+
11488
+fi
11489
+rm -f conftest.err conftest.$ac_objext \
11490
+      conftest$ac_exeext conftest.$ac_ext
11491
+if test "$ac_cv_search_strlcpy" = no; then
11492
+  for ac_lib in sm smutil; do
11493
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
11494
+    cat >conftest.$ac_ext <<_ACEOF
11495
+/* confdefs.h.  */
11496
+_ACEOF
11497
+cat confdefs.h >>conftest.$ac_ext
11498
+cat >>conftest.$ac_ext <<_ACEOF
11499
+/* end confdefs.h.  */
11500
+
11501
+/* Override any gcc2 internal prototype to avoid an error.  */
11502
+#ifdef __cplusplus
11503
+extern "C"
11504
+#endif
11505
+/* We use char because int might match the return type of a gcc2
11506
+   builtin and then its argument prototype would still apply.  */
11507
+char strlcpy ();
11508
+int
11509
+main ()
11510
+{
11511
+strlcpy ();
11512
+  ;
11513
+  return 0;
11514
+}
11515
+_ACEOF
11516
+rm -f conftest.$ac_objext conftest$ac_exeext
11517
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
11518
+  (eval $ac_link) 2>conftest.er1
11519
+  ac_status=$?
11520
+  grep -v '^ *+' conftest.er1 >conftest.err
11521
+  rm -f conftest.er1
11522
+  cat conftest.err >&5
11523
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11524
+  (exit $ac_status); } &&
11525
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11526
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11527
+  (eval $ac_try) 2>&5
11528
+  ac_status=$?
11529
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11530
+  (exit $ac_status); }; } &&
11531
+	 { ac_try='test -s conftest$ac_exeext'
11532
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11533
+  (eval $ac_try) 2>&5
11534
+  ac_status=$?
11535
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11536
+  (exit $ac_status); }; }; then
11537
+  ac_cv_search_strlcpy="-l$ac_lib"
11538
+break
11539
+else
11540
+  echo "$as_me: failed program was:" >&5
11541
+sed 's/^/| /' conftest.$ac_ext >&5
11542
+
11543
+fi
11544
+rm -f conftest.err conftest.$ac_objext \
11545
+      conftest$ac_exeext conftest.$ac_ext
11546
+  done
11547
+fi
11548
+LIBS=$ac_func_search_save_LIBS
11549
+fi
11550
+echo "$as_me:$LINENO: result: $ac_cv_search_strlcpy" >&5
11551
+echo "${ECHO_T}$ac_cv_search_strlcpy" >&6
11552
+if test "$ac_cv_search_strlcpy" != no; then
11553
+  test "$ac_cv_search_strlcpy" = "none required" || LIBS="$ac_cv_search_strlcpy $LIBS"
11554
+  test "$ac_cv_search_strlcpy" = "none required" || CLAMAV_MILTER_XLIB="$ac_cv_search_strlcpy"
11555
+fi
11556
+
11557
+	LDFLAGS="$save_LDFLAGS $CLAMAV_MILTER_LIBS $CLAMAV_MILTER_XLIB"
11558
+	$as_unset ac_cv_lib_milter_mi_stop
11559
+	echo "$as_me:$LINENO: checking for mi_stop in -lmilter" >&5
11560
+echo $ECHO_N "checking for mi_stop in -lmilter... $ECHO_C" >&6
11561
+if test "${ac_cv_lib_milter_mi_stop+set}" = set; then
11562
+  echo $ECHO_N "(cached) $ECHO_C" >&6
11563
+else
11564
+  ac_check_lib_save_LIBS=$LIBS
11565
+LIBS="-lmilter  $LIBS"
11566
+cat >conftest.$ac_ext <<_ACEOF
11567
+/* confdefs.h.  */
11568
+_ACEOF
11569
+cat confdefs.h >>conftest.$ac_ext
11570
+cat >>conftest.$ac_ext <<_ACEOF
11571
+/* end confdefs.h.  */
11572
+
11573
+/* Override any gcc2 internal prototype to avoid an error.  */
11574
+#ifdef __cplusplus
11575
+extern "C"
11576
+#endif
11577
+/* We use char because int might match the return type of a gcc2
11578
+   builtin and then its argument prototype would still apply.  */
11579
+char mi_stop ();
11580
+int
11581
+main ()
11582
+{
11583
+mi_stop ();
11584
+  ;
11585
+  return 0;
11586
+}
11587
+_ACEOF
11588
+rm -f conftest.$ac_objext conftest$ac_exeext
11589
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
11590
+  (eval $ac_link) 2>conftest.er1
11591
+  ac_status=$?
11592
+  grep -v '^ *+' conftest.er1 >conftest.err
11593
+  rm -f conftest.er1
11594
+  cat conftest.err >&5
11595
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11596
+  (exit $ac_status); } &&
11597
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11598
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11599
+  (eval $ac_try) 2>&5
11600
+  ac_status=$?
11601
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11602
+  (exit $ac_status); }; } &&
11603
+	 { ac_try='test -s conftest$ac_exeext'
11604
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11605
+  (eval $ac_try) 2>&5
11606
+  ac_status=$?
11607
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11608
+  (exit $ac_status); }; }; then
11609
+  ac_cv_lib_milter_mi_stop=yes
11610
+else
11611
+  echo "$as_me: failed program was:" >&5
11612
+sed 's/^/| /' conftest.$ac_ext >&5
11613
+
11614
+ac_cv_lib_milter_mi_stop=no
11615
+fi
11616
+rm -f conftest.err conftest.$ac_objext \
11617
+      conftest$ac_exeext conftest.$ac_ext
11618
+LIBS=$ac_check_lib_save_LIBS
11619
+fi
11620
+echo "$as_me:$LINENO: result: $ac_cv_lib_milter_mi_stop" >&5
11621
+echo "${ECHO_T}$ac_cv_lib_milter_mi_stop" >&6
11622
+if test $ac_cv_lib_milter_mi_stop = yes; then
11623
+  CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lmilter $CLAMAV_MILTER_XLIB"
11624
+else
11625
+
11626
+	    { { echo "$as_me:$LINENO: error: Cannot find libmilter" >&5
11627
+echo "$as_me: error: Cannot find libmilter" >&2;}
11628
+   { (exit 1); exit 1; }; }
11629
+
11630
+fi
11631
+
11632
+
11633
+fi
11634
+
11635
+    LDFLAGS="$save_LDFLAGS"
11636
+
11637
+for ac_header in libmilter/mfapi.h
11638
+do
11639
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
11640
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
11641
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
11642
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
11643
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
11644
+  echo $ECHO_N "(cached) $ECHO_C" >&6
11645
+fi
11646
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
11647
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
11648
+else
11649
+  # Is the header compilable?
11650
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
11651
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
11652
+cat >conftest.$ac_ext <<_ACEOF
11653
+/* confdefs.h.  */
11654
+_ACEOF
11655
+cat confdefs.h >>conftest.$ac_ext
11656
+cat >>conftest.$ac_ext <<_ACEOF
11657
+/* end confdefs.h.  */
11658
+$ac_includes_default
11659
+#include <$ac_header>
11660
+_ACEOF
11661
+rm -f conftest.$ac_objext
11662
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
11663
+  (eval $ac_compile) 2>conftest.er1
11664
+  ac_status=$?
11665
+  grep -v '^ *+' conftest.er1 >conftest.err
11666
+  rm -f conftest.er1
11667
+  cat conftest.err >&5
11668
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11669
+  (exit $ac_status); } &&
11670
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
11671
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11672
+  (eval $ac_try) 2>&5
11673
+  ac_status=$?
11674
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11675
+  (exit $ac_status); }; } &&
11676
+	 { ac_try='test -s conftest.$ac_objext'
11677
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
11678
+  (eval $ac_try) 2>&5
11679
+  ac_status=$?
11680
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11681
+  (exit $ac_status); }; }; then
11682
+  ac_header_compiler=yes
11683
+else
11684
+  echo "$as_me: failed program was:" >&5
11685
+sed 's/^/| /' conftest.$ac_ext >&5
11686
+
11687
+ac_header_compiler=no
11688
+fi
11689
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
11690
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
11691
+echo "${ECHO_T}$ac_header_compiler" >&6
11692
+
11693
+# Is the header present?
11694
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
11695
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
11696
+cat >conftest.$ac_ext <<_ACEOF
11697
+/* confdefs.h.  */
11698
+_ACEOF
11699
+cat confdefs.h >>conftest.$ac_ext
11700
+cat >>conftest.$ac_ext <<_ACEOF
11701
+/* end confdefs.h.  */
11702
+#include <$ac_header>
11703
+_ACEOF
11704
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
11705
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
11706
+  ac_status=$?
11707
+  grep -v '^ *+' conftest.er1 >conftest.err
11708
+  rm -f conftest.er1
11709
+  cat conftest.err >&5
11710
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
11711
+  (exit $ac_status); } >/dev/null; then
11712
+  if test -s conftest.err; then
11713
+    ac_cpp_err=$ac_c_preproc_warn_flag
11714
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
11715
+  else
11716
+    ac_cpp_err=
11717
+  fi
11718
+else
11719
+  ac_cpp_err=yes
11720
+fi
11721
+if test -z "$ac_cpp_err"; then
11722
+  ac_header_preproc=yes
11723
+else
11724
+  echo "$as_me: failed program was:" >&5
11725
+sed 's/^/| /' conftest.$ac_ext >&5
11726
+
11727
+  ac_header_preproc=no
11728
+fi
11729
+rm -f conftest.err conftest.$ac_ext
11730
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
11731
+echo "${ECHO_T}$ac_header_preproc" >&6
11732
+
11733
+# So?  What about this header?
11734
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
11735
+  yes:no: )
11736
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
11737
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
11738
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
11739
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
11740
+    ac_header_preproc=yes
11741
+    ;;
11742
+  no:yes:* )
11743
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
11744
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
11745
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
11746
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
11747
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
11748
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
11749
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
11750
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
11751
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
11752
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
11753
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
11754
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
11755
+    (
11756
+      cat <<\_ASBOX
11757
+## ------------------------------------------ ##
11758
+## Report this to the AC_PACKAGE_NAME lists.  ##
11759
+## ------------------------------------------ ##
11760
+_ASBOX
11761
+    ) |
11762
+      sed "s/^/$as_me: WARNING:     /" >&2
11763
+    ;;
11764
+esac
11765
+echo "$as_me:$LINENO: checking for $ac_header" >&5
11766
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
11767
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
11768
+  echo $ECHO_N "(cached) $ECHO_C" >&6
11769
+else
11770
+  eval "$as_ac_Header=\$ac_header_preproc"
11771
+fi
11772
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
11773
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
11774
+
11775
+fi
11776
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
11777
+  cat >>confdefs.h <<_ACEOF
11778
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
11779
+_ACEOF
11780
+ have_milter="yes"
11781
+else
11782
+
11783
+	{ { echo "$as_me:$LINENO: error: Please install mfapi.h from the sendmail distribution" >&5
11784
+echo "$as_me: error: Please install mfapi.h from the sendmail distribution" >&2;}
11785
+   { (exit 1); exit 1; }; }
11786
+
11787
+fi
11788
+
11789
+done
11790
+
11791
+fi
11792
+
11354 11793
 
11355 11794
 
11356 11795
 if test "$have_pthreads" = "yes"; then
... ...
@@ -86,12 +86,9 @@ want_clamuko="no",)
86 86
 
87 87
 AC_FUNC_SETPGRP
88 88
 
89
-have_milter="no"
90
-AC_CHECK_HEADER(libmilter/mfapi.h,have_milter="yes",)
91
-
92 89
 AC_ARG_ENABLE(milter,
93
-[  --enable-milter	  Build clamav-milter (if milter library found)],
94
-,have_milter="no")
90
+[  --enable-milter	  Build clamav-milter],
91
+have_milter=$enableval,have_milter="no")
95 92
 
96 93
 want_dsig="yes"
97 94
 AC_ARG_ENABLE(dsig,
... ...
@@ -381,6 +378,32 @@ AC_SUBST(FRESHCLAM_LIBS)
381 381
 AC_SUBST(TH_SAFE)
382 382
 AC_SUBST(ADDITIONAL_LIBS)
383 383
 
384
+# --enable-milter
385
+if test "$have_milter" = "yes"; then
386
+    # libmilter checking code adapted from spamass-milter by
387
+    # Tom G. Christensen <tgc@statsbiblioteket.dk>
388
+
389
+    # Check for libmilter and it's header files in the usual locations
390
+    save_LDFLAGS="$LDFLAGS"
391
+    if test -d /usr/lib/libmilter ; then
392
+	CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -L/usr/lib/libmilter"
393
+    fi
394
+    LDFLAGS="$LDFLAGS $CLAMAV_MILTER_LIBS"
395
+    AC_CHECK_LIB(milter, mi_stop,[CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lmilter"],[
396
+	# Older sendmails require libsm or libsmutil for support functions
397
+	AC_SEARCH_LIBS(strlcpy, [sm smutil], [test "$ac_cv_search_strlcpy" = "none required" || CLAMAV_MILTER_XLIB="$ac_cv_search_strlcpy"])
398
+	LDFLAGS="$save_LDFLAGS $CLAMAV_MILTER_LIBS $CLAMAV_MILTER_XLIB"
399
+	$as_unset ac_cv_lib_milter_mi_stop
400
+	AC_CHECK_LIB(milter, mi_stop,[CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lmilter $CLAMAV_MILTER_XLIB"],[
401
+	    AC_MSG_ERROR([Cannot find libmilter])
402
+	])
403
+    ])
404
+    LDFLAGS="$save_LDFLAGS"
405
+    AC_CHECK_HEADERS(libmilter/mfapi.h,have_milter="yes",[
406
+	AC_MSG_ERROR([Please install mfapi.h from the sendmail distribution])
407
+    ])
408
+fi
409
+
384 410
 AM_CONDITIONAL(BUILD_CLAMD, test "$have_pthreads" = "yes")
385 411
 AM_CONDITIONAL(HAVE_MILTER, test "$have_milter" = "yes")
386 412