# HG changeset patch # User Aidan Kehoe # Date 1314225689 -3600 # Node ID a142ad1a9140f795f809aa4ad42fc11edcb4bdf5 # Parent a39cd9dc92ba3be6018f8f47b050fe878a4c1d47 Use dlsym() in preference to NSLookupSymbolInModule() on Darwin, if available. ChangeLog addition: 2011-08-24 Aidan Kehoe * 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 * 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. diff -r a39cd9dc92ba -r a142ad1a9140 ChangeLog --- 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 + + * 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 * Makefile.in.in: Default DESTDIR to the empty string, and use it in diff -r a39cd9dc92ba -r a142ad1a9140 configure --- 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 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 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 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 diff -r a39cd9dc92ba -r a142ad1a9140 configure.ac --- 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 ], - [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 ], - [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 ], - [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 ], + [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 ], + [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 ], + [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 diff -r a39cd9dc92ba -r a142ad1a9140 src/ChangeLog --- 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 + + * 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 Fix performance regression in refactored syntax cache setup. diff -r a39cd9dc92ba -r a142ad1a9140 src/config.h.in --- 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