]>
Commit | Line | Data |
---|---|---|
4b0e5c1b AM |
1 | From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 |
2 | From: Fedora GDB patches <invalid@email.com> | |
3 | Date: Fri, 27 Oct 2017 21:07:50 +0200 | |
4 | Subject: gdb-6.6-buildid-locate-rpm.patch | |
5 | ||
4b0e5c1b | 6 | ;;=push+jan |
4b0e5c1b AM |
7 | |
8 | diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 | |
4b0e5c1b AM |
9 | --- a/gdb/aclocal.m4 |
10 | +++ b/gdb/aclocal.m4 | |
ed003b1c | 11 | @@ -11,7 +11,223 @@ |
321e94d6 BS |
12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
13 | # PARTICULAR PURPOSE. | |
14 | ||
15 | +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- | |
16 | +# serial 1 (pkg-config-0.24) | |
174fe25c | 17 | +# |
321e94d6 BS |
18 | +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. |
19 | +# | |
20 | +# This program is free software; you can redistribute it and/or modify | |
21 | +# it under the terms of the GNU General Public License as published by | |
22 | +# the Free Software Foundation; either version 2 of the License, or | |
23 | +# (at your option) any later version. | |
24 | +# | |
25 | +# This program is distributed in the hope that it will be useful, but | |
26 | +# WITHOUT ANY WARRANTY; without even the implied warranty of | |
27 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
28 | +# General Public License for more details. | |
29 | +# | |
30 | +# You should have received a copy of the GNU General Public License | |
31 | +# along with this program; if not, write to the Free Software | |
32 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
33 | +# | |
34 | +# As a special exception to the GNU General Public License, if you | |
35 | +# distribute this file as part of a program that contains a | |
36 | +# configuration script generated by Autoconf, you may include it under | |
37 | +# the same distribution terms that you use for the rest of that program. | |
3a58abaf | 38 | + |
321e94d6 BS |
39 | +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) |
40 | +# ---------------------------------- | |
41 | +AC_DEFUN([PKG_PROG_PKG_CONFIG], | |
42 | +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) | |
43 | +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) | |
44 | +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) | |
45 | +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) | |
46 | +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) | |
47 | +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) | |
3a58abaf | 48 | + |
321e94d6 BS |
49 | +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then |
50 | + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) | |
51 | +fi | |
52 | +if test -n "$PKG_CONFIG"; then | |
53 | + _pkg_min_version=m4_default([$1], [0.9.0]) | |
54 | + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) | |
55 | + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then | |
56 | + AC_MSG_RESULT([yes]) | |
57 | + else | |
58 | + AC_MSG_RESULT([no]) | |
59 | + PKG_CONFIG="" | |
60 | + fi | |
61 | +fi[]dnl | |
62 | +])# PKG_PROG_PKG_CONFIG | |
3a58abaf | 63 | + |
321e94d6 BS |
64 | +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) |
65 | +# | |
66 | +# Check to see whether a particular set of modules exists. Similar | |
67 | +# to PKG_CHECK_MODULES(), but does not set variables or print errors. | |
68 | +# | |
69 | +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) | |
70 | +# only at the first occurence in configure.ac, so if the first place | |
71 | +# it's called might be skipped (such as if it is within an "if", you | |
72 | +# have to call PKG_CHECK_EXISTS manually | |
73 | +# -------------------------------------------------------------- | |
74 | +AC_DEFUN([PKG_CHECK_EXISTS], | |
75 | +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | |
76 | +if test -n "$PKG_CONFIG" && \ | |
77 | + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then | |
78 | + m4_default([$2], [:]) | |
79 | +m4_ifvaln([$3], [else | |
80 | + $3])dnl | |
81 | +fi]) | |
3a58abaf | 82 | + |
321e94d6 BS |
83 | +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) |
84 | +# --------------------------------------------- | |
85 | +m4_define([_PKG_CONFIG], | |
86 | +[if test -n "$$1"; then | |
87 | + pkg_cv_[]$1="$$1" | |
88 | + elif test -n "$PKG_CONFIG"; then | |
89 | + PKG_CHECK_EXISTS([$3], | |
90 | + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` | |
91 | + test "x$?" != "x0" && pkg_failed=yes ], | |
92 | + [pkg_failed=yes]) | |
93 | + else | |
94 | + pkg_failed=untried | |
95 | +fi[]dnl | |
96 | +])# _PKG_CONFIG | |
3a58abaf | 97 | + |
321e94d6 BS |
98 | +# _PKG_SHORT_ERRORS_SUPPORTED |
99 | +# ----------------------------- | |
100 | +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], | |
101 | +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) | |
102 | +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then | |
103 | + _pkg_short_errors_supported=yes | |
104 | +else | |
105 | + _pkg_short_errors_supported=no | |
106 | +fi[]dnl | |
107 | +])# _PKG_SHORT_ERRORS_SUPPORTED | |
3a58abaf | 108 | + |
3a58abaf | 109 | + |
321e94d6 BS |
110 | +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], |
111 | +# [ACTION-IF-NOT-FOUND]) | |
112 | +# | |
113 | +# | |
114 | +# Note that if there is a possibility the first call to | |
115 | +# PKG_CHECK_MODULES might not happen, you should be sure to include an | |
116 | +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac | |
117 | +# | |
118 | +# | |
119 | +# -------------------------------------------------------------- | |
120 | +AC_DEFUN([PKG_CHECK_MODULES], | |
121 | +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | |
122 | +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl | |
123 | +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl | |
3a58abaf | 124 | + |
321e94d6 BS |
125 | +pkg_failed=no |
126 | +AC_MSG_CHECKING([for $1]) | |
3a58abaf | 127 | + |
321e94d6 BS |
128 | +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) |
129 | +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) | |
e5178960 | 130 | + |
321e94d6 BS |
131 | +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS |
132 | +and $1[]_LIBS to avoid the need to call pkg-config. | |
133 | +See the pkg-config man page for more details.]) | |
e5178960 | 134 | + |
321e94d6 | 135 | +if test $pkg_failed = yes; then |
174fe25c | 136 | + AC_MSG_RESULT([no]) |
321e94d6 BS |
137 | + _PKG_SHORT_ERRORS_SUPPORTED |
138 | + if test $_pkg_short_errors_supported = yes; then | |
139 | + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` | |
174fe25c | 140 | + else |
321e94d6 BS |
141 | + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` |
142 | + fi | |
143 | + # Put the nasty error message in config.log where it belongs | |
144 | + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD | |
3a58abaf | 145 | + |
321e94d6 BS |
146 | + m4_default([$4], [AC_MSG_ERROR( |
147 | +[Package requirements ($2) were not met: | |
3a58abaf | 148 | + |
321e94d6 | 149 | +$$1_PKG_ERRORS |
3a58abaf | 150 | + |
321e94d6 BS |
151 | +Consider adjusting the PKG_CONFIG_PATH environment variable if you |
152 | +installed software in a non-standard prefix. | |
3a58abaf | 153 | + |
321e94d6 BS |
154 | +_PKG_TEXT])[]dnl |
155 | + ]) | |
156 | +elif test $pkg_failed = untried; then | |
174fe25c | 157 | + AC_MSG_RESULT([no]) |
321e94d6 BS |
158 | + m4_default([$4], [AC_MSG_FAILURE( |
159 | +[The pkg-config script could not be found or is too old. Make sure it | |
160 | +is in your PATH or set the PKG_CONFIG environment variable to the full | |
161 | +path to pkg-config. | |
3a58abaf | 162 | + |
321e94d6 | 163 | +_PKG_TEXT |
3a58abaf | 164 | + |
321e94d6 BS |
165 | +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl |
166 | + ]) | |
167 | +else | |
168 | + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS | |
169 | + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS | |
170 | + AC_MSG_RESULT([yes]) | |
171 | + $3 | |
172 | +fi[]dnl | |
173 | +])# PKG_CHECK_MODULES | |
3a58abaf | 174 | + |
3a58abaf | 175 | + |
321e94d6 BS |
176 | +# PKG_INSTALLDIR(DIRECTORY) |
177 | +# ------------------------- | |
178 | +# Substitutes the variable pkgconfigdir as the location where a module | |
179 | +# should install pkg-config .pc files. By default the directory is | |
180 | +# $libdir/pkgconfig, but the default can be changed by passing | |
181 | +# DIRECTORY. The user can override through the --with-pkgconfigdir | |
182 | +# parameter. | |
183 | +AC_DEFUN([PKG_INSTALLDIR], | |
184 | +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) | |
185 | +m4_pushdef([pkg_description], | |
186 | + [pkg-config installation directory @<:@]pkg_default[@:>@]) | |
187 | +AC_ARG_WITH([pkgconfigdir], | |
188 | + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, | |
189 | + [with_pkgconfigdir=]pkg_default) | |
190 | +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) | |
191 | +m4_popdef([pkg_default]) | |
192 | +m4_popdef([pkg_description]) | |
193 | +]) dnl PKG_INSTALLDIR | |
194 | + | |
195 | + | |
196 | +# PKG_NOARCH_INSTALLDIR(DIRECTORY) | |
197 | +# ------------------------- | |
198 | +# Substitutes the variable noarch_pkgconfigdir as the location where a | |
199 | +# module should install arch-independent pkg-config .pc files. By | |
200 | +# default the directory is $datadir/pkgconfig, but the default can be | |
201 | +# changed by passing DIRECTORY. The user can override through the | |
202 | +# --with-noarch-pkgconfigdir parameter. | |
203 | +AC_DEFUN([PKG_NOARCH_INSTALLDIR], | |
204 | +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) | |
205 | +m4_pushdef([pkg_description], | |
206 | + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) | |
207 | +AC_ARG_WITH([noarch-pkgconfigdir], | |
208 | + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, | |
209 | + [with_noarch_pkgconfigdir=]pkg_default) | |
210 | +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) | |
211 | +m4_popdef([pkg_default]) | |
212 | +m4_popdef([pkg_description]) | |
213 | +]) dnl PKG_NOARCH_INSTALLDIR | |
214 | + | |
215 | + | |
216 | +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, | |
217 | +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) | |
218 | +# ------------------------------------------- | |
219 | +# Retrieves the value of the pkg-config variable for the given module. | |
220 | +AC_DEFUN([PKG_CHECK_VAR], | |
221 | +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | |
222 | +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl | |
3a58abaf | 223 | + |
321e94d6 BS |
224 | +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) |
225 | +AS_VAR_COPY([$1], [pkg_cv_][$1]) | |
3a58abaf | 226 | + |
321e94d6 BS |
227 | +AS_VAR_IF([$1], [""], [$5], [$4])dnl |
228 | +])# PKG_CHECK_VAR | |
ed003b1c AM |
229 | + |
230 | m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) | |
3a58abaf | 231 | + |
321e94d6 BS |
232 | # AM_AUX_DIR_EXPAND -*- Autoconf -*- |
233 | ||
ed003b1c | 234 | # Copyright (C) 2001-2017 Free Software Foundation, Inc. |
4b0e5c1b | 235 | diff --git a/gdb/config.in b/gdb/config.in |
4b0e5c1b AM |
236 | --- a/gdb/config.in |
237 | +++ b/gdb/config.in | |
174fe25c JP |
238 | @@ -39,6 +39,9 @@ |
239 | /* Handle .ctf type-info sections */ | |
240 | #undef ENABLE_LIBCTF | |
4b0e5c1b AM |
241 | |
242 | +/* librpm version specific library name to dlopen. */ | |
243 | +#undef DLOPEN_LIBRPM | |
321e94d6 | 244 | + |
4b0e5c1b AM |
245 | /* Define to 1 if translation of program messages to the user's native |
246 | language is requested. */ | |
247 | #undef ENABLE_NLS | |
0e7ddf04 | 248 | @@ -259,6 +262,9 @@ |
e28f2cc1 AM |
249 | /* Define if you have the mpfr library. */ |
250 | #undef HAVE_LIBMPFR | |
321e94d6 | 251 | |
4b0e5c1b AM |
252 | +/* Define if librpm library is being used. */ |
253 | +#undef HAVE_LIBRPM | |
254 | + | |
255 | /* Define to 1 if you have the <libunwind-ia64.h> header file. */ | |
256 | #undef HAVE_LIBUNWIND_IA64_H | |
321e94d6 | 257 | |
4b0e5c1b | 258 | diff --git a/gdb/configure b/gdb/configure |
4b0e5c1b AM |
259 | --- a/gdb/configure |
260 | +++ b/gdb/configure | |
0e7ddf04 JB |
261 | @@ -775,6 +775,11 @@ TARGET_OBS |
262 | ENABLE_BFD_64_BIT_FALSE | |
263 | ENABLE_BFD_64_BIT_TRUE | |
4b0e5c1b AM |
264 | subdirs |
265 | +RPM_LIBS | |
266 | +RPM_CFLAGS | |
267 | +PKG_CONFIG_LIBDIR | |
268 | +PKG_CONFIG_PATH | |
269 | +PKG_CONFIG | |
270 | GDB_DATADIR | |
271 | DEBUGDIR | |
272 | MAKEINFO_EXTRA_FLAGS | |
0e7ddf04 | 273 | @@ -880,6 +885,7 @@ with_gdb_datadir |
4b0e5c1b AM |
274 | with_relocated_sources |
275 | with_auto_load_dir | |
276 | with_auto_load_safe_path | |
277 | +with_rpm | |
278 | enable_targets | |
279 | enable_64_bit_bfd | |
77d10998 | 280 | enable_gdbmi |
0e7ddf04 | 281 | @@ -959,6 +965,8 @@ PKG_CONFIG_PATH |
174fe25c JP |
282 | PKG_CONFIG_LIBDIR |
283 | DEBUGINFOD_CFLAGS | |
284 | DEBUGINFOD_LIBS | |
4b0e5c1b AM |
285 | +RPM_CFLAGS |
286 | +RPM_LIBS | |
287 | YACC | |
288 | YFLAGS | |
289 | XMKMF' | |
0e7ddf04 | 290 | @@ -1635,6 +1643,8 @@ Optional Packages: |
4b0e5c1b | 291 | do not restrict auto-loaded files locations |
174fe25c JP |
292 | --with-debuginfod Enable debuginfo lookups with debuginfod |
293 | (auto/yes/no) | |
4b0e5c1b AM |
294 | + --with-rpm query rpm database for missing debuginfos (yes/no, |
295 | + def. auto=librpm.so) | |
296 | --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets | |
297 | --with-curses use the curses library instead of the termcap | |
298 | library | |
0e7ddf04 | 299 | @@ -1715,6 +1725,8 @@ Some influential environment variables: |
174fe25c JP |
300 | C compiler flags for DEBUGINFOD, overriding pkg-config |
301 | DEBUGINFOD_LIBS | |
302 | linker flags for DEBUGINFOD, overriding pkg-config | |
4b0e5c1b AM |
303 | + RPM_CFLAGS C compiler flags for RPM, overriding pkg-config |
304 | + RPM_LIBS linker flags for RPM, overriding pkg-config | |
ed003b1c AM |
305 | YACC The `Yet Another Compiler Compiler' implementation to use. |
306 | Defaults to the first program found out of: `bison -y', `byacc', | |
307 | `yacc'. | |
0e7ddf04 | 308 | @@ -6634,6 +6646,494 @@ _ACEOF |
4b0e5c1b AM |
309 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 |
310 | $as_echo "$with_auto_load_safe_path" >&6; } | |
321e94d6 BS |
311 | |
312 | +# Integration with rpm library to support missing debuginfo suggestions. | |
313 | +# --without-rpm: Disable any rpm support. | |
314 | +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime. | |
315 | +# Even with runtime missing `libname.so' GDB will still other run correctly. | |
316 | +# Missing `libname.so' during ./configure will abort the configuration. | |
317 | +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific | |
318 | +# minor version first such as `librpm-4.6.so' as minor version differences | |
319 | +# mean API+ABI incompatibility. If the specific match versioned library name | |
320 | +# could not be found still open dynamically at least `librpm.so'. | |
321 | +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try | |
322 | +# to find librpm for compilation-time linking by pkg-config. GDB binary will | |
323 | +# be probably linked with the version specific library (as `librpm-4.6.so'). | |
324 | +# Failure to find librpm by pkg-config will abort the configuration. | |
325 | +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config | |
326 | +# cannot find librpm use to the rpmless compilation (like `--without-rpm'). | |
327 | + | |
321e94d6 | 328 | + |
4b0e5c1b AM |
329 | +# Check whether --with-rpm was given. |
330 | +if test "${with_rpm+set}" = set; then : | |
331 | + withval=$with_rpm; | |
332 | +else | |
333 | + with_rpm="auto" | |
334 | +fi | |
335 | + | |
336 | + | |
337 | + | |
338 | + | |
321e94d6 BS |
339 | +if test "x$with_rpm" != "xno"; then |
340 | + if test "x$with_rpm" = "xyes"; then | |
341 | + LIBRPM="librpm.so" | |
342 | + RPM_REQUIRE=true | |
343 | + DLOPEN_REQUIRE=false | |
344 | + elif test "x$with_rpm" = "xauto"; then | |
345 | + LIBRPM="librpm.so" | |
346 | + RPM_REQUIRE=false | |
347 | + DLOPEN_REQUIRE=false | |
348 | + else | |
349 | + LIBRPM="$with_rpm" | |
350 | + RPM_REQUIRE=true | |
351 | + DLOPEN_REQUIRE=true | |
352 | + fi | |
353 | + LIBRPM_STRING='"'"$LIBRPM"'"' | |
354 | + | |
4b0e5c1b AM |
355 | + { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5 |
356 | +$as_echo_n "checking specific librpm version... " >&6; } | |
321e94d6 BS |
357 | + HAVE_DLOPEN_LIBRPM=false |
358 | + save_LIBS="$LIBS" | |
359 | + LIBS="$LIBS -ldl" | |
4b0e5c1b AM |
360 | + if test "$cross_compiling" = yes; then : |
361 | + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 | |
362 | +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} | |
363 | +as_fn_error "cannot run test program while cross compiling | |
364 | +See \`config.log' for more details." "$LINENO" 5; } | |
365 | +else | |
366 | + cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
367 | +/* end confdefs.h. */ | |
368 | + | |
321e94d6 BS |
369 | +#include <rpm/rpmlib.h> |
370 | +#include <dlfcn.h> | |
371 | +#include <errno.h> | |
4b0e5c1b AM |
372 | + |
373 | +int | |
374 | +main () | |
375 | +{ | |
376 | + | |
321e94d6 | 377 | + void *h; |
3a58abaf AM |
378 | + const char *const *rpmverp; |
379 | + FILE *f; | |
380 | + | |
381 | + f = fopen ("conftest.out", "w"); | |
382 | + if (!f) | |
383 | + { | |
384 | + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out", | |
385 | + strerror (errno)); | |
386 | + return 1; | |
387 | + } | |
388 | + h = dlopen ($LIBRPM_STRING, RTLD_LAZY); | |
389 | + if (!h) | |
390 | + { | |
391 | + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ()); | |
392 | + return 1; | |
393 | + } | |
394 | + rpmverp = dlsym (h, "RPMVERSION"); | |
395 | + if (!rpmverp) | |
396 | + { | |
397 | + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ()); | |
398 | + return 1; | |
399 | + } | |
400 | + fprintf (stderr, "RPMVERSION is: \""); | |
401 | + fprintf (stderr, "%s\"\n", *rpmverp); | |
402 | + | |
403 | + /* Try to find the specific librpm version only for "librpm.so" as we do | |
404 | + not know how to assemble the version string otherwise. */ | |
405 | + | |
406 | + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0) | |
407 | + { | |
408 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
409 | + return 0; | |
410 | + } | |
411 | + else | |
412 | + { | |
413 | + char *h2_name; | |
414 | + void *h2; | |
415 | + int major, minor; | |
416 | + | |
417 | + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2) | |
418 | + { | |
419 | + fprintf (stderr, "Unable to parse RPMVERSION.\n"); | |
420 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
421 | + return 0; | |
422 | + } | |
423 | + /* Avoid the square brackets by malloc. */ | |
424 | + h2_name = malloc (64); | |
425 | + sprintf (h2_name, "librpm-%d.%d.so", major, minor); | |
426 | + h2 = dlopen (h2_name, RTLD_LAZY); | |
427 | + if (!h2) | |
428 | + { | |
429 | + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ()); | |
430 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
431 | + return 0; | |
432 | + } | |
433 | + if (h2 != h) | |
434 | + { | |
435 | + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n", | |
436 | + $LIBRPM_STRING, h2_name); | |
437 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
438 | + return 0; | |
439 | + } | |
440 | + /* Found the valid .so name with a specific version. */ | |
441 | + fprintf (f, "%s\n", h2_name); | |
442 | + return 0; | |
443 | + } | |
4b0e5c1b AM |
444 | + |
445 | + ; | |
446 | + return 0; | |
447 | +} | |
448 | +_ACEOF | |
449 | +if ac_fn_c_try_run "$LINENO"; then : | |
450 | + | |
3a58abaf AM |
451 | + DLOPEN_LIBRPM="`cat conftest.out`" |
452 | + if test "x$DLOPEN_LIBRPM" != "x"; then | |
453 | + HAVE_DLOPEN_LIBRPM=true | |
4b0e5c1b AM |
454 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5 |
455 | +$as_echo "$DLOPEN_LIBRPM" >&6; } | |
3a58abaf | 456 | + fi |
4b0e5c1b AM |
457 | + |
458 | +fi | |
459 | +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ | |
460 | + conftest.$ac_objext conftest.beam conftest.$ac_ext | |
461 | +fi | |
462 | + | |
3a58abaf AM |
463 | + rm -f conftest.out |
464 | + | |
4b0e5c1b AM |
465 | + |
466 | + | |
467 | + if $HAVE_DLOPEN_LIBRPM; then | |
468 | + | |
469 | + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5 | |
470 | +$as_echo_n "checking rpm library API compatibility... " >&6; } | |
3a58abaf AM |
471 | + # The compilation requires -Werror to verify anything. |
472 | + save_CFLAGS="$CFLAGS" | |
473 | + CFLAGS="$CFLAGS -Werror" | |
4b0e5c1b AM |
474 | + cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
475 | +/* end confdefs.h. */ | |
476 | + | |
51a5ef0f | 477 | +/* Duplicate here the declarations to verify they match "elfread.c". */ |
3a58abaf AM |
478 | +#include <rpm/rpmlib.h> |
479 | +#include <rpm/rpmts.h> | |
480 | +#include <rpm/rpmdb.h> | |
481 | +#include <rpm/header.h> | |
482 | +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); | |
483 | +extern int rpmReadConfigFiles(const char * file, const char * target); | |
484 | +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); | |
485 | +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); | |
486 | +extern rpmts rpmtsCreate(void); | |
487 | +extern rpmts rpmtsFree(rpmts ts); | |
488 | +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, | |
489 | + const void * keyp, size_t keylen); | |
4b0e5c1b AM |
490 | + |
491 | +int | |
492 | +main () | |
493 | +{ | |
494 | + | |
495 | + ; | |
496 | + return 0; | |
497 | +} | |
498 | +_ACEOF | |
499 | +if ac_fn_c_try_compile "$LINENO"; then : | |
500 | + | |
3a58abaf | 501 | + LIBRPM_COMPAT=true |
4b0e5c1b AM |
502 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 |
503 | +$as_echo "yes" >&6; } | |
504 | + | |
505 | +else | |
506 | + | |
3a58abaf | 507 | + LIBRPM_COMPAT=false |
4b0e5c1b AM |
508 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
509 | +$as_echo "no" >&6; } | |
510 | + | |
511 | +fi | |
512 | +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
3a58abaf AM |
513 | + CFLAGS="$save_CFLAGS" |
514 | + | |
515 | + if ! $LIBRPM_COMPAT; then | |
516 | + HAVE_DLOPEN_LIBRPM=false | |
517 | + fi | |
518 | + fi | |
519 | + | |
520 | + if $HAVE_DLOPEN_LIBRPM; then | |
521 | + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"' | |
3a58abaf | 522 | + |
4b0e5c1b AM |
523 | +cat >>confdefs.h <<_ACEOF |
524 | +#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING | |
525 | +_ACEOF | |
3a58abaf | 526 | + |
3a58abaf | 527 | + |
4b0e5c1b | 528 | +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h |
3a58abaf | 529 | + |
4b0e5c1b AM |
530 | + else |
531 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
532 | +$as_echo "no" >&6; } | |
533 | + LIBS="$save_LIBS" | |
534 | + if $DLOPEN_REQUIRE; then | |
535 | + as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5 | |
536 | + fi | |
28b292e9 | 537 | + |
3a58abaf AM |
538 | + |
539 | + | |
540 | + | |
3a58abaf | 541 | + |
3a58abaf | 542 | + |
3a58abaf | 543 | + |
4b0e5c1b AM |
544 | +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then |
545 | + if test -n "$ac_tool_prefix"; then | |
546 | + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. | |
547 | +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 | |
548 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
549 | +$as_echo_n "checking for $ac_word... " >&6; } | |
550 | +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : | |
551 | + $as_echo_n "(cached) " >&6 | |
552 | +else | |
553 | + case $PKG_CONFIG in | |
554 | + [\\/]* | ?:[\\/]*) | |
555 | + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. | |
556 | + ;; | |
557 | + *) | |
558 | + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
559 | +for as_dir in $PATH | |
560 | +do | |
561 | + IFS=$as_save_IFS | |
562 | + test -z "$as_dir" && as_dir=. | |
563 | + for ac_exec_ext in '' $ac_executable_extensions; do | |
564 | + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
565 | + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" | |
566 | + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
567 | + break 2 | |
568 | + fi | |
569 | +done | |
570 | + done | |
571 | +IFS=$as_save_IFS | |
3a58abaf | 572 | + |
4b0e5c1b AM |
573 | + ;; |
574 | +esac | |
575 | +fi | |
576 | +PKG_CONFIG=$ac_cv_path_PKG_CONFIG | |
577 | +if test -n "$PKG_CONFIG"; then | |
578 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 | |
579 | +$as_echo "$PKG_CONFIG" >&6; } | |
580 | +else | |
581 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
582 | +$as_echo "no" >&6; } | |
583 | +fi | |
3a58abaf | 584 | + |
3a58abaf | 585 | + |
4b0e5c1b AM |
586 | +fi |
587 | +if test -z "$ac_cv_path_PKG_CONFIG"; then | |
588 | + ac_pt_PKG_CONFIG=$PKG_CONFIG | |
589 | + # Extract the first word of "pkg-config", so it can be a program name with args. | |
590 | +set dummy pkg-config; ac_word=$2 | |
591 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
592 | +$as_echo_n "checking for $ac_word... " >&6; } | |
593 | +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : | |
594 | + $as_echo_n "(cached) " >&6 | |
595 | +else | |
596 | + case $ac_pt_PKG_CONFIG in | |
597 | + [\\/]* | ?:[\\/]*) | |
598 | + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. | |
599 | + ;; | |
600 | + *) | |
601 | + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
602 | +for as_dir in $PATH | |
603 | +do | |
604 | + IFS=$as_save_IFS | |
605 | + test -z "$as_dir" && as_dir=. | |
606 | + for ac_exec_ext in '' $ac_executable_extensions; do | |
607 | + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
608 | + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" | |
609 | + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
610 | + break 2 | |
611 | + fi | |
612 | +done | |
613 | + done | |
614 | +IFS=$as_save_IFS | |
3a58abaf | 615 | + |
4b0e5c1b AM |
616 | + ;; |
617 | +esac | |
618 | +fi | |
619 | +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG | |
620 | +if test -n "$ac_pt_PKG_CONFIG"; then | |
621 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 | |
622 | +$as_echo "$ac_pt_PKG_CONFIG" >&6; } | |
623 | +else | |
624 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
625 | +$as_echo "no" >&6; } | |
626 | +fi | |
3a58abaf | 627 | + |
4b0e5c1b AM |
628 | + if test "x$ac_pt_PKG_CONFIG" = x; then |
629 | + PKG_CONFIG="" | |
630 | + else | |
631 | + case $cross_compiling:$ac_tool_warned in | |
632 | +yes:) | |
633 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 | |
634 | +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} | |
635 | +ac_tool_warned=yes ;; | |
636 | +esac | |
637 | + PKG_CONFIG=$ac_pt_PKG_CONFIG | |
638 | + fi | |
639 | +else | |
640 | + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" | |
641 | +fi | |
3a58abaf | 642 | + |
4b0e5c1b AM |
643 | +fi |
644 | +if test -n "$PKG_CONFIG"; then | |
645 | + _pkg_min_version=0.9.0 | |
646 | + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 | |
647 | +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } | |
648 | + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then | |
649 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 | |
650 | +$as_echo "yes" >&6; } | |
651 | + else | |
652 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
653 | +$as_echo "no" >&6; } | |
654 | + PKG_CONFIG="" | |
655 | + fi | |
656 | +fi | |
657 | + | |
658 | +pkg_failed=no | |
659 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5 | |
660 | +$as_echo_n "checking for RPM... " >&6; } | |
661 | + | |
662 | +if test -n "$RPM_CFLAGS"; then | |
663 | + pkg_cv_RPM_CFLAGS="$RPM_CFLAGS" | |
664 | + elif test -n "$PKG_CONFIG"; then | |
665 | + if test -n "$PKG_CONFIG" && \ | |
666 | + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5 | |
667 | + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5 | |
668 | + ac_status=$? | |
669 | + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
670 | + test $ac_status = 0; }; then | |
671 | + pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null` | |
672 | + test "x$?" != "x0" && pkg_failed=yes | |
673 | +else | |
674 | + pkg_failed=yes | |
675 | +fi | |
676 | + else | |
677 | + pkg_failed=untried | |
678 | +fi | |
679 | +if test -n "$RPM_LIBS"; then | |
680 | + pkg_cv_RPM_LIBS="$RPM_LIBS" | |
681 | + elif test -n "$PKG_CONFIG"; then | |
682 | + if test -n "$PKG_CONFIG" && \ | |
683 | + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5 | |
684 | + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5 | |
685 | + ac_status=$? | |
686 | + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
687 | + test $ac_status = 0; }; then | |
688 | + pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null` | |
689 | + test "x$?" != "x0" && pkg_failed=yes | |
690 | +else | |
691 | + pkg_failed=yes | |
692 | +fi | |
693 | + else | |
694 | + pkg_failed=untried | |
695 | +fi | |
3a58abaf | 696 | + |
3a58abaf | 697 | + |
3a58abaf | 698 | + |
4b0e5c1b | 699 | +if test $pkg_failed = yes; then |
174fe25c | 700 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
4b0e5c1b | 701 | +$as_echo "no" >&6; } |
3a58abaf | 702 | + |
4b0e5c1b AM |
703 | +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then |
704 | + _pkg_short_errors_supported=yes | |
705 | +else | |
706 | + _pkg_short_errors_supported=no | |
707 | +fi | |
708 | + if test $_pkg_short_errors_supported = yes; then | |
709 | + RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "rpm" 2>&1` | |
710 | + else | |
711 | + RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "rpm" 2>&1` | |
712 | + fi | |
713 | + # Put the nasty error message in config.log where it belongs | |
714 | + echo "$RPM_PKG_ERRORS" >&5 | |
3a58abaf | 715 | + |
4b0e5c1b AM |
716 | + HAVE_LIBRPM=false |
717 | +elif test $pkg_failed = untried; then | |
174fe25c | 718 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
4b0e5c1b AM |
719 | +$as_echo "no" >&6; } |
720 | + HAVE_LIBRPM=false | |
721 | +else | |
722 | + RPM_CFLAGS=$pkg_cv_RPM_CFLAGS | |
723 | + RPM_LIBS=$pkg_cv_RPM_LIBS | |
724 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 | |
725 | +$as_echo "yes" >&6; } | |
726 | + HAVE_LIBRPM=true | |
727 | +fi | |
3a58abaf | 728 | + |
4b0e5c1b | 729 | + if $HAVE_LIBRPM; then |
6ed6bacf | 730 | + |
4b0e5c1b AM |
731 | + { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5 |
732 | +$as_echo_n "checking rpm library API compatibility... " >&6; } | |
733 | + # The compilation requires -Werror to verify anything. | |
734 | + save_CFLAGS="$CFLAGS" | |
735 | + CFLAGS="$CFLAGS -Werror" | |
736 | + cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
737 | +/* end confdefs.h. */ | |
3a58abaf | 738 | + |
4b0e5c1b AM |
739 | +/* Duplicate here the declarations to verify they match "elfread.c". */ |
740 | +#include <rpm/rpmlib.h> | |
741 | +#include <rpm/rpmts.h> | |
742 | +#include <rpm/rpmdb.h> | |
743 | +#include <rpm/header.h> | |
744 | +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); | |
745 | +extern int rpmReadConfigFiles(const char * file, const char * target); | |
746 | +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); | |
747 | +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); | |
748 | +extern rpmts rpmtsCreate(void); | |
749 | +extern rpmts rpmtsFree(rpmts ts); | |
750 | +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, | |
751 | + const void * keyp, size_t keylen); | |
3a58abaf | 752 | + |
4b0e5c1b AM |
753 | +int |
754 | +main () | |
755 | +{ | |
3a58abaf | 756 | + |
4b0e5c1b AM |
757 | + ; |
758 | + return 0; | |
321e94d6 | 759 | +} |
4b0e5c1b AM |
760 | +_ACEOF |
761 | +if ac_fn_c_try_compile "$LINENO"; then : | |
3a58abaf | 762 | + |
4b0e5c1b AM |
763 | + LIBRPM_COMPAT=true |
764 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 | |
765 | +$as_echo "yes" >&6; } | |
3a58abaf | 766 | + |
4b0e5c1b | 767 | +else |
3a58abaf | 768 | + |
4b0e5c1b AM |
769 | + LIBRPM_COMPAT=false |
770 | + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
771 | +$as_echo "no" >&6; } | |
3a58abaf | 772 | + |
4b0e5c1b AM |
773 | +fi |
774 | +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
775 | + CFLAGS="$save_CFLAGS" | |
3a58abaf | 776 | + |
4b0e5c1b AM |
777 | + if ! $LIBRPM_COMPAT; then |
778 | + HAVE_LIBRPM=false | |
779 | + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB" | |
780 | + fi | |
781 | + fi | |
3a58abaf | 782 | + |
4b0e5c1b | 783 | + if $HAVE_LIBRPM; then |
3a58abaf | 784 | + |
4b0e5c1b | 785 | +$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h |
3a58abaf | 786 | + |
4b0e5c1b AM |
787 | + CFLAGS="$CFLAGS $RPM_CFLAGS" |
788 | + LIBS="$LIBS $RPM_LIBS" | |
789 | + else | |
790 | + if $RPM_REQUIRE; then | |
791 | + as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5 | |
792 | + else | |
793 | + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5 | |
794 | +$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;} | |
795 | + fi | |
796 | + fi | |
797 | + fi | |
798 | +fi | |
799 | + | |
800 | ||
801 | ||
802 | subdirs="$subdirs testsuite" | |
803 | diff --git a/gdb/configure.ac b/gdb/configure.ac | |
4b0e5c1b AM |
804 | --- a/gdb/configure.ac |
805 | +++ b/gdb/configure.ac | |
1d2a824d | 806 | @@ -153,6 +153,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir, |
4b0e5c1b AM |
807 | [Directories safe to hold auto-loaded files.]) |
808 | AC_MSG_RESULT([$with_auto_load_safe_path]) | |
809 | ||
810 | +# Integration with rpm library to support missing debuginfo suggestions. | |
811 | +# --without-rpm: Disable any rpm support. | |
812 | +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime. | |
813 | +# Even with runtime missing `libname.so' GDB will still other run correctly. | |
814 | +# Missing `libname.so' during ./configure will abort the configuration. | |
815 | +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific | |
816 | +# minor version first such as `librpm-4.6.so' as minor version differences | |
817 | +# mean API+ABI incompatibility. If the specific match versioned library name | |
818 | +# could not be found still open dynamically at least `librpm.so'. | |
819 | +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try | |
820 | +# to find librpm for compilation-time linking by pkg-config. GDB binary will | |
821 | +# be probably linked with the version specific library (as `librpm-4.6.so'). | |
822 | +# Failure to find librpm by pkg-config will abort the configuration. | |
823 | +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config | |
824 | +# cannot find librpm use to the rpmless compilation (like `--without-rpm'). | |
825 | + | |
826 | +AC_ARG_WITH([rpm], | |
827 | + [AS_HELP_STRING([--with-rpm], | |
828 | + [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"]) | |
829 | + | |
830 | +m4_pattern_allow([^AC_MSG_ERROR$]) | |
831 | +m4_pattern_allow([^AC_MSG_WARN$]) | |
832 | +if test "x$with_rpm" != "xno"; then | |
833 | + if test "x$with_rpm" = "xyes"; then | |
834 | + LIBRPM="librpm.so" | |
835 | + RPM_REQUIRE=true | |
836 | + DLOPEN_REQUIRE=false | |
837 | + elif test "x$with_rpm" = "xauto"; then | |
838 | + LIBRPM="librpm.so" | |
839 | + RPM_REQUIRE=false | |
840 | + DLOPEN_REQUIRE=false | |
841 | + else | |
842 | + LIBRPM="$with_rpm" | |
843 | + RPM_REQUIRE=true | |
844 | + DLOPEN_REQUIRE=true | |
845 | + fi | |
846 | + LIBRPM_STRING='"'"$LIBRPM"'"' | |
847 | + | |
848 | + AC_MSG_CHECKING([specific librpm version]) | |
849 | + HAVE_DLOPEN_LIBRPM=false | |
850 | + save_LIBS="$LIBS" | |
851 | + LIBS="$LIBS -ldl" | |
852 | + AC_RUN_IFELSE(AC_LANG_PROGRAM([[ | |
853 | +#include <rpm/rpmlib.h> | |
854 | +#include <dlfcn.h> | |
855 | +#include <errno.h> | |
856 | + ]], [[ | |
857 | + void *h; | |
858 | + const char *const *rpmverp; | |
859 | + FILE *f; | |
860 | + | |
861 | + f = fopen ("conftest.out", "w"); | |
862 | + if (!f) | |
863 | + { | |
864 | + fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out", | |
865 | + strerror (errno)); | |
866 | + return 1; | |
867 | + } | |
868 | + h = dlopen ($LIBRPM_STRING, RTLD_LAZY); | |
869 | + if (!h) | |
870 | + { | |
871 | + fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ()); | |
872 | + return 1; | |
873 | + } | |
874 | + rpmverp = dlsym (h, "RPMVERSION"); | |
875 | + if (!rpmverp) | |
876 | + { | |
877 | + fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ()); | |
878 | + return 1; | |
879 | + } | |
880 | + fprintf (stderr, "RPMVERSION is: \""); | |
881 | + fprintf (stderr, "%s\"\n", *rpmverp); | |
3a58abaf | 882 | + |
4b0e5c1b AM |
883 | + /* Try to find the specific librpm version only for "librpm.so" as we do |
884 | + not know how to assemble the version string otherwise. */ | |
321e94d6 | 885 | + |
4b0e5c1b AM |
886 | + if (strcmp ("librpm.so", $LIBRPM_STRING) != 0) |
887 | + { | |
888 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
889 | + return 0; | |
890 | + } | |
891 | + else | |
892 | + { | |
893 | + char *h2_name; | |
894 | + void *h2; | |
895 | + int major, minor; | |
321e94d6 | 896 | + |
4b0e5c1b AM |
897 | + if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2) |
898 | + { | |
899 | + fprintf (stderr, "Unable to parse RPMVERSION.\n"); | |
900 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
901 | + return 0; | |
902 | + } | |
903 | + /* Avoid the square brackets by malloc. */ | |
904 | + h2_name = malloc (64); | |
905 | + sprintf (h2_name, "librpm-%d.%d.so", major, minor); | |
906 | + h2 = dlopen (h2_name, RTLD_LAZY); | |
907 | + if (!h2) | |
908 | + { | |
909 | + fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ()); | |
910 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
911 | + return 0; | |
912 | + } | |
913 | + if (h2 != h) | |
914 | + { | |
915 | + fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n", | |
916 | + $LIBRPM_STRING, h2_name); | |
917 | + fprintf (f, "%s\n", $LIBRPM_STRING); | |
918 | + return 0; | |
919 | + } | |
920 | + /* Found the valid .so name with a specific version. */ | |
921 | + fprintf (f, "%s\n", h2_name); | |
922 | + return 0; | |
923 | + } | |
924 | + ]]), [ | |
925 | + DLOPEN_LIBRPM="`cat conftest.out`" | |
926 | + if test "x$DLOPEN_LIBRPM" != "x"; then | |
927 | + HAVE_DLOPEN_LIBRPM=true | |
928 | + AC_MSG_RESULT($DLOPEN_LIBRPM) | |
929 | + fi | |
930 | + ]) | |
931 | + rm -f conftest.out | |
321e94d6 | 932 | + |
4b0e5c1b AM |
933 | + m4_define([CHECK_LIBRPM_COMPAT], [ |
934 | + AC_MSG_CHECKING([rpm library API compatibility]) | |
935 | + # The compilation requires -Werror to verify anything. | |
936 | + save_CFLAGS="$CFLAGS" | |
937 | + CFLAGS="$CFLAGS -Werror" | |
938 | + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[ | |
939 | +/* Duplicate here the declarations to verify they match "elfread.c". */ | |
940 | +#include <rpm/rpmlib.h> | |
941 | +#include <rpm/rpmts.h> | |
942 | +#include <rpm/rpmdb.h> | |
943 | +#include <rpm/header.h> | |
944 | +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); | |
945 | +extern int rpmReadConfigFiles(const char * file, const char * target); | |
946 | +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); | |
947 | +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); | |
948 | +extern rpmts rpmtsCreate(void); | |
949 | +extern rpmts rpmtsFree(rpmts ts); | |
950 | +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, | |
951 | + const void * keyp, size_t keylen); | |
952 | + ]]), [ | |
953 | + LIBRPM_COMPAT=true | |
954 | + AC_MSG_RESULT(yes) | |
955 | + ], [ | |
956 | + LIBRPM_COMPAT=false | |
957 | + AC_MSG_RESULT(no) | |
958 | + ]) | |
959 | + CFLAGS="$save_CFLAGS" | |
960 | + ]) | |
321e94d6 | 961 | + |
4b0e5c1b AM |
962 | + if $HAVE_DLOPEN_LIBRPM; then |
963 | + CHECK_LIBRPM_COMPAT | |
964 | + if ! $LIBRPM_COMPAT; then | |
965 | + HAVE_DLOPEN_LIBRPM=false | |
966 | + fi | |
967 | + fi | |
321e94d6 | 968 | + |
4b0e5c1b AM |
969 | + if $HAVE_DLOPEN_LIBRPM; then |
970 | + DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"' | |
971 | + AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.]) | |
972 | + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.]) | |
973 | + else | |
974 | + AC_MSG_RESULT(no) | |
975 | + LIBS="$save_LIBS" | |
976 | + if $DLOPEN_REQUIRE; then | |
977 | + AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.]) | |
978 | + fi | |
979 | + PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false]) | |
321e94d6 | 980 | + |
4b0e5c1b AM |
981 | + if $HAVE_LIBRPM; then |
982 | + CHECK_LIBRPM_COMPAT | |
983 | + if ! $LIBRPM_COMPAT; then | |
984 | + HAVE_LIBRPM=false | |
985 | + RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB" | |
986 | + fi | |
987 | + fi | |
321e94d6 | 988 | + |
4b0e5c1b AM |
989 | + if $HAVE_LIBRPM; then |
990 | + AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.]) | |
991 | + CFLAGS="$CFLAGS $RPM_CFLAGS" | |
992 | + LIBS="$LIBS $RPM_LIBS" | |
993 | + else | |
994 | + if $RPM_REQUIRE; then | |
995 | + AC_MSG_ERROR($RPM_PKG_ERRORS) | |
996 | + else | |
997 | + AC_MSG_WARN($RPM_PKG_ERRORS) | |
998 | + fi | |
999 | + fi | |
1000 | + fi | |
1001 | +fi | |
174fe25c | 1002 | + |
4b0e5c1b | 1003 | AC_CONFIG_SUBDIRS(testsuite) |
3a58abaf | 1004 | |
4b0e5c1b | 1005 | # Check whether to support alternative target configurations |
4b0e5c1b | 1006 | diff --git a/gdb/event-top.c b/gdb/event-top.c |
4b0e5c1b AM |
1007 | --- a/gdb/event-top.c |
1008 | +++ b/gdb/event-top.c | |
0e7ddf04 | 1009 | @@ -42,6 +42,7 @@ |
e28f2cc1 | 1010 | #include "gdbsupport/gdb-sigmask.h" |
174fe25c | 1011 | #include "async-event.h" |
0e7ddf04 | 1012 | #include "bt-utils.h" |
4b0e5c1b | 1013 | +#include "symfile.h" |
321e94d6 | 1014 | |
4b0e5c1b AM |
1015 | /* readline include files. */ |
1016 | #include "readline/readline.h" | |
0e7ddf04 | 1017 | @@ -374,6 +375,8 @@ display_gdb_prompt (const char *new_prompt) |
4b0e5c1b AM |
1018 | /* Reset the nesting depth used when trace-commands is set. */ |
1019 | reset_command_nest_depth (); | |
321e94d6 | 1020 | |
4b0e5c1b AM |
1021 | + debug_flush_missing (); |
1022 | + | |
1023 | /* Do not call the python hook on an explicit prompt change as | |
1024 | passed to this function, as this forms a secondary/local prompt, | |
1025 | IE, displayed but not set. */ | |
0e7ddf04 | 1026 | @@ -800,7 +803,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl) |
4b0e5c1b | 1027 | command_handler (cmd); |
321e94d6 | 1028 | |
4b0e5c1b AM |
1029 | if (ui->prompt_state != PROMPTED) |
1030 | - display_gdb_prompt (0); | |
321e94d6 | 1031 | + { |
4b0e5c1b AM |
1032 | + debug_flush_missing (); |
1033 | + display_gdb_prompt (0); | |
321e94d6 | 1034 | + } |
4b0e5c1b | 1035 | } |
321e94d6 | 1036 | } |
e5178960 | 1037 | |
4b0e5c1b | 1038 | diff --git a/gdb/symfile.h b/gdb/symfile.h |
4b0e5c1b AM |
1039 | --- a/gdb/symfile.h |
1040 | +++ b/gdb/symfile.h | |
1d2a824d | 1041 | @@ -342,6 +342,7 @@ extern void generic_load (const char *args, int from_tty); |
4b0e5c1b AM |
1042 | /* build-id support. */ |
1043 | extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr); | |
1044 | extern void debug_print_missing (const char *binary, const char *debug); | |
1045 | +extern void debug_flush_missing (void); | |
174fe25c | 1046 | #define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file") |
4b0e5c1b | 1047 | |
1d2a824d | 1048 | /* From minidebug.c. */ |