Browse code

replace AC_FUNC_MMAP: check only for MAP_PRIVATE and not MAP_FIXED (bb #1140) HP-UX: zlib in non-standard path, LIBS got set to -lz, but -L was missing, just restore LIBS and don't touch it

git-svn: trunk@4145

Török Edvin authored on 2008/08/26 21:45:20
Showing 22 changed files
... ...
@@ -72,7 +72,8 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
72 72
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
73 73
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
74 74
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
75
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
75
+	$(top_srcdir)/m4/lib-prefix.m4 \
76
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
76 77
 	$(top_srcdir)/configure.in
77 78
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
78 79
 	$(ACLOCAL_M4)
... ...
@@ -7791,4 +7791,5 @@ m4_include([m4/acinclude.m4])
7791 7791
 m4_include([m4/fdpassing.m4])
7792 7792
 m4_include([m4/lib-link.m4])
7793 7793
 m4_include([m4/lib-prefix.m4])
7794
+m4_include([m4/mmap_private.m4])
7794 7795
 m4_include([m4/resolv.m4])
... ...
@@ -39,9 +39,6 @@
39 39
 /* os is bsd flavor */
40 40
 #undef C_BSD
41 41
 
42
-/* os is cygwin */
43
-#undef C_CYGWIN
44
-
45 42
 /* os is darwin */
46 43
 #undef C_DARWIN
47 44
 
... ...
@@ -141,9 +138,6 @@
141 141
 /* gethostbyname_r takes 6 arguments */
142 142
 #undef HAVE_GETHOSTBYNAME_R_6
143 143
 
144
-/* Define to 1 if you have the `getpagesize' function. */
145
-#undef HAVE_GETPAGESIZE
146
-
147 144
 /* Define to 1 if you have the <grp.h> header file. */
148 145
 #undef HAVE_GRP_H
149 146
 
... ...
@@ -192,7 +186,8 @@
192 192
 /* Define to 1 if you have the `mkstemp' function. */
193 193
 #undef HAVE_MKSTEMP
194 194
 
195
-/* Define to 1 if you have a working `mmap' system call. */
195
+/* Define to 1 if you have a working `mmap' system call that supports
196
+   MAP_PRIVATE. */
196 197
 #undef HAVE_MMAP
197 198
 
198 199
 /* Define to 1 if you have the <ndir.h> header file. */
... ...
@@ -58,7 +58,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in INSTALL
58 58
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
59 59
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
60 60
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
61
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
61
+	$(top_srcdir)/m4/lib-prefix.m4 \
62
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
62 63
 	$(top_srcdir)/configure.in
63 64
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
64 65
 	$(ACLOCAL_M4)
... ...
@@ -6069,7 +6069,7 @@ verifyIncomingSocketName(const char *sockName)
6069 6069
 		return -1;
6070 6070
 	}
6071 6071
 
6072
-	ptr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
6072
+	ptr = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
6073 6073
 	if(ptr == MAP_FAILED) {
6074 6074
 		perror("mmap");
6075 6075
 		close(fd);
... ...
@@ -57,7 +57,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
57 57
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
58 58
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
59 59
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
60
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
60
+	$(top_srcdir)/m4/lib-prefix.m4 \
61
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
61 62
 	$(top_srcdir)/configure.in
62 63
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
63 64
 	$(ACLOCAL_M4)
... ...
@@ -57,7 +57,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
57 57
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
58 58
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
59 59
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
60
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
60
+	$(top_srcdir)/m4/lib-prefix.m4 \
61
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
61 62
 	$(top_srcdir)/configure.in
62 63
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
63 64
 	$(ACLOCAL_M4)
... ...
@@ -57,7 +57,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
57 57
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
58 58
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
59 59
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
60
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
60
+	$(top_srcdir)/m4/lib-prefix.m4 \
61
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
61 62
 	$(top_srcdir)/configure.in
62 63
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
63 64
 	$(ACLOCAL_M4)
... ...
@@ -58,7 +58,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
58 58
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
59 59
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
60 60
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
61
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
61
+	$(top_srcdir)/m4/lib-prefix.m4 \
62
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
62 63
 	$(top_srcdir)/configure.in
63 64
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
64 65
 	$(ACLOCAL_M4)
... ...
@@ -12513,159 +12513,14 @@ fi
12513 12513
 done
12514 12514
 
12515 12515
 
12516
-
12517
-for ac_header in stdlib.h unistd.h
12518
-do
12519
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
12520
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
12521
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
12522
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
12523
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
12524
-  echo $ECHO_N "(cached) $ECHO_C" >&6
12525
-fi
12526
-ac_res=`eval echo '${'$as_ac_Header'}'`
12527
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
12528
-echo "${ECHO_T}$ac_res" >&6; }
12529
-else
12530
-  # Is the header compilable?
12531
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
12532
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
12533
-cat >conftest.$ac_ext <<_ACEOF
12534
-/* confdefs.h.  */
12535
-_ACEOF
12536
-cat confdefs.h >>conftest.$ac_ext
12537
-cat >>conftest.$ac_ext <<_ACEOF
12538
-/* end confdefs.h.  */
12539
-$ac_includes_default
12540
-#include <$ac_header>
12541
-_ACEOF
12542
-rm -f conftest.$ac_objext
12543
-if { (ac_try="$ac_compile"
12544
-case "(($ac_try" in
12545
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12546
-  *) ac_try_echo=$ac_try;;
12547
-esac
12548
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12549
-  (eval "$ac_compile") 2>conftest.er1
12550
-  ac_status=$?
12551
-  grep -v '^ *+' conftest.er1 >conftest.err
12552
-  rm -f conftest.er1
12553
-  cat conftest.err >&5
12554
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12555
-  (exit $ac_status); } && {
12556
-	 test -z "$ac_c_werror_flag" ||
12557
-	 test ! -s conftest.err
12558
-       } && test -s conftest.$ac_objext; then
12559
-  ac_header_compiler=yes
12560
-else
12561
-  echo "$as_me: failed program was:" >&5
12562
-sed 's/^/| /' conftest.$ac_ext >&5
12563
-
12564
-	ac_header_compiler=no
12565
-fi
12566
-
12567
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
12568
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
12569
-echo "${ECHO_T}$ac_header_compiler" >&6; }
12570
-
12571
-# Is the header present?
12572
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
12573
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
12574
-cat >conftest.$ac_ext <<_ACEOF
12575
-/* confdefs.h.  */
12576
-_ACEOF
12577
-cat confdefs.h >>conftest.$ac_ext
12578
-cat >>conftest.$ac_ext <<_ACEOF
12579
-/* end confdefs.h.  */
12580
-#include <$ac_header>
12581
-_ACEOF
12582
-if { (ac_try="$ac_cpp conftest.$ac_ext"
12583
-case "(($ac_try" in
12584
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12585
-  *) ac_try_echo=$ac_try;;
12586
-esac
12587
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12588
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
12589
-  ac_status=$?
12590
-  grep -v '^ *+' conftest.er1 >conftest.err
12591
-  rm -f conftest.er1
12592
-  cat conftest.err >&5
12593
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12594
-  (exit $ac_status); } >/dev/null && {
12595
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
12596
-	 test ! -s conftest.err
12597
-       }; then
12598
-  ac_header_preproc=yes
12599
-else
12600
-  echo "$as_me: failed program was:" >&5
12601
-sed 's/^/| /' conftest.$ac_ext >&5
12602
-
12603
-  ac_header_preproc=no
12604
-fi
12605
-
12606
-rm -f conftest.err conftest.$ac_ext
12607
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
12608
-echo "${ECHO_T}$ac_header_preproc" >&6; }
12609
-
12610
-# So?  What about this header?
12611
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
12612
-  yes:no: )
12613
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
12614
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
12615
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
12616
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
12617
-    ac_header_preproc=yes
12618
-    ;;
12619
-  no:yes:* )
12620
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
12621
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
12622
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
12623
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
12624
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
12625
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
12626
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
12627
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
12628
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
12629
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
12630
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
12631
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
12632
-    ( cat <<\_ASBOX
12633
-## -------------------------------------- ##
12634
-## Report this to http://bugs.clamav.net/ ##
12635
-## -------------------------------------- ##
12636
-_ASBOX
12637
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
12638
-    ;;
12639
-esac
12640
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
12641
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
12642
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
12516
+	{ echo "$as_me:$LINENO: checking for working mmap" >&5
12517
+echo $ECHO_N "checking for working mmap... $ECHO_C" >&6; }
12518
+if test "${ac_cv_c_mmap_private+set}" = set; then
12643 12519
   echo $ECHO_N "(cached) $ECHO_C" >&6
12644 12520
 else
12645
-  eval "$as_ac_Header=\$ac_header_preproc"
12646
-fi
12647
-ac_res=`eval echo '${'$as_ac_Header'}'`
12648
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
12649
-echo "${ECHO_T}$ac_res" >&6; }
12650
-
12651
-fi
12652
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
12653
-  cat >>confdefs.h <<_ACEOF
12654
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
12655
-_ACEOF
12656
-
12657
-fi
12658 12521
 
12659
-done
12660
-
12661
-
12662
-for ac_func in getpagesize
12663
-do
12664
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
12665
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
12666
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
12667
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
12668
-  echo $ECHO_N "(cached) $ECHO_C" >&6
12522
+		if test "$cross_compiling" = yes; then
12523
+  ac_cv_c_mmap_private=no
12669 12524
 else
12670 12525
   cat >conftest.$ac_ext <<_ACEOF
12671 12526
 /* confdefs.h.  */
... ...
@@ -12673,224 +12528,64 @@ _ACEOF
12673 12673
 cat confdefs.h >>conftest.$ac_ext
12674 12674
 cat >>conftest.$ac_ext <<_ACEOF
12675 12675
 /* end confdefs.h.  */
12676
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
12677
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
12678
-#define $ac_func innocuous_$ac_func
12679
-
12680
-/* System header to define __stub macros and hopefully few prototypes,
12681
-    which can conflict with char $ac_func (); below.
12682
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
12683
-    <limits.h> exists even on freestanding compilers.  */
12684
-
12685
-#ifdef __STDC__
12686
-# include <limits.h>
12687
-#else
12688
-# include <assert.h>
12689
-#endif
12690 12676
 
12691
-#undef $ac_func
12692
-
12693
-/* Override any GCC internal prototype to avoid an error.
12694
-   Use char because int might match the return type of a GCC
12695
-   builtin and then its argument prototype would still apply.  */
12696
-#ifdef __cplusplus
12697
-extern "C"
12677
+#include <unistd.h>
12678
+#include <stdlib.h>
12679
+#include <sys/mman.h>
12680
+#ifdef HAVE_SYS_TYPES_H
12681
+#include <sys/types.h>
12698 12682
 #endif
12699
-char $ac_func ();
12700
-/* The GNU C library defines this for functions which it implements
12701
-    to always fail with ENOSYS.  Some functions are actually named
12702
-    something starting with __ and the normal name is an alias.  */
12703
-#if defined __stub_$ac_func || defined __stub___$ac_func
12704
-choke me
12683
+#ifdef HAVE_SYS_STAT_H
12684
+#include <sys/stat.h>
12705 12685
 #endif
12706
-
12707
-int
12708
-main ()
12709
-{
12710
-return $ac_func ();
12711
-  ;
12712
-  return 0;
12713
-}
12714
-_ACEOF
12715
-rm -f conftest.$ac_objext conftest$ac_exeext
12716
-if { (ac_try="$ac_link"
12717
-case "(($ac_try" in
12718
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12719
-  *) ac_try_echo=$ac_try;;
12720
-esac
12721
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12722
-  (eval "$ac_link") 2>conftest.er1
12723
-  ac_status=$?
12724
-  grep -v '^ *+' conftest.er1 >conftest.err
12725
-  rm -f conftest.er1
12726
-  cat conftest.err >&5
12727
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12728
-  (exit $ac_status); } && {
12729
-	 test -z "$ac_c_werror_flag" ||
12730
-	 test ! -s conftest.err
12731
-       } && test -s conftest$ac_exeext &&
12732
-       $as_test_x conftest$ac_exeext; then
12733
-  eval "$as_ac_var=yes"
12734
-else
12735
-  echo "$as_me: failed program was:" >&5
12736
-sed 's/^/| /' conftest.$ac_ext >&5
12737
-
12738
-	eval "$as_ac_var=no"
12739
-fi
12740
-
12741
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
12742
-      conftest$ac_exeext conftest.$ac_ext
12743
-fi
12744
-ac_res=`eval echo '${'$as_ac_var'}'`
12745
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
12746
-echo "${ECHO_T}$ac_res" >&6; }
12747
-if test `eval echo '${'$as_ac_var'}'` = yes; then
12748
-  cat >>confdefs.h <<_ACEOF
12749
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
12750
-_ACEOF
12751
-
12752
-fi
12753
-done
12754
-
12755
-{ echo "$as_me:$LINENO: checking for working mmap" >&5
12756
-echo $ECHO_N "checking for working mmap... $ECHO_C" >&6; }
12757
-if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
12758
-  echo $ECHO_N "(cached) $ECHO_C" >&6
12759
-else
12760
-  if test "$cross_compiling" = yes; then
12761
-  ac_cv_func_mmap_fixed_mapped=no
12762
-else
12763
-  cat >conftest.$ac_ext <<_ACEOF
12764
-/* confdefs.h.  */
12765
-_ACEOF
12766
-cat confdefs.h >>conftest.$ac_ext
12767
-cat >>conftest.$ac_ext <<_ACEOF
12768
-/* end confdefs.h.  */
12769
-$ac_includes_default
12770
-/* malloc might have been renamed as rpl_malloc. */
12771
-#undef malloc
12772
-
12773
-/* Thanks to Mike Haertel and Jim Avera for this test.
12774
-   Here is a matrix of mmap possibilities:
12775
-	mmap private not fixed
12776
-	mmap private fixed at somewhere currently unmapped
12777
-	mmap private fixed at somewhere already mapped
12778
-	mmap shared not fixed
12779
-	mmap shared fixed at somewhere currently unmapped
12780
-	mmap shared fixed at somewhere already mapped
12781
-   For private mappings, we should verify that changes cannot be read()
12782
-   back from the file, nor mmap's back from the file at a different
12783
-   address.  (There have been systems where private was not correctly
12784
-   implemented like the infamous i386 svr4.0, and systems where the
12785
-   VM page cache was not coherent with the file system buffer cache
12786
-   like early versions of FreeBSD and possibly contemporary NetBSD.)
12787
-   For shared mappings, we should conversely verify that changes get
12788
-   propagated back to all the places they're supposed to be.
12789
-
12790
-   Grep wants private fixed already mapped.
12791
-   The main things grep needs to know about mmap are:
12792
-   * does it exist and is it safe to write into the mmap'd area
12793
-   * how to use it (BSD variants)  */
12794
-
12795 12686
 #include <fcntl.h>
12796
-#include <sys/mman.h>
12797
-
12798
-#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
12799
-char *malloc ();
12800
-#endif
12801
-
12802
-/* This mess was copied from the GNU getpagesize.h.  */
12803
-#ifndef HAVE_GETPAGESIZE
12804
-/* Assume that all systems that can run configure have sys/param.h.  */
12805
-# ifndef HAVE_SYS_PARAM_H
12806
-#  define HAVE_SYS_PARAM_H 1
12807
-# endif
12808
-
12809
-# ifdef _SC_PAGESIZE
12810
-#  define getpagesize() sysconf(_SC_PAGESIZE)
12811
-# else /* no _SC_PAGESIZE */
12812
-#  ifdef HAVE_SYS_PARAM_H
12813
-#   include <sys/param.h>
12814
-#   ifdef EXEC_PAGESIZE
12815
-#    define getpagesize() EXEC_PAGESIZE
12816
-#   else /* no EXEC_PAGESIZE */
12817
-#    ifdef NBPG
12818
-#     define getpagesize() NBPG * CLSIZE
12819
-#     ifndef CLSIZE
12820
-#      define CLSIZE 1
12821
-#     endif /* no CLSIZE */
12822
-#    else /* no NBPG */
12823
-#     ifdef NBPC
12824
-#      define getpagesize() NBPC
12825
-#     else /* no NBPC */
12826
-#      ifdef PAGESIZE
12827
-#       define getpagesize() PAGESIZE
12828
-#      endif /* PAGESIZE */
12829
-#     endif /* no NBPC */
12830
-#    endif /* no NBPG */
12831
-#   endif /* no EXEC_PAGESIZE */
12832
-#  else /* no HAVE_SYS_PARAM_H */
12833
-#   define getpagesize() 8192	/* punt totally */
12834
-#  endif /* no HAVE_SYS_PARAM_H */
12835
-# endif /* no _SC_PAGESIZE */
12836
-
12837
-#endif /* no HAVE_GETPAGESIZE */
12838
-
12839
-int
12840
-main ()
12687
+int main(void)
12841 12688
 {
12842
-  char *data, *data2, *data3;
12843
-  int i, pagesize;
12844
-  int fd;
12845
-
12846
-  pagesize = getpagesize ();
12847
-
12848
-  /* First, make a file with some known garbage in it. */
12849
-  data = (char *) malloc (pagesize);
12850
-  if (!data)
12851
-    return 1;
12852
-  for (i = 0; i < pagesize; ++i)
12853
-    *(data + i) = rand ();
12854
-  umask (0);
12855
-  fd = creat ("conftest.mmap", 0600);
12856
-  if (fd < 0)
12857
-    return 1;
12858
-  if (write (fd, data, pagesize) != pagesize)
12859
-    return 1;
12860
-  close (fd);
12861
-
12862
-  /* Next, try to mmap the file at a fixed address which already has
12863
-     something else allocated at it.  If we can, also make sure that
12864
-     we see the same garbage.  */
12865
-  fd = open ("conftest.mmap", O_RDWR);
12866
-  if (fd < 0)
12867
-    return 1;
12868
-  data2 = (char *) malloc (2 * pagesize);
12869
-  if (!data2)
12870
-    return 1;
12871
-  data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1);
12872
-  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
12873
-		     MAP_PRIVATE | MAP_FIXED, fd, 0L))
12874
-    return 1;
12875
-  for (i = 0; i < pagesize; ++i)
12876
-    if (*(data + i) != *(data2 + i))
12877
-      return 1;
12878
-
12879
-  /* Finally, make sure that changes to the mapped area do not
12880
-     percolate back to the file as seen by read().  (This is a bug on
12881
-     some variants of i386 svr4.0.)  */
12882
-  for (i = 0; i < pagesize; ++i)
12883
-    *(data2 + i) = *(data2 + i) + 1;
12884
-  data3 = (char *) malloc (pagesize);
12885
-  if (!data3)
12886
-    return 1;
12887
-  if (read (fd, data3, pagesize) != pagesize)
12888
-    return 1;
12889
-  for (i = 0; i < pagesize; ++i)
12890
-    if (*(data + i) != *(data3 + i))
12891
-      return 1;
12892
-  close (fd);
12893
-  return 0;
12689
+	char *data, *data2, *data3;
12690
+	unsigned i, datasize = 1024;
12691
+	int fd;
12692
+
12693
+  	/* First, make a file with some known garbage in it. */
12694
+	data = (char*) malloc(datasize);
12695
+	if(!data)
12696
+		return 1;
12697
+	for(i=0;i<datasize;i++)
12698
+		*(data + i) = rand();
12699
+	umask(0);
12700
+	fd = creat("conftest.mmap", 0600);
12701
+	if(fd < 0)
12702
+		return 1;
12703
+	if(write (fd, data, datasize) != datasize)
12704
+		return 1;
12705
+	close(fd);
12706
+	fd = open("conftest.mmap", O_RDWR);
12707
+	if (fd < 0)
12708
+		return 1;
12709
+	/* Next, try to mmap the file at a fixed address which already has
12710
+	   something else allocated at it.  If we can, also make sure that
12711
+	   we see the same garbage.  */
12712
+	data2 = mmap(NULL, sizeof(data), PROT_READ | PROT_WRITE,
12713
+		MAP_PRIVATE, fd, 0L);
12714
+	if(data2 == MAP_FAILED)
12715
+		return 2;
12716
+	for(i=0;i<sizeof(data);i++)
12717
+		if(*(data + i) != *(data2+ i))
12718
+			return 3;
12719
+	  /* Finally, make sure that changes to the mapped area do not
12720
+     	     percolate back to the file as seen by read().  (This is a bug on
12721
+             some variants of i386 svr4.0.)  */
12722
+	  for (i = 0; i < datasize; ++i)
12723
+	    *(data2 + i) = *(data2 + i) + 1;
12724
+	data3 = (char*) malloc(datasize);
12725
+	if(!data3)
12726
+		return 1;
12727
+	if(read (fd, data3, datasize) != datasize)
12728
+		return 1;
12729
+	for(i=0;i<sizeof(data);i++)
12730
+		if(*(data + i) != *(data3 + i))
12731
+			return 3;
12732
+	close(fd);
12733
+	return 0;
12894 12734
 }
12895 12735
 _ACEOF
12896 12736
 rm -f conftest$ac_exeext
... ...
@@ -12913,23 +12608,23 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
12913 12913
   ac_status=$?
12914 12914
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
12915 12915
   (exit $ac_status); }; }; then
12916
-  ac_cv_func_mmap_fixed_mapped=yes
12916
+  ac_cv_c_mmap_private=yes
12917 12917
 else
12918 12918
   echo "$as_me: program exited with status $ac_status" >&5
12919 12919
 echo "$as_me: failed program was:" >&5
12920 12920
 sed 's/^/| /' conftest.$ac_ext >&5
12921 12921
 
12922 12922
 ( exit $ac_status )
12923
-ac_cv_func_mmap_fixed_mapped=no
12923
+ac_cv_c_mmap_private=no
12924 12924
 fi
12925 12925
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
12926 12926
 fi
12927 12927
 
12928 12928
 
12929 12929
 fi
12930
-{ echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
12931
-echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6; }
12932
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
12930
+{ echo "$as_me:$LINENO: result: $ac_cv_c_mmap_private" >&5
12931
+echo "${ECHO_T}$ac_cv_c_mmap_private" >&6; }
12932
+if test $ac_cv_c_mmap_private = yes; then
12933 12933
 
12934 12934
 cat >>confdefs.h <<\_ACEOF
12935 12935
 #define HAVE_MMAP 1
... ...
@@ -13914,7 +13609,8 @@ echo "$as_me: WARNING: ****** stability problems to the ClamAV developers!" >&2;
13914 13914
     if test "$ZLIB_HOME" != "/usr"; then
13915 13915
 	CPPFLAGS="$CPPFLAGS -I$ZLIB_HOME/include"
13916 13916
 	save_LDFLAGS="$LDFLAGS"
13917
-	LDFLAGS="$LIBS -L$ZLIB_HOME/lib"
13917
+	save_LIBS="$LIBS"
13918
+	LDFLAGS="$LDFLAGS -L$ZLIB_HOME/lib"
13918 13919
 	{ echo "$as_me:$LINENO: checking for inflateEnd in -lz" >&5
13919 13920
 echo $ECHO_N "checking for inflateEnd in -lz... $ECHO_C" >&6; }
13920 13921
 if test "${ac_cv_lib_z_inflateEnd+set}" = set; then
... ...
@@ -14064,6 +13760,7 @@ echo "$as_me: error: Your zlib is missing gzopen()" >&2;}
14064 14064
 fi
14065 14065
 
14066 14066
 	LDFLAGS="$save_LDFLAGS"
14067
+	LIBS="$save_LIBS"
14067 14068
     else
14068 14069
 	{ echo "$as_me:$LINENO: checking for inflateEnd in -lz" >&5
14069 14070
 echo $ECHO_N "checking for inflateEnd in -lz... $ECHO_C" >&6; }
... ...
@@ -18956,7 +18653,8 @@ _ACEOF
18956 18956
 cat confdefs.h >>conftest.$ac_ext
18957 18957
 cat >>conftest.$ac_ext <<_ACEOF
18958 18958
 /* end confdefs.h.  */
18959
-int main(int argc, char **argv) {
18959
+
18960
+			    int main(int argc, char **argv) {
18960 18961
 #pragma pack(1)			/* has to be in column 1 ! */
18961 18962
 			struct { char c; long l; } s;
18962 18963
 			return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; }
... ...
@@ -314,7 +314,7 @@ AC_CHECK_LIB([socket], [bind], [LIBS="$LIBS -lsocket"; CLAMAV_MILTER_LIBS="$CLAM
314 314
 AC_SEARCH_LIBS([gethostent],[nsl], [(LIBS="$LIBS -lnsl"; CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lnsl"; FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lnsl"; CLAMD_LIBS="$CLAMD_LIBS -lnsl")])
315 315
 
316 316
 AC_CHECK_FUNCS([poll setsid memcpy snprintf vsnprintf strerror_r strlcpy strlcat strcasestr inet_ntop setgroups initgroups ctime_r mkstemp])
317
-AC_FUNC_MMAP
317
+AC_C_FUNC_MMAP_PRIVATE
318 318
 AC_FUNC_FSEEKO
319 319
 
320 320
 enable_check_ut=auto
... ...
@@ -437,10 +437,12 @@ else
437 437
     if test "$ZLIB_HOME" != "/usr"; then
438 438
 	CPPFLAGS="$CPPFLAGS -I$ZLIB_HOME/include"
439 439
 	save_LDFLAGS="$LDFLAGS"
440
-	LDFLAGS="$LIBS -L$ZLIB_HOME/lib"
440
+	save_LIBS="$LIBS"
441
+	LDFLAGS="$LDFLAGS -L$ZLIB_HOME/lib"
441 442
 	AC_CHECK_LIB([z], [inflateEnd], [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -L$ZLIB_HOME/lib -lz";FRESHCLAM_LIBS="$FRESHCLAM_LIBS -L$ZLIB_HOME/lib -lz"; AC_DEFINE([HAVE_ZLIB_H],1,zlib installed)], AC_MSG_ERROR([Please install zlib and zlib-devel packages]))
442 443
 	AC_CHECK_LIB([z], [gzopen], [], AC_MSG_ERROR([Your zlib is missing gzopen()]))
443 444
 	LDFLAGS="$save_LDFLAGS"
445
+	LIBS="$save_LIBS"
444 446
     else
445 447
 	AC_CHECK_LIB([z], [inflateEnd], [LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lz";FRESHCLAM_LIBS="$FRESHCLAM_LIBS -lz"; AC_DEFINE([HAVE_ZLIB_H],1,zlib installed)], AC_MSG_ERROR([Please install zlib and zlib-devel packages]))
446 448
 	AC_CHECK_LIB([z], [gzopen],[], AC_MSG_ERROR([Your zlib is missing gzopen()]))
... ...
@@ -1352,7 +1354,8 @@ AC_MSG_RESULT([$have_attrib_packed])
1352 1352
 if test "$have_attrib_packed" = no; then
1353 1353
 	AC_MSG_CHECKING([for structure packing via pragma])
1354 1354
 	AC_CACHE_VAL([have_pragma_pack],[
1355
-		AC_TRY_RUN([int main(int argc, char **argv) {
1355
+		AC_TRY_RUN([
1356
+			    int main(int argc, char **argv) {
1356 1357
 #pragma pack(1)			/* has to be in column 1 ! */
1357 1358
 			struct { char c; long l; } s;
1358 1359
 			return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; } ],
... ...
@@ -56,7 +56,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
56 56
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
57 57
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
58 58
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
59
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
59
+	$(top_srcdir)/m4/lib-prefix.m4 \
60
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
60 61
 	$(top_srcdir)/configure.in
61 62
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
62 63
 	$(ACLOCAL_M4)
... ...
@@ -55,7 +55,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
55 55
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
56 56
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
57 57
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
58
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
58
+	$(top_srcdir)/m4/lib-prefix.m4 \
59
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
59 60
 	$(top_srcdir)/configure.in
60 61
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 62
 	$(ACLOCAL_M4)
... ...
@@ -55,7 +55,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
55 55
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
56 56
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
57 57
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
58
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
58
+	$(top_srcdir)/m4/lib-prefix.m4 \
59
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
59 60
 	$(top_srcdir)/configure.in
60 61
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 62
 	$(ACLOCAL_M4)
... ...
@@ -58,7 +58,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
58 58
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
59 59
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
60 60
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
61
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
61
+	$(top_srcdir)/m4/lib-prefix.m4 \
62
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
62 63
 	$(top_srcdir)/configure.in
63 64
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
64 65
 	$(ACLOCAL_M4)
... ...
@@ -59,7 +59,8 @@ DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
59 59
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
60 60
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
61 61
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
62
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
62
+	$(top_srcdir)/m4/lib-prefix.m4 \
63
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
63 64
 	$(top_srcdir)/configure.in
64 65
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
65 66
 	$(ACLOCAL_M4)
... ...
@@ -57,7 +57,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
57 57
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
58 58
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
59 59
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
60
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
60
+	$(top_srcdir)/m4/lib-prefix.m4 \
61
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
61 62
 	$(top_srcdir)/configure.in
62 63
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
63 64
 	$(ACLOCAL_M4)
... ...
@@ -43,7 +43,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
43 43
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
44 44
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
45 45
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
46
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
46
+	$(top_srcdir)/m4/lib-prefix.m4 \
47
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
47 48
 	$(top_srcdir)/configure.in
48 49
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
49 50
 	$(ACLOCAL_M4)
... ...
@@ -43,7 +43,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
43 43
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
44 44
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
45 45
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
46
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
46
+	$(top_srcdir)/m4/lib-prefix.m4 \
47
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
47 48
 	$(top_srcdir)/configure.in
48 49
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
49 50
 	$(ACLOCAL_M4)
... ...
@@ -57,7 +57,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
57 57
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
58 58
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
59 59
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
60
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
60
+	$(top_srcdir)/m4/lib-prefix.m4 \
61
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
61 62
 	$(top_srcdir)/configure.in
62 63
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
63 64
 	$(ACLOCAL_M4)
... ...
@@ -37,7 +37,8 @@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
37 37
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
38 38
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
39 39
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
40
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
40
+	$(top_srcdir)/m4/lib-prefix.m4 \
41
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
41 42
 	$(top_srcdir)/configure.in
42 43
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
43 44
 	$(ACLOCAL_M4)
... ...
@@ -43,7 +43,8 @@ DIST_COMMON = $(am__dist_bin_SCRIPTS_DIST) $(srcdir)/Makefile.am \
43 43
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
44 44
 am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
45 45
 	$(top_srcdir)/m4/fdpassing.m4 $(top_srcdir)/m4/lib-link.m4 \
46
-	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/resolv.m4 \
46
+	$(top_srcdir)/m4/lib-prefix.m4 \
47
+	$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
47 48
 	$(top_srcdir)/configure.in
48 49
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
49 50
 	$(ACLOCAL_M4)