APR's configure script uses AC_TRY_RUN to detect whether /dev/zero can
be mmaped. When cross-compiling this defaults to no. While APR compiles
fine like this (since r1873594 in the APR 1.7 branch), the apr_lock
implementation method falls back to SysV IPC semget().

<snip>
checking for mmap that can map /dev/zero... no
<snip>
decision on apr_lock implementation method... SysV IPC semget()
<snip>

This commit adds a cache check with which users who cross-compile APR
can influence the outcome of the test by setting the variable
ac_cv_mmap__dev_zero=yes:

<snip>
checking for mmap that can map /dev/zero... (cached) yes
<snip>
decision on apr_lock implementation method... pthread pshared mutex
<snip>

This way the new default apr_lock mechanism can also be used when
cross-compiling (if /dev/zero is in fact mmapable that is).

Index: configure.in
===================================================================
--- configure.in        (revision 1873663)
+++ configure.in        (working copy)
@@ -1186,8 +1186,9 @@
 # Not all systems can mmap /dev/zero (such as HP-UX).  Check for that.
 if test "$ac_cv_func_mmap" = "yes" &&
    test "$ac_cv_file__dev_zero" = "yes"; then
-    AC_MSG_CHECKING(for mmap that can map /dev/zero)
-    AC_TRY_RUN([
+    AC_CACHE_CHECK([for mmap that can map /dev/zero],
+    [ac_cv_mmap__dev_zero],
+    [AC_TRY_RUN([
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -1210,9 +1211,7 @@
             return 3;
         }
         return 0;
-    }], [], [ac_cv_file__dev_zero=no], [ac_cv_file__dev_zero=no])
-
-    AC_MSG_RESULT($ac_cv_file__dev_zero)
+    }], [], [ac_cv_file__dev_zero=no], [ac_cv_file__dev_zero=no])])
 fi

 # Now we determine which one is our anonymous shmem preference.

Reply via email to