From: "H.J. Lu" <hjl.tools@gmail.com>
To: Aaron Merey <amerey@redhat.com>
Cc: Tom Tromey <tom@tromey.com>, Simon Marchi <simark@simark.ca>,
GCC Patches <gcc-patches@gcc.gnu.org>,
Aaron Merey via Binutils <binutils@sourceware.org>,
GDB <gdb-patches@sourceware.org>
Subject: [PATCH] config/debuginfod.m4: Restore AC_CHECK_LIB check
Date: Mon, 27 Jul 2020 08:31:55 -0700 [thread overview]
Message-ID: <CAMe9rOrJY8Ui92m-HrDCOgb1p+NCNzm6VtWMj925HXBNQmnnjg@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOo2phYZYFSZR-uDqUF5vCNGZmCoh0-rcMqDVp14nEKScQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1701 bytes --]
On Sat, Jul 25, 2020 at 9:01 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Fri, Jul 24, 2020 at 1:04 PM Aaron Merey via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > On Tue, Jul 21, 2020 at 2:11 PM Aaron Merey <amerey@redhat.com> wrote:
> > >
> > > On Tue, Jul 21, 2020 at 11:20 AM Tom Tromey <tom@tromey.com> wrote:
> > > >
> > > > Simon> Since it's debuginfo.m4 that is using PKG_CHECK_MODULES, can you put the include
> > > > Simon> of pkg.m4 in debuginfo.m4, instead of in {binutils,gdb}/configure.ac?
> > > >
> > > > Simon> Otherwise, from GDB's point of view I think it looks good, unless
> > > > Simon> Tom has some things to add.
> > > >
> > > > I'm happy with it. Thanks for persevering.
> > >
> > > Great. I can push to binutils-gdb but not gcc. Should I just push to
> > > binutils-gdb for now or wait until the patch can be applied to both
> > > repos at once?
> >
> > I'm going to go ahead and push to binutils-gdb. Since these changes
> > should not affect gcc there shouldn't be any conflicts.
> >
>
> This caused:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=26301
>
It is quite normal to have debuginfod headers without libdebuginfod on
multilib OSes. Restore AC_CHECK_LIB to check if libdebuginfod exists.
And always define HAVE_LIBDEBUGINFOD to 0 or 1 for
binutils/dwarf.c:#if HAVE_LIBDEBUGINFOD
binutils/dwarf.c:#if HAVE_LIBDEBUGINFOD
binutils/dwarf.c:#if HAVE_LIBDEBUGINFOD
binutils/dwarf.h:#if HAVE_LIBDEBUGINFOD
binutils/objdump.c:#if HAVE_LIBDEBUGINFOD
binutils/objdump.c:#endif /* HAVE_LIBDEBUGINFOD */
binutils/readelf.c:#if HAVE_LIBDEBUGINFOD
binutils/readelf.c:#endif /* HAVE_LIBDEBUGINFOD */
gdb/top.c:#if HAVE_LIBDEBUGINFOD
OK for master?
--
H.J.
[-- Attachment #2: 0001-config-debuginfod.m4-Restore-AC_CHECK_LIB-check.patch --]
[-- Type: text/x-patch, Size: 12084 bytes --]
From 975f68898817f2db13c5d7061fb6e6a9147b06aa Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 27 Jul 2020 08:24:15 -0700
Subject: [PATCH] config/debuginfod.m4: Restore AC_CHECK_LIB check
It is quite normal to have debuginfod headers without libdebuginfod on
multilib OSes. Restore AC_CHECK_LIB to check if libdebuginfod exists.
And always define HAVE_LIBDEBUGINFOD to 0 or 1 for
binutils/dwarf.c:#if HAVE_LIBDEBUGINFOD
binutils/dwarf.c:#if HAVE_LIBDEBUGINFOD
binutils/dwarf.c:#if HAVE_LIBDEBUGINFOD
binutils/dwarf.h:#if HAVE_LIBDEBUGINFOD
binutils/objdump.c:#if HAVE_LIBDEBUGINFOD
binutils/objdump.c:#endif /* HAVE_LIBDEBUGINFOD */
binutils/readelf.c:#if HAVE_LIBDEBUGINFOD
binutils/readelf.c:#endif /* HAVE_LIBDEBUGINFOD */
gdb/top.c:#if HAVE_LIBDEBUGINFOD
config/
PR binutils/26301
* debuginfod.m4 (AC_DEBUGINFOD): Restore AC_CHECK_LIB to check if
libdebuginfod exists.
binutils/
PR binutils/26301
* configure: Regenerated.
gdb/
PR binutils/26301
* configure: Regenerated.
---
binutils/configure | 88 +++++++++++++++++++++++++++++++++++++-------
config/debuginfod.m4 | 14 +++++--
gdb/configure | 88 +++++++++++++++++++++++++++++++++++++-------
3 files changed, 161 insertions(+), 29 deletions(-)
diff --git a/binutils/configure b/binutils/configure
index c9fc5108e0..02d33cb5ed 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -12398,6 +12398,7 @@ $as_echo_n "checking whether to use debuginfod... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_debuginfod" >&5
$as_echo "$with_debuginfod" >&6; }
+have_libdebuginfod=0
if test "x$with_debuginfod" != xno; then
pkg_failed=no
@@ -12458,35 +12459,96 @@ fi
# Put the nasty error message in config.log where it belongs
echo "$DEBUGINFOD_PKG_ERRORS" >&5
- if test "x$with_debuginfod" = xyes; then
- as_fn_error $? "\"--with-debuginfod was given, but libdebuginfod is missing or unusable.\"" "$LINENO" 5
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&5
-$as_echo "$as_me: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&2;}
- fi
+ as_fn_error $? "Package requirements (libdebuginfod >= 0.179) were not met:
+
+$DEBUGINFOD_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables DEBUGINFOD_CFLAGS
+and DEBUGINFOD_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- if test "x$with_debuginfod" = xyes; then
- as_fn_error $? "\"--with-debuginfod was given, but libdebuginfod is missing or unusable.\"" "$LINENO" 5
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&5
-$as_echo "$as_me: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&2;}
- fi
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables DEBUGINFOD_CFLAGS
+and DEBUGINFOD_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
else
DEBUGINFOD_CFLAGS=$pkg_cv_DEBUGINFOD_CFLAGS
DEBUGINFOD_LIBS=$pkg_cv_DEBUGINFOD_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for debuginfod_begin in -ldebuginfod" >&5
+$as_echo_n "checking for debuginfod_begin in -ldebuginfod... " >&6; }
+if ${ac_cv_lib_debuginfod_debuginfod_begin+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldebuginfod $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
-$as_echo "#define HAVE_LIBDEBUGINFOD 1" >>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 debuginfod_begin ();
+int
+main ()
+{
+return debuginfod_begin ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_debuginfod_debuginfod_begin=yes
+else
+ ac_cv_lib_debuginfod_debuginfod_begin=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_debuginfod_debuginfod_begin" >&5
+$as_echo "$ac_cv_lib_debuginfod_debuginfod_begin" >&6; }
+if test "x$ac_cv_lib_debuginfod_debuginfod_begin" = xyes; then :
+ have_libdebuginfod=1
+fi
fi
+ if test "x$have_libdebuginfod" = "x0"; then
+ DEBUGINFOD_LIBS=
+ if test "x$with_debuginfod" = xyes; then
+ as_fn_error $? "\"--with-debuginfod was given, but libdebuginfod is missing or unusable.\"" "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&2;}
+ fi
+ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod support disabled; some features may be unavailable." >&5
$as_echo "$as_me: WARNING: debuginfod support disabled; some features may be unavailable." >&2;}
fi
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDEBUGINFOD $have_libdebuginfod
+_ACEOF
+
+
cat >>confdefs.h <<_ACEOF
diff --git a/config/debuginfod.m4 b/config/debuginfod.m4
index f9eb0988e3..e05d69e24c 100644
--- a/config/debuginfod.m4
+++ b/config/debuginfod.m4
@@ -16,15 +16,23 @@ AC_ARG_WITH([debuginfod],
AC_MSG_CHECKING([whether to use debuginfod])
AC_MSG_RESULT([$with_debuginfod])
+have_libdebuginfod=0
if test "x$with_debuginfod" != xno; then
PKG_CHECK_MODULES([DEBUGINFOD], [libdebuginfod >= 0.179],
- [AC_DEFINE([HAVE_LIBDEBUGINFOD], [1], [Define to 1 if debuginfod is enabled.])],
- [if test "x$with_debuginfod" = xyes; then
+ [AC_CHECK_LIB([debuginfod], [debuginfod_begin],
+ [have_libdebuginfod=1])])
+ if test "x$have_libdebuginfod" = "x0"; then
+ DEBUGINFOD_LIBS=
+ if test "x$with_debuginfod" = xyes; then
AC_MSG_ERROR(["--with-debuginfod was given, but libdebuginfod is missing or unusable."])
else
AC_MSG_WARN([libdebuginfod is missing or unusable; some features may be unavailable.])
- fi])
+ fi
+ fi
else
AC_MSG_WARN([debuginfod support disabled; some features may be unavailable.])
fi
+AC_DEFINE_UNQUOTED([HAVE_LIBDEBUGINFOD],
+ [$have_libdebuginfod],
+ [Define to 1 if debuginfod is enabled.])
])
diff --git a/gdb/configure b/gdb/configure
index adcfa49c63..154370f9ab 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -6996,6 +6996,7 @@ $as_echo_n "checking whether to use debuginfod... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_debuginfod" >&5
$as_echo "$with_debuginfod" >&6; }
+have_libdebuginfod=0
if test "x$with_debuginfod" != xno; then
pkg_failed=no
@@ -7056,35 +7057,96 @@ fi
# Put the nasty error message in config.log where it belongs
echo "$DEBUGINFOD_PKG_ERRORS" >&5
- if test "x$with_debuginfod" = xyes; then
- as_fn_error $? "\"--with-debuginfod was given, but libdebuginfod is missing or unusable.\"" "$LINENO" 5
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&5
-$as_echo "$as_me: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&2;}
- fi
+ as_fn_error $? "Package requirements (libdebuginfod >= 0.179) were not met:
+
+$DEBUGINFOD_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables DEBUGINFOD_CFLAGS
+and DEBUGINFOD_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- if test "x$with_debuginfod" = xyes; then
- as_fn_error $? "\"--with-debuginfod was given, but libdebuginfod is missing or unusable.\"" "$LINENO" 5
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&5
-$as_echo "$as_me: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&2;}
- fi
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables DEBUGINFOD_CFLAGS
+and DEBUGINFOD_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
else
DEBUGINFOD_CFLAGS=$pkg_cv_DEBUGINFOD_CFLAGS
DEBUGINFOD_LIBS=$pkg_cv_DEBUGINFOD_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for debuginfod_begin in -ldebuginfod" >&5
+$as_echo_n "checking for debuginfod_begin in -ldebuginfod... " >&6; }
+if ${ac_cv_lib_debuginfod_debuginfod_begin+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldebuginfod $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
-$as_echo "#define HAVE_LIBDEBUGINFOD 1" >>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 debuginfod_begin ();
+int
+main ()
+{
+return debuginfod_begin ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_debuginfod_debuginfod_begin=yes
+else
+ ac_cv_lib_debuginfod_debuginfod_begin=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_debuginfod_debuginfod_begin" >&5
+$as_echo "$ac_cv_lib_debuginfod_debuginfod_begin" >&6; }
+if test "x$ac_cv_lib_debuginfod_debuginfod_begin" = xyes; then :
+ have_libdebuginfod=1
+fi
fi
+ if test "x$have_libdebuginfod" = "x0"; then
+ DEBUGINFOD_LIBS=
+ if test "x$with_debuginfod" = xyes; then
+ as_fn_error $? "\"--with-debuginfod was given, but libdebuginfod is missing or unusable.\"" "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&2;}
+ fi
+ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod support disabled; some features may be unavailable." >&5
$as_echo "$as_me: WARNING: debuginfod support disabled; some features may be unavailable." >&2;}
fi
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDEBUGINFOD $have_libdebuginfod
+_ACEOF
+
+
# Libunwind support for ia64.
--
2.26.2
next prev parent reply other threads:[~2020-07-27 15:32 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-02 2:29 [PATCH] config/debuginfod.m4: Use PKG_CHECK_MODULES Aaron Merey
2020-05-05 16:41 ` Jeff Law
2020-05-05 21:23 ` Aaron Merey
2020-05-08 20:56 ` Tom Tromey
2020-07-16 22:17 ` Aaron Merey
2020-07-16 22:37 ` Aaron Merey
2020-07-19 15:43 ` Simon Marchi
2020-07-21 15:20 ` Tom Tromey
2020-07-21 18:11 ` Aaron Merey
2020-07-24 20:03 ` Aaron Merey
2020-07-25 16:01 ` H.J. Lu
2020-07-27 15:31 ` H.J. Lu [this message]
2020-07-27 16:11 ` [PATCH] config/debuginfod.m4: Restore AC_CHECK_LIB check Aaron Merey
2020-07-27 19:14 ` [PATCH] PKG_CHECK_MODULES: Check if $pkg_cv_[]$1[]_LIBS works H.J. Lu
2020-07-27 19:32 ` V2 " H.J. Lu
2020-07-28 10:45 ` H.J. Lu
2020-07-28 12:46 ` Simon Marchi
2020-07-28 13:33 ` H.J. Lu
2020-07-28 13:51 ` Andreas Schwab
2020-07-28 13:56 ` H.J. Lu
2020-07-28 14:01 ` Simon Marchi
2020-07-28 14:11 ` H.J. Lu
2020-07-28 14:34 ` Simon Marchi
2020-07-28 15:05 ` H.J. Lu
2020-07-28 15:13 ` Simon Marchi
2020-07-28 16:07 ` H.J. Lu
2020-07-28 16:28 ` Simon Marchi
2020-07-28 17:26 ` H.J. Lu
2020-07-28 17:43 ` Simon Marchi
2020-07-28 18:31 ` H.J. Lu
2020-07-28 18:47 ` Simon Marchi
2020-07-28 18:57 ` H.J. Lu
2020-07-28 14:54 ` Andreas Schwab
2020-07-28 13:53 ` H.J. Lu
2020-07-28 13:54 ` Simon Marchi
2020-07-28 12:54 ` Mark Wielaard
2020-07-28 13:27 ` [PATCH] PKG_CHECK_MODULES: Properly check " H.J. Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMe9rOrJY8Ui92m-HrDCOgb1p+NCNzm6VtWMj925HXBNQmnnjg@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=amerey@redhat.com \
--cc=binutils@sourceware.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).