[gold commit] PR gold/16203: Fix build failure on Gentoo/FreeBSD

Cary Coutant ccoutant@google.com
Fri Nov 22 23:57:00 GMT 2013
PR gold/16203 complains that gold assumes that -ldl is needed when
plugins are enabled, but dlopen is provided by default on FreeBSD.
I've committed the following patch to check what library is needed for
dlopen.

-cary


2013-11-22  Cary Coutant  <ccoutant@google.com>

gold/
        PR gold/16203
        * configure.ac: Add check for which library is needed for
        dlopen.
        * configure: Regenerate.

diff --git a/gold/configure.ac b/gold/configure.ac
index 82ad11e..9bc216b 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -528,9 +528,14 @@ AC_CHECK_HEADERS(ext/hash_map ext/hash_set)
 AC_CHECK_HEADERS(byteswap.h)

 dnl When plugins enabled dynamic loader interface is required. Check headers
-dnl which may provide this interface. In case of dlfcn.h add libdl to link.
+dnl which may provide this interface. Add the necessary library to link.
 AC_CHECK_HEADERS(windows.h)
-AC_CHECK_HEADERS(dlfcn.h, [DLOPEN_LIBS="-ldl"], [DLOPEN_LIBS=""])
+AC_CHECK_HEADERS(dlfcn.h)
+AC_SEARCH_LIBS(dlopen, [dl dld])
+case "$ac_cv_search_dlopen" in
+  no*) DLOPEN_LIBS="";;
+  *)   DLOPEN_LIBS="$ac_cv_search_dlopen";;
+esac
 AC_SUBST(DLOPEN_LIBS)

 AC_CHECK_FUNCS(mallinfo posix_fallocate fallocate readv sysconf times)



More information about the Binutils mailing list