Browse code

Automatically check for stat64

Shawn webb authored on 2012/09/01 03:05:46
Showing 3 changed files
... ...
@@ -854,7 +854,6 @@ enable_dns_fix
854 854
 enable_bigstack
855 855
 with_dbdir
856 856
 enable_readdir_r
857
-enable_stat64
858 857
 enable_fdpassing
859 858
 enable_clamdtop
860 859
 with_libncurses_prefix
... ...
@@ -1531,7 +1530,6 @@ Optional Features:
1531 1531
   --enable-dns-fix	  enable workaround for broken DNS servers (as in SpeedTouch 510)
1532 1532
   --enable-bigstack	  increase thread stack size
1533 1533
   --enable-readdir_r		    enable support for readdir_r
1534 1534
   --disable-fdpassing        don't build file descriptor passing support
1535 1535
   --enable-clamdtop       Enable 'clamdtop' tool [default=auto]
1536 1536
   --enable-distcheck-werror
... ...
@@ -18738,11 +18736,40 @@ cat >>confdefs.h <<_ACEOF
18738 18738
 _ACEOF
18739 18739
 
18740 18740
 
18741
-# Check whether --enable-stat64 was given.
18742
-if test "${enable_stat64+set}" = set; then :
18743
-  enableval=$enable_stat64; enable_stat64=$enableval
18741
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stat64" >&5
18742
+$as_echo_n "checking stat64... " >&6; }
18743
+if test "$cross_compiling" = yes; then :
18744
+  enable_stat64=no
18745
+else
18746
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18747
+/* end confdefs.h.  */
18748
+
18749
+#define _LARGEFILE_SOURCE
18750
+#define _LARGEFILE64_SOURCE
18751
+#define _FILE_OFFSET_BITS 64
18752
+#include <stdio.h>
18753
+#include <sys/types.h>
18754
+#include <sys/stat.h>
18755
+#include <unistd.h>
18756
+#include <errno.h>
18757
+
18758
+int main(void) {
18759
+    struct stat64 sb;
18760
+
18761
+    if (stat64(".", &sb) == -1)
18762
+        return errno;
18763
+
18764
+    return 0;
18765
+}
18766
+
18767
+_ACEOF
18768
+if ac_fn_c_try_run "$LINENO"; then :
18769
+  enable_stat64=yes
18744 18770
 else
18745
-  enable_stat64="no"
18771
+  enable_stat64=no
18772
+fi
18773
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
18774
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
18746 18775
 fi
18747 18776
 
18748 18777
 
... ...
@@ -18752,6 +18779,8 @@ $as_echo "#define HAVE_STAT64 1" >>confdefs.h
18752 18752
 
18753 18753
 CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
18754 18754
 fi
18755
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_stat64" >&5
18756
+$as_echo "$enable_stat64" >&6; }
18755 18757
 
18756 18758
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether signed right shift is sign extended" >&5
18757 18759
 $as_echo_n "checking whether signed right shift is sign extended... " >&6; }
... ...
@@ -1491,13 +1491,36 @@ DEFAULT_FD_SETSIZE=256)
1491 1491
 AC_MSG_RESULT([$DEFAULT_FD_SETSIZE])
1492 1492
 AC_DEFINE_UNQUOTED([DEFAULT_FD_SETSIZE], $DEFAULT_FD_SETSIZE, "default FD_SETSIZE value")
1493 1493
 
1494
-AC_ARG_ENABLE([stat64], [--enable-stat64]          enable support for stat64],
1495
-              enable_stat64=$enableval, enable_stat64="no")
1494
+AC_MSG_CHECKING([stat64])
1495
+AC_TRY_RUN([
1496
+#define _LARGEFILE_SOURCE
1497
+#define _LARGEFILE64_SOURCE
1498
+#define _FILE_OFFSET_BITS 64
1499
+#include <stdio.h>
1500
+#include <sys/types.h>
1501
+#include <sys/stat.h>
1502
+#include <unistd.h>
1503
+#include <errno.h>
1504
+
1505
+int main(void) {
1506
+    struct stat64 sb;
1507
+
1508
+    if (stat64(".", &sb) == -1)
1509
+        return errno;
1510
+
1511
+    return 0;
1512
+}
1513
+],
1514
+[enable_stat64=yes],
1515
+[enable_stat64=no],
1516
+[enable_stat64=no],
1517
+)
1496 1518
 
1497 1519
 if test "$enable_stat64" != "no"; then
1498 1520
 AC_DEFINE([HAVE_STAT64],1,[enable stat64])
1499 1521
 CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
1500 1522
 fi
1523
+AC_MSG_RESULT([$enable_stat64])
1501 1524
 
1502 1525
 dnl Check signed right shift implementation
1503 1526
 AC_MSG_CHECKING([whether signed right shift is sign extended])
... ...
@@ -695,8 +695,7 @@ libclamav_la_SOURCES = clamav.h matcher-ac.c matcher-ac.h matcher-bm.c \
695 695
 	tomsfastmath/bin/fp_signed_bin_size.c \
696 696
 	tomsfastmath/bin/fp_to_signed_bin.c \
697 697
 	tomsfastmath/bin/fp_to_unsigned_bin.c \
698
-	tomsfastmath/bin/fp_toradix.c \
699
-	tomsfastmath/bin/fp_toradix_n.c \
698
+	tomsfastmath/bin/fp_toradix.c tomsfastmath/bin/fp_toradix_n.c \
700 699
 	tomsfastmath/bin/fp_unsigned_bin_size.c \
701 700
 	tomsfastmath/bit/fp_cnt_lsb.c tomsfastmath/bit/fp_count_bits.c \
702 701
 	tomsfastmath/bit/fp_div_2.c tomsfastmath/bit/fp_div_2d.c \