]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libtool.m4 (AC_LIBTOOL_DLOPEN): check for dlopen in libc before
authorAlexandre Oliva <oliva@dcc.unicamp.br>
Sat, 20 Feb 1999 15:07:54 +0000 (15:07 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Sat, 20 Feb 1999 15:07:54 +0000 (15:07 +0000)
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.

ChangeLog
libtool.m4

index 13c5873985c0e3598f0be8330593ea22b0587fa7..202acaa5434c495706eb730f2d4606cbe99fcf08 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+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
index 394f783a93c42399e0b267a9f4e92da89291b812..3d4fbe4965718d8eb4bb22f9a88109cb3cfbd0e9 100644 (file)
@@ -21,7 +21,7 @@
 ## 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
@@ -44,7 +44,7 @@ AC_SUBST(LIBTOOL)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"
@@ -121,29 +121,37 @@ exec 5>>./config.log
 # 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