diff configure.ac @ 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 4b5b7dcc19d6
children 53c066311921
line wrap: on
line diff
--- 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