diff --git a/H/Foreign.h b/H/Foreign.h index 6013836b9..c77c83161 100644 --- a/H/Foreign.h +++ b/H/Foreign.h @@ -75,7 +75,9 @@ #ifdef NO_DYN #undef NO_DYN #endif +#if !HAVE_DLOPEN #define LOAD_DYLD 1 +#endif #endif /* LOAD_DYLD */ extern char LoadMsg[]; diff --git a/configure b/configure index 508c1d0f1..682b0ce16 100755 --- a/configure +++ b/configure @@ -855,6 +855,7 @@ Optional Features: --enable-use-malloc use malloc to allocate memory --enable-condor allow Yap to be used from condor --enable-april compile Yap to support April ILP system + --enable-dlcompat use dlcompat library for dynamic loading on Mac OS X Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -2172,6 +2173,14 @@ else use_april=no fi; +# Check whether --enable-dlcompat or --disable-dlcompat was given. +if test "${enable_dlcompat+set}" = set; then + enableval="$enable_dlcompat" + use_dlcompat="$enableval" +else + use_dlcompat=no +fi; + # Check whether --with-gmp or --without-gmp was given. if test "${with_gmp+set}" = set; then @@ -4701,6 +4710,69 @@ fi INSTALL_DLLS="" ;; *darwin*) + if test ${use_dlcompat} = yes + then + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + have_dl=yes + +else + have_dl=no +fi + + if test ${have_dl} = yes + then + LIBS="$LIBS -ldl" + fi + fi SHLIB_CFLAGS="-fno-common" SHLIB_SUFFIX=".so" DO_SECOND_LD="" diff --git a/configure.in b/configure.in index 4dc465793..ae8007782 100644 --- a/configure.in +++ b/configure.in @@ -58,6 +58,10 @@ AC_ARG_ENABLE(condor, AC_ARG_ENABLE(april, [ --enable-april compile Yap to support April ILP system], use_april="$enableval", use_april=no) + +AC_ARG_ENABLE(dlcompat, + [ --enable-dlcompat use dlcompat library for dynamic loading on Mac OS X], + use_dlcompat="$enableval", use_dlcompat=no) AC_ARG_WITH(gmp, [ --with-gmp[=DIR] use GNU Multiple Precision in DIR], @@ -515,6 +519,17 @@ dnl Linux has both elf and a.out, in this case we found elf INSTALL_DLLS="" ;; *darwin*) + if test ${use_dlcompat} = yes + then + AC_CHECK_LIB(dl,dlopen, + have_dl=yes + , + have_dl=no) + if test ${have_dl} = yes + then + LIBS="$LIBS -ldl" + fi + fi SHLIB_CFLAGS="-fno-common" SHLIB_SUFFIX=".so" DO_SECOND_LD=""