]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-6.6-buildid-locate-rpm.patch
- update to 6.8.91.20090930-1 from fedora
[packages/gdb.git] / gdb-6.6-buildid-locate-rpm.patch
CommitLineData
7566401a 1Index: gdb-6.8.50.20090909/gdb/event-top.c
3a58abaf 2===================================================================
7566401a
ER
3--- gdb-6.8.50.20090909.orig/gdb/event-top.c 2009-09-09 20:05:48.000000000 +0200
4+++ gdb-6.8.50.20090909/gdb/event-top.c 2009-09-09 20:08:04.000000000 +0200
3a58abaf
AM
5@@ -33,6 +33,7 @@
6 #include "cli/cli-script.h" /* for reset_command_nest_depth */
7 #include "main.h"
8 #include "gdbthread.h"
9+#include "symfile.h"
10
11 /* For dont_repeat() */
12 #include "gdbcmd.h"
13@@ -193,6 +194,8 @@ cli_command_loop (void)
14 char *a_prompt;
15 char *gdb_prompt = get_prompt ();
16
17+ debug_flush_missing ();
18+
19 /* Tell readline what the prompt to display is and what function it
20 will need to call after a whole line is read. This also displays
21 the first prompt. */
22@@ -264,6 +267,8 @@ display_gdb_prompt (char *new_prompt)
23 /* Reset the nesting depth used when trace-commands is set. */
24 reset_command_nest_depth ();
25
26+ debug_flush_missing ();
27+
28 /* Each interpreter has its own rules on displaying the command
29 prompt. */
30 if (!current_interp_display_prompt_p ())
7566401a 31Index: gdb-6.8.50.20090909/gdb/symfile.c
3a58abaf 32===================================================================
7566401a
ER
33--- gdb-6.8.50.20090909.orig/gdb/symfile.c 2009-09-09 20:08:04.000000000 +0200
34+++ gdb-6.8.50.20090909/gdb/symfile.c 2009-09-09 20:08:04.000000000 +0200
35@@ -57,6 +57,7 @@
3a58abaf
AM
36 #include "solib.h"
37 #include "remote.h"
38 #include "libbfd.h"
39+#include "elf/external.h"
40
41 #include <sys/types.h>
42 #include <fcntl.h>
7566401a 43@@ -65,6 +66,7 @@
3a58abaf
AM
44 #include <ctype.h>
45 #include <time.h>
46 #include <sys/time.h>
47+#include <sys/param.h>
48
49
50 int (*deprecated_ui_load_progress_hook) (const char *section, unsigned long num);
7566401a 51@@ -1673,8 +1675,352 @@ build_id_to_filename (struct build_id *b
3a58abaf
AM
52 return retval;
53 }
54
55+#ifdef HAVE_LIBRPM
56+
57+#include <rpm/rpmlib.h>
58+#include <rpm/rpmts.h>
59+#include <rpm/rpmdb.h>
60+#include <rpm/header.h>
61+#ifdef DLOPEN_LIBRPM
62+#include <dlfcn.h>
63+#endif
64+
65+/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
66+ and avoid their duplicities during a single inferior run. */
67+
68+static struct htab *missing_rpm_hash;
69+
70+/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
71+ all the rpms right before the nearest GDB prompt. It gets cleared after
72+ each such print (it is questionable if we should clear it after the print).
73+ */
74+
75+struct missing_rpm
76+ {
77+ struct missing_rpm *next;
78+ char rpm[1];
79+ };
80+static struct missing_rpm *missing_rpm_list;
81+static int missing_rpm_list_entries;
82+
83+/* Returns the count of newly added rpms. */
84+
85+static int
86+missing_rpm_enlist (const char *filename)
87+{
88+ static int rpm_init_done = 0;
89+ rpmts ts;
90+ rpmdbMatchIterator mi;
91+ int count = 0;
92+
93+#ifdef DLOPEN_LIBRPM
94+ /* Duplicate here the declarations to verify they match. The same sanity
95+ check is present also in `configure.ac'. */
96+ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
97+ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
98+ extern int rpmReadConfigFiles(const char * file, const char * target);
99+ static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
100+ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
101+ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
102+ extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
103+ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
104+ extern rpmts rpmtsCreate(void);
105+ static rpmts (*rpmtsCreate_p) (void);
106+ extern rpmts rpmtsFree(rpmts ts);
107+ static rpmts (*rpmtsFree_p) (rpmts ts);
108+ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
109+ const void * keyp, size_t keylen);
110+ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
111+ rpmTag rpmtag,
112+ const void *keyp,
113+ size_t keylen);
114+#else /* !DLOPEN_LIBRPM */
115+# define headerFormat_p headerFormat
116+# define rpmReadConfigFiles_p rpmReadConfigFiles
117+# define rpmdbFreeIterator_p rpmdbFreeIterator
118+# define rpmdbNextIterator_p rpmdbNextIterator
119+# define rpmtsCreate_p rpmtsCreate
120+# define rpmtsFree_p rpmtsFree
121+# define rpmtsInitIterator_p rpmtsInitIterator
122+#endif /* !DLOPEN_LIBRPM */
123+
124+ if (filename == NULL)
125+ return 0;
126+
127+ if (!rpm_init_done)
128+ {
129+ static int init_tried;
130+
131+ /* Already failed the initialization before? */
132+ if (init_tried)
133+ return 0;
134+ init_tried = 1;
135+
136+#ifdef DLOPEN_LIBRPM
137+ {
138+ void *h;
139+
140+ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
141+ if (!h)
142+ {
143+ warning (_("Unable to open \"%s\" (%s), "
144+ "missing debuginfos notifications will not be displayed"),
145+ DLOPEN_LIBRPM, dlerror ());
146+ return 0;
147+ }
148+
149+ if (!((headerFormat_p = dlsym (h, "headerFormat"))
150+ && (rpmReadConfigFiles_p = dlsym (h, "rpmReadConfigFiles"))
151+ && (rpmdbFreeIterator_p = dlsym (h, "rpmdbFreeIterator"))
152+ && (rpmdbNextIterator_p = dlsym (h, "rpmdbNextIterator"))
153+ && (rpmtsCreate_p = dlsym (h, "rpmtsCreate"))
154+ && (rpmtsFree_p = dlsym (h, "rpmtsFree"))
155+ && (rpmtsInitIterator_p = dlsym (h, "rpmtsInitIterator"))))
156+ {
157+ warning (_("Opened library \"%s\" is incompatible (%s), "
158+ "missing debuginfos notifications will not be displayed"),
159+ DLOPEN_LIBRPM, dlerror ());
160+ if (dlclose (h))
161+ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
162+ dlerror ());
163+ return 0;
164+ }
165+ }
166+#endif /* DLOPEN_LIBRPM */
167+
168+ if (rpmReadConfigFiles_p (NULL, NULL) != 0)
169+ {
170+ warning (_("Error reading the rpm configuration files"));
171+ return 0;
172+ }
173+
174+ rpm_init_done = 1;
175+ }
176+
177+ ts = rpmtsCreate_p ();
178+
179+ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
180+ if (mi != NULL)
181+ {
182+ for (;;)
183+ {
184+ Header h;
185+ char *debuginfo, **slot, *s, *s2;
186+ errmsg_t err;
187+ size_t srcrpmlen = sizeof (".src.rpm") - 1;
188+ size_t debuginfolen = sizeof ("-debuginfo") - 1;
189+ rpmdbMatchIterator mi_debuginfo;
190+
191+ h = rpmdbNextIterator_p (mi);
192+ if (h == NULL)
193+ break;
194+
195+ /* Verify the debuginfo file is not already installed. */
196+
197+ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
198+ &err);
199+ if (!debuginfo)
200+ {
201+ warning (_("Error querying the rpm file `%s': %s"), filename,
202+ err);
203+ continue;
204+ }
205+ /* s = `.src.rpm-debuginfo.%{arch}' */
206+ s = strrchr (debuginfo, '-') - srcrpmlen;
207+ s2 = NULL;
208+ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
209+ {
210+ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
211+ s2 = memrchr (debuginfo, '-', s - debuginfo);
212+ }
213+ if (s2)
214+ {
215+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
216+ s2 = memrchr (debuginfo, '-', s2 - debuginfo);
217+ }
218+ if (!s2)
219+ {
220+ warning (_("Error querying the rpm file `%s': %s"), filename,
221+ debuginfo);
222+ xfree (debuginfo);
223+ continue;
224+ }
225+ /* s = `.src.rpm-debuginfo.%{arch}' */
226+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
227+ memmove (s2 + debuginfolen, s2, s - s2);
228+ memcpy (s2, "-debuginfo", debuginfolen);
229+ /* s = `XXXX.%{arch}' */
230+ /* strlen ("XXXX") == srcrpmlen + debuginfolen */
231+ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
232+ /* strlen ("XX") == srcrpmlen */
233+ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
234+ strlen (s + srcrpmlen + debuginfolen) + 1);
235+ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
236+
237+ /* RPMDBI_PACKAGES requires keylen == sizeof (int). */
238+ /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
239+ mi_debuginfo = rpmtsInitIterator_p (ts, RPMDBI_LABEL, debuginfo, 0);
240+ xfree (debuginfo);
241+ if (mi_debuginfo)
242+ {
243+ rpmdbFreeIterator_p (mi_debuginfo);
244+ count = 0;
245+ break;
246+ }
247+
248+ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
249+ debuginfo = headerFormat_p (h,
250+ "%{name}-%{version}-%{release}.%{arch}",
251+ &err);
252+ if (!debuginfo)
253+ {
254+ warning (_("Error querying the rpm file `%s': %s"), filename,
255+ err);
256+ continue;
257+ }
258+
259+ /* Base package name for `debuginfo-install'. We do not use the
260+ `yum' command directly as the line
261+ yum --enablerepo='*-debuginfo' install NAME-debuginfo.ARCH
262+ would be more complicated than just:
263+ debuginfo-install NAME-VERSION-RELEASE.ARCH
264+ Do not supply the rpm base name (derived from .src.rpm name) as
265+ debuginfo-install is unable to install the debuginfo package if
266+ the base name PKG binary rpm is not installed while for example
267+ PKG-libs would be installed (RH Bug 467901).
268+ FUTURE: After multiple debuginfo versions simultaneously installed
269+ get supported the support for the VERSION-RELEASE tags handling
270+ may need an update. */
271+
272+ if (missing_rpm_hash == NULL)
273+ {
274+ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
275+ should not deallocate the entries. */
276+
277+ missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
278+ (int (*) (const void *, const void *)) streq,
279+ NULL, xcalloc, xfree);
280+ }
281+ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
282+ /* XCALLOC never returns NULL. */
283+ gdb_assert (slot != NULL);
284+ if (*slot == NULL)
285+ {
286+ struct missing_rpm *missing_rpm;
287+
288+ *slot = debuginfo;
289+
290+ missing_rpm = xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
291+ strcpy (missing_rpm->rpm, debuginfo);
292+ missing_rpm->next = missing_rpm_list;
293+ missing_rpm_list = missing_rpm;
294+ missing_rpm_list_entries++;
295+ }
296+ else
297+ xfree (debuginfo);
298+ count++;
299+ }
300+
301+ rpmdbFreeIterator_p (mi);
302+ }
303+
304+ rpmtsFree_p (ts);
305+
306+ return count;
307+}
308+
309+static int
310+missing_rpm_list_compar (const char *const *ap, const char *const *bp)
311+{
312+ return strcoll (*ap, *bp);
313+}
314+
315+/* It returns a NULL-terminated array of strings needing to be FREEd. It may
316+ also return only NULL. */
317+
318+static void
319+missing_rpm_list_print (void)
320+{
321+ char **array, **array_iter;
322+ struct missing_rpm *list_iter;
323+ struct cleanup *cleanups;
324+
325+ if (missing_rpm_list_entries == 0)
326+ return;
327+
328+ array = xmalloc (sizeof (*array) * missing_rpm_list_entries);
329+ cleanups = make_cleanup (xfree, array);
330+
331+ array_iter = array;
332+ for (list_iter = missing_rpm_list; list_iter != NULL;
333+ list_iter = list_iter->next)
334+ {
335+ *array_iter++ = list_iter->rpm;
336+ }
337+ gdb_assert (array_iter == array + missing_rpm_list_entries);
338+
339+ qsort (array, missing_rpm_list_entries, sizeof (*array),
340+ (int (*) (const void *, const void *)) missing_rpm_list_compar);
341+
342+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
343+ "debuginfo-install");
344+ for (array_iter = array; array_iter < array + missing_rpm_list_entries;
345+ array_iter++)
346+ {
347+ putchar_unfiltered (' ');
348+ puts_unfiltered (*array_iter);
349+ }
350+ putchar_unfiltered ('\n');
351+
352+ while (missing_rpm_list != NULL)
353+ {
354+ list_iter = missing_rpm_list;
355+ missing_rpm_list = list_iter->next;
356+ xfree (list_iter);
357+ }
358+ missing_rpm_list_entries = 0;
359+
360+ do_cleanups (cleanups);
361+}
362+
363+static void
364+missing_rpm_change (void)
365+{
366+ debug_flush_missing ();
367+
368+ gdb_assert (missing_rpm_list == NULL);
369+ if (missing_rpm_hash != NULL)
370+ {
371+ htab_delete (missing_rpm_hash);
372+ missing_rpm_hash = NULL;
373+ }
374+}
375+
376+enum missing_exec
377+ {
378+ /* Init state. EXEC_BFD also still could be NULL. */
379+ MISSING_EXEC_NOT_TRIED,
380+ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
381+ MISSING_EXEC_NOT_FOUND,
382+ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
383+ or separate) or the main executable's RPM is now contained in
384+ MISSING_RPM_HASH. */
385+ MISSING_EXEC_ENLISTED
386+ };
387+static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
388+
389+#endif /* HAVE_LIBRPM */
390+
391+void
392+debug_flush_missing (void)
393+{
394+#ifdef HAVE_LIBRPM
395+ missing_rpm_list_print ();
396+#endif
397+}
398+
399 /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
400- Try to install the hash file ...
401+ yum --enablerepo='*-debuginfo' install ...
402 avoidance. */
403
404 struct missing_filepair
7566401a 405@@ -1728,11 +2074,17 @@ missing_filepair_change (void)
3a58abaf
AM
406 /* All their memory came just from missing_filepair_OBSTACK. */
407 missing_filepair_hash = NULL;
408 }
409+#ifdef HAVE_LIBRPM
410+ missing_exec = MISSING_EXEC_NOT_TRIED;
411+#endif
412 }
413
414 static void
415 debug_print_executable_changed (void)
416 {
417+#ifdef HAVE_LIBRPM
418+ missing_rpm_change ();
419+#endif
420 missing_filepair_change ();
421 }
422
7566401a
ER
423@@ -1799,14 +2151,33 @@ debug_print_missing (const char *binary,
424
3a58abaf
AM
425 *slot = missing_filepair;
426
427- /* We do not collect and flush these messages as each such message
428- already requires its own separate lines. */
429+#ifdef HAVE_LIBRPM
430+ if (missing_exec == MISSING_EXEC_NOT_TRIED)
431+ {
432+ char *exec_filename;
433
434- fprintf_unfiltered (gdb_stdlog,
435- _("Missing separate debuginfo for %s\n"), binary);
436- if (debug != NULL)
437- fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
438- debug);
439+ exec_filename = get_exec_file (0);
440+ if (exec_filename != NULL)
441+ {
442+ if (missing_rpm_enlist (exec_filename) == 0)
443+ missing_exec = MISSING_EXEC_NOT_FOUND;
444+ else
445+ missing_exec = MISSING_EXEC_ENLISTED;
446+ }
447+ }
448+ if (missing_exec != MISSING_EXEC_ENLISTED)
449+ if (missing_rpm_enlist (binary) == 0 && missing_rpm_enlist (debug) == 0)
450+#endif /* HAVE_LIBRPM */
451+ {
452+ /* We do not collect and flush these messages as each such message
453+ already requires its own separate lines. */
454+
455+ fprintf_unfiltered (gdb_stdlog,
456+ _("Missing separate debuginfo for %s\n"), binary);
457+ if (debug != NULL)
7566401a
ER
458+ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
459+ "yum --enablerepo='*-debuginfo' install", debug);
3a58abaf
AM
460+ }
461 }
462
463 static char *
7566401a 464Index: gdb-6.8.50.20090909/gdb/symfile.h
3a58abaf 465===================================================================
7566401a
ER
466--- gdb-6.8.50.20090909.orig/gdb/symfile.h 2009-09-09 20:08:04.000000000 +0200
467+++ gdb-6.8.50.20090909/gdb/symfile.h 2009-09-09 20:08:04.000000000 +0200
468@@ -387,6 +387,7 @@ extern struct build_id *build_id_addr_ge
3a58abaf
AM
469 extern char *build_id_to_filename (struct build_id *build_id,
470 char **link_return, int add_debug_suffix);
471 extern void debug_print_missing (const char *binary, const char *debug);
472+extern void debug_flush_missing (void);
473
474 /* From dwarf2read.c */
475
7566401a 476Index: gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp
3a58abaf 477===================================================================
7566401a
ER
478--- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/gdb.exp 2009-09-09 20:08:04.000000000 +0200
479+++ gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp 2009-09-09 20:08:04.000000000 +0200
480@@ -1248,7 +1248,7 @@ proc default_gdb_start { } {
3a58abaf
AM
481 warning "Couldn't set the width to 0."
482 }
483 }
484- # Turn off the missing warnings as the testsuite does not expect it.
485+ # Turn off the missing RPMs warnings as the testsuite does not expect it.
486 send_gdb "set build-id-verbose 0\n"
487 gdb_expect 10 {
488 -re "$gdb_prompt $" {
7566401a
ER
489Index: gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp
490===================================================================
491--- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/mi-support.exp 2009-09-09 20:08:04.000000000 +0200
492+++ gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp 2009-09-09 20:08:04.000000000 +0200
d566d21e 493@@ -221,7 +221,7 @@ proc default_mi_gdb_start { args } {
494 }
495 }
496 }
497- # Turn off the missing warnings as the testsuite does not expect it.
498+ # Turn off the missing RPMs warnings as the testsuite does not expect it.
499 send_gdb "190-gdb-set build-id-verbose 0\n"
500 gdb_expect 10 {
501 -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
7566401a 502Index: gdb-6.8.50.20090909/gdb/tui/tui-interp.c
3a58abaf 503===================================================================
7566401a
ER
504--- gdb-6.8.50.20090909.orig/gdb/tui/tui-interp.c 2009-09-09 20:05:48.000000000 +0200
505+++ gdb-6.8.50.20090909/gdb/tui/tui-interp.c 2009-09-09 20:08:04.000000000 +0200
3a58abaf
AM
506@@ -30,6 +30,7 @@
507 #include "tui/tui.h"
508 #include "tui/tui-io.h"
509 #include "exceptions.h"
510+#include "symfile.h"
511
512 /* Set to 1 when the TUI mode must be activated when we first start
513 gdb. */
514@@ -128,6 +129,8 @@ tui_command_loop (void *data)
515 char *a_prompt;
516 char *gdb_prompt = get_prompt ();
517
518+ debug_flush_missing ();
519+
520 /* Tell readline what the prompt to display is and what function
521 it will need to call after a whole line is read. This also
522 displays the first prompt. */
7566401a 523Index: gdb-6.8.50.20090909/gdb/aclocal.m4
3a58abaf 524===================================================================
7566401a
ER
525--- gdb-6.8.50.20090909.orig/gdb/aclocal.m4 2009-09-09 20:05:48.000000000 +0200
526+++ gdb-6.8.50.20090909/gdb/aclocal.m4 2009-09-09 20:09:32.000000000 +0200
527@@ -19,6 +19,162 @@ You have another version of autoconf. I
528 If you have problems, you may need to regenerate the build system entirely.
529 To do so, use the procedure documented by the package, typically `autoreconf'.])])
3a58abaf
AM
530
531+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
532+#
533+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
534+#
535+# This program is free software; you can redistribute it and/or modify
536+# it under the terms of the GNU General Public License as published by
537+# the Free Software Foundation; either version 2 of the License, or
538+# (at your option) any later version.
539+#
540+# This program is distributed in the hope that it will be useful, but
541+# WITHOUT ANY WARRANTY; without even the implied warranty of
542+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
543+# General Public License for more details.
544+#
545+# You should have received a copy of the GNU General Public License
546+# along with this program; if not, write to the Free Software
547+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
548+#
549+# As a special exception to the GNU General Public License, if you
550+# distribute this file as part of a program that contains a
551+# configuration script generated by Autoconf, you may include it under
552+# the same distribution terms that you use for the rest of that program.
553+
554+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
555+# ----------------------------------
556+AC_DEFUN([PKG_PROG_PKG_CONFIG],
557+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
558+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
559+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
560+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
561+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
562+fi
563+if test -n "$PKG_CONFIG"; then
564+ _pkg_min_version=m4_default([$1], [0.9.0])
565+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
566+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
567+ AC_MSG_RESULT([yes])
568+ else
569+ AC_MSG_RESULT([no])
570+ PKG_CONFIG=""
571+ fi
572+
573+fi[]dnl
574+])# PKG_PROG_PKG_CONFIG
575+
576+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
577+#
578+# Check to see whether a particular set of modules exists. Similar
579+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
580+#
581+#
582+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
583+# this or PKG_CHECK_MODULES is called, or make sure to call
584+# PKG_CHECK_EXISTS manually
585+# --------------------------------------------------------------
586+AC_DEFUN([PKG_CHECK_EXISTS],
587+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
588+if test -n "$PKG_CONFIG" && \
589+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
590+ m4_ifval([$2], [$2], [:])
591+m4_ifvaln([$3], [else
592+ $3])dnl
593+fi])
594+
595+
596+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
597+# ---------------------------------------------
598+m4_define([_PKG_CONFIG],
599+[if test -n "$$1"; then
600+ pkg_cv_[]$1="$$1"
601+ elif test -n "$PKG_CONFIG"; then
602+ PKG_CHECK_EXISTS([$3],
603+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
604+ [pkg_failed=yes])
605+ else
606+ pkg_failed=untried
607+fi[]dnl
608+])# _PKG_CONFIG
609+
610+# _PKG_SHORT_ERRORS_SUPPORTED
611+# -----------------------------
612+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
613+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
614+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
615+ _pkg_short_errors_supported=yes
616+else
617+ _pkg_short_errors_supported=no
618+fi[]dnl
619+])# _PKG_SHORT_ERRORS_SUPPORTED
620+
621+
622+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
623+# [ACTION-IF-NOT-FOUND])
624+#
625+#
626+# Note that if there is a possibility the first call to
627+# PKG_CHECK_MODULES might not happen, you should be sure to include an
628+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
629+#
630+#
631+# --------------------------------------------------------------
632+AC_DEFUN([PKG_CHECK_MODULES],
633+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
634+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
635+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
636+
637+pkg_failed=no
638+AC_MSG_CHECKING([for $1])
639+
640+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
641+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
642+
643+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
644+and $1[]_LIBS to avoid the need to call pkg-config.
645+See the pkg-config man page for more details.])
646+
647+if test $pkg_failed = yes; then
648+ _PKG_SHORT_ERRORS_SUPPORTED
649+ if test $_pkg_short_errors_supported = yes; then
650+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
651+ else
652+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
653+ fi
654+ # Put the nasty error message in config.log where it belongs
655+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
656+
657+ ifelse([$4], , [AC_MSG_ERROR(dnl
658+[Package requirements ($2) were not met:
659+
660+$$1_PKG_ERRORS
661+
662+Consider adjusting the PKG_CONFIG_PATH environment variable if you
663+installed software in a non-standard prefix.
664+
665+_PKG_TEXT
666+])],
667+ [AC_MSG_RESULT([no])
668+ $4])
669+elif test $pkg_failed = untried; then
670+ ifelse([$4], , [AC_MSG_FAILURE(dnl
671+[The pkg-config script could not be found or is too old. Make sure it
672+is in your PATH or set the PKG_CONFIG environment variable to the full
673+path to pkg-config.
674+
675+_PKG_TEXT
676+
677+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
678+ [$4])
679+else
680+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
681+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
682+ AC_MSG_RESULT([yes])
683+ ifelse([$3], , :, [$3])
684+fi[]dnl
685+])# PKG_CHECK_MODULES
686+
7566401a 687 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
3a58abaf
AM
688 #
689 # This file is free software; the Free Software Foundation
7566401a 690Index: gdb-6.8.50.20090909/gdb/config.in
3a58abaf 691===================================================================
7566401a
ER
692--- gdb-6.8.50.20090909.orig/gdb/config.in 2009-09-09 20:08:04.000000000 +0200
693+++ gdb-6.8.50.20090909/gdb/config.in 2009-09-09 20:08:04.000000000 +0200
694@@ -42,6 +42,9 @@
3a58abaf
AM
695 /* Define to BFD's default target vector. */
696 #undef DEFAULT_BFD_VEC
697
698+/* librpm version specific library name to dlopen. */
699+#undef DLOPEN_LIBRPM
700+
701 /* Define to 1 if translation of program messages to the user's native
702 language is requested. */
703 #undef ENABLE_NLS
7566401a 704@@ -221,6 +224,9 @@
3a58abaf
AM
705 /* Define if Python 2.6 is being used. */
706 #undef HAVE_LIBPYTHON2_6
707
708+/* Define if librpm library is being used. */
709+#undef HAVE_LIBRPM
710+
711 /* Define if libunwind library is being used. */
712 #undef HAVE_LIBUNWIND
713
7566401a 714Index: gdb-6.8.50.20090909/gdb/configure
3a58abaf 715===================================================================
7566401a
ER
716--- gdb-6.8.50.20090909.orig/gdb/configure 2009-09-09 20:08:04.000000000 +0200
717+++ gdb-6.8.50.20090909/gdb/configure 2009-09-09 20:09:35.000000000 +0200
718@@ -676,6 +676,9 @@ REPORT_BUGS_TO
719 PKGVERSION
720 TARGET_OBS
721 subdirs
722+RPM_LIBS
723+RPM_CFLAGS
724+PKG_CONFIG
725 pythondir
726 GDB_DATADIR_PATH
727 GDB_DATADIR
728@@ -886,6 +889,7 @@ with_separate_debug_dir
729 with_gdb_datadir
730 with_relocated_sources
731 with_pythondir
732+with_rpm
733 enable_targets
734 enable_64_bit_bfd
735 enable_gdbcli
736@@ -925,6 +929,9 @@ LDFLAGS
737 LIBS
738 CPPFLAGS
739 CPP
740+PKG_CONFIG
741+RPM_CFLAGS
742+RPM_LIBS
743 YACC
744 YFLAGS
745 XMKMF'
746@@ -1588,6 +1595,8 @@ Optional Packages:
3a58abaf
AM
747 [DATADIR/gdb]
748 --with-pythondir install Python data files in this path
749 [DATADIR/gdb/python]
7566401a
ER
750+ --with-rpm query rpm database for missing debuginfos (yes/no,
751+ def. auto=librpm.so)
752 --with-libunwind use libunwind frame unwinding support
753 --with-curses use the curses library instead of the termcap
754 library
755@@ -1621,6 +1630,9 @@ Some influential environment variables:
756 CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
757 you have headers in a nonstandard directory <include dir>
3a58abaf
AM
758 CPP C preprocessor
759+ PKG_CONFIG path to pkg-config utility
760+ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
761+ RPM_LIBS linker flags for RPM, overriding pkg-config
7566401a
ER
762 YACC The `Yet Another C Compiler' implementation to use. Defaults to
763 the first program found out of: `bison -y', `byacc', `yacc'.
764 YFLAGS The list of arguments that will be passed by default to $YACC.
765@@ -6675,6 +6687,486 @@ _ACEOF
3a58abaf
AM
766 fi
767
768
769+# Integration with rpm library to support missing debuginfo suggestions.
770+# --without-rpm: Disable any rpm support.
771+# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
772+# Even with runtime missing `libname.so' GDB will still other run correctly.
773+# Missing `libname.so' during ./configure will abort the configuration.
774+# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
775+# minor version first such as `librpm-4.6.so' as minor version differences
776+# mean API+ABI incompatibility. If the specific match versioned library name
777+# could not be found still open dynamically at least `librpm.so'.
778+# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
779+# to find librpm for compilation-time linking by pkg-config. GDB binary will
780+# be probably linked with the version specific library (as `librpm-4.6.so').
781+# Failure to find librpm by pkg-config will abort the configuration.
782+# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
783+# cannot find librpm use to the rpmless compilation (like `--without-rpm').
784+
785+
7566401a
ER
786+# Check whether --with-rpm was given.
787+if test "${with_rpm+set}" = set; then :
788+ withval=$with_rpm;
3a58abaf
AM
789+else
790+ with_rpm="auto"
7566401a
ER
791+fi
792+
3a58abaf
AM
793+
794+
795+
796+if test "x$with_rpm" != "xno"; then
797+ if test "x$with_rpm" = "xyes"; then
798+ LIBRPM="librpm.so"
799+ RPM_REQUIRE=true
800+ DLOPEN_REQUIRE=false
801+ elif test "x$with_rpm" = "xauto"; then
802+ LIBRPM="librpm.so"
803+ RPM_REQUIRE=false
804+ DLOPEN_REQUIRE=false
805+ else
806+ LIBRPM="$with_rpm"
807+ RPM_REQUIRE=true
808+ DLOPEN_REQUIRE=true
809+ fi
810+ LIBRPM_STRING='"'"$LIBRPM"'"'
811+
7566401a
ER
812+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5
813+$as_echo_n "checking specific librpm version... " >&6; }
3a58abaf
AM
814+ HAVE_DLOPEN_LIBRPM=false
815+ save_LIBS="$LIBS"
816+ LIBS="$LIBS -ldl"
7566401a
ER
817+ if test "$cross_compiling" = yes; then :
818+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
819+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
820+as_fn_error "cannot run test program while cross compiling
821+See \`config.log' for more details." "$LINENO" 5; }
3a58abaf 822+else
7566401a 823+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3a58abaf
AM
824+/* end confdefs.h. */
825+
826+#include <rpm/rpmlib.h>
827+#include <dlfcn.h>
828+#include <errno.h>
829+
830+int
831+main ()
832+{
833+
834+ void *h;
835+ const char *const *rpmverp;
836+ FILE *f;
837+
838+ f = fopen ("conftest.out", "w");
839+ if (!f)
840+ {
841+ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
842+ strerror (errno));
843+ return 1;
844+ }
845+ h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
846+ if (!h)
847+ {
848+ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
849+ return 1;
850+ }
851+ rpmverp = dlsym (h, "RPMVERSION");
852+ if (!rpmverp)
853+ {
854+ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
855+ return 1;
856+ }
857+ fprintf (stderr, "RPMVERSION is: \"");
858+ fprintf (stderr, "%s\"\n", *rpmverp);
859+
860+ /* Try to find the specific librpm version only for "librpm.so" as we do
861+ not know how to assemble the version string otherwise. */
862+
863+ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
864+ {
865+ fprintf (f, "%s\n", $LIBRPM_STRING);
866+ return 0;
867+ }
868+ else
869+ {
870+ char *h2_name;
871+ void *h2;
872+ int major, minor;
873+
874+ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
875+ {
876+ fprintf (stderr, "Unable to parse RPMVERSION.\n");
877+ fprintf (f, "%s\n", $LIBRPM_STRING);
878+ return 0;
879+ }
880+ /* Avoid the square brackets by malloc. */
881+ h2_name = malloc (64);
882+ sprintf (h2_name, "librpm-%d.%d.so", major, minor);
883+ h2 = dlopen (h2_name, RTLD_LAZY);
884+ if (!h2)
885+ {
886+ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
887+ fprintf (f, "%s\n", $LIBRPM_STRING);
888+ return 0;
889+ }
890+ if (h2 != h)
891+ {
892+ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
893+ $LIBRPM_STRING, h2_name);
894+ fprintf (f, "%s\n", $LIBRPM_STRING);
895+ return 0;
896+ }
897+ /* Found the valid .so name with a specific version. */
898+ fprintf (f, "%s\n", h2_name);
899+ return 0;
900+ }
901+
902+ ;
903+ return 0;
904+}
905+_ACEOF
7566401a 906+if ac_fn_c_try_run "$LINENO"; then :
3a58abaf
AM
907+
908+ DLOPEN_LIBRPM="`cat conftest.out`"
909+ if test "x$DLOPEN_LIBRPM" != "x"; then
910+ HAVE_DLOPEN_LIBRPM=true
7566401a
ER
911+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5
912+$as_echo "$DLOPEN_LIBRPM" >&6; }
3a58abaf
AM
913+ fi
914+
3a58abaf 915+fi
7566401a
ER
916+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
917+ conftest.$ac_objext conftest.beam conftest.$ac_ext
3a58abaf 918+fi
7566401a 919+
3a58abaf
AM
920+ rm -f conftest.out
921+
922+
923+
924+ if $HAVE_DLOPEN_LIBRPM; then
925+
7566401a
ER
926+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
927+$as_echo_n "checking rpm library API compatibility... " >&6; }
3a58abaf
AM
928+ # The compilation requires -Werror to verify anything.
929+ save_CFLAGS="$CFLAGS"
930+ CFLAGS="$CFLAGS -Werror"
7566401a 931+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3a58abaf
AM
932+/* end confdefs.h. */
933+
934+/* Duplicate here the declarations to verify they match "symfile.c". */
935+#include <rpm/rpmlib.h>
936+#include <rpm/rpmts.h>
937+#include <rpm/rpmdb.h>
938+#include <rpm/header.h>
939+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
940+extern int rpmReadConfigFiles(const char * file, const char * target);
941+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
942+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
943+extern rpmts rpmtsCreate(void);
944+extern rpmts rpmtsFree(rpmts ts);
945+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
946+ const void * keyp, size_t keylen);
947+
948+int
949+main ()
950+{
951+
952+ ;
953+ return 0;
954+}
955+_ACEOF
7566401a 956+if ac_fn_c_try_compile "$LINENO"; then :
3a58abaf
AM
957+
958+ LIBRPM_COMPAT=true
7566401a
ER
959+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
960+$as_echo "yes" >&6; }
3a58abaf
AM
961+
962+else
3a58abaf
AM
963+
964+ LIBRPM_COMPAT=false
7566401a
ER
965+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
966+$as_echo "no" >&6; }
3a58abaf
AM
967+
968+fi
7566401a 969+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3a58abaf
AM
970+ CFLAGS="$save_CFLAGS"
971+
972+ if ! $LIBRPM_COMPAT; then
973+ HAVE_DLOPEN_LIBRPM=false
974+ fi
975+ fi
976+
977+ if $HAVE_DLOPEN_LIBRPM; then
978+ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
979+
980+cat >>confdefs.h <<_ACEOF
981+#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING
982+_ACEOF
983+
984+
7566401a 985+$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
3a58abaf
AM
986+
987+ else
7566401a
ER
988+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
989+$as_echo "no" >&6; }
3a58abaf
AM
990+ LIBS="$save_LIBS"
991+ if $DLOPEN_REQUIRE; then
7566401a 992+ as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
3a58abaf
AM
993+ fi
994+
995+
996+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
997+ if test -n "$ac_tool_prefix"; then
998+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
999+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
7566401a
ER
1000+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
1001+$as_echo_n "checking for $ac_word... " >&6; }
1002+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
1003+ $as_echo_n "(cached) " >&6
3a58abaf
AM
1004+else
1005+ case $PKG_CONFIG in
1006+ [\\/]* | ?:[\\/]*)
1007+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
1008+ ;;
1009+ *)
1010+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1011+for as_dir in $PATH
1012+do
1013+ IFS=$as_save_IFS
1014+ test -z "$as_dir" && as_dir=.
7566401a
ER
1015+ for ac_exec_ext in '' $ac_executable_extensions; do
1016+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
3a58abaf 1017+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
7566401a 1018+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
3a58abaf
AM
1019+ break 2
1020+ fi
1021+done
7566401a
ER
1022+ done
1023+IFS=$as_save_IFS
3a58abaf
AM
1024+
1025+ ;;
1026+esac
1027+fi
1028+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
3a58abaf 1029+if test -n "$PKG_CONFIG"; then
7566401a
ER
1030+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
1031+$as_echo "$PKG_CONFIG" >&6; }
3a58abaf 1032+else
7566401a
ER
1033+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1034+$as_echo "no" >&6; }
3a58abaf
AM
1035+fi
1036+
7566401a 1037+
3a58abaf
AM
1038+fi
1039+if test -z "$ac_cv_path_PKG_CONFIG"; then
1040+ ac_pt_PKG_CONFIG=$PKG_CONFIG
1041+ # Extract the first word of "pkg-config", so it can be a program name with args.
1042+set dummy pkg-config; ac_word=$2
7566401a
ER
1043+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
1044+$as_echo_n "checking for $ac_word... " >&6; }
1045+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
1046+ $as_echo_n "(cached) " >&6
3a58abaf
AM
1047+else
1048+ case $ac_pt_PKG_CONFIG in
1049+ [\\/]* | ?:[\\/]*)
1050+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
1051+ ;;
1052+ *)
1053+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1054+for as_dir in $PATH
1055+do
1056+ IFS=$as_save_IFS
1057+ test -z "$as_dir" && as_dir=.
7566401a
ER
1058+ for ac_exec_ext in '' $ac_executable_extensions; do
1059+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
3a58abaf 1060+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
7566401a 1061+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
3a58abaf
AM
1062+ break 2
1063+ fi
1064+done
7566401a
ER
1065+ done
1066+IFS=$as_save_IFS
3a58abaf
AM
1067+
1068+ ;;
1069+esac
1070+fi
1071+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
3a58abaf 1072+if test -n "$ac_pt_PKG_CONFIG"; then
7566401a
ER
1073+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
1074+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
3a58abaf 1075+else
7566401a
ER
1076+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1077+$as_echo "no" >&6; }
3a58abaf
AM
1078+fi
1079+
7566401a
ER
1080+ if test "x$ac_pt_PKG_CONFIG" = x; then
1081+ PKG_CONFIG=""
1082+ else
1083+ case $cross_compiling:$ac_tool_warned in
1084+yes:)
1085+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
1086+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
1087+ac_tool_warned=yes ;;
1088+esac
1089+ PKG_CONFIG=$ac_pt_PKG_CONFIG
1090+ fi
3a58abaf
AM
1091+else
1092+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
1093+fi
1094+
1095+fi
1096+if test -n "$PKG_CONFIG"; then
1097+ _pkg_min_version=0.9.0
7566401a
ER
1098+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
1099+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
3a58abaf 1100+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
7566401a
ER
1101+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1102+$as_echo "yes" >&6; }
3a58abaf 1103+ else
7566401a
ER
1104+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1105+$as_echo "no" >&6; }
3a58abaf
AM
1106+ PKG_CONFIG=""
1107+ fi
1108+
1109+fi
1110+
1111+pkg_failed=no
7566401a
ER
1112+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5
1113+$as_echo_n "checking for RPM... " >&6; }
3a58abaf
AM
1114+
1115+if test -n "$RPM_CFLAGS"; then
1116+ pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
1117+ elif test -n "$PKG_CONFIG"; then
1118+ if test -n "$PKG_CONFIG" && \
7566401a 1119+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
3a58abaf
AM
1120+ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1121+ ac_status=$?
7566401a
ER
1122+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1123+ test $ac_status = 0; }; then
3a58abaf
AM
1124+ pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null`
1125+else
1126+ pkg_failed=yes
1127+fi
1128+ else
1129+ pkg_failed=untried
1130+fi
1131+if test -n "$RPM_LIBS"; then
1132+ pkg_cv_RPM_LIBS="$RPM_LIBS"
1133+ elif test -n "$PKG_CONFIG"; then
1134+ if test -n "$PKG_CONFIG" && \
7566401a 1135+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5
3a58abaf
AM
1136+ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1137+ ac_status=$?
7566401a
ER
1138+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1139+ test $ac_status = 0; }; then
3a58abaf
AM
1140+ pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null`
1141+else
1142+ pkg_failed=yes
1143+fi
1144+ else
1145+ pkg_failed=untried
1146+fi
1147+
1148+
1149+
1150+if test $pkg_failed = yes; then
1151+
1152+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1153+ _pkg_short_errors_supported=yes
1154+else
1155+ _pkg_short_errors_supported=no
1156+fi
1157+ if test $_pkg_short_errors_supported = yes; then
1158+ RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "rpm" 2>&1`
1159+ else
1160+ RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors "rpm" 2>&1`
1161+ fi
1162+ # Put the nasty error message in config.log where it belongs
1163+ echo "$RPM_PKG_ERRORS" >&5
1164+
7566401a
ER
1165+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1166+$as_echo "no" >&6; }
3a58abaf
AM
1167+ HAVE_LIBRPM=false
1168+elif test $pkg_failed = untried; then
1169+ HAVE_LIBRPM=false
1170+else
1171+ RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
1172+ RPM_LIBS=$pkg_cv_RPM_LIBS
7566401a
ER
1173+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1174+$as_echo "yes" >&6; }
3a58abaf
AM
1175+ HAVE_LIBRPM=true
1176+fi
1177+
1178+ if $HAVE_LIBRPM; then
1179+
7566401a
ER
1180+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5
1181+$as_echo_n "checking rpm library API compatibility... " >&6; }
3a58abaf
AM
1182+ # The compilation requires -Werror to verify anything.
1183+ save_CFLAGS="$CFLAGS"
1184+ CFLAGS="$CFLAGS -Werror"
7566401a 1185+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3a58abaf
AM
1186+/* end confdefs.h. */
1187+
1188+/* Duplicate here the declarations to verify they match "symfile.c". */
1189+#include <rpm/rpmlib.h>
1190+#include <rpm/rpmts.h>
1191+#include <rpm/rpmdb.h>
1192+#include <rpm/header.h>
1193+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1194+extern int rpmReadConfigFiles(const char * file, const char * target);
1195+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1196+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1197+extern rpmts rpmtsCreate(void);
1198+extern rpmts rpmtsFree(rpmts ts);
1199+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1200+ const void * keyp, size_t keylen);
1201+
1202+int
1203+main ()
1204+{
1205+
1206+ ;
1207+ return 0;
1208+}
1209+_ACEOF
7566401a 1210+if ac_fn_c_try_compile "$LINENO"; then :
3a58abaf
AM
1211+
1212+ LIBRPM_COMPAT=true
7566401a
ER
1213+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1214+$as_echo "yes" >&6; }
3a58abaf
AM
1215+
1216+else
3a58abaf
AM
1217+
1218+ LIBRPM_COMPAT=false
7566401a
ER
1219+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1220+$as_echo "no" >&6; }
3a58abaf
AM
1221+
1222+fi
7566401a 1223+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3a58abaf
AM
1224+ CFLAGS="$save_CFLAGS"
1225+
1226+ if ! $LIBRPM_COMPAT; then
1227+ HAVE_LIBRPM=false
1228+ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1229+ fi
1230+ fi
1231+
1232+ if $HAVE_LIBRPM; then
1233+
7566401a 1234+$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
3a58abaf
AM
1235+
1236+ CFLAGS="$CFLAGS $RPM_CFLAGS"
1237+ LIBS="$LIBS $RPM_LIBS"
1238+ else
1239+ if $RPM_REQUIRE; then
7566401a 1240+ as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5
3a58abaf 1241+ else
7566401a
ER
1242+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5
1243+$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
3a58abaf
AM
1244+ fi
1245+ fi
1246+ fi
1247+fi
1248+
1249
1250
1251
7566401a
ER
1252@@ -9721,265 +10213,25 @@ $as_echo "#define STDC_HEADERS 1" >>conf
1253
1254 fi
3a58abaf 1255
7566401a
ER
1256-
1257-
1258 for ac_header in sys/user32.h sys/procfs32.h
1259-do
1260-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
1261-if eval "test \"\${$as_ac_Header+set}\" = set"; then
1262- echo "$as_me:$LINENO: checking for $ac_header" >&5
1263-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
1264-if eval "test \"\${$as_ac_Header+set}\" = set"; then
1265- echo $ECHO_N "(cached) $ECHO_C" >&6
1266-fi
1267-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
1268-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
1269-else
1270- # Is the header compilable?
1271-echo "$as_me:$LINENO: checking $ac_header usability" >&5
1272-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
1273-cat >conftest.$ac_ext <<_ACEOF
1274-/* confdefs.h. */
1275-_ACEOF
1276-cat confdefs.h >>conftest.$ac_ext
1277-cat >>conftest.$ac_ext <<_ACEOF
1278-/* end confdefs.h. */
1279-$ac_includes_default
1280-#include <$ac_header>
1281-_ACEOF
1282-rm -f conftest.$ac_objext
1283-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
1284- (eval $ac_compile) 2>conftest.er1
1285- ac_status=$?
1286- grep -v '^ *+' conftest.er1 >conftest.err
1287- rm -f conftest.er1
1288- cat conftest.err >&5
1289- echo "$as_me:$LINENO: \$? = $ac_status" >&5
1290- (exit $ac_status); } &&
1291- { ac_try='test -z "$ac_c_werror_flag"
1292- || test ! -s conftest.err'
1293- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
1294- (eval $ac_try) 2>&5
1295- ac_status=$?
1296- echo "$as_me:$LINENO: \$? = $ac_status" >&5
1297- (exit $ac_status); }; } &&
1298- { ac_try='test -s conftest.$ac_objext'
1299- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
1300- (eval $ac_try) 2>&5
1301- ac_status=$?
1302- echo "$as_me:$LINENO: \$? = $ac_status" >&5
1303- (exit $ac_status); }; }; then
1304- ac_header_compiler=yes
1305-else
1306- echo "$as_me: failed program was:" >&5
1307-sed 's/^/| /' conftest.$ac_ext >&5
1308-
1309-ac_header_compiler=no
1310-fi
1311-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
1312-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
1313-echo "${ECHO_T}$ac_header_compiler" >&6
1314-
1315-# Is the header present?
1316-echo "$as_me:$LINENO: checking $ac_header presence" >&5
1317-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
1318-cat >conftest.$ac_ext <<_ACEOF
1319-/* confdefs.h. */
1320-_ACEOF
1321-cat confdefs.h >>conftest.$ac_ext
1322-cat >>conftest.$ac_ext <<_ACEOF
1323-/* end confdefs.h. */
1324-#include <$ac_header>
1325-_ACEOF
1326-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
1327- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
1328- ac_status=$?
1329- grep -v '^ *+' conftest.er1 >conftest.err
1330- rm -f conftest.er1
1331- cat conftest.err >&5
1332- echo "$as_me:$LINENO: \$? = $ac_status" >&5
1333- (exit $ac_status); } >/dev/null; then
1334- if test -s conftest.err; then
1335- ac_cpp_err=$ac_c_preproc_warn_flag
1336- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
1337- else
1338- ac_cpp_err=
1339- fi
1340-else
1341- ac_cpp_err=yes
1342-fi
1343-if test -z "$ac_cpp_err"; then
1344- ac_header_preproc=yes
1345-else
1346- echo "$as_me: failed program was:" >&5
1347-sed 's/^/| /' conftest.$ac_ext >&5
1348-
1349- ac_header_preproc=no
1350-fi
1351-rm -f conftest.err conftest.$ac_ext
1352-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
1353-echo "${ECHO_T}$ac_header_preproc" >&6
1354-
1355-# So? What about this header?
1356-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
1357- yes:no: )
1358- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
1359-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
1360- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
1361-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
1362- ac_header_preproc=yes
1363- ;;
1364- no:yes:* )
1365- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
1366-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
1367- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
1368-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
1369- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
1370-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
1371- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
1372-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
1373- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
1374-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
1375- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
1376-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
1377- (
1378- cat <<\_ASBOX
1379-## ------------------------------------------ ##
1380-## Report this to the AC_PACKAGE_NAME lists. ##
1381-## ------------------------------------------ ##
1382-_ASBOX
1383- ) |
1384- sed "s/^/$as_me: WARNING: /" >&2
1385- ;;
1386-esac
1387-echo "$as_me:$LINENO: checking for $ac_header" >&5
1388-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
1389-if eval "test \"\${$as_ac_Header+set}\" = set"; then
1390- echo $ECHO_N "(cached) $ECHO_C" >&6
1391-else
1392- eval "$as_ac_Header=\$ac_header_preproc"
1393-fi
1394-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
1395-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
1396-
1397-fi
1398-if test `eval echo '${'$as_ac_Header'}'` = yes; then
1399+do :
1400+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
1401+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
1402+eval as_val=\$$as_ac_Header
1403+ if test "x$as_val" = x""yes; then :
1404 cat >>confdefs.h <<_ACEOF
1405-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
1406+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
1407 _ACEOF
3a58abaf
AM
1408
1409 fi
7566401a
ER
1410
1411 done
1412
1413-echo "$as_me:$LINENO: checking for struct elf_prstatus32.pr_reg" >&5
1414-echo $ECHO_N "checking for struct elf_prstatus32.pr_reg... $ECHO_C" >&6
1415-if test "${ac_cv_member_struct_elf_prstatus32_pr_reg+set}" = set; then
1416- echo $ECHO_N "(cached) $ECHO_C" >&6
1417-else
1418- cat >conftest.$ac_ext <<_ACEOF
1419-/* confdefs.h. */
1420-_ACEOF
1421-cat confdefs.h >>conftest.$ac_ext
1422-cat >>conftest.$ac_ext <<_ACEOF
1423-/* end confdefs.h. */
1424-#include <sys/procfs.h>
1425-
1426-int
1427-main ()
1428-{
1429-static struct elf_prstatus32 ac_aggr;
1430-if (ac_aggr.pr_reg)
1431-return 0;
1432- ;
1433- return 0;
1434-}
1435-_ACEOF
1436-rm -f conftest.$ac_objext
1437-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
1438- (eval $ac_compile) 2>conftest.er1
1439- ac_status=$?
1440- grep -v '^ *+' conftest.er1 >conftest.err
1441- rm -f conftest.er1
1442- cat conftest.err >&5
1443- echo "$as_me:$LINENO: \$? = $ac_status" >&5
1444- (exit $ac_status); } &&
1445- { ac_try='test -z "$ac_c_werror_flag"
1446- || test ! -s conftest.err'
1447- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
1448- (eval $ac_try) 2>&5
1449- ac_status=$?
1450- echo "$as_me:$LINENO: \$? = $ac_status" >&5
1451- (exit $ac_status); }; } &&
1452- { ac_try='test -s conftest.$ac_objext'
1453- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
1454- (eval $ac_try) 2>&5
1455- ac_status=$?
1456- echo "$as_me:$LINENO: \$? = $ac_status" >&5
1457- (exit $ac_status); }; }; then
1458- ac_cv_member_struct_elf_prstatus32_pr_reg=yes
1459-else
1460- echo "$as_me: failed program was:" >&5
1461-sed 's/^/| /' conftest.$ac_ext >&5
1462-
1463-cat >conftest.$ac_ext <<_ACEOF
1464-/* confdefs.h. */
1465-_ACEOF
1466-cat confdefs.h >>conftest.$ac_ext
1467-cat >>conftest.$ac_ext <<_ACEOF
1468-/* end confdefs.h. */
1469-#include <sys/procfs.h>
1470-
1471-int
1472-main ()
1473-{
1474-static struct elf_prstatus32 ac_aggr;
1475-if (sizeof ac_aggr.pr_reg)
1476-return 0;
1477- ;
1478- return 0;
1479-}
1480-_ACEOF
1481-rm -f conftest.$ac_objext
1482-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
1483- (eval $ac_compile) 2>conftest.er1
1484- ac_status=$?
1485- grep -v '^ *+' conftest.er1 >conftest.err
1486- rm -f conftest.er1
1487- cat conftest.err >&5
1488- echo "$as_me:$LINENO: \$? = $ac_status" >&5
1489- (exit $ac_status); } &&
1490- { ac_try='test -z "$ac_c_werror_flag"
1491- || test ! -s conftest.err'
1492- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
1493- (eval $ac_try) 2>&5
1494- ac_status=$?
1495- echo "$as_me:$LINENO: \$? = $ac_status" >&5
1496- (exit $ac_status); }; } &&
1497- { ac_try='test -s conftest.$ac_objext'
1498- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
1499- (eval $ac_try) 2>&5
1500- ac_status=$?
1501- echo "$as_me:$LINENO: \$? = $ac_status" >&5
1502- (exit $ac_status); }; }; then
1503- ac_cv_member_struct_elf_prstatus32_pr_reg=yes
1504-else
1505- echo "$as_me: failed program was:" >&5
1506-sed 's/^/| /' conftest.$ac_ext >&5
1507-
1508-ac_cv_member_struct_elf_prstatus32_pr_reg=no
1509-fi
1510-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
1511-fi
1512-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
1513-fi
1514-echo "$as_me:$LINENO: result: $ac_cv_member_struct_elf_prstatus32_pr_reg" >&5
1515-echo "${ECHO_T}$ac_cv_member_struct_elf_prstatus32_pr_reg" >&6
1516-if test $ac_cv_member_struct_elf_prstatus32_pr_reg = yes; then
1517+ac_fn_c_check_member "$LINENO" "struct elf_prstatus32" "pr_reg" "ac_cv_member_struct_elf_prstatus32_pr_reg" "#include <sys/procfs.h>
1518+"
1519+if test "x$ac_cv_member_struct_elf_prstatus32_pr_reg" = x""yes; then :
1520
1521-cat >>confdefs.h <<\_ACEOF
1522-#define HAVE_ELF_PRSTATUS32 1
1523-_ACEOF
1524+$as_echo "#define HAVE_ELF_PRSTATUS32 1" >>confdefs.h
1525
3a58abaf 1526 fi
7566401a
ER
1527
1528Index: gdb-6.8.50.20090909/gdb/configure.ac
3a58abaf 1529===================================================================
7566401a
ER
1530--- gdb-6.8.50.20090909.orig/gdb/configure.ac 2009-09-09 20:08:04.000000000 +0200
1531+++ gdb-6.8.50.20090909/gdb/configure.ac 2009-09-09 20:08:04.000000000 +0200
1532@@ -151,6 +151,199 @@ else
3a58abaf
AM
1533 fi
1534 AC_SUBST(pythondir)
1535
1536+# Integration with rpm library to support missing debuginfo suggestions.
1537+# --without-rpm: Disable any rpm support.
1538+# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
1539+# Even with runtime missing `libname.so' GDB will still other run correctly.
1540+# Missing `libname.so' during ./configure will abort the configuration.
1541+# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
1542+# minor version first such as `librpm-4.6.so' as minor version differences
1543+# mean API+ABI incompatibility. If the specific match versioned library name
1544+# could not be found still open dynamically at least `librpm.so'.
1545+# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
1546+# to find librpm for compilation-time linking by pkg-config. GDB binary will
1547+# be probably linked with the version specific library (as `librpm-4.6.so').
1548+# Failure to find librpm by pkg-config will abort the configuration.
1549+# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
1550+# cannot find librpm use to the rpmless compilation (like `--without-rpm').
1551+
1552+AC_ARG_WITH([rpm],
1553+ [AS_HELP_STRING([--with-rpm],
7566401a 1554+ [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"])
3a58abaf
AM
1555+
1556+m4_pattern_allow([^AC_MSG_ERROR$])
1557+m4_pattern_allow([^AC_MSG_WARN$])
1558+if test "x$with_rpm" != "xno"; then
1559+ if test "x$with_rpm" = "xyes"; then
1560+ LIBRPM="librpm.so"
1561+ RPM_REQUIRE=true
1562+ DLOPEN_REQUIRE=false
1563+ elif test "x$with_rpm" = "xauto"; then
1564+ LIBRPM="librpm.so"
1565+ RPM_REQUIRE=false
1566+ DLOPEN_REQUIRE=false
1567+ else
1568+ LIBRPM="$with_rpm"
1569+ RPM_REQUIRE=true
1570+ DLOPEN_REQUIRE=true
1571+ fi
1572+ LIBRPM_STRING='"'"$LIBRPM"'"'
1573+
1574+ AC_MSG_CHECKING([specific librpm version])
1575+ HAVE_DLOPEN_LIBRPM=false
1576+ save_LIBS="$LIBS"
1577+ LIBS="$LIBS -ldl"
1578+ AC_RUN_IFELSE(AC_LANG_PROGRAM([[
1579+#include <rpm/rpmlib.h>
1580+#include <dlfcn.h>
1581+#include <errno.h>
1582+ ]], [[
1583+ void *h;
1584+ const char *const *rpmverp;
1585+ FILE *f;
1586+
1587+ f = fopen ("conftest.out", "w");
1588+ if (!f)
1589+ {
1590+ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
1591+ strerror (errno));
1592+ return 1;
1593+ }
1594+ h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
1595+ if (!h)
1596+ {
1597+ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
1598+ return 1;
1599+ }
1600+ rpmverp = dlsym (h, "RPMVERSION");
1601+ if (!rpmverp)
1602+ {
1603+ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
1604+ return 1;
1605+ }
1606+ fprintf (stderr, "RPMVERSION is: \"");
1607+ fprintf (stderr, "%s\"\n", *rpmverp);
1608+
1609+ /* Try to find the specific librpm version only for "librpm.so" as we do
1610+ not know how to assemble the version string otherwise. */
1611+
1612+ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
1613+ {
1614+ fprintf (f, "%s\n", $LIBRPM_STRING);
1615+ return 0;
1616+ }
1617+ else
1618+ {
1619+ char *h2_name;
1620+ void *h2;
1621+ int major, minor;
1622+
1623+ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
1624+ {
1625+ fprintf (stderr, "Unable to parse RPMVERSION.\n");
1626+ fprintf (f, "%s\n", $LIBRPM_STRING);
1627+ return 0;
1628+ }
1629+ /* Avoid the square brackets by malloc. */
1630+ h2_name = malloc (64);
1631+ sprintf (h2_name, "librpm-%d.%d.so", major, minor);
1632+ h2 = dlopen (h2_name, RTLD_LAZY);
1633+ if (!h2)
1634+ {
1635+ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
1636+ fprintf (f, "%s\n", $LIBRPM_STRING);
1637+ return 0;
1638+ }
1639+ if (h2 != h)
1640+ {
1641+ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
1642+ $LIBRPM_STRING, h2_name);
1643+ fprintf (f, "%s\n", $LIBRPM_STRING);
1644+ return 0;
1645+ }
1646+ /* Found the valid .so name with a specific version. */
1647+ fprintf (f, "%s\n", h2_name);
1648+ return 0;
1649+ }
1650+ ]]), [
1651+ DLOPEN_LIBRPM="`cat conftest.out`"
1652+ if test "x$DLOPEN_LIBRPM" != "x"; then
1653+ HAVE_DLOPEN_LIBRPM=true
1654+ AC_MSG_RESULT($DLOPEN_LIBRPM)
1655+ fi
1656+ ])
1657+ rm -f conftest.out
1658+
1659+ m4_define([CHECK_LIBRPM_COMPAT], [
1660+ AC_MSG_CHECKING([rpm library API compatibility])
1661+ # The compilation requires -Werror to verify anything.
1662+ save_CFLAGS="$CFLAGS"
1663+ CFLAGS="$CFLAGS -Werror"
1664+ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
1665+/* Duplicate here the declarations to verify they match "symfile.c". */
1666+#include <rpm/rpmlib.h>
1667+#include <rpm/rpmts.h>
1668+#include <rpm/rpmdb.h>
1669+#include <rpm/header.h>
1670+extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1671+extern int rpmReadConfigFiles(const char * file, const char * target);
1672+extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1673+extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1674+extern rpmts rpmtsCreate(void);
1675+extern rpmts rpmtsFree(rpmts ts);
1676+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1677+ const void * keyp, size_t keylen);
1678+ ]]), [
1679+ LIBRPM_COMPAT=true
1680+ AC_MSG_RESULT(yes)
1681+ ], [
1682+ LIBRPM_COMPAT=false
1683+ AC_MSG_RESULT(no)
1684+ ])
1685+ CFLAGS="$save_CFLAGS"
1686+ ])
1687+
1688+ if $HAVE_DLOPEN_LIBRPM; then
1689+ CHECK_LIBRPM_COMPAT
1690+ if ! $LIBRPM_COMPAT; then
1691+ HAVE_DLOPEN_LIBRPM=false
1692+ fi
1693+ fi
1694+
1695+ if $HAVE_DLOPEN_LIBRPM; then
1696+ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
1697+ AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
1698+ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1699+ else
1700+ AC_MSG_RESULT(no)
1701+ LIBS="$save_LIBS"
1702+ if $DLOPEN_REQUIRE; then
1703+ AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
1704+ fi
1705+ PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
1706+
1707+ if $HAVE_LIBRPM; then
1708+ CHECK_LIBRPM_COMPAT
1709+ if ! $LIBRPM_COMPAT; then
1710+ HAVE_LIBRPM=false
1711+ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1712+ fi
1713+ fi
1714+
1715+ if $HAVE_LIBRPM; then
1716+ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1717+ CFLAGS="$CFLAGS $RPM_CFLAGS"
1718+ LIBS="$LIBS $RPM_LIBS"
1719+ else
1720+ if $RPM_REQUIRE; then
1721+ AC_MSG_ERROR($RPM_PKG_ERRORS)
1722+ else
1723+ AC_MSG_WARN($RPM_PKG_ERRORS)
1724+ fi
1725+ fi
1726+ fi
1727+fi
1728+
1729
1730 AC_CONFIG_SUBDIRS(doc testsuite)
1731
7566401a
ER
1732Index: gdb-6.8.50.20090909/gdb/acinclude.m4
1733===================================================================
1734--- gdb-6.8.50.20090909.orig/gdb/acinclude.m4 2009-09-09 20:05:48.000000000 +0200
1735+++ gdb-6.8.50.20090909/gdb/acinclude.m4 2009-09-09 20:08:04.000000000 +0200
1736@@ -1,3 +1,5 @@
1737+# serial 1
1738+
1739 dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
1740 dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
1741
1742@@ -79,8 +81,6 @@ AC_MSG_RESULT(yes)
1743 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
1744 # Boston, MA 02110-1301, USA.
1745
1746-# serial 1
1747-
1748 # @defmac AC_PROG_CC_STDC
1749 # @maindex PROG_CC_STDC
1750 # @ovindex CC
This page took 0.487925 seconds and 4 git commands to generate.