Re: Plugin support for FreeBSD and OS X

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Nicholas \"Indy\" Ray" <arelius@xxxxxxxxx> writes:

> I've attached a patch that seems to fix the build problem on my
> FreeBSD box. I would submit the patch to gcc-patches directlly but I
> don't have a GNU/Linux box, or a machine without dlopen to test on
> before such. So I was hoping I could get someone to test the patch out
> on at least Linux before hand, considering this is my first time
> touching an autoconf file.

That patch doesn't work right on GNU/Linux.  Would you mind testing
this one on FreeBSD?

Ian

Index: configure.ac
===================================================================
--- configure.ac	(revision 152499)
+++ 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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux