1commit 6632e8ccecd8fe5de18ad78ced1c14755a24b169 2Author: Cary Coutant <ccoutant@google.com> 3Date: Fri Nov 22 15:46:51 2013 -0800 4 5 Add check for which library is needed for dlopen. 6 7 gold/ 8 PR gold/16203 9 * configure.ac: Add check for which library is needed for 10 dlopen. 11 * configure: Regenerate. 12 13diff --git a/gold/configure b/gold/configure 14index 83f5aa9..24140cf 100755 15--- a/gold/configure 16+++ b/gold/configure 17@@ -7193,13 +7193,71 @@ if test "x$ac_cv_header_dlfcn_h" = x""yes; then : 18 cat >>confdefs.h <<_ACEOF 19 #define HAVE_DLFCN_H 1 20 _ACEOF 21- DLOPEN_LIBS="-ldl" 22-else 23- DLOPEN_LIBS="" 24+ 25 fi 26 27 done 28 29+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 30+$as_echo_n "checking for library containing dlopen... " >&6; } 31+if test "${ac_cv_search_dlopen+set}" = set; then : 32+ $as_echo_n "(cached) " >&6 33+else 34+ ac_func_search_save_LIBS=$LIBS 35+cat confdefs.h - <<_ACEOF >conftest.$ac_ext 36+/* end confdefs.h. */ 37+ 38+/* Override any GCC internal prototype to avoid an error. 39+ Use char because int might match the return type of a GCC 40+ builtin and then its argument prototype would still apply. */ 41+#ifdef __cplusplus 42+extern "C" 43+#endif 44+char dlopen (); 45+int 46+main () 47+{ 48+return dlopen (); 49+ ; 50+ return 0; 51+} 52+_ACEOF 53+for ac_lib in '' dl dld; do 54+ if test -z "$ac_lib"; then 55+ ac_res="none required" 56+ else 57+ ac_res=-l$ac_lib 58+ LIBS="-l$ac_lib $ac_func_search_save_LIBS" 59+ fi 60+ if ac_fn_cxx_try_link "$LINENO"; then : 61+ ac_cv_search_dlopen=$ac_res 62+fi 63+rm -f core conftest.err conftest.$ac_objext \ 64+ conftest$ac_exeext 65+ if test "${ac_cv_search_dlopen+set}" = set; then : 66+ break 67+fi 68+done 69+if test "${ac_cv_search_dlopen+set}" = set; then : 70+ 71+else 72+ ac_cv_search_dlopen=no 73+fi 74+rm conftest.$ac_ext 75+LIBS=$ac_func_search_save_LIBS 76+fi 77+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 78+$as_echo "$ac_cv_search_dlopen" >&6; } 79+ac_res=$ac_cv_search_dlopen 80+if test "$ac_res" != no; then : 81+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" 82+ 83+fi 84+ 85+case "$ac_cv_search_dlopen" in 86+ no*) DLOPEN_LIBS="";; 87+ *) DLOPEN_LIBS="$ac_cv_search_dlopen";; 88+esac 89 90 91 for ac_func in mallinfo posix_fallocate fallocate readv sysconf times 92diff --git a/gold/configure.ac b/gold/configure.ac 93index 82ad11e..9bc216b 100644 94--- a/gold/configure.ac 95+++ b/gold/configure.ac 96@@ -528,9 +528,14 @@ AC_CHECK_HEADERS(ext/hash_map ext/hash_set) 97 AC_CHECK_HEADERS(byteswap.h) 98 99 dnl When plugins enabled dynamic loader interface is required. Check headers 100-dnl which may provide this interface. In case of dlfcn.h add libdl to link. 101+dnl which may provide this interface. Add the necessary library to link. 102 AC_CHECK_HEADERS(windows.h) 103-AC_CHECK_HEADERS(dlfcn.h, [DLOPEN_LIBS="-ldl"], [DLOPEN_LIBS=""]) 104+AC_CHECK_HEADERS(dlfcn.h) 105+AC_SEARCH_LIBS(dlopen, [dl dld]) 106+case "$ac_cv_search_dlopen" in 107+ no*) DLOPEN_LIBS="";; 108+ *) DLOPEN_LIBS="$ac_cv_search_dlopen";; 109+esac 110 AC_SUBST(DLOPEN_LIBS) 111 112 AC_CHECK_FUNCS(mallinfo posix_fallocate fallocate readv sysconf times) 113