You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2010/10/26 03:57:32 UTC

[lucy-commits] svn commit: r1027342 - in /incubator/lucy/trunk/charmonizer: charmonize.c src/Charmonizer/Probe/Memory.c src/Charmonizer/Probe/Memory.h

Author: marvin
Date: Tue Oct 26 01:57:31 2010
New Revision: 1027342

URL: http://svn.apache.org/viewvc?rev=1027342&view=rev
Log:
Move Charmonizer probe for "sys/mman.h" out of charmonize.c and into the
Memory module.

Modified:
    incubator/lucy/trunk/charmonizer/charmonize.c
    incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c
    incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h

Modified: incubator/lucy/trunk/charmonizer/charmonize.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/charmonize.c?rev=1027342&r1=1027341&r2=1027342&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/charmonize.c (original)
+++ incubator/lucy/trunk/charmonizer/charmonize.c Tue Oct 26 01:57:31 2010
@@ -65,9 +65,6 @@ int main(int argc, char **argv) 
     chaz_VariadicMacros_run();
 
     /* Write custom postamble. */
-    if (chaz_HeadCheck_check_header("sys/mman.h")) {
-        chaz_ConfWriter_append_conf("#define CHY_HAS_SYS_MMAN_H\n\n");
-    }
     chaz_ConfWriter_append_conf(
         "#ifdef CHY_HAS_SYS_TYPES_H\n"
         "  #include <sys/types.h>\n"

Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c?rev=1027342&r1=1027341&r2=1027342&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c Tue Oct 26 01:57:31 2010
@@ -35,16 +35,32 @@ static char alloca_code[] = 
 void
 Memory_run(void) 
 {
-    chaz_bool_t has_alloca_h  = false;
-    chaz_bool_t has_malloc_h  = false;
-    chaz_bool_t need_stdlib_h = false;
-    chaz_bool_t has_alloca    = false;
+    chaz_bool_t has_sys_mman_h = false;
+    chaz_bool_t has_alloca_h   = false;
+    chaz_bool_t has_malloc_h   = false;
+    chaz_bool_t need_stdlib_h  = false;
+    chaz_bool_t has_alloca     = false;
     chaz_bool_t has_builtin_alloca    = false;
     chaz_bool_t has_underscore_alloca = false;
     char code_buf[sizeof(alloca_code) + 100];
 
     ConfWriter_start_module("Memory");
 
+    {
+        /* OpenBSD needs sys/types.h for sys/mman.h to work and mmap() to be
+         * available. Everybody else that has sys/mman.h should have
+         * sys/types.h as well. */
+        char *mman_headers[] = {
+            "sys/types.h",
+            "sys/mman.h",
+            NULL
+        };
+        if (chaz_HeadCheck_check_many_headers((const char**)mman_headers)) {
+            has_sys_mman_h = true;
+            chaz_ConfWriter_append_conf("#define CHY_HAS_SYS_MMAN_H\n\n");
+        }
+    }
+
     /* Unixen. */
     sprintf(code_buf, alloca_code, "alloca.h", "alloca");
     if (CC_test_compile(code_buf, strlen(code_buf))) {
@@ -93,6 +109,9 @@ Memory_run(void) 
 
     /* Shorten */
     ConfWriter_start_short_names();
+    if (has_sys_mman_h) {
+        ConfWriter_shorten_macro("HAS_SYS_MMAN_H");
+    }
     if (has_alloca_h) {
         ConfWriter_shorten_macro("HAS_ALLOCA_H");
     }

Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h?rev=1027342&r1=1027341&r2=1027342&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h Tue Oct 26 01:57:31 2010
@@ -32,6 +32,7 @@ extern "C" {
  * These following symbols will be defined if the associated headers are
  * available:
  * 
+ * HAS_SYS_MMAN_H          <sys/mman.h>
  * HAS_ALLOCA_H            <alloca.h> 
  * HAS_MALLOC_H            <malloc.h>
  *