This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] config/debuginfod.m4: Rewrite with pkg-config
- From: Aaron Merey <amerey at redhat dot com>
- To: binutils at sourceware dot org
- Cc: simark at simark dot ca, tom at tromey dot com
- Date: Tue, 3 Mar 2020 19:15:16 -0500
- Subject: [PATCH] config/debuginfod.m4: Rewrite with pkg-config
Hello,
This patch modifies config/debuginfod.m4 so that it takes advantage of
debuginfod's support for pkg-config. Both binutils' and gdb's configure
and Makefile as well as the top-level configure are regenerated in
this patch. I also removed the call to AC_DEBUGINFOD in the top-level
configure.ac in order to conform with the configure-time handling of
other shared libraries used in this project (many of which are not
handled at the top-level). I am posting this patch on this list since
debuginfod.m4 was originally added by a patch I posted here. I have
discussed these changes with Simon Marchi and Tom Tromey who have
indicated their support for the gdb side.
Aaron
From 7d8e4a2086480ce2e61040b104c8d9d46bfb97b2 Mon Sep 17 00:00:00 2001
From: Aaron Merey <amerey@redhat.com>
Date: Tue, 3 Mar 2020 18:25:25 -0500
Subject: [PATCH] config/debuginfod.m4: Rewrite with pkg-config.
Use pkg-config to specify debuginfod minimum version and
to set DEBUGINFOD_{LIBS,CFLAGS}.
ChangeLog:
* configure: Regenerate.
* configure.ac: Remove AC_DEBUGINFOD.
binutils/ChangeLog:
* Makefile.am: Use debuginfod pkg-config variables.
* Makefile.in: Regenerate.
* configure: Regenerate.
* doc/Makefile.in: Regenerate.
config/ChangeLog:
* debuginfod.m4: Rewrite with pkg-config.
gdb/ChangeLog:
* Makefile.in: Use debuginfod pkg-config variables.
* configure: Regenerate.
---
binutils/Makefile.am | 13 +--
binutils/Makefile.in | 12 ++-
binutils/configure | 211 ++++++++++++++++++++-------------------
binutils/doc/Makefile.in | 4 +-
config/debuginfod.m4 | 42 ++++----
configure | 139 +-------------------------
configure.ac | 3 -
gdb/Makefile.in | 8 +-
gdb/configure | 208 +++++++++++++++++++-------------------
9 files changed, 264 insertions(+), 376 deletions(-)
diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index e5cf5634a7..a14c7ab0f8 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -46,15 +46,16 @@ am__skipyacc =
ZLIB = @zlibdir@ -lz
ZLIBINC = @zlibinc@
+DEBUGINFOD_LIBS = @DEBUGINFOD_LIBS@
+DEBUGINFOD_CFLAGS = @DEBUGINFOD_CFLAGS@
+
WARN_CFLAGS = @WARN_CFLAGS@
WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
NO_WERROR = @NO_WERROR@
-AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
-AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
+AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) $(DEBUGINFOD_CFLAGS)
+AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC) $(DEBUGINFOD_CFLAGS)
LIBICONV = @LIBICONV@
-LIBDEBUGINFOD = @LIBDEBUGINFOD@
-
# these two are almost the same program
AR_PROG=ar
RANLIB_PROG=ranlib
@@ -247,7 +248,7 @@ objcopy_SOURCES = objcopy.c not-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS)
strings_SOURCES = strings.c $(BULIBS)
readelf_SOURCES = readelf.c version.c unwind-ia64.c dwarf.c $(ELFLIBS)
-readelf_LDADD = $(LIBINTL) $(LIBCTF_NOBFD) $(LIBIBERTY) $(ZLIB) $(LIBDEBUGINFOD)
+readelf_LDADD = $(LIBINTL) $(LIBCTF_NOBFD) $(LIBIBERTY) $(ZLIB) $(DEBUGINFOD_LIBS)
elfedit_SOURCES = elfedit.c version.c $(ELFLIBS)
elfedit_LDADD = $(LIBINTL) $(LIBIBERTY)
@@ -258,7 +259,7 @@ nm_new_SOURCES = nm.c $(BULIBS)
objdump_SOURCES = objdump.c dwarf.c prdbg.c $(DEBUG_SRCS) $(BULIBS) $(ELFLIBS)
EXTRA_objdump_SOURCES = od-xcoff.c
-objdump_LDADD = $(OBJDUMP_PRIVATE_OFILES) $(OPCODES) $(LIBCTF) $(BFDLIB) $(LIBIBERTY) $(LIBINTL) $(LIBDEBUGINFOD)
+objdump_LDADD = $(OBJDUMP_PRIVATE_OFILES) $(OPCODES) $(LIBCTF) $(BFDLIB) $(LIBIBERTY) $(LIBINTL) $(DEBUGINFOD_LIBS)
objdump.@OBJEXT@:objdump.c
if am__fastdepCC
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index ee6f267df9..6cfd735258 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -420,6 +420,8 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
+DEBUGINFOD_CFLAGS = @DEBUGINFOD_CFLAGS@
+DEBUGINFOD_LIBS = @DEBUGINFOD_LIBS@
DEFS = @DEFS@
DEMANGLER_NAME = @DEMANGLER_NAME@
DEPDIR = @DEPDIR@
@@ -451,7 +453,6 @@ LDFLAGS = @LDFLAGS@
LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBDEBUGINFOD = @LIBDEBUGINFOD@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBINTL_DEP = @LIBINTL_DEP@
@@ -541,6 +542,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+pkg_config_prog_path = @pkg_config_prog_path@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
@@ -573,8 +575,8 @@ am__skipyacc =
# case both are empty.
ZLIB = @zlibdir@ -lz
ZLIBINC = @zlibinc@
-AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
-AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC)
+AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) $(DEBUGINFOD_CFLAGS)
+AM_CFLAGS_FOR_BUILD = $(WARN_CFLAGS_FOR_BUILD) $(ZLIBINC) $(DEBUGINFOD_CFLAGS)
# these two are almost the same program
AR_PROG = ar
@@ -709,14 +711,14 @@ size_SOURCES = size.c $(BULIBS)
objcopy_SOURCES = objcopy.c not-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS)
strings_SOURCES = strings.c $(BULIBS)
readelf_SOURCES = readelf.c version.c unwind-ia64.c dwarf.c $(ELFLIBS)
-readelf_LDADD = $(LIBINTL) $(LIBCTF_NOBFD) $(LIBIBERTY) $(ZLIB) $(LIBDEBUGINFOD)
+readelf_LDADD = $(LIBINTL) $(LIBCTF_NOBFD) $(LIBIBERTY) $(ZLIB) $(DEBUGINFOD_LIBS)
elfedit_SOURCES = elfedit.c version.c $(ELFLIBS)
elfedit_LDADD = $(LIBINTL) $(LIBIBERTY)
strip_new_SOURCES = objcopy.c is-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS)
nm_new_SOURCES = nm.c $(BULIBS)
objdump_SOURCES = objdump.c dwarf.c prdbg.c $(DEBUG_SRCS) $(BULIBS) $(ELFLIBS)
EXTRA_objdump_SOURCES = od-xcoff.c
-objdump_LDADD = $(OBJDUMP_PRIVATE_OFILES) $(OPCODES) $(LIBCTF) $(BFDLIB) $(LIBIBERTY) $(LIBINTL) $(LIBDEBUGINFOD)
+objdump_LDADD = $(OBJDUMP_PRIVATE_OFILES) $(OPCODES) $(LIBCTF) $(BFDLIB) $(LIBIBERTY) $(LIBINTL) $(DEBUGINFOD_LIBS)
cxxfilt_SOURCES = cxxfilt.c $(BULIBS)
ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c rename.c binemul.c \
emul_$(EMULATION).c $(BULIBS)
diff --git a/binutils/configure b/binutils/configure
index 782fffac6f..dd2fe07253 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -684,7 +684,9 @@ WARN_WRITE_STRINGS
NO_WERROR
WARN_CFLAGS_FOR_BUILD
WARN_CFLAGS
-LIBDEBUGINFOD
+DEBUGINFOD_CFLAGS
+DEBUGINFOD_LIBS
+pkg_config_prog_path
OTOOL64
OTOOL
LIPO
@@ -1938,52 +1940,6 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_func
-# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
-# ---------------------------------------------
-# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
-# accordingly.
-ac_fn_c_check_decl ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- as_decl_name=`echo $2|sed 's/ *(.*//'`
- as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
-$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-#ifndef $as_decl_name
-#ifdef __cplusplus
- (void) $as_decl_use;
-#else
- (void) $as_decl_name;
-#endif
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$3=yes"
-else
- eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_decl
-
# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
# --------------------------------------------
# Tries to find the compile-time value of EXPR in a program that includes
@@ -2220,6 +2176,52 @@ $as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
@@ -11529,7 +11531,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11532 "configure"
+#line 11534 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11635,7 +11637,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11638 "configure"
+#line 11640 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12242,7 +12244,7 @@ fi
-# Enable debuginfod
+# Handle optional debuginfod support
# Check whether --with-debuginfod was given.
if test "${with_debuginfod+set}" = set; then :
@@ -12256,72 +12258,77 @@ $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; }
-if test "${with_debuginfod}" = no; then
- { $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;}
-else
- { $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 :
+if test "x$with_debuginfod" != xno; then
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_pkg_config_prog_path+:} 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. */
+ case $pkg_config_prog_path in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_pkg_config_prog_path="$pkg_config_prog_path" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_pkg_config_prog_path="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
-/* 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
+ test -z "$ac_cv_path_pkg_config_prog_path" && ac_cv_path_pkg_config_prog_path="missing"
+ ;;
+esac
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_debuginfod_lib=yes
+pkg_config_prog_path=$ac_cv_path_pkg_config_prog_path
+if test -n "$pkg_config_prog_path"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pkg_config_prog_path" >&5
+$as_echo "$pkg_config_prog_path" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
- ac_fn_c_check_decl "$LINENO" "debuginfod_begin" "ac_cv_have_decl_debuginfod_begin" "#include <elfutils/debuginfod.h>
-"
-if test "x$ac_cv_have_decl_debuginfod_begin" = xyes; then :
- have_debuginfod_h=yes
-fi
- if test "x$have_debuginfod_lib" = "xyes" -a \
- "x$have_debuginfod_h" = "xyes"; then
+ if test "${pkg_config_prog_path}" != "missing"; then
+ ${pkg_config_prog_path} --exists --atleast-version=0.178 libdebuginfod
+ if test $? = 0; then
+ DEBUGINFOD_LIBS=`${pkg_config_prog_path} --libs libdebuginfod`
-$as_echo "#define HAVE_LIBDEBUGINFOD 1" >>confdefs.h
+ DEBUGINFOD_CFLAGS=`${pkg_config_prog_path} --cflags libdebuginfod`
- LIBDEBUGINFOD="-ldebuginfod"
- else
+$as_echo "#define HAVE_LIBDEBUGINFOD 1" >>confdefs.h
- if test "$with_debuginfod" = yes; then
- as_fn_error $? "debuginfod is missing or unusable" "$LINENO" 5
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&5
-$as_echo "$as_me: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&2;}
+ 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
+ if test "x$with_debuginfod" = xyes; then
+ as_fn_error $? "--with-debuginfod was given, but pkg-config missing or unusable; cannot find libdebuginfod" "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config missing or unusable; debuginfod support disabled." >&5
+$as_echo "$as_me: WARNING: pkg-config missing or unusable; debuginfod support disabled." >&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
diff --git a/binutils/doc/Makefile.in b/binutils/doc/Makefile.in
index b0e7b7b6c8..d4e69ab81a 100644
--- a/binutils/doc/Makefile.in
+++ b/binutils/doc/Makefile.in
@@ -255,6 +255,8 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
+DEBUGINFOD_CFLAGS = @DEBUGINFOD_CFLAGS@
+DEBUGINFOD_LIBS = @DEBUGINFOD_LIBS@
DEFS = @DEFS@
DEMANGLER_NAME = @DEMANGLER_NAME@
DEPDIR = @DEPDIR@
@@ -286,7 +288,6 @@ LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBDEBUGINFOD = @LIBDEBUGINFOD@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBINTL_DEP = @LIBINTL_DEP@
@@ -374,6 +375,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
+pkg_config_prog_path = @pkg_config_prog_path@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
diff --git a/config/debuginfod.m4 b/config/debuginfod.m4
index 9979abe89d..2a2491c6ca 100644
--- a/config/debuginfod.m4
+++ b/config/debuginfod.m4
@@ -7,32 +7,36 @@ dnl the same distribution terms as the rest of that program.
AC_DEFUN([AC_DEBUGINFOD],
[
-# Enable debuginfod
+# Handle optional debuginfod support
AC_ARG_WITH([debuginfod],
- AC_HELP_STRING([--with-debuginfod],
- [Enable debuginfo lookups with debuginfod (auto/yes/no)]),
- [], [with_debuginfod=auto])
+ AC_HELP_STRING([--with-debuginfod], [Enable debuginfo lookups with debuginfod (auto/yes/no)]),
+ [], [with_debuginfod=auto])
AC_MSG_CHECKING([whether to use debuginfod])
AC_MSG_RESULT([$with_debuginfod])
-if test "${with_debuginfod}" = no; then
- AC_MSG_WARN([debuginfod support disabled; some features may be unavailable.])
-else
- AC_CHECK_LIB([debuginfod], [debuginfod_begin], [have_debuginfod_lib=yes])
- AC_CHECK_DECL([debuginfod_begin], [have_debuginfod_h=yes], [],
- [#include <elfutils/debuginfod.h>])
- if test "x$have_debuginfod_lib" = "xyes" -a \
- "x$have_debuginfod_h" = "xyes"; then
- AC_DEFINE([HAVE_LIBDEBUGINFOD], [1],
- [Define to 1 if debuginfod is enabled.])
- AC_SUBST([LIBDEBUGINFOD], ["-ldebuginfod"])
+if test "x$with_debuginfod" != xno; then
+ AC_PATH_PROG(pkg_config_prog_path, pkg-config, missing)
+ if test "${pkg_config_prog_path}" != "missing"; then
+ ${pkg_config_prog_path} --exists --atleast-version=0.178 libdebuginfod
+ if test $? = 0; then
+ AC_SUBST([DEBUGINFOD_LIBS], [`${pkg_config_prog_path} --libs libdebuginfod`])
+ AC_SUBST([DEBUGINFOD_CFLAGS], [`${pkg_config_prog_path} --cflags libdebuginfod`])
+ AC_DEFINE([HAVE_LIBDEBUGINFOD], [1], [Define to 1 if debuginfod is enabled.])
+ else
+ 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
else
- AC_SUBST([LIBDEBUGINFOD], [])
- if test "$with_debuginfod" = yes; then
- AC_MSG_ERROR([debuginfod is missing or unusable])
+ if test "x$with_debuginfod" = xyes; then
+ AC_MSG_ERROR([--with-debuginfod was given, but pkg-config missing or unusable; cannot find libdebuginfod])
else
- AC_MSG_WARN([debuginfod is missing or unusable; some features may be unavailable.])
+ AC_MSG_WARN([pkg-config missing or unusable; debuginfod support disabled.])
fi
fi
+else
+ AC_MSG_WARN([debuginfod support disabled; some features may be unavailable.])
fi
])
diff --git a/configure b/configure
index 1c5403e9e4..f618ee8bdf 100755
--- a/configure
+++ b/configure
@@ -690,7 +690,6 @@ extra_mpc_gmp_configure_flags
extra_mpfr_configure_flags
gmpinc
gmplibs
-LIBDEBUGINFOD
do_compare
GNATMAKE
GNATBIND
@@ -791,7 +790,6 @@ enable_libssp
enable_libstdcxx
enable_liboffloadmic
enable_bootstrap
-with_debuginfod
with_mpc
with_mpc_include
with_mpc_lib
@@ -1555,8 +1553,6 @@ Optional Packages:
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-build-libsubdir=DIR Directory where to find libraries for build system
--with-system-zlib use installed libz
- --with-debuginfod Enable debuginfo lookups with debuginfod
- (auto/yes/no)
--with-mpc=PATH specify prefix directory for installed MPC package.
Equivalent to --with-mpc-include=PATH/include plus
--with-mpc-lib=PATH/lib
@@ -1925,52 +1921,6 @@ fi
as_fn_set_status $ac_retval
} # ac_fn_c_try_link
-
-# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
-# ---------------------------------------------
-# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
-# accordingly.
-ac_fn_c_check_decl ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- as_decl_name=`echo $2|sed 's/ *(.*//'`
- as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
-$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-#ifndef $as_decl_name
-#ifdef __cplusplus
- (void) $as_decl_use;
-#else
- (void) $as_decl_name;
-#endif
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$3=yes"
-else
- eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_decl
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
@@ -5502,92 +5452,6 @@ gmplibs="-lmpc -lmpfr -lgmp"
gmpinc=
have_gmp=no
-# Check for debuginfod
-
-
-# Enable debuginfod
-
-# Check whether --with-debuginfod was given.
-if test "${with_debuginfod+set}" = set; then :
- withval=$with_debuginfod;
-else
- with_debuginfod=auto
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use debuginfod" >&5
-$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; }
-
-if test "${with_debuginfod}" = no; then
- { $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;}
-else
- { $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. */
-
-/* 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_debuginfod_lib=yes
-fi
-
- ac_fn_c_check_decl "$LINENO" "debuginfod_begin" "ac_cv_have_decl_debuginfod_begin" "#include <elfutils/debuginfod.h>
-"
-if test "x$ac_cv_have_decl_debuginfod_begin" = xyes; then :
- have_debuginfod_h=yes
-fi
-
- if test "x$have_debuginfod_lib" = "xyes" -a \
- "x$have_debuginfod_h" = "xyes"; then
-
-$as_echo "#define HAVE_LIBDEBUGINFOD 1" >>confdefs.h
-
- LIBDEBUGINFOD="-ldebuginfod"
-
- else
-
- if test "$with_debuginfod" = yes; then
- as_fn_error $? "debuginfod is missing or unusable" "$LINENO" 5
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&5
-$as_echo "$as_me: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&2;}
- fi
- fi
-fi
-
-
# Specify a location for mpc
# check for this first so it ends up on the link line before mpfr.
@@ -5742,7 +5606,8 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
# Check for the recommended and required versions of GMP.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the correct version of gmp.h" >&5
$as_echo_n "checking for the correct version of gmp.h... " >&6; }
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include "gmp.h"
int
diff --git a/configure.ac b/configure.ac
index f3065091c2..0d317c3225 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1380,9 +1380,6 @@ gmplibs="-lmpc -lmpfr -lgmp"
gmpinc=
have_gmp=no
-# Check for debuginfod
-AC_DEBUGINFOD
-
# Specify a location for mpc
# check for this first so it ends up on the link line before mpfr.
AC_ARG_WITH(mpc,
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 7c0a0aefbc..833015ebde 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -213,6 +213,9 @@ GDB_WERROR_CFLAGS = $(WERROR_CFLAGS)
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
+DEBUGINFOD_LIBS = @DEBUGINFOD_LIBS@
+DEBUGINFOD_CFLAGS = @DEBUGINFOD_CFLAGS@
+
RDYNAMIC = @RDYNAMIC@
# Where is the INTL library? Typically in ../intl.
@@ -592,7 +595,8 @@ INTERNAL_CFLAGS_BASE = \
$(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) $(ZLIBINC) \
$(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \
$(INTL_CFLAGS) $(INCGNU) $(INCSUPPORT) $(ENABLE_CFLAGS) \
- $(INTERNAL_CPPFLAGS) $(SRCHIGH_CFLAGS) $(TOP_CFLAGS) $(PTHREAD_CFLAGS)
+ $(INTERNAL_CPPFLAGS) $(SRCHIGH_CFLAGS) $(TOP_CFLAGS) $(PTHREAD_CFLAGS) \
+ $(DEBUGINFOD_CFLAGS)
INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS)
INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS)
@@ -618,7 +622,7 @@ CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(LIBCTF) $(ZLIB) \
$(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \
$(WIN32LIBS) $(LIBGNU) $(LIBICONV) \
$(LIBMPFR) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \
- @LIBDEBUGINFOD@
+ $(DEBUGINFOD_LIBS)
CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(LIBCTF) \
$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \
$(LIBSUPPORT)
diff --git a/gdb/configure b/gdb/configure
index f99cbe40f1..82625fcbbc 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -719,7 +719,6 @@ GUILE_LIBS
GUILE_CPPFLAGS
GUILD_TARGET_FLAG
GUILD
-pkg_config_prog_path
HAVE_PYTHON_FALSE
HAVE_PYTHON_TRUE
PYTHON_LIBS
@@ -758,7 +757,9 @@ REPORT_BUGS_TEXI
REPORT_BUGS_TO
PKGVERSION
CODESIGN_CERT
-LIBDEBUGINFOD
+DEBUGINFOD_CFLAGS
+DEBUGINFOD_LIBS
+pkg_config_prog_path
HAVE_NATIVE_GCORE_TARGET
TARGET_OBS
subdirs
@@ -2268,52 +2269,6 @@ rm -f conftest.val
} # ac_fn_c_compute_int
-# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
-# ---------------------------------------------
-# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
-# accordingly.
-ac_fn_c_check_decl ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- as_decl_name=`echo $2|sed 's/ *(.*//'`
- as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
-$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-#ifndef $as_decl_name
-#ifdef __cplusplus
- (void) $as_decl_use;
-#else
- (void) $as_decl_name;
-#endif
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$3=yes"
-else
- eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_decl
-
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
@@ -2435,6 +2390,52 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_type
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
+
# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
# ----------------------------------------------------
# Tries to find if the field MEMBER exists in type AGGR, after including
@@ -6842,7 +6843,7 @@ esac
# Handle optional debuginfod support
-# Enable debuginfod
+# Handle optional debuginfod support
# Check whether --with-debuginfod was given.
if test "${with_debuginfod+set}" = set; then :
@@ -6856,72 +6857,77 @@ $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; }
-if test "${with_debuginfod}" = no; then
- { $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;}
-else
- { $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 :
+if test "x$with_debuginfod" != xno; then
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_pkg_config_prog_path+:} 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. */
+ case $pkg_config_prog_path in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_pkg_config_prog_path="$pkg_config_prog_path" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_pkg_config_prog_path="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
-/* 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
+ test -z "$ac_cv_path_pkg_config_prog_path" && ac_cv_path_pkg_config_prog_path="missing"
+ ;;
+esac
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_debuginfod_lib=yes
+pkg_config_prog_path=$ac_cv_path_pkg_config_prog_path
+if test -n "$pkg_config_prog_path"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pkg_config_prog_path" >&5
+$as_echo "$pkg_config_prog_path" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
- ac_fn_c_check_decl "$LINENO" "debuginfod_begin" "ac_cv_have_decl_debuginfod_begin" "#include <elfutils/debuginfod.h>
-"
-if test "x$ac_cv_have_decl_debuginfod_begin" = xyes; then :
- have_debuginfod_h=yes
-fi
- if test "x$have_debuginfod_lib" = "xyes" -a \
- "x$have_debuginfod_h" = "xyes"; then
+ if test "${pkg_config_prog_path}" != "missing"; then
+ ${pkg_config_prog_path} --exists --atleast-version=0.178 libdebuginfod
+ if test $? = 0; then
+ DEBUGINFOD_LIBS=`${pkg_config_prog_path} --libs libdebuginfod`
-$as_echo "#define HAVE_LIBDEBUGINFOD 1" >>confdefs.h
+ DEBUGINFOD_CFLAGS=`${pkg_config_prog_path} --cflags libdebuginfod`
- LIBDEBUGINFOD="-ldebuginfod"
- else
+$as_echo "#define HAVE_LIBDEBUGINFOD 1" >>confdefs.h
- if test "$with_debuginfod" = yes; then
- as_fn_error $? "debuginfod is missing or unusable" "$LINENO" 5
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&5
-$as_echo "$as_me: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&2;}
+ 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
+ if test "x$with_debuginfod" = xyes; then
+ as_fn_error $? "--with-debuginfod was given, but pkg-config missing or unusable; cannot find libdebuginfod" "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config missing or unusable; debuginfod support disabled." >&5
+$as_echo "$as_me: WARNING: pkg-config missing or unusable; debuginfod support disabled." >&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
--
2.24.1