Commit 236c9391321f83ad40daf03f40c35c9ebc1da6b3

Anthony Green 2011-11-12T07:37:40

Fix darwin11 build problem

diff --git a/ChangeLog b/ChangeLog
index f965aec..d193641 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
 
 	* m4/ax_enable_builddir: Change from string comparison to numeric
 	comparison for wc output. 
+	* configure.ac: Enable FFI_MMAP_EXEC_WRIT for darwin11 aka Mac OS
+	X 10.7.
+	* configure: Rebuilt.
 
 2011-11-10  Richard Henderson  <rth@redhat.com>
 
diff --git a/configure b/configure
index 4ce690f..bc4bb15 100755
--- a/configure
+++ b/configure
@@ -12240,45 +12240,6 @@ $as_echo "$icc_archflag" >&6; }
      # default optimization flags for gcc on all systems
      CFLAGS="-O3 -fomit-frame-pointer"
 
-     # -malign-double for x86 systems
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -malign-double" >&5
-$as_echo_n "checking whether C compiler accepts -malign-double... " >&6; }
-if ${ax_cv_c_flags__malign_double+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-      ax_save_FLAGS=$CFLAGS
-      CFLAGS="-malign-double"
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ax_cv_c_flags__malign_double=yes
-else
-  ax_cv_c_flags__malign_double=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-      CFLAGS=$ax_save_FLAGS
-fi
-
-eval ax_check_compiler_flags=$ax_cv_c_flags__malign_double
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_check_compiler_flags" >&5
-$as_echo "$ax_check_compiler_flags" >&6; }
-if test "x$ax_check_compiler_flags" = xyes; then
-	CFLAGS="$CFLAGS -malign-double"
-else
-	:
-fi
-
-
      #  -fstrict-aliasing for gcc-2.95+
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstrict-aliasing" >&5
 $as_echo_n "checking whether C compiler accepts -fstrict-aliasing... " >&6; }
@@ -12318,7 +12279,6 @@ else
 fi
 
 
-     # note that we enable "unsafe" fp optimization with other compilers, too
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -ffast-math" >&5
 $as_echo_n "checking whether C compiler accepts -ffast-math... " >&6; }
 if ${ax_cv_c_flags__ffast_math+:} false; then :
@@ -13105,7 +13065,7 @@ case "$host" in
 	TARGET=FRV; TARGETDIR=frv
 	;;
 
-  hppa*-*-linux* | parisc*-*-linux*)
+  hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*)
 	TARGET=PA_LINUX; TARGETDIR=pa
 	;;
   hppa*64-*-hpux*)
@@ -13155,7 +13115,7 @@ case "$host" in
   mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
 	TARGET=MIPS; TARGETDIR=mips
 	;;
-  mips*-*-linux*)
+  mips*-*-linux* | mips*-*-openbsd*)
 	# Support 128-bit long double for NewABI.
 	HAVE_LONG_DOUBLE='defined(__mips64)'
 	TARGET=MIPS; TARGETDIR=mips
@@ -13177,7 +13137,7 @@ case "$host" in
   powerpc-*-aix* | rs6000-*-aix*)
 	TARGET=POWERPC_AIX; TARGETDIR=powerpc
 	;;
-  powerpc-*-freebsd*)
+  powerpc-*-freebsd* | powerpc-*-openbsd*)
 	TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
 	;;
   powerpc64-*-freebsd*)
@@ -14337,7 +14297,7 @@ case "$target" in
 $as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h
 
      ;;
-     *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
+     *-apple-darwin1[10]* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
 
 $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h
 
diff --git a/configure.ac b/configure.ac
index a8adbc2..8f66d08 100644
--- a/configure.ac
+++ b/configure.ac
@@ -339,7 +339,7 @@ case "$target" in
                  [Cannot use PROT_EXEC on this target, so, we revert to
                    alternative means])
      ;;
-     *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
+     *-apple-darwin1[[10]]* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
        AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1,
                  [Cannot use malloc on this target, so, we revert to
                    alternative means])
diff --git a/patches/darwin11 b/patches/darwin11
new file mode 100644
index 0000000..b3c32b7
--- /dev/null
+++ b/patches/darwin11
@@ -0,0 +1,121 @@
+Index: libffi/ChangeLog
+===================================================================
+--- libffi.orig/ChangeLog
++++ libffi/ChangeLog
+@@ -2,6 +2,9 @@
+ 
+ 	* m4/ax_enable_builddir: Change from string comparison to numeric
+ 	comparison for wc output. 
++	* configure.ac: Enable FFI_MMAP_EXEC_WRIT for darwin11 aka Mac OS
++	X 10.7.
++	* configure: Rebuilt.
+ 
+ 2011-11-10  Richard Henderson  <rth@redhat.com>
+ 
+Index: libffi/configure
+===================================================================
+--- libffi.orig/configure
++++ libffi/configure
+@@ -12240,45 +12240,6 @@ $as_echo "$icc_archflag" >&6; }
+      # default optimization flags for gcc on all systems
+      CFLAGS="-O3 -fomit-frame-pointer"
+ 
+-     # -malign-double for x86 systems
+-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -malign-double" >&5
+-$as_echo_n "checking whether C compiler accepts -malign-double... " >&6; }
+-if ${ax_cv_c_flags__malign_double+:} false; then :
+-  $as_echo_n "(cached) " >&6
+-else
+-
+-      ax_save_FLAGS=$CFLAGS
+-      CFLAGS="-malign-double"
+-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-
+-int
+-main ()
+-{
+-
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+-  ax_cv_c_flags__malign_double=yes
+-else
+-  ax_cv_c_flags__malign_double=no
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-      CFLAGS=$ax_save_FLAGS
+-fi
+-
+-eval ax_check_compiler_flags=$ax_cv_c_flags__malign_double
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_check_compiler_flags" >&5
+-$as_echo "$ax_check_compiler_flags" >&6; }
+-if test "x$ax_check_compiler_flags" = xyes; then
+-	CFLAGS="$CFLAGS -malign-double"
+-else
+-	:
+-fi
+-
+-
+      #  -fstrict-aliasing for gcc-2.95+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstrict-aliasing" >&5
+ $as_echo_n "checking whether C compiler accepts -fstrict-aliasing... " >&6; }
+@@ -12318,7 +12279,6 @@ else
+ fi
+ 
+ 
+-     # note that we enable "unsafe" fp optimization with other compilers, too
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -ffast-math" >&5
+ $as_echo_n "checking whether C compiler accepts -ffast-math... " >&6; }
+ if ${ax_cv_c_flags__ffast_math+:} false; then :
+@@ -13105,7 +13065,7 @@ case "$host" in
+ 	TARGET=FRV; TARGETDIR=frv
+ 	;;
+ 
+-  hppa*-*-linux* | parisc*-*-linux*)
++  hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*)
+ 	TARGET=PA_LINUX; TARGETDIR=pa
+ 	;;
+   hppa*64-*-hpux*)
+@@ -13155,7 +13115,7 @@ case "$host" in
+   mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
+ 	TARGET=MIPS; TARGETDIR=mips
+ 	;;
+-  mips*-*-linux*)
++  mips*-*-linux* | mips*-*-openbsd*)
+ 	# Support 128-bit long double for NewABI.
+ 	HAVE_LONG_DOUBLE='defined(__mips64)'
+ 	TARGET=MIPS; TARGETDIR=mips
+@@ -13177,7 +13137,7 @@ case "$host" in
+   powerpc-*-aix* | rs6000-*-aix*)
+ 	TARGET=POWERPC_AIX; TARGETDIR=powerpc
+ 	;;
+-  powerpc-*-freebsd*)
++  powerpc-*-freebsd* | powerpc-*-openbsd*)
+ 	TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
+ 	;;
+   powerpc64-*-freebsd*)
+@@ -14337,7 +14297,7 @@ case "$target" in
+ $as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h
+ 
+      ;;
+-     *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
++     *-apple-darwin1[10]* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
+ 
+ $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h
+ 
+Index: libffi/configure.ac
+===================================================================
+--- libffi.orig/configure.ac
++++ libffi/configure.ac
+@@ -339,7 +339,7 @@ case "$target" in
+                  [Cannot use PROT_EXEC on this target, so, we revert to
+                    alternative means])
+      ;;
+-     *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
++     *-apple-darwin1[[10]]* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
+        AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1,
+                  [Cannot use malloc on this target, so, we revert to
+                    alternative means])
diff --git a/patches/series b/patches/series
index 47b8570..3ebccee 100644
--- a/patches/series
+++ b/patches/series
@@ -27,6 +27,7 @@ fix-ppc32
 darwin-EH-fix
 more-openbsd
 more-openbsd-mips
+darwin11
 minix
 
 interix-patch