This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH RFA: Do not require dlopen to be in -ldl
Paolo Bonzini <bonzini@gnu.org> writes:
>> I considered using AC_SEARCH_LIBS, but as your example shows I would
>> have to use the undocumented ac_cv_search_dlopen and
>> ac_cv_search_libs_dlopen shell variables. ÂI will do it that way if
>> you prefer, but I think my approach is cleaner.
>
> Actually there is no ac_cv_search_libs_dlopen, it is just
> ac_cv_search_dlopen which can be "no", "dl" (without -l unlike what I
> wrote above) and "none needed". Please use it, cache variables have
> always been considered part of the interface, and have finally been
> documented in git autoconf.
>
> I will preapprove the patch, since I am going to be offline for a few days.
Committed as follows, after retesting.
Ian
2009-10-09 Ian Lance Taylor <iant@google.com>
* configure.ac: Use AC_SEARCH_LIBS to find dlopen.
* configure: Rebuild.
Index: configure.ac
===================================================================
--- configure.ac (revision 152614)
+++ configure.ac (working copy)
@@ -4253,14 +4253,8 @@ if test x"$enable_plugin" = x"yes"; then
fi
# Check -ldl
- LIBS="$LIBS -ldl"
- AC_MSG_CHECKING([for -ldl])
- AC_TRY_LINK(
- [#include <dlfcn.h>],
- [volatile int f = 0; if (f) dlopen ("dummy", 0);],
- [AC_MSG_RESULT([yes]); have_dl=yes],
- [AC_MSG_RESULT([no])])
- if test x"$have_dl" = x"yes"; then
+ AC_SEARCH_LIBS([dlopen], [dl])
+ if test x"$ac_cv_search_dlopen" = x"-ldl"; then
pluginlibs="$pluginlibs -ldl"
fi
@@ -4271,7 +4265,7 @@ if test x"$enable_plugin" = x"yes"; then
[extern int X;],[return X == 0;],
[AC_MSG_RESULT([yes]); have_pic_shared=yes],
[AC_MSG_RESULT([no]); have_pic_shared=no])
- if test x"$have_pic_shared" != x"yes"; then
+ if test x"$have_pic_shared" != x"yes" -o x"$ac_cv_search_dlopen" = x"no"; then
pluginlibs=
enable_plugin=no
fi