From a48b32c06849c3e91e92cb5261e135a55cd584c4 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 17 May 2013 16:24:21 +0000 Subject: Replace hardcoded -ldl with check for availability 2013-05-17 Pavel Chupin * acinclude.m4: Add check for dlopen in libdl. * configure.ac: Ditto. * configure: Regenerate. --- gdb/ChangeLog | 6 ++ gdb/acinclude.m4 | 2 +- gdb/configure | 228 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- gdb/configure.ac | 2 +- 4 files changed, 232 insertions(+), 6 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e670522..47dbcb5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2013-05-17 Pavel Chupin + + * acinclude.m4: Add check for dlopen in libdl. + * configure.ac: Ditto. + * configure: Regenerate. + 2013-05-17 Phil Muldoon * frame.c (frame_stash): Convert to htab. diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 index 25caddd..df7d8c0 100644 --- a/gdb/acinclude.m4 +++ b/gdb/acinclude.m4 @@ -455,7 +455,7 @@ AC_DEFUN([GDB_AC_CHECK_BFD], [ intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` # -ldl is provided by bfd/Makfile.am (LIBDL) . if test "$plugins" = "yes"; then - LIBS="-ldl $LIBS" + AC_SEARCH_LIBS(dlopen, dl) fi LIBS="-lbfd -liberty $intl $LIBS" AC_CACHE_CHECK([$1], [$2], diff --git a/gdb/configure b/gdb/configure index f0cdeb2..5de43e7 100755 --- a/gdb/configure +++ b/gdb/configure @@ -12600,7 +12600,62 @@ esac intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` # -ldl is provided by bfd/Makfile.am (LIBDL) . if test "$plugins" = "yes"; then - LIBS="-ldl $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if test "${ac_cv_search_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_dlopen+set}" = set; then : + break +fi +done +if test "${ac_cv_search_dlopen+set}" = set; then : + +else + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + fi LIBS="-lbfd -liberty $intl $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF support in BFD" >&5 @@ -12642,7 +12697,62 @@ $as_echo "#define HAVE_ELF 1" >>confdefs.h # -ldl is provided by bfd/Makfile.am (LIBDL) . if test "$plugins" = "yes"; then - LIBS="-ldl $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if test "${ac_cv_search_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_dlopen+set}" = set; then : + break +fi +done +if test "${ac_cv_search_dlopen+set}" = set; then : + +else + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + fi fi @@ -12659,7 +12769,62 @@ fi intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` # -ldl is provided by bfd/Makfile.am (LIBDL) . if test "$plugins" = "yes"; then - LIBS="-ldl $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if test "${ac_cv_search_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_dlopen+set}" = set; then : + break +fi +done +if test "${ac_cv_search_dlopen+set}" = set; then : + +else + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + fi LIBS="-lbfd -liberty $intl $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mach-O support in BFD" >&5 @@ -12711,7 +12876,62 @@ fi intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` # -ldl is provided by bfd/Makfile.am (LIBDL) . if test "$plugins" = "yes"; then - LIBS="-ldl $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if test "${ac_cv_search_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_dlopen+set}" = set; then : + break +fi +done +if test "${ac_cv_search_dlopen+set}" = set; then : + +else + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + fi LIBS="-lbfd -liberty $intl $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SOM support in BFD" >&5 diff --git a/gdb/configure.ac b/gdb/configure.ac index c3f79ec..5fcec52 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -2036,7 +2036,7 @@ if test $gdb_cv_var_elf = yes; then [Define if ELF support should be included.]) # -ldl is provided by bfd/Makfile.am (LIBDL) . if test "$plugins" = "yes"; then - LIBS="-ldl $LIBS" + AC_SEARCH_LIBS(dlopen, dl) fi fi -- cgit v1.1