This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH RFA: Do not require dlopen to be in -ldl


I am told that on FreeBSD dlopen is libc, not libdl.  This patch has
been confirmed to permit plugins to work on FreeBSD.  I have
bootstrapped it on i686-pc-linux-gnu and confirmed that the plugin.exp
tests all pass.

OK for mainline?

Ian


2009-10-08  Ian Lance Taylor  <iant@google.com>

	* configure.ac: Test for dlopen separately from testing for -ldl.
	* configure: Rebuild.



Index: configure.ac
===================================================================
--- configure.ac	(revision 152544)
+++ configure.ac	(working copy)
@@ -4253,16 +4253,13 @@ 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_CHECK_LIB(dl, dlopen, found_dl=yes, found_dl=no)
+  if test x"$found_dl" = x"yes"; then
+    LIBS="$LIBS -ldl"
     pluginlibs="$pluginlibs -ldl"
   fi
+  AC_CHECK_FUNC(dlopen, found_dlopen=yes, found_dlopen=no)
 
   # Check that we can build shared objects with -fPIC -shared
   LDFLAGS="$LDFLAGS -fPIC -shared"
@@ -4271,7 +4268,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"$found_dlopen" != x"yes"; then
     pluginlibs=
     enable_plugin=no
   fi

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]