changeset 5556:a142ad1a9140

Use dlsym() in preference to NSLookupSymbolInModule() on Darwin, if available. ChangeLog addition: 2011-08-24 Aidan Kehoe <kehoea@parhasard.net> * configure.ac: On OS X, if dlopen() is available in dlfcn.h, use it in preference to dyld; the latter API is deprecated. Move DLSYM_NEEDS_UNDERSCORE together with HAVE_DLYD, it's not needed if the dlsym() and dlopen() APIs are being used. Define REALPATH_CORRECTS_CASE, DEFAULT_FILE_SYSTEM_IGNORE_CASE in this file, don't define them in terms of HAVE_DYLD in src/config.h.in. * configure: Regenerate. src/ChangeLog addition: 2011-08-24 Aidan Kehoe <kehoea@parhasard.net> * config.h.in: Move REALPATH_CORRECTS_CASE, DEFAULT_FILE_SYSTEM_IGNORE_CASE to ../configure.ac rather than implementing them in terms of HAVE_DYLD here.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 24 Aug 2011 23:41:29 +0100
parents a39cd9dc92ba
children 53c066311921
files ChangeLog configure configure.ac src/ChangeLog src/config.h.in
diffstat 5 files changed, 107 insertions(+), 72 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Aug 24 11:22:30 2011 +0100
+++ b/ChangeLog	Wed Aug 24 23:41:29 2011 +0100
@@ -1,3 +1,15 @@
+2011-08-24  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* configure.ac:
+	On OS X, if dlopen() is available in dlfcn.h, use it in preference
+	to dyld; the latter API is deprecated.
+	Move DLSYM_NEEDS_UNDERSCORE together with HAVE_DLYD, it's not
+	needed if the dlsym() and dlopen() APIs are being used.
+	Define REALPATH_CORRECTS_CASE, DEFAULT_FILE_SYSTEM_IGNORE_CASE in
+	this file, don't define them in terms of HAVE_DYLD in
+	src/config.h.in.
+	* configure: Regenerate.
+
 2011-05-20  Jerry James  <james@xemacs.org>
 
 	* Makefile.in.in: Default DESTDIR to the empty string, and use it in
--- a/configure	Wed Aug 24 11:22:30 2011 +0100
+++ b/configure	Wed Aug 24 23:41:29 2011 +0100
@@ -5939,8 +5939,6 @@
 if test "$with_dynamic" = "yes"; then
   case "$opsys" in
     hpux* ) opsys="${opsys}-shr" ;;
-    darwin ) $as_echo "#define DLSYM_NEEDS_UNDERSCORE 1" >>confdefs.h
- ;;
   esac
 else   case "$opsys" in
     sol2 )
@@ -13765,7 +13763,7 @@
     fi
 
     install_pp="$srcdir/lib-src/installexe.sh"
-    libs_system="$libs_system -limm32 -lshell32 -lgdi32 -luser32 -lcomdlg32 -lcomctl32 -lole32 -luuid -lwinspool -lmpr" &&  if test "$verbose" = "yes"; then echo "    Appending \"-limm32 -lshell32 -lgdi32 -luser32 -lcomdlg32 -lcomctl32 -lole32 -luuid -lwinspool -lmpr\" to \$libs_system"; fi
+    libs_system="$libs_system -L/usr/lib/w32api -limm32 -lshell32 -lgdi32 -luser32 -lcomdlg32 -lcomctl32 -lole32 -luuid -lwinspool -lmpr" &&  if test "$verbose" = "yes"; then echo "    Appending \"-L/usr/lib/w32api -limm32 -lshell32 -lgdi32 -luser32 -lcomdlg32 -lcomctl32 -lole32 -luuid -lwinspool -lmpr\" to \$libs_system"; fi
     if test "$with_dragndrop" != no; then
       dragndrop_proto="$dragndrop_proto msw" &&  if test "$verbose" = "yes"; then echo "    Appending \"msw\" to \$dragndrop_proto"; fi
       with_dragndrop=yes
@@ -13956,6 +13954,13 @@
 fi
 
 
+if test "$opsys" = "darwin"; then
+  $as_echo "#define REALPATH_CORRECTS_CASE 1" >>confdefs.h
+
+  $as_echo "#define DEFAULT_FILE_SYSTEM_IGNORE_CASE 1" >>confdefs.h
+
+fi
+
 if test "$with_modules" != "no"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for module support" >&5
 $as_echo_n "checking for module support... " >&6; }
@@ -13964,11 +13969,7 @@
 
   case "$opsys" in
     mingw* | cygwin* ) have_dl=yes ;;
-    darwin ) have_dl=yes
-      $as_echo "#define HAVE_DYLD 1" >>confdefs.h
-
-      ;;
-    * )
+    *)
             ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default"
 if test "x$ac_cv_header_dlfcn_h" = xyes; then :
 
@@ -14050,12 +14051,19 @@
 	$as_echo "#define HAVE_DLOPEN 1" >>confdefs.h
 
       else
-		ac_fn_c_check_header_mongrel "$LINENO" "dl.h" "ac_cv_header_dl_h" "$ac_includes_default"
+                        if test "$opsys" = "darwin"; then
+          have_dl=yes
+          $as_echo "#define HAVE_DYLD 1" >>confdefs.h
+
+          $as_echo "#define DLSYM_NEEDS_UNDERSCORE 1" >>confdefs.h
+
+        else
+                    ac_fn_c_check_header_mongrel "$LINENO" "dl.h" "ac_cv_header_dl_h" "$ac_includes_default"
 if test "x$ac_cv_header_dl_h" = xyes; then :
 
-	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -lc" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -lc" >&5
 $as_echo_n "checking for shl_load in -lc... " >&6; }
-	  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <dl.h>
 int
@@ -14071,13 +14079,13 @@
 $as_echo "$have_dl" >&6; }
 else
 
-	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldl" >&5
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldl" >&5
 $as_echo_n "checking for shl_load in -ldl... " >&6; }
-	    ac_save_LIBS="$LIBS"
-	    LIBS="$LIBS -ldld"
-	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+              ac_save_LIBS="$LIBS"
+              LIBS="$LIBS -ldld"
+              cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <dl.h>
 int
@@ -14102,18 +14110,18 @@
 fi
 
 
-	if test "$have_dl" = "yes"; then
-	  $as_echo "#define HAVE_SHL_LOAD 1" >>confdefs.h
-
-	else
-	  	  ac_fn_c_check_header_mongrel "$LINENO" "ltdl.h" "ac_cv_header_ltdl_h" "$ac_includes_default"
+          if test "$have_dl" = "yes"; then
+            $as_echo "#define HAVE_SHL_LOAD 1" >>confdefs.h
+
+          else
+                        ac_fn_c_check_header_mongrel "$LINENO" "ltdl.h" "ac_cv_header_ltdl_h" "$ac_includes_default"
 if test "x$ac_cv_header_ltdl_h" = xyes; then :
 
-	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lt_dlinit in -lltdl" >&5
+              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lt_dlinit in -lltdl" >&5
 $as_echo_n "checking for lt_dlinit in -lltdl... " >&6; }
-	    ac_save_LIBS="$LIBS"
-	    LIBS="$LIBS -lltdl"
-	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+              ac_save_LIBS="$LIBS"
+              LIBS="$LIBS -lltdl"
+              cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ltdl.h>
 int
@@ -14134,16 +14142,17 @@
 fi
 
 
-	  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_dl" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_dl" >&5
 $as_echo "$have_dl" >&6; }
-	  if test "$have_dl" = "yes"; then
-	    $as_echo "#define HAVE_LTDL 1" >>confdefs.h
-
-	  fi
-		fi
+            if test "$have_dl" = "yes"; then
+              $as_echo "#define HAVE_LTDL 1" >>confdefs.h
+
+            fi
+              	  fi
+       fi
             fi
       ac_save_LIBS=
-    esac
+  esac
 
   if test -n "$have_dl"; then
 
--- a/configure.ac	Wed Aug 24 11:22:30 2011 +0100
+++ b/configure.ac	Wed Aug 24 23:41:29 2011 +0100
@@ -1475,7 +1475,6 @@
 if test "$with_dynamic" = "yes"; then
   case "$opsys" in
     hpux* ) opsys="${opsys}-shr" ;;
-    darwin ) AC_DEFINE(DLSYM_NEEDS_UNDERSCORE) ;;
   esac
 else dnl "$with_dynamic" = "no"
   case "$opsys" in
@@ -3375,6 +3374,13 @@
 fi
 AC_SUBST(LIBSTDCPP)
 
+dnl Tell the pathname handling code about a couple of Darwin-specific things
+dnl it needs to know:
+if test "$opsys" = "darwin"; then
+  AC_DEFINE(REALPATH_CORRECTS_CASE)
+  AC_DEFINE(DEFAULT_FILE_SYSTEM_IGNORE_CASE)
+fi
+
 dnl This must come before the detection code for anything that is in a module
 if test "$with_modules" != "no"; then
   AC_MSG_CHECKING([for module support])
@@ -3382,10 +3388,7 @@
 
   case "$opsys" in
     mingw* | cygwin* ) have_dl=yes ;;
-    darwin ) have_dl=yes
-      AC_DEFINE(HAVE_DYLD)
-      ;;
-    * )
+    *)
       dnl Check for the ELFish dlopen()
       AC_CHECK_HEADER(dlfcn.h, [
 	AC_MSG_CHECKING([for dlopen in -lc])
@@ -3406,38 +3409,45 @@
       if test "$have_dl" = "yes"; then
 	AC_DEFINE(HAVE_DLOPEN)
       else
-	dnl Check for HP/UX shl_load
-	AC_CHECK_HEADER(dl.h, [
-	  AC_MSG_CHECKING([for shl_load in -lc])
-	  AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <dl.h>],
-	   [shl_load ("", 0, 0);])], [have_dl=yes; AC_MSG_RESULT($have_dl)], [
-	    AC_MSG_RESULT([no])
-	    AC_MSG_CHECKING([for shl_load in -ldl])
-	    ac_save_LIBS="$LIBS"
-	    LIBS="$LIBS -ldld"
-	    AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <dl.h>],
-	     [shl_load ("", 0, 0);])], [have_dl=yes],
-	     [LIBS="$ac_save_LIBS"; AC_MSG_RESULT([no])])])])
-	if test "$have_dl" = "yes"; then
-	  AC_DEFINE(HAVE_SHL_LOAD) 
-	else
-	  dnl Check for libtool's libltdl
-	  AC_CHECK_HEADER(ltdl.h, [
-	    AC_MSG_CHECKING([for lt_dlinit in -lltdl])
-	    ac_save_LIBS="$LIBS"
-	    LIBS="$LIBS -lltdl"
-	    AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <ltdl.h>],
-	     [lt_dlinit ();])], [have_dl=yes], [LIBS="$ac_save_LIBS"])])
-	  AC_MSG_RESULT($have_dl)
-	  if test "$have_dl" = "yes"; then
-	    AC_DEFINE(HAVE_LTDL)
-	  fi
-	dnl end !HP/UX
-	fi
+        dnl On Darwin, the DYLD API is deprecated, so we prefer dlopen if
+        dnl available, above.
+        if test "$opsys" = "darwin"; then 
+          have_dl=yes
+          AC_DEFINE(HAVE_DYLD)
+          AC_DEFINE(DLSYM_NEEDS_UNDERSCORE)
+        else
+          dnl Check for HP/UX shl_load
+          AC_CHECK_HEADER(dl.h, [
+            AC_MSG_CHECKING([for shl_load in -lc])
+            AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <dl.h>],
+             [shl_load ("", 0, 0);])], [have_dl=yes; AC_MSG_RESULT($have_dl)],[
+              AC_MSG_RESULT([no])
+              AC_MSG_CHECKING([for shl_load in -ldl])
+              ac_save_LIBS="$LIBS"
+              LIBS="$LIBS -ldld"
+              AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <dl.h>],
+               [shl_load ("", 0, 0);])], [have_dl=yes],
+               [LIBS="$ac_save_LIBS"; AC_MSG_RESULT([no])])])])
+          if test "$have_dl" = "yes"; then
+            AC_DEFINE(HAVE_SHL_LOAD) 
+          else
+            dnl Check for libtool's libltdl
+            AC_CHECK_HEADER(ltdl.h, [
+              AC_MSG_CHECKING([for lt_dlinit in -lltdl])
+              ac_save_LIBS="$LIBS"
+              LIBS="$LIBS -lltdl"
+              AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <ltdl.h>],
+               [lt_dlinit ();])], [have_dl=yes], [LIBS="$ac_save_LIBS"])])
+            AC_MSG_RESULT($have_dl)
+            if test "$have_dl" = "yes"; then
+              AC_DEFINE(HAVE_LTDL)
+            fi
+          dnl end !HP/UX
+    	  fi
+       fi
       dnl end !dlopen
       fi
       ac_save_LIBS=
-  dnl end !darwin
   esac
 
   if test -n "$have_dl"; then
--- a/src/ChangeLog	Wed Aug 24 11:22:30 2011 +0100
+++ b/src/ChangeLog	Wed Aug 24 23:41:29 2011 +0100
@@ -1,3 +1,10 @@
+2011-08-24  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* config.h.in:
+	Move REALPATH_CORRECTS_CASE, DEFAULT_FILE_SYSTEM_IGNORE_CASE to
+	../configure.ac rather than implementing them in terms of
+	HAVE_DYLD here.
+
 2011-08-23  Stephen Turnbull  <stephen@xemacs.org>
 
 	Fix performance regression in refactored syntax cache setup.
--- a/src/config.h.in	Wed Aug 24 11:22:30 2011 +0100
+++ b/src/config.h.in	Wed Aug 24 23:41:29 2011 +0100
@@ -330,11 +330,8 @@
 #undef DLSYM_NEEDS_UNDERSCORE
 #undef HAVE_SHLIB
 
-/* Darwin; realpath corrects for case: */
-#ifdef HAVE_DYLD
-#define REALPATH_CORRECTS_CASE 1
-#define DEFAULT_FILE_SYSTEM_IGNORE_CASE 1
-#endif
+#undef REALPATH_CORRECTS_CASE
+#undef DEFAULT_FILE_SYSTEM_IGNORE_CASE
 
 #undef HAVE_LIBINTL
 #undef HAVE_LIBDNET