]> granicus.if.org Git - php/commitdiff
Improve the Darwin 9 hack considerably and switch to using dl*() instead of NS*(...
authorGwynne Raskind <gwynne@php.net>
Mon, 10 Mar 2008 15:17:47 +0000 (15:17 +0000)
committerGwynne Raskind <gwynne@php.net>
Mon, 10 Mar 2008 15:17:47 +0000 (15:17 +0000)
configure.in

index cb27bb94912324e6c24e23382ecd9ac6a8321617..57c37be79da1bdf51ab022a4b426fcf5a08f1b7c 100644 (file)
@@ -129,8 +129,8 @@ dnl messing with the CFLAGS here to trick it.
 php_did_darwin9_cheat=0
 case $host_alias in
 *darwin9*)
-  echo $CFLAGS | grep -E '(^-g)|([[:space:]]-g)' 2>/dev/null >/dev/null
-  if test "$?" -ne 0; then
+  hasg=`echo $CFLAGS | grep -E '(^-g)|([[:space:]]-g)'`
+  if test x"$hasg" = "x"; then
     php_did_darwin9_cheat=1
     CFLAGS="$CFLAGS -gstabs"
   fi
@@ -391,7 +391,6 @@ langinfo.h \
 limits.h \
 locale.h \
 monetary.h \
-mach-o/dyld.h \
 netdb.h \
 pwd.h \
 resolv.h \
@@ -443,6 +442,18 @@ assert.h
 #endif
 ])
 
+dnl Don't use mach-o/dyld.h on Darwin 8+, dl* is recommended by Apple from there on
+dnl See http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachOTopics/Articles/loading_code.html
+case $host_alias in
+*darwin[[89]]*)
+    ;;
+*)
+    AC_CHECK_HEADERS([  \
+mach-o/dyld.h
+],[],[][])
+    ;;
+esac
+
 PHP_FOPENCOOKIE
 PHP_BROKEN_GETCWD
 PHP_BROKEN_GLIBC_FOPEN_APPEND
@@ -737,10 +748,6 @@ if test "$PHP_DEBUG" = "yes"; then
     CXXFLAGS="$CXXFLAGS -O0"
   fi
 else
-  dnl Finish the Darwin hack
-  if test "$php_did_darwin9_cheat" -eq 1; then
-    CFLAGS=`echo "$CFLAGS" | $SED -e 's/-gstabs//g'`
-  fi
   PHP_DEBUG=0
   ZEND_DEBUG=no
 fi
@@ -1222,6 +1229,15 @@ SHARED_LIBTOOL='$(LIBTOOL)'
 
 CC=$old_CC
 
+dnl Finish the Darwin hack
+if test "$php_did_darwin9_cheat" -eq 1; then
+  if test "$PHP_DEBUG" = "yes"; then
+    CFLAGS=`echo "$CFLAGS" | $SED -e 's/-gstabs/-g/g'`
+  else
+    CFLAGS=`echo "$CFLAGS" | $SED -e 's/-gstabs//g'`
+  fi
+fi
+
 PHP_CONFIGURE_PART(Generating files)
 
 CXXFLAGS_CLEAN=$CXXFLAGS