* [PATCH] gdb/configure: Replace hardcoded -ldl with check based on dlfcn.h availability
@ 2013-04-17 16:39 Pavel Chupin
2013-05-06 11:28 ` Pavel Chupin
0 siblings, 1 reply; 8+ messages in thread
From: Pavel Chupin @ 2013-04-17 16:39 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 652 bytes --]
Hi,
Attached patch adds check for dlfcn.h header availability before
adding -ldl to some configure commands. Otherwise on some
configuration -ldl is added unconditionally even though it's not
required and gdb is configured without ELF support due to failed link.
Issue is found on mingw gdb build for Android.
gdb/ChangeLog entry:
2013-04-16 Pavel Chupin <pavel.v.chupin@intel.com>
Replace hardcoded -ldl with check based on dlfcn.h availability
* configure.ac: Add dlfcn.h check and DLOPEN_LIBS def.
* acinclude.m4: Use DLOPEN_LIBS instead of hardcode.
* configure: Regenerate.
--
Pavel Chupin
Intel Corporation
[-- Attachment #2: 0001-Replace-hardcoded-ldl-with-check-based-on-dlfcn.h-av.patch --]
[-- Type: application/octet-stream, Size: 3517 bytes --]
From dc692c2a2185b0e882d945cd8dd80ff928efb1c5 Mon Sep 17 00:00:00 2001
From: Pavel Chupin <pavel.v.chupin@intel.com>
Date: Tue, 16 Apr 2013 16:05:20 +0400
Subject: [PATCH] Replace hardcoded -ldl with check based on dlfcn.h
availability
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
---
gdb/acinclude.m4 | 2 +-
gdb/configure | 22 ++++++++++++++++++----
gdb/configure.ac | 3 ++-
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 25caddd..b2a08de 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) <PLUGINS>.
if test "$plugins" = "yes"; then
- LIBS="-ldl $LIBS"
+ LIBS="$DLOPEN_LIBS $LIBS"
fi
LIBS="-lbfd -liberty $intl $LIBS"
AC_CACHE_CHECK([$1], [$2],
diff --git a/gdb/configure b/gdb/configure
index f9d9a17..becb3c4 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -12585,6 +12585,20 @@ $as_echo "#define USE_WIN32API 1" >>confdefs.h
esac
+for ac_header in dlfcn.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default"
+if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+ DLOPEN_LIBS="-ldl"
+else
+ DLOPEN_LIBS=""
+fi
+
+done
+
# Add ELF support to GDB, but only if BFD includes ELF support.
OLD_CFLAGS=$CFLAGS
@@ -12598,7 +12612,7 @@ esac
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
if test "$plugins" = "yes"; then
- LIBS="-ldl $LIBS"
+ LIBS="$DLOPEN_LIBS $LIBS"
fi
LIBS="-lbfd -liberty $intl $LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF support in BFD" >&5
@@ -12640,7 +12654,7 @@ $as_echo "#define HAVE_ELF 1" >>confdefs.h
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
if test "$plugins" = "yes"; then
- LIBS="-ldl $LIBS"
+ LIBS="$DLOPEN_LIBS $LIBS"
fi
fi
@@ -12657,7 +12671,7 @@ fi
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
if test "$plugins" = "yes"; then
- LIBS="-ldl $LIBS"
+ LIBS="$DLOPEN_LIBS $LIBS"
fi
LIBS="-lbfd -liberty $intl $LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mach-O support in BFD" >&5
@@ -12709,7 +12723,7 @@ fi
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
if test "$plugins" = "yes"; then
- LIBS="-ldl $LIBS"
+ LIBS="$DLOPEN_LIBS $LIBS"
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 ce6fa7a..a864e3c 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -2025,6 +2025,7 @@ case ${host} in
esac
AC_SUBST(WIN32LIBS)
+AC_CHECK_HEADERS(dlfcn.h,DLOPEN_LIBS="-ldl",DLOPEN_LIBS="")
# Add ELF support to GDB, but only if BFD includes ELF support.
GDB_AC_CHECK_BFD([for ELF support in BFD], gdb_cv_var_elf,
[bfd_get_elf_phdr_upper_bound (NULL)], elf-bfd.h)
@@ -2034,7 +2035,7 @@ if test $gdb_cv_var_elf = yes; then
[Define if ELF support should be included.])
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
if test "$plugins" = "yes"; then
- LIBS="-ldl $LIBS"
+ LIBS="$DLOPEN_LIBS $LIBS"
fi
fi
--
1.7.11.4
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] gdb/configure: Replace hardcoded -ldl with check based on dlfcn.h availability
2013-04-17 16:39 [PATCH] gdb/configure: Replace hardcoded -ldl with check based on dlfcn.h availability Pavel Chupin
@ 2013-05-06 11:28 ` Pavel Chupin
2013-05-06 12:30 ` Mark Kettenis
0 siblings, 1 reply; 8+ messages in thread
From: Pavel Chupin @ 2013-05-06 11:28 UTC (permalink / raw)
To: gdb-patches
On Wed, Apr 17, 2013 at 3:21 PM, Pavel Chupin <pavel.v.chupin@gmail.com> wrote:
> Hi,
> Attached patch adds check for dlfcn.h header availability before
> adding -ldl to some configure commands. Otherwise on some
> configuration -ldl is added unconditionally even though it's not
> required and gdb is configured without ELF support due to failed link.
>
> Issue is found on mingw gdb build for Android.
>
> gdb/ChangeLog entry:
> 2013-04-16 Pavel Chupin <pavel.v.chupin@intel.com>
>
> Replace hardcoded -ldl with check based on dlfcn.h availability
> * configure.ac: Add dlfcn.h check and DLOPEN_LIBS def.
> * acinclude.m4: Use DLOPEN_LIBS instead of hardcode.
> * configure: Regenerate.
>
Ping
--
Pavel Chupin
Intel Corporation
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gdb/configure: Replace hardcoded -ldl with check based on dlfcn.h availability
2013-05-06 11:28 ` Pavel Chupin
@ 2013-05-06 12:30 ` Mark Kettenis
2013-05-07 10:02 ` Pavel Chupin
0 siblings, 1 reply; 8+ messages in thread
From: Mark Kettenis @ 2013-05-06 12:30 UTC (permalink / raw)
To: pavel.v.chupin; +Cc: gdb-patches
> Date: Mon, 6 May 2013 15:28:14 +0400
> From: Pavel Chupin <pavel.v.chupin@gmail.com>
>
> On Wed, Apr 17, 2013 at 3:21 PM, Pavel Chupin <pavel.v.chupin@gmail.com> wrote:
> > Hi,
> > Attached patch adds check for dlfcn.h header availability before
> > adding -ldl to some configure commands. Otherwise on some
> > configuration -ldl is added unconditionally even though it's not
> > required and gdb is configured without ELF support due to failed link.
> >
> > Issue is found on mingw gdb build for Android.
> >
> > gdb/ChangeLog entry:
> > 2013-04-16 Pavel Chupin <pavel.v.chupin@intel.com>
> >
> > Replace hardcoded -ldl with check based on dlfcn.h availability
> > * configure.ac: Add dlfcn.h check and DLOPEN_LIBS def.
> > * acinclude.m4: Use DLOPEN_LIBS instead of hardcode.
> > * configure: Regenerate.
> >
>
> Ping
The fix isn't quite right. OpenBSD for example has <dlfcn.h> but no
libdl; dlopen(3) and friends live in libc.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gdb/configure: Replace hardcoded -ldl with check based on dlfcn.h availability
2013-05-06 12:30 ` Mark Kettenis
@ 2013-05-07 10:02 ` Pavel Chupin
2013-05-14 19:00 ` Tom Tromey
0 siblings, 1 reply; 8+ messages in thread
From: Pavel Chupin @ 2013-05-07 10:02 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1431 bytes --]
On Mon, May 6, 2013 at 4:30 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> Date: Mon, 6 May 2013 15:28:14 +0400
>> From: Pavel Chupin <pavel.v.chupin@gmail.com>
>>
>> On Wed, Apr 17, 2013 at 3:21 PM, Pavel Chupin <pavel.v.chupin@gmail.com> wrote:
>> > Hi,
>> > Attached patch adds check for dlfcn.h header availability before
>> > adding -ldl to some configure commands. Otherwise on some
>> > configuration -ldl is added unconditionally even though it's not
>> > required and gdb is configured without ELF support due to failed link.
>> >
>> > Issue is found on mingw gdb build for Android.
>> >
>> > gdb/ChangeLog entry:
>> > 2013-04-16 Pavel Chupin <pavel.v.chupin@intel.com>
>> >
>> > Replace hardcoded -ldl with check based on dlfcn.h availability
>> > * configure.ac: Add dlfcn.h check and DLOPEN_LIBS def.
>> > * acinclude.m4: Use DLOPEN_LIBS instead of hardcode.
>> > * configure: Regenerate.
>> >
>>
>> Ping
>
> The fix isn't quite right. OpenBSD for example has <dlfcn.h> but no
> libdl; dlopen(3) and friends live in libc.
Hi Mark,
Thanks for your comments. Please see new patch attached.
Updated ChangeLog:
2013-05-07 Pavel Chupin <pavel.v.chupin@intel.com>
Replace hardcoded -ldl with check for availability
* acinclude.m4: Add check for dlopen in libdl.
* configure.ac: Ditto.
* configure: Regenerate.
--
Pavel Chupin
Intel Corporation
[-- Attachment #2: 0001-Replace-hardcoded-ldl-with-check-for-availability.patch --]
[-- Type: application/octet-stream, Size: 7151 bytes --]
From e0859b03d7b5cf7aa48730dd02ba0f83c1fc2b6c Mon Sep 17 00:00:00 2001
From: Pavel Chupin <pavel.v.chupin@intel.com>
Date: Tue, 16 Apr 2013 16:05:20 +0400
Subject: [PATCH] Replace hardcoded -ldl with check for availability
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
---
gdb/acinclude.m4 | 2 +-
gdb/configure | 184 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
gdb/configure.ac | 2 +-
3 files changed, 182 insertions(+), 6 deletions(-)
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index 25caddd..644c1f7 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) <PLUGINS>.
if test "$plugins" = "yes"; then
- LIBS="-ldl $LIBS"
+ AC_CHECK_LIB(dl, dlopen)
fi
LIBS="-lbfd -liberty $intl $LIBS"
AC_CACHE_CHECK([$1], [$2],
diff --git a/gdb/configure b/gdb/configure
index c5ad94b..449f23c 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -12599,7 +12599,51 @@ esac
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
if test "$plugins" = "yes"; then
- LIBS="-ldl $LIBS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $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
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+ LIBS="-ldl $LIBS"
+
+fi
+
fi
LIBS="-lbfd -liberty $intl $LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF support in BFD" >&5
@@ -12641,7 +12685,51 @@ $as_echo "#define HAVE_ELF 1" >>confdefs.h
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
if test "$plugins" = "yes"; then
- LIBS="-ldl $LIBS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $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
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+ LIBS="-ldl $LIBS"
+
+fi
+
fi
fi
@@ -12658,7 +12746,51 @@ fi
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
if test "$plugins" = "yes"; then
- LIBS="-ldl $LIBS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $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
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+ LIBS="-ldl $LIBS"
+
+fi
+
fi
LIBS="-lbfd -liberty $intl $LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mach-O support in BFD" >&5
@@ -12710,7 +12842,51 @@ fi
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
if test "$plugins" = "yes"; then
- LIBS="-ldl $LIBS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $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
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+ LIBS="-ldl $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 bb7fbdd..8d53e25 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -2035,7 +2035,7 @@ if test $gdb_cv_var_elf = yes; then
[Define if ELF support should be included.])
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
if test "$plugins" = "yes"; then
- LIBS="-ldl $LIBS"
+ AC_CHECK_LIB(dl, dlopen)
fi
fi
--
1.7.11.4
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] gdb/configure: Replace hardcoded -ldl with check based on dlfcn.h availability
2013-05-07 10:02 ` Pavel Chupin
@ 2013-05-14 19:00 ` Tom Tromey
2013-05-14 19:24 ` Mark Kettenis
0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2013-05-14 19:00 UTC (permalink / raw)
To: Pavel Chupin; +Cc: Mark Kettenis, gdb-patches
Mark> The fix isn't quite right. OpenBSD for example has <dlfcn.h> but no
Mark> libdl; dlopen(3) and friends live in libc.
Pavel> Hi Mark,
Pavel> Thanks for your comments. Please see new patch attached.
Pavel> - LIBS="-ldl $LIBS"
Pavel> + AC_CHECK_LIB(dl, dlopen)
I think it is probably better to use AC_SEARCH_LIBS.
Tom
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gdb/configure: Replace hardcoded -ldl with check based on dlfcn.h availability
2013-05-14 19:00 ` Tom Tromey
@ 2013-05-14 19:24 ` Mark Kettenis
2013-05-16 6:47 ` Pavel Chupin
0 siblings, 1 reply; 8+ messages in thread
From: Mark Kettenis @ 2013-05-14 19:24 UTC (permalink / raw)
To: tromey; +Cc: pavel.v.chupin, mark.kettenis, gdb-patches
> From: Tom Tromey <tromey@redhat.com>
> Date: Tue, 14 May 2013 13:00:10 -0600
>
> Mark> The fix isn't quite right. OpenBSD for example has <dlfcn.h> but no
> Mark> libdl; dlopen(3) and friends live in libc.
>
> Pavel> Hi Mark,
> Pavel> Thanks for your comments. Please see new patch attached.
>
> Pavel> - LIBS="-ldl $LIBS"
> Pavel> + AC_CHECK_LIB(dl, dlopen)
>
> I think it is probably better to use AC_SEARCH_LIBS.
That's indeed what the autoconf manual suggests.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gdb/configure: Replace hardcoded -ldl with check based on dlfcn.h availability
2013-05-14 19:24 ` Mark Kettenis
@ 2013-05-16 6:47 ` Pavel Chupin
2013-05-16 14:04 ` Mark Kettenis
0 siblings, 1 reply; 8+ messages in thread
From: Pavel Chupin @ 2013-05-16 6:47 UTC (permalink / raw)
To: Mark Kettenis; +Cc: tromey, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 914 bytes --]
On Tue, May 14, 2013 at 11:23 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> From: Tom Tromey <tromey@redhat.com>
>> Date: Tue, 14 May 2013 13:00:10 -0600
>>
>> Mark> The fix isn't quite right. OpenBSD for example has <dlfcn.h> but no
>> Mark> libdl; dlopen(3) and friends live in libc.
>>
>> Pavel> Hi Mark,
>> Pavel> Thanks for your comments. Please see new patch attached.
>>
>> Pavel> - LIBS="-ldl $LIBS"
>> Pavel> + AC_CHECK_LIB(dl, dlopen)
>>
>> I think it is probably better to use AC_SEARCH_LIBS.
>
> That's indeed what the autoconf manual suggests.
Please see attached.
ChangeLog entry didn't change:
2013-05-16 Pavel Chupin <pavel.v.chupin@intel.com>
Replace hardcoded -ldl with check for availability
* acinclude.m4: Add check for dlopen in libdl.
* configure.ac: Ditto.
* configure: Regenerate.
Is it OK for trunk?
--
Pavel Chupin
Intel Corporation
[-- Attachment #2: 0001-Replace-hardcoded-ldl-with-check-for-availability-2.patch --]
[-- Type: application/octet-stream, Size: 8375 bytes --]
From f4972c4b995de564936a4e2048c926b84f79f7a6 Mon Sep 17 00:00:00 2001
From: Pavel Chupin <pavel.v.chupin@intel.com>
Date: Tue, 16 Apr 2013 16:05:20 +0400
Subject: [PATCH] Replace hardcoded -ldl with check for availability
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
---
gdb/acinclude.m4 | 2 +-
gdb/configure | 228 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
gdb/configure.ac | 2 +-
3 files changed, 226 insertions(+), 6 deletions(-)
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) <PLUGINS>.
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 6033791..32f1efa 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -12593,7 +12593,62 @@ esac
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
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
@@ -12635,7 +12690,62 @@ $as_echo "#define HAVE_ELF 1" >>confdefs.h
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
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
@@ -12652,7 +12762,62 @@ fi
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
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
@@ -12704,7 +12869,62 @@ fi
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
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 3e95c25..df2c919 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -2029,7 +2029,7 @@ if test $gdb_cv_var_elf = yes; then
[Define if ELF support should be included.])
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
if test "$plugins" = "yes"; then
- LIBS="-ldl $LIBS"
+ AC_SEARCH_LIBS(dlopen, dl)
fi
fi
--
1.7.11.4
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] gdb/configure: Replace hardcoded -ldl with check based on dlfcn.h availability
2013-05-16 6:47 ` Pavel Chupin
@ 2013-05-16 14:04 ` Mark Kettenis
0 siblings, 0 replies; 8+ messages in thread
From: Mark Kettenis @ 2013-05-16 14:04 UTC (permalink / raw)
To: pavel.v.chupin; +Cc: gdb-patches
> Date: Thu, 16 May 2013 10:47:14 +0400
> From: Pavel Chupin <pavel.v.chupin@gmail.com>
>
> On Tue, May 14, 2013 at 11:23 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
> >> From: Tom Tromey <tromey@redhat.com>
> >> Date: Tue, 14 May 2013 13:00:10 -0600
> >>
> >> Mark> The fix isn't quite right. OpenBSD for example has <dlfcn.h> but no
> >> Mark> libdl; dlopen(3) and friends live in libc.
> >>
> >> Pavel> Hi Mark,
> >> Pavel> Thanks for your comments. Please see new patch attached.
> >>
> >> Pavel> - LIBS="-ldl $LIBS"
> >> Pavel> + AC_CHECK_LIB(dl, dlopen)
> >>
> >> I think it is probably better to use AC_SEARCH_LIBS.
> >
> > That's indeed what the autoconf manual suggests.
>
> Please see attached.
>
> ChangeLog entry didn't change:
> 2013-05-16 Pavel Chupin <pavel.v.chupin@intel.com>
>
> Replace hardcoded -ldl with check for availability
> * acinclude.m4: Add check for dlopen in libdl.
> * configure.ac: Ditto.
> * configure: Regenerate.
>
> Is it OK for trunk?
Fine with me.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-05-16 14:04 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-17 16:39 [PATCH] gdb/configure: Replace hardcoded -ldl with check based on dlfcn.h availability Pavel Chupin
2013-05-06 11:28 ` Pavel Chupin
2013-05-06 12:30 ` Mark Kettenis
2013-05-07 10:02 ` Pavel Chupin
2013-05-14 19:00 ` Tom Tromey
2013-05-14 19:24 ` Mark Kettenis
2013-05-16 6:47 ` Pavel Chupin
2013-05-16 14:04 ` Mark Kettenis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox