Browse code

check for tcpwrappers and in_port_t in configure

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@281 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2004/02/14 18:32:34
Showing 5 changed files
... ...
@@ -1,3 +1,8 @@
1
+Sat Feb 14 10:28:47 CET 2004 (tk)
2
+---------------------------------
3
+  * configure: check for tcpwrappers and definition of in_port_t (requested
4
+	       by Nigel)
5
+
1 6
 Fri Feb 13 22:35:55 CET 2004 (tk)
2 7
 ---------------------------------
3 8
   * Makefile: don't use non standard id flags (thanks to Andy Fiddaman
... ...
@@ -81,7 +81,7 @@ dnl there is now a CREATE_PREFIX_TARGET_H in this file as a shorthand for
81 81
 dnl PREFIX_CONFIG_H from a target.h file, however w/o the target.h ever created
82 82
 dnl (the prefix is a bit different, since we add an extra -target- and -host-)
83 83
 dnl 
84
-dnl @version: $Id: aclocal.m4,v 1.18 2004/02/06 13:46:07 kojm Exp $
84
+dnl @version: $Id: aclocal.m4,v 1.19 2004/02/14 09:32:34 kojm Exp $
85 85
 dnl @author Guido Draheim <guidod@gmx.de>                 STATUS: used often
86 86
 
87 87
 AC_DEFUN([AC_CREATE_TARGET_H],
... ...
@@ -4041,7 +4041,7 @@ dnl      AC_COMPILE_CHECK_SIZEOF(ptrdiff_t, $headers)
4041 4041
 dnl      AC_COMPILE_CHECK_SIZEOF(off_t, $headers)
4042 4042
 dnl
4043 4043
 dnl @author Kaveh Ghazi <ghazi@caip.rutgers.edu>
4044
-dnl @version $Id: aclocal.m4,v 1.18 2004/02/06 13:46:07 kojm Exp $
4044
+dnl @version $Id: aclocal.m4,v 1.19 2004/02/14 09:32:34 kojm Exp $
4045 4045
 dnl
4046 4046
 AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
4047 4047
 [changequote(<<, >>)dnl
... ...
@@ -84,6 +84,9 @@
84 84
 /* Define to 1 if you have the <inttypes.h> header file. */
85 85
 #undef HAVE_INTTYPES_H
86 86
 
87
+/* in_port_t is defined */
88
+#undef HAVE_IN_PORT_T
89
+
87 90
 /* Define to 1 if you have the <malloc.h> header file. */
88 91
 #undef HAVE_MALLOC_H
89 92
 
... ...
@@ -183,6 +186,9 @@
183 183
 /* Version number of package */
184 184
 #undef VERSION
185 185
 
186
+/* tcpwrappers support */
187
+#undef WITH_TCPWRAP
188
+
186 189
 /* endianess */
187 190
 #undef WORDS_BIGENDIAN
188 191
 
... ...
@@ -1019,6 +1019,7 @@ Optional Packages:
1019 1019
   --with-dbdir=path	  Path to virus database directory.
1020 1020
   --with-db1=name	  Name of the main database (main.cvd).
1021 1021
   --with-db2=name	  Name of the daily database (daily.cvd).
1022
+  --with-tcpwrappers      Support hosts.allow / hosts.deny (default=auto)
1022 1023
 
1023 1024
 Some influential environment variables:
1024 1025
   CC          C compiler command
... ...
@@ -4540,7 +4541,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
4540 4540
 case $host in
4541 4541
 *-*-irix6*)
4542 4542
   # Find out which ABI we are using.
4543
-  echo '#line 4543 "configure"' > conftest.$ac_ext
4543
+  echo '#line 4544 "configure"' > conftest.$ac_ext
4544 4544
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
4545 4545
   (eval $ac_compile) 2>&5
4546 4546
   ac_status=$?
... ...
@@ -5076,7 +5077,7 @@ chmod -w .
5076 5076
 save_CFLAGS="$CFLAGS"
5077 5077
 CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
5078 5078
 compiler_c_o=no
5079
-if { (eval echo configure:5079: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
5079
+if { (eval echo configure:5080: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
5080 5080
   # The compiler can only warn and ignore the option if not recognized
5081 5081
   # So say no if there are warnings
5082 5082
   if test -s out/conftest.err; then
... ...
@@ -6869,7 +6870,7 @@ else
6869 6869
     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
6870 6870
   lt_status=$lt_dlunknown
6871 6871
   cat > conftest.$ac_ext <<EOF
6872
-#line 6872 "configure"
6872
+#line 6873 "configure"
6873 6873
 #include "confdefs.h"
6874 6874
 
6875 6875
 #if HAVE_DLFCN_H
... ...
@@ -6967,7 +6968,7 @@ else
6967 6967
     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
6968 6968
   lt_status=$lt_dlunknown
6969 6969
   cat > conftest.$ac_ext <<EOF
6970
-#line 6970 "configure"
6970
+#line 6971 "configure"
6971 6971
 #include "confdefs.h"
6972 6972
 
6973 6973
 #if HAVE_DLFCN_H
... ...
@@ -9351,6 +9352,248 @@ echo "${ECHO_T}/dev/(u)random not detected - using weak software rand()" >&6
9351 9351
     fi
9352 9352
 fi
9353 9353
 
9354
+# tcpwrappers support
9355
+# rules from http://ma.ph-freiburg.de/tng/tng-technical/2002-01/msg00094.html
9356
+
9357
+# Check whether --with-tcpwrappers or --without-tcpwrappers was given.
9358
+if test "${with_tcpwrappers+set}" = set; then
9359
+  withval="$with_tcpwrappers"
9360
+   case "$withval" in
9361
+  yes|no) tcpw="$withval" ;;
9362
+  *)      { { echo "$as_me:$LINENO: error: --with-tcpwrappers does not take an argument" >&5
9363
+echo "$as_me: error: --with-tcpwrappers does not take an argument" >&2;}
9364
+   { (exit 1); exit 1; }; } ;;
9365
+  esac
9366
+else
9367
+   tcpw=auto
9368
+fi;
9369
+
9370
+if test x"$tcpw" != xno; then
9371
+  err=no
9372
+  if test "${ac_cv_header_tcpd_h+set}" = set; then
9373
+  echo "$as_me:$LINENO: checking for tcpd.h" >&5
9374
+echo $ECHO_N "checking for tcpd.h... $ECHO_C" >&6
9375
+if test "${ac_cv_header_tcpd_h+set}" = set; then
9376
+  echo $ECHO_N "(cached) $ECHO_C" >&6
9377
+fi
9378
+echo "$as_me:$LINENO: result: $ac_cv_header_tcpd_h" >&5
9379
+echo "${ECHO_T}$ac_cv_header_tcpd_h" >&6
9380
+else
9381
+  # Is the header compilable?
9382
+echo "$as_me:$LINENO: checking tcpd.h usability" >&5
9383
+echo $ECHO_N "checking tcpd.h usability... $ECHO_C" >&6
9384
+cat >conftest.$ac_ext <<_ACEOF
9385
+#line $LINENO "configure"
9386
+#include "confdefs.h"
9387
+$ac_includes_default
9388
+#include <tcpd.h>
9389
+_ACEOF
9390
+rm -f conftest.$ac_objext
9391
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
9392
+  (eval $ac_compile) 2>&5
9393
+  ac_status=$?
9394
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
9395
+  (exit $ac_status); } &&
9396
+         { ac_try='test -s conftest.$ac_objext'
9397
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9398
+  (eval $ac_try) 2>&5
9399
+  ac_status=$?
9400
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
9401
+  (exit $ac_status); }; }; then
9402
+  ac_header_compiler=yes
9403
+else
9404
+  echo "$as_me: failed program was:" >&5
9405
+cat conftest.$ac_ext >&5
9406
+ac_header_compiler=no
9407
+fi
9408
+rm -f conftest.$ac_objext conftest.$ac_ext
9409
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
9410
+echo "${ECHO_T}$ac_header_compiler" >&6
9411
+
9412
+# Is the header present?
9413
+echo "$as_me:$LINENO: checking tcpd.h presence" >&5
9414
+echo $ECHO_N "checking tcpd.h presence... $ECHO_C" >&6
9415
+cat >conftest.$ac_ext <<_ACEOF
9416
+#line $LINENO "configure"
9417
+#include "confdefs.h"
9418
+#include <tcpd.h>
9419
+_ACEOF
9420
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
9421
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
9422
+  ac_status=$?
9423
+  egrep -v '^ *\+' conftest.er1 >conftest.err
9424
+  rm -f conftest.er1
9425
+  cat conftest.err >&5
9426
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
9427
+  (exit $ac_status); } >/dev/null; then
9428
+  if test -s conftest.err; then
9429
+    ac_cpp_err=$ac_c_preproc_warn_flag
9430
+  else
9431
+    ac_cpp_err=
9432
+  fi
9433
+else
9434
+  ac_cpp_err=yes
9435
+fi
9436
+if test -z "$ac_cpp_err"; then
9437
+  ac_header_preproc=yes
9438
+else
9439
+  echo "$as_me: failed program was:" >&5
9440
+  cat conftest.$ac_ext >&5
9441
+  ac_header_preproc=no
9442
+fi
9443
+rm -f conftest.err conftest.$ac_ext
9444
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
9445
+echo "${ECHO_T}$ac_header_preproc" >&6
9446
+
9447
+# So?  What about this header?
9448
+case $ac_header_compiler:$ac_header_preproc in
9449
+  yes:no )
9450
+    { echo "$as_me:$LINENO: WARNING: tcpd.h: accepted by the compiler, rejected by the preprocessor!" >&5
9451
+echo "$as_me: WARNING: tcpd.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
9452
+    { echo "$as_me:$LINENO: WARNING: tcpd.h: proceeding with the preprocessor's result" >&5
9453
+echo "$as_me: WARNING: tcpd.h: proceeding with the preprocessor's result" >&2;};;
9454
+  no:yes )
9455
+    { echo "$as_me:$LINENO: WARNING: tcpd.h: present but cannot be compiled" >&5
9456
+echo "$as_me: WARNING: tcpd.h: present but cannot be compiled" >&2;}
9457
+    { echo "$as_me:$LINENO: WARNING: tcpd.h: check for missing prerequisite headers?" >&5
9458
+echo "$as_me: WARNING: tcpd.h: check for missing prerequisite headers?" >&2;}
9459
+    { echo "$as_me:$LINENO: WARNING: tcpd.h: proceeding with the preprocessor's result" >&5
9460
+echo "$as_me: WARNING: tcpd.h: proceeding with the preprocessor's result" >&2;};;
9461
+esac
9462
+echo "$as_me:$LINENO: checking for tcpd.h" >&5
9463
+echo $ECHO_N "checking for tcpd.h... $ECHO_C" >&6
9464
+if test "${ac_cv_header_tcpd_h+set}" = set; then
9465
+  echo $ECHO_N "(cached) $ECHO_C" >&6
9466
+else
9467
+  ac_cv_header_tcpd_h=$ac_header_preproc
9468
+fi
9469
+echo "$as_me:$LINENO: result: $ac_cv_header_tcpd_h" >&5
9470
+echo "${ECHO_T}$ac_cv_header_tcpd_h" >&6
9471
+
9472
+fi
9473
+if test $ac_cv_header_tcpd_h = yes; then
9474
+  :
9475
+else
9476
+  err=yes
9477
+fi
9478
+
9479
+
9480
+  echo "$as_me:$LINENO: checking for hosts_ctl in -lwrap" >&5
9481
+echo $ECHO_N "checking for hosts_ctl in -lwrap... $ECHO_C" >&6
9482
+if test "${ac_cv_lib_wrap_hosts_ctl+set}" = set; then
9483
+  echo $ECHO_N "(cached) $ECHO_C" >&6
9484
+else
9485
+  ac_check_lib_save_LIBS=$LIBS
9486
+LIBS="-lwrap  $LIBS"
9487
+cat >conftest.$ac_ext <<_ACEOF
9488
+#line $LINENO "configure"
9489
+#include "confdefs.h"
9490
+
9491
+/* Override any gcc2 internal prototype to avoid an error.  */
9492
+#ifdef __cplusplus
9493
+extern "C"
9494
+#endif
9495
+/* We use char because int might match the return type of a gcc2
9496
+   builtin and then its argument prototype would still apply.  */
9497
+char hosts_ctl ();
9498
+#ifdef F77_DUMMY_MAIN
9499
+#  ifdef __cplusplus
9500
+     extern "C"
9501
+#  endif
9502
+   int F77_DUMMY_MAIN() { return 1; }
9503
+#endif
9504
+int
9505
+main ()
9506
+{
9507
+hosts_ctl ();
9508
+  ;
9509
+  return 0;
9510
+}
9511
+_ACEOF
9512
+rm -f conftest.$ac_objext conftest$ac_exeext
9513
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
9514
+  (eval $ac_link) 2>&5
9515
+  ac_status=$?
9516
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
9517
+  (exit $ac_status); } &&
9518
+         { ac_try='test -s conftest$ac_exeext'
9519
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9520
+  (eval $ac_try) 2>&5
9521
+  ac_status=$?
9522
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
9523
+  (exit $ac_status); }; }; then
9524
+  ac_cv_lib_wrap_hosts_ctl=yes
9525
+else
9526
+  echo "$as_me: failed program was:" >&5
9527
+cat conftest.$ac_ext >&5
9528
+ac_cv_lib_wrap_hosts_ctl=no
9529
+fi
9530
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
9531
+LIBS=$ac_check_lib_save_LIBS
9532
+fi
9533
+echo "$as_me:$LINENO: result: $ac_cv_lib_wrap_hosts_ctl" >&5
9534
+echo "${ECHO_T}$ac_cv_lib_wrap_hosts_ctl" >&6
9535
+if test $ac_cv_lib_wrap_hosts_ctl = yes; then
9536
+  true
9537
+else
9538
+  err=yes
9539
+fi
9540
+
9541
+  if test x"$err" = xyes; then
9542
+    if test x"$tcpw" = xyes; then
9543
+      { { echo "$as_me:$LINENO: error: tcpwrappers not available" >&5
9544
+echo "$as_me: error: tcpwrappers not available" >&2;}
9545
+   { (exit 1); exit 1; }; }
9546
+    fi
9547
+  else
9548
+
9549
+cat >>confdefs.h <<\_ACEOF
9550
+#define WITH_TCPWRAP 1
9551
+_ACEOF
9552
+
9553
+    LIBS="$LIBS -lwrap"
9554
+  fi
9555
+fi
9556
+
9557
+# check for in_port_t definition
9558
+if test "$cross_compiling" = yes; then
9559
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
9560
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
9561
+   { (exit 1); exit 1; }; }
9562
+else
9563
+  cat >conftest.$ac_ext <<_ACEOF
9564
+#line $LINENO "configure"
9565
+#include "confdefs.h"
9566
+#include <netinet/in.h>
9567
+int main(int argc, char **argv) { in_port_t pt; pt = 0; return pt; }
9568
+_ACEOF
9569
+rm -f conftest$ac_exeext
9570
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
9571
+  (eval $ac_link) 2>&5
9572
+  ac_status=$?
9573
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
9574
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
9575
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9576
+  (eval $ac_try) 2>&5
9577
+  ac_status=$?
9578
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
9579
+  (exit $ac_status); }; }; then
9580
+
9581
+cat >>confdefs.h <<\_ACEOF
9582
+#define HAVE_IN_PORT_T 1
9583
+_ACEOF
9584
+
9585
+else
9586
+  echo "$as_me: program exited with status $ac_status" >&5
9587
+echo "$as_me: failed program was:" >&5
9588
+cat conftest.$ac_ext >&5
9589
+( exit $ac_status )
9590
+echo "$as_me:$LINENO: result: in_port_t is not defined" >&5
9591
+echo "${ECHO_T}in_port_t is not defined" >&6
9592
+fi
9593
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
9594
+fi
9595
+
9354 9596
 
9355 9597
 case "$target_os" in
9356 9598
 linux*)
... ...
@@ -10257,7 +10500,7 @@ else
10257 10257
   cat >conftest.$ac_ext <<_ACEOF
10258 10258
 #line $LINENO "configure"
10259 10259
 #include "confdefs.h"
10260
-int main(void) {
10260
+int main(int argc, char **argv) {
10261 10261
 #pragma pack(1)			/* has to be in column 1 ! */
10262 10262
 			struct { char c; long l; } s;
10263 10263
 			return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; }
... ...
@@ -1,5 +1,5 @@
1 1
 dnl
2
-dnl   Copyright (C) 2002, 2003 Tomasz Kojm <zolw@konarski.edu.pl>
2
+dnl   Copyright (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net>
3 3
 dnl
4 4
 dnl   This program is free software; you can redistribute it and/or modify
5 5
 dnl   it under the terms of the GNU General Public License as published by
... ...
@@ -209,6 +209,35 @@ then
209 209
     fi
210 210
 fi
211 211
 
212
+# tcpwrappers support
213
+# rules from http://ma.ph-freiburg.de/tng/tng-technical/2002-01/msg00094.html
214
+AC_ARG_WITH(tcpwrappers,
215
+[  --with-tcpwrappers      Support hosts.allow / hosts.deny (default=auto)],
216
+[ case "$withval" in
217
+  yes|no) tcpw="$withval" ;;
218
+  *)      AC_MSG_ERROR([--with-tcpwrappers does not take an argument]) ;;
219
+  esac],
220
+[ tcpw=auto ])
221
+
222
+if test x"$tcpw" != xno; then
223
+  err=no
224
+  AC_CHECK_HEADER(tcpd.h,,err=yes)
225
+  AC_CHECK_LIB(wrap,hosts_ctl,true,err=yes)
226
+  if test x"$err" = xyes; then
227
+    if test x"$tcpw" = xyes; then
228
+      AC_MSG_ERROR([tcpwrappers not available])
229
+    fi
230
+  else
231
+    AC_DEFINE(WITH_TCPWRAP,1,[tcpwrappers support])
232
+    LIBS="$LIBS -lwrap"
233
+  fi
234
+fi
235
+
236
+# check for in_port_t definition
237
+AC_TRY_RUN([#include <netinet/in.h>
238
+int main(int argc, char **argv) { in_port_t pt; pt = 0; return pt; }],
239
+AC_DEFINE(HAVE_IN_PORT_T,1,[in_port_t is defined]), AC_MSG_RESULT(in_port_t is not defined))
240
+
212 241
 dnl CLAMSCAN_LIBS=""
213 242
 dnl FRESHCLAM_LIBS=""
214 243
 dnl CLAMD_LIBS=""
... ...
@@ -438,7 +467,7 @@ AC_MSG_RESULT($have_attrib_packed)
438 438
 if test "$have_attrib_packed" = no; then
439 439
 	AC_MSG_CHECKING(for structure packing via pragma)
440 440
 	AC_CACHE_VAL(have_pragma_pack,[
441
-		AC_TRY_RUN([int main(void) {
441
+		AC_TRY_RUN([int main(int argc, char **argv) {
442 442
 #pragma pack(1)			/* has to be in column 1 ! */
443 443
 			struct { char c; long l; } s;
444 444
 			return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; } ],