From: Alexandre Oliva Date: Sat, 20 Feb 1999 15:07:54 +0000 (+0000) Subject: * libtool.m4 (AC_LIBTOOL_DLOPEN): check for dlopen in libc before X-Git-Tag: release-1-2f~110 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2dc0082648df235093d808e69c57cc13caf54b4a;p=thirdparty%2Flibtool.git * 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. --- diff --git a/ChangeLog b/ChangeLog index 13c587398..202acaa54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +1999-02-20 Alexandre Oliva + + * 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 * libltdl/ltdl.c (lt_dlopen): use newhandle instead of handle diff --git a/libtool.m4 b/libtool.m4 index 394f783a9..3d4fbe496 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -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 #include 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