+1999-02-20 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * libtool.m4 (AC_LIBTOOL_DLOPEN): check for dlopen in libc before
+ trying in dl. Add the actual dlopening type to lt_cv_dlopen, and
+ add any needed libraries to lt_cv_dlopen_LIBS. Add test for
+ MS-Windows' LoadLibrary. Check whether a program can dlopen
+ itself only if we really have dlopen(), not some equivalent
+ function, but leave room for testing with other mechanisms.
+ (AC_PROG_LIBTOOL): assume some form of dlopen, but not
+ dlopen(NULL), is available if AC_LIBTOOL_DLOPEN is not used, for
+ backward compatibility.
+
1999-02-20 Archie Cobbs <archie@whistle.com>
* libltdl/ltdl.c (lt_dlopen): use newhandle instead of handle
## configuration script generated by Autoconf, you may include it under
## the same distribution terms that you use for the rest of that program.
-# serial 31 AC_PROG_LIBTOOL
+# serial 32 AC_PROG_LIBTOOL
AC_DEFUN(AC_PROG_LIBTOOL,
[AC_PREREQ(2.12.2)dnl
AC_REQUIRE([AC_ENABLE_SHARED])dnl
libtool_flags=
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
-test "x$lt_cv_dlopen" = xyes && libtool_flags="$libtool_flags --enable-dlopen"
+test "x$lt_cv_dlopen" != xno && libtool_flags="$libtool_flags --enable-dlopen"
test "x$lt_cv_dlopen_self" = xyes && libtool_flags="$libtool_flags --enable-dlopen-self"
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
# AC_LIBTOOL_DLOPEN - check for dlopen support
AC_DEFUN(AC_LIBTOOL_DLOPEN,
[AC_CACHE_VAL(lt_cv_dlopen,
-[lt_cv_dlopen=no
-AC_CHECK_LIB(dl, dlopen, lt_cv_dlopen=yes,
- [AC_CHECK_FUNCS(dlopen, lt_cv_dlopen=yes,
- [AC_CHECK_LIB(dld, dld_link, lt_cv_dlopen=yes,
- [AC_CHECK_FUNCS(shl_load, lt_cv_dlopen=yes)]
+[lt_cv_dlopen=no lt_cv_dlopen_LIBS=
+AC_CHECK_FUNC(dlopen, [lt_cv_dlopen="yes: dlopen"],
+ [AC_CHECK_LIB(dl, dlopen, [lt_cv_dlopen="yes: dlopen" lt_cv_dlopen_LIBS="-ldl"],
+ [AC_CHECK_LIB(dld, dld_link, [lt_cv_dlopen="yes: dld_link" lt_cv_dlopen_LIBS="-ldld"],
+ [AC_CHECK_FUNC(shl_load, [lt_cv_dlopen="yes: shl_load"],
+ [AC_CHECK_FUNC(LoadLibrary, [lt_cv_dlopen="yes: LoadLibrary"])]
+ )]
)]
)]
)])
-if test "$lt_cv_dlopen" = yes; then
- AC_REQUIRE([AC_PROG_CC])dnl
- AC_CACHE_VAL(lt_cv_dlopen_self,
- [AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self,
- [AC_TRY_RUN([
+case "$lt_cv_dlopen" in
+"yes: dlopen")
+ AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self,
+ [LT_SAVE_LIBS="$LIBS"; LIBS="$lt_cv_dlopen_LIBS $LIBS"
+ AC_TRY_RUN([
#include <dlfcn.h>
#include <stdio.h>
fnord() { int i=42;}
main() { void *self, *ptr1, *ptr2; self=dlopen(0,RTLD_LAZY);
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
if(ptr1 || ptr2) exit(0); } exit(1); }
-], lt_cv_dlopen_self=no, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no)])
- ])
-fi
+], lt_cv_dlopen_self=no, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=cross)
+ LIBS="$LT_SAVE_LIBS"])
+ ;;
+# We should probably test other for NULL support in other dlopening
+# mechanisms too.
+*)
+ lt_cv_dlopen_self=no
+ ;;
+esac
])
# AC_ENABLE_SHARED - implement the --enable-shared flag