Browse code

configure - check for sys/types.h

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

Tomasz Kojm authored on 2004/02/24 02:24:52
Showing 5 changed files
... ...
@@ -1,3 +1,8 @@
1
+Mon Feb 23 18:22:14 CET 2004 (tk)
2
+---------------------------------
3
+  * configure: check if <sys/select.h> needs to be included for fd_set (patch
4
+	       from Trog)
5
+
1 6
 Mon Feb 23 10:42:25 GMT 2004 (trog)
2 7
 -----------------------------------
3 8
   * clamd: use select() instead of poll()
... ...
@@ -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.23 2004/02/22 23:46:02 kojm Exp $
84
+dnl @version: $Id: aclocal.m4,v 1.24 2004/02/23 17:24:52 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.23 2004/02/22 23:46:02 kojm Exp $
4044
+dnl @version $Id: aclocal.m4,v 1.24 2004/02/23 17:24:52 kojm Exp $
4045 4045
 dnl
4046 4046
 AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
4047 4047
 [changequote(<<, >>)dnl
... ...
@@ -132,6 +132,9 @@
132 132
 /* Define to 1 if you have the <sys/param.h> header file. */
133 133
 #undef HAVE_SYS_PARAM_H
134 134
 
135
+/* "have <sys/select.h>" */
136
+#undef HAVE_SYS_SELECT_H
137
+
135 138
 /* Define to 1 if you have the <sys/stat.h> header file. */
136 139
 #undef HAVE_SYS_STAT_H
137 140
 
... ...
@@ -147,6 +150,9 @@
147 147
 /* bzip funtions do not have bz2 prefix */
148 148
 #undef NOBZ2PREFIX
149 149
 
150
+/* "no fd_set" */
151
+#undef NO_FD_SET
152
+
150 153
 /* Name of package */
151 154
 #undef PACKAGE
152 155
 
... ...
@@ -10580,6 +10580,81 @@ _ACEOF
10580 10580
 
10581 10581
 fi
10582 10582
 
10583
+# Check if <sys/select.h> needs to be included for fd_set
10584
+echo "$as_me:$LINENO: checking for fd_set" >&5
10585
+echo $ECHO_N "checking for fd_set... $ECHO_C" >&6
10586
+cat >conftest.$ac_ext <<_ACEOF
10587
+#line $LINENO "configure"
10588
+#include "confdefs.h"
10589
+#include <sys/types.h>
10590
+#ifdef F77_DUMMY_MAIN
10591
+#  ifdef __cplusplus
10592
+     extern "C"
10593
+#  endif
10594
+   int F77_DUMMY_MAIN() { return 1; }
10595
+#endif
10596
+int
10597
+main ()
10598
+{
10599
+fd_set readMask, writeMask;
10600
+  ;
10601
+  return 0;
10602
+}
10603
+_ACEOF
10604
+rm -f conftest.$ac_objext
10605
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
10606
+  (eval $ac_compile) 2>&5
10607
+  ac_status=$?
10608
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10609
+  (exit $ac_status); } &&
10610
+         { ac_try='test -s conftest.$ac_objext'
10611
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10612
+  (eval $ac_try) 2>&5
10613
+  ac_status=$?
10614
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10615
+  (exit $ac_status); }; }; then
10616
+  have_fd_set=yes
10617
+else
10618
+  echo "$as_me: failed program was:" >&5
10619
+cat conftest.$ac_ext >&5
10620
+have_fd_set=no
10621
+fi
10622
+rm -f conftest.$ac_objext conftest.$ac_ext
10623
+if test $have_fd_set = yes; then
10624
+    echo "$as_me:$LINENO: result: yes, found in sys/types.h" >&5
10625
+echo "${ECHO_T}yes, found in sys/types.h" >&6
10626
+else
10627
+    cat >conftest.$ac_ext <<_ACEOF
10628
+#line $LINENO "configure"
10629
+#include "confdefs.h"
10630
+#include <sys/select.h>
10631
+
10632
+_ACEOF
10633
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
10634
+  egrep "fd_mask" >/dev/null 2>&1; then
10635
+  have_fd_set=yes
10636
+fi
10637
+rm -f conftest*
10638
+
10639
+    if test $have_fd_set = yes; then
10640
+
10641
+cat >>confdefs.h <<\_ACEOF
10642
+#define HAVE_SYS_SELECT_H 1
10643
+_ACEOF
10644
+
10645
+        echo "$as_me:$LINENO: result: yes, found in sys/select.h" >&5
10646
+echo "${ECHO_T}yes, found in sys/select.h" >&6
10647
+    else
10648
+
10649
+cat >>confdefs.h <<\_ACEOF
10650
+#define NO_FD_SET 1
10651
+_ACEOF
10652
+
10653
+        echo "$as_me:$LINENO: result: no" >&5
10654
+echo "${ECHO_T}no" >&6
10655
+    fi
10656
+fi
10657
+
10583 10658
 ac_config_files="$ac_config_files libclamav/Makefile clamscan/Makefile database/Makefile docs/Makefile clamd/Makefile clamdscan/Makefile clamav-milter/Makefile freshclam/Makefile sigtool/Makefile etc/Makefile Makefile"
10584 10659
 cat >confcache <<\_ACEOF
10585 10660
 # This file is a shell script that caches the results of configure
... ...
@@ -508,6 +508,23 @@ if test "$have_attrib_packed" = yes; then
508 508
 	AC_DEFINE(HAVE_ATTRIB_PACKED, 1, "attrib packed")
509 509
 fi
510 510
 
511
+# Check if <sys/select.h> needs to be included for fd_set
512
+AC_MSG_CHECKING([for fd_set])
513
+AC_TRY_COMPILE([#include <sys/types.h>],
514
+        [fd_set readMask, writeMask;], have_fd_set=yes, have_fd_set=no)
515
+if test $have_fd_set = yes; then
516
+    AC_MSG_RESULT([yes, found in sys/types.h])
517
+else
518
+    AC_HEADER_EGREP(fd_mask, sys/select.h, have_fd_set=yes)
519
+    if test $have_fd_set = yes; then
520
+        AC_DEFINE(HAVE_SYS_SELECT_H, 1, "have <sys/select.h>")
521
+        AC_MSG_RESULT([yes, found in sys/select.h])
522
+    else
523
+        AC_DEFINE(NO_FD_SET, 1, "no fd_set")
524
+        AC_MSG_RESULT(no)
525
+    fi
526
+fi
527
+
511 528
 AC_OUTPUT([
512 529
 libclamav/Makefile
513 530
 clamscan/Makefile