]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-6.6-buildid-locate-rpm.patch
- rel 1.x (so no need for using epoch)
[packages/gdb.git] / gdb-6.6-buildid-locate-rpm.patch
1 Index: gdb-6.8.50.20090302/gdb/event-top.c
2 ===================================================================
3 --- gdb-6.8.50.20090302.orig/gdb/event-top.c    2009-03-07 17:13:33.000000000 +0100
4 +++ gdb-6.8.50.20090302/gdb/event-top.c 2009-03-07 17:25:06.000000000 +0100
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 ())
31 Index: gdb-6.8.50.20090302/gdb/symfile.c
32 ===================================================================
33 --- gdb-6.8.50.20090302.orig/gdb/symfile.c      2009-03-07 17:22:21.000000000 +0100
34 +++ gdb-6.8.50.20090302/gdb/symfile.c   2009-03-07 17:26:47.000000000 +0100
35 @@ -55,6 +55,7 @@
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>
43 @@ -63,6 +64,7 @@
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);
51 @@ -1684,8 +1686,352 @@ build_id_to_filename (struct build_id *b
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
405 @@ -1739,11 +2085,17 @@ missing_filepair_change (void)
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  
423 @@ -1802,14 +2154,33 @@ debug_print_missing (const char *binary,
424      }
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)
458 +         fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
459 +                             "yum --enablerepo='*-debuginfo' install", debug);
460 +      }
461  }
462  
463  static char *
464 Index: gdb-6.8.50.20090302/gdb/symfile.h
465 ===================================================================
466 --- gdb-6.8.50.20090302.orig/gdb/symfile.h      2009-03-07 17:13:33.000000000 +0100
467 +++ gdb-6.8.50.20090302/gdb/symfile.h   2009-03-07 17:25:06.000000000 +0100
468 @@ -378,6 +378,7 @@ extern struct build_id *build_id_addr_ge
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  
476 Index: gdb-6.8.50.20090302/gdb/testsuite/lib/gdb.exp
477 ===================================================================
478 --- gdb-6.8.50.20090302.orig/gdb/testsuite/lib/gdb.exp  2009-03-07 17:13:33.000000000 +0100
479 +++ gdb-6.8.50.20090302/gdb/testsuite/lib/gdb.exp       2009-03-07 17:25:06.000000000 +0100
480 @@ -1230,7 +1230,7 @@ proc default_gdb_start { } {
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 $" {
489 Index: gdb-6.8.50.20090302/gdb/tui/tui-interp.c
490 ===================================================================
491 --- gdb-6.8.50.20090302.orig/gdb/tui/tui-interp.c       2009-03-07 17:13:33.000000000 +0100
492 +++ gdb-6.8.50.20090302/gdb/tui/tui-interp.c    2009-03-07 17:25:06.000000000 +0100
493 @@ -30,6 +30,7 @@
494  #include "tui/tui.h"
495  #include "tui/tui-io.h"
496  #include "exceptions.h"
497 +#include "symfile.h"
498  
499  /* Set to 1 when the TUI mode must be activated when we first start
500     gdb.  */
501 @@ -128,6 +129,8 @@ tui_command_loop (void *data)
502        char *a_prompt;
503        char *gdb_prompt = get_prompt ();
504  
505 +      debug_flush_missing ();
506 +
507        /* Tell readline what the prompt to display is and what function
508           it will need to call after a whole line is read. This also
509           displays the first prompt.  */
510 Index: gdb-6.8.50.20090302/gdb/aclocal.m4
511 ===================================================================
512 --- gdb-6.8.50.20090302.orig/gdb/aclocal.m4     2009-03-07 17:13:33.000000000 +0100
513 +++ gdb-6.8.50.20090302/gdb/aclocal.m4  2009-03-07 17:25:06.000000000 +0100
514 @@ -11,6 +11,162 @@
515  # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
516  # PARTICULAR PURPOSE.
517  
518 +# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
519 +# 
520 +# Copyright Â© 2004 Scott James Remnant <scott@netsplit.com>.
521 +#
522 +# This program is free software; you can redistribute it and/or modify
523 +# it under the terms of the GNU General Public License as published by
524 +# the Free Software Foundation; either version 2 of the License, or
525 +# (at your option) any later version.
526 +#
527 +# This program is distributed in the hope that it will be useful, but
528 +# WITHOUT ANY WARRANTY; without even the implied warranty of
529 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
530 +# General Public License for more details.
531 +#
532 +# You should have received a copy of the GNU General Public License
533 +# along with this program; if not, write to the Free Software
534 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
535 +#
536 +# As a special exception to the GNU General Public License, if you
537 +# distribute this file as part of a program that contains a
538 +# configuration script generated by Autoconf, you may include it under
539 +# the same distribution terms that you use for the rest of that program.
540 +
541 +# PKG_PROG_PKG_CONFIG([MIN-VERSION])
542 +# ----------------------------------
543 +AC_DEFUN([PKG_PROG_PKG_CONFIG],
544 +[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
545 +m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
546 +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
547 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
548 +       AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
549 +fi
550 +if test -n "$PKG_CONFIG"; then
551 +       _pkg_min_version=m4_default([$1], [0.9.0])
552 +       AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
553 +       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
554 +               AC_MSG_RESULT([yes])
555 +       else
556 +               AC_MSG_RESULT([no])
557 +               PKG_CONFIG=""
558 +       fi
559 +               
560 +fi[]dnl
561 +])# PKG_PROG_PKG_CONFIG
562 +
563 +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
564 +#
565 +# Check to see whether a particular set of modules exists.  Similar
566 +# to PKG_CHECK_MODULES(), but does not set variables or print errors.
567 +#
568 +#
569 +# Similar to PKG_CHECK_MODULES, make sure that the first instance of
570 +# this or PKG_CHECK_MODULES is called, or make sure to call
571 +# PKG_CHECK_EXISTS manually
572 +# --------------------------------------------------------------
573 +AC_DEFUN([PKG_CHECK_EXISTS],
574 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
575 +if test -n "$PKG_CONFIG" && \
576 +    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
577 +  m4_ifval([$2], [$2], [:])
578 +m4_ifvaln([$3], [else
579 +  $3])dnl
580 +fi])
581 +
582 +
583 +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
584 +# ---------------------------------------------
585 +m4_define([_PKG_CONFIG],
586 +[if test -n "$$1"; then
587 +    pkg_cv_[]$1="$$1"
588 + elif test -n "$PKG_CONFIG"; then
589 +    PKG_CHECK_EXISTS([$3],
590 +                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
591 +                    [pkg_failed=yes])
592 + else
593 +    pkg_failed=untried
594 +fi[]dnl
595 +])# _PKG_CONFIG
596 +
597 +# _PKG_SHORT_ERRORS_SUPPORTED
598 +# -----------------------------
599 +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
600 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
601 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
602 +        _pkg_short_errors_supported=yes
603 +else
604 +        _pkg_short_errors_supported=no
605 +fi[]dnl
606 +])# _PKG_SHORT_ERRORS_SUPPORTED
607 +
608 +
609 +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
610 +# [ACTION-IF-NOT-FOUND])
611 +#
612 +#
613 +# Note that if there is a possibility the first call to
614 +# PKG_CHECK_MODULES might not happen, you should be sure to include an
615 +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
616 +#
617 +#
618 +# --------------------------------------------------------------
619 +AC_DEFUN([PKG_CHECK_MODULES],
620 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
621 +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
622 +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
623 +
624 +pkg_failed=no
625 +AC_MSG_CHECKING([for $1])
626 +
627 +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
628 +_PKG_CONFIG([$1][_LIBS], [libs], [$2])
629 +
630 +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
631 +and $1[]_LIBS to avoid the need to call pkg-config.
632 +See the pkg-config man page for more details.])
633 +
634 +if test $pkg_failed = yes; then
635 +        _PKG_SHORT_ERRORS_SUPPORTED
636 +        if test $_pkg_short_errors_supported = yes; then
637 +               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
638 +        else 
639 +               $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
640 +        fi
641 +       # Put the nasty error message in config.log where it belongs
642 +       echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
643 +
644 +       ifelse([$4], , [AC_MSG_ERROR(dnl
645 +[Package requirements ($2) were not met:
646 +
647 +$$1_PKG_ERRORS
648 +
649 +Consider adjusting the PKG_CONFIG_PATH environment variable if you
650 +installed software in a non-standard prefix.
651 +
652 +_PKG_TEXT
653 +])],
654 +               [AC_MSG_RESULT([no])
655 +                $4])
656 +elif test $pkg_failed = untried; then
657 +       ifelse([$4], , [AC_MSG_FAILURE(dnl
658 +[The pkg-config script could not be found or is too old.  Make sure it
659 +is in your PATH or set the PKG_CONFIG environment variable to the full
660 +path to pkg-config.
661 +
662 +_PKG_TEXT
663 +
664 +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
665 +               [$4])
666 +else
667 +       $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
668 +       $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
669 +        AC_MSG_RESULT([yes])
670 +       ifelse([$3], , :, [$3])
671 +fi[]dnl
672 +])# PKG_CHECK_MODULES
673 +
674  # Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
675  #
676  # This file is free software; the Free Software Foundation
677 @@ -468,6 +624,27 @@ AC_DEFUN([AM_PROG_INSTALL_SH],
678  install_sh=${install_sh-"$am_aux_dir/install-sh"}
679  AC_SUBST(install_sh)])
680  
681 +# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
682 +#
683 +# This file is free software; the Free Software Foundation
684 +# gives unlimited permission to copy and/or distribute it,
685 +# with or without modifications, as long as this notice is preserved.
686 +
687 +# serial 2
688 +
689 +# Check whether the underlying file-system supports filenames
690 +# with a leading dot.  For instance MS-DOS doesn't.
691 +AC_DEFUN([AM_SET_LEADING_DOT],
692 +[rm -rf .tst 2>/dev/null
693 +mkdir .tst 2>/dev/null
694 +if test -d .tst; then
695 +  am__leading_dot=.
696 +else
697 +  am__leading_dot=_
698 +fi
699 +rmdir .tst 2>/dev/null
700 +AC_SUBST([am__leading_dot])])
701 +
702  # Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
703  # From Jim Meyering
704  
705 @@ -868,7 +1045,4 @@ m4_include([gnulib/m4/onceonly_2_57.m4])
706  m4_include([gnulib/m4/stdint.m4])
707  m4_include([gnulib/m4/string_h.m4])
708  m4_include([gnulib/m4/wchar.m4])
709 -m4_include([../config/extensions.m4])
710 -m4_include([../config/lead-dot.m4])
711 -m4_include([../config/proginstall.m4])
712  m4_include([acinclude.m4])
713 Index: gdb-6.8.50.20090302/gdb/config.in
714 ===================================================================
715 --- gdb-6.8.50.20090302.orig/gdb/config.in      2009-03-07 17:13:33.000000000 +0100
716 +++ gdb-6.8.50.20090302/gdb/config.in   2009-03-07 17:25:06.000000000 +0100
717 @@ -38,6 +38,9 @@
718  /* Define to BFD's default target vector. */
719  #undef DEFAULT_BFD_VEC
720  
721 +/* librpm version specific library name to dlopen. */
722 +#undef DLOPEN_LIBRPM
723 +
724  /* Define to 1 if translation of program messages to the user's native
725     language is requested. */
726  #undef ENABLE_NLS
727 @@ -211,6 +214,9 @@
728  /* Define if Python 2.6 is being used. */
729  #undef HAVE_LIBPYTHON2_6
730  
731 +/* Define if librpm library is being used. */
732 +#undef HAVE_LIBRPM
733 +
734  /* Define if libunwind library is being used. */
735  #undef HAVE_LIBUNWIND
736  
737 Index: gdb-6.8.50.20090302/gdb/configure
738 ===================================================================
739 --- gdb-6.8.50.20090302.orig/gdb/configure      2009-03-07 17:13:33.000000000 +0100
740 +++ gdb-6.8.50.20090302/gdb/configure   2009-03-07 17:25:06.000000000 +0100
741 @@ -314,7 +314,7 @@ ac_subdirs_all="$ac_subdirs_all doc test
742  ac_subdirs_all="$ac_subdirs_all gdbtk"
743  ac_subdirs_all="$ac_subdirs_all multi-ice"
744  ac_subdirs_all="$ac_subdirs_all gdbserver"
745 -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE GDB_DATADIR_PATH pythondir subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG LIBICONV LIBICONV_INCLUDE LIBICONV_LIBDIR READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
746 +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE GDB_DATADIR_PATH pythondir PKG_CONFIG ac_pt_PKG_CONFIG RPM_CFLAGS RPM_LIBS subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG LIBICONV LIBICONV_INCLUDE LIBICONV_LIBDIR READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
747  ac_subst_files='host_makefile_frag'
748  ac_pwd=`pwd`
749  
750 @@ -776,6 +776,18 @@ ac_env_CPP_set=${CPP+set}
751  ac_env_CPP_value=$CPP
752  ac_cv_env_CPP_set=${CPP+set}
753  ac_cv_env_CPP_value=$CPP
754 +ac_env_PKG_CONFIG_set=${PKG_CONFIG+set}
755 +ac_env_PKG_CONFIG_value=$PKG_CONFIG
756 +ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set}
757 +ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG
758 +ac_env_RPM_CFLAGS_set=${RPM_CFLAGS+set}
759 +ac_env_RPM_CFLAGS_value=$RPM_CFLAGS
760 +ac_cv_env_RPM_CFLAGS_set=${RPM_CFLAGS+set}
761 +ac_cv_env_RPM_CFLAGS_value=$RPM_CFLAGS
762 +ac_env_RPM_LIBS_set=${RPM_LIBS+set}
763 +ac_env_RPM_LIBS_value=$RPM_LIBS
764 +ac_cv_env_RPM_LIBS_set=${RPM_LIBS+set}
765 +ac_cv_env_RPM_LIBS_value=$RPM_LIBS
766  
767  #
768  # Report the --help message.
769 @@ -886,6 +898,8 @@ Optional Packages:
770                            [DATADIR/gdb]
771    --with-pythondir        install Python data files in this path
772                            [DATADIR/gdb/python]
773 +  --with-rpm              query rpm database for missing debuginfos
774 +                          [yes/no,], [def.], [auto=librpm.so]
775    --with-libunwind            Use libunwind frame unwinding support
776    --with-pkgversion=PKG   Use PKG in the version string in place of "GDB"
777    --with-bugurl=URL       Direct users to URL to report a bug
778 @@ -913,6 +927,9 @@ Some influential environment variables:
779    CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
780                headers in a nonstandard directory <include dir>
781    CPP         C preprocessor
782 +  PKG_CONFIG  path to pkg-config utility
783 +  RPM_CFLAGS  C compiler flags for RPM, overriding pkg-config
784 +  RPM_LIBS    linker flags for RPM, overriding pkg-config
785  
786  Use these variables to override the choices made by `configure' or to help
787  it to find libraries and programs with nonstandard names/locations.
788 @@ -6556,7 +6573,6 @@ am__api_version="1.9"
789  # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
790  # OS/2's system install, which has a completely different semantic
791  # ./install, which can be erroneously created by make from ./install.sh.
792 -# Reject install programs that cannot install multiple files.
793  echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
794  echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
795  if test -z "$INSTALL"; then
796 @@ -6590,18 +6606,8 @@ case $as_dir/ in
797             # program-specific install script used by HP pwplus--don't use.
798             :
799           else
800 -           rm -rf conftest.one conftest.two conftest.dir
801 -           echo one > conftest.one
802 -           echo two > conftest.two
803 -           mkdir conftest.dir
804 -           if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
805 -             test -s conftest.one && test -s conftest.two &&
806 -             test -s conftest.dir/conftest.one &&
807 -             test -s conftest.dir/conftest.two
808 -           then
809 -             ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
810 -             break 3
811 -           fi
812 +           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
813 +           break 3
814           fi
815         fi
816        done
817 @@ -6610,16 +6616,15 @@ case $as_dir/ in
818  esac
819  done
820  
821 -rm -rf conftest.one conftest.two conftest.dir
822  
823  fi
824    if test "${ac_cv_path_install+set}" = set; then
825      INSTALL=$ac_cv_path_install
826    else
827 -    # As a last resort, use the slow shell script.  Don't cache a
828 -    # value for INSTALL within a source directory, because that will
829 +    # As a last resort, use the slow shell script.  We don't cache a
830 +    # path for INSTALL within a source directory, because that will
831      # break other packages using the cache if that directory is
832 -    # removed, or if the value is a relative name.
833 +    # removed, or if the path is relative.
834      INSTALL=$ac_install_sh
835    fi
836  fi
837 @@ -7202,6 +7207,559 @@ _ACEOF
838  fi
839  
840  
841 +# Integration with rpm library to support missing debuginfo suggestions.
842 +# --without-rpm: Disable any rpm support.
843 +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
844 +#   Even with runtime missing `libname.so' GDB will still other run correctly.
845 +#   Missing `libname.so' during ./configure will abort the configuration.
846 +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
847 +#   minor version first such as `librpm-4.6.so' as minor version differences
848 +#   mean API+ABI incompatibility.  If the specific match versioned library name
849 +#   could not be found still open dynamically at least `librpm.so'.
850 +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
851 +#   to find librpm for compilation-time linking by pkg-config.  GDB binary will
852 +#   be probably linked with the version specific library (as `librpm-4.6.so').
853 +#   Failure to find librpm by pkg-config will abort the configuration.
854 +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
855 +#   cannot find librpm use to the rpmless compilation (like `--without-rpm').
856 +
857 +
858 +# Check whether --with-rpm or --without-rpm was given.
859 +if test "${with_rpm+set}" = set; then
860 +  withval="$with_rpm"
861 +
862 +else
863 +  with_rpm="auto"
864 +fi;
865 +
866 +
867 +
868 +if test "x$with_rpm" != "xno"; then
869 +  if test "x$with_rpm" = "xyes"; then
870 +    LIBRPM="librpm.so"
871 +    RPM_REQUIRE=true
872 +    DLOPEN_REQUIRE=false
873 +  elif test "x$with_rpm" = "xauto"; then
874 +    LIBRPM="librpm.so"
875 +    RPM_REQUIRE=false
876 +    DLOPEN_REQUIRE=false
877 +  else
878 +    LIBRPM="$with_rpm"
879 +    RPM_REQUIRE=true
880 +    DLOPEN_REQUIRE=true
881 +  fi
882 +  LIBRPM_STRING='"'"$LIBRPM"'"'
883 +
884 +  echo "$as_me:$LINENO: checking specific librpm version" >&5
885 +echo $ECHO_N "checking specific librpm version... $ECHO_C" >&6
886 +  HAVE_DLOPEN_LIBRPM=false
887 +  save_LIBS="$LIBS"
888 +  LIBS="$LIBS -ldl"
889 +  if test "$cross_compiling" = yes; then
890 +  { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
891 +echo "$as_me: error: in \`$ac_pwd':" >&2;}
892 +{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
893 +See \`config.log' for more details." >&5
894 +echo "$as_me: error: cannot run test program while cross compiling
895 +See \`config.log' for more details." >&2;}
896 +   { (exit 1); exit 1; }; }; }
897 +else
898 +  cat >conftest.$ac_ext <<_ACEOF
899 +/* confdefs.h.  */
900 +_ACEOF
901 +cat confdefs.h >>conftest.$ac_ext
902 +cat >>conftest.$ac_ext <<_ACEOF
903 +/* end confdefs.h.  */
904 +
905 +#include <rpm/rpmlib.h>
906 +#include <dlfcn.h>
907 +#include <errno.h>
908 +
909 +int
910 +main ()
911 +{
912 +
913 +    void *h;
914 +    const char *const *rpmverp;
915 +    FILE *f;
916 +
917 +    f = fopen ("conftest.out", "w");
918 +    if (!f)
919 +      {
920 +       fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
921 +                strerror (errno));
922 +       return 1;
923 +      }
924 +    h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
925 +    if (!h)
926 +      {
927 +       fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
928 +       return 1;
929 +      }
930 +    rpmverp = dlsym (h, "RPMVERSION");
931 +    if (!rpmverp)
932 +      {
933 +       fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
934 +       return 1;
935 +      }
936 +    fprintf (stderr, "RPMVERSION is: \"");
937 +    fprintf (stderr, "%s\"\n", *rpmverp);
938 +
939 +    /* Try to find the specific librpm version only for "librpm.so" as we do
940 +       not know how to assemble the version string otherwise.  */
941 +
942 +    if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
943 +      {
944 +       fprintf (f, "%s\n", $LIBRPM_STRING);
945 +       return 0;
946 +      }
947 +    else
948 +      {
949 +       char *h2_name;
950 +       void *h2;
951 +       int major, minor;
952 +
953 +       if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
954 +         {
955 +           fprintf (stderr, "Unable to parse RPMVERSION.\n");
956 +           fprintf (f, "%s\n", $LIBRPM_STRING);
957 +           return 0;
958 +         }
959 +       /* Avoid the square brackets by malloc.  */
960 +       h2_name = malloc (64);
961 +       sprintf (h2_name, "librpm-%d.%d.so", major, minor);
962 +       h2 = dlopen (h2_name, RTLD_LAZY);
963 +       if (!h2)
964 +         {
965 +           fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
966 +           fprintf (f, "%s\n", $LIBRPM_STRING);
967 +           return 0;
968 +         }
969 +       if (h2 != h)
970 +         {
971 +           fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
972 +                    $LIBRPM_STRING, h2_name);
973 +           fprintf (f, "%s\n", $LIBRPM_STRING);
974 +           return 0;
975 +         }
976 +       /* Found the valid .so name with a specific version.  */
977 +       fprintf (f, "%s\n", h2_name);
978 +       return 0;
979 +      }
980 +
981 +  ;
982 +  return 0;
983 +}
984 +_ACEOF
985 +rm -f conftest$ac_exeext
986 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
987 +  (eval $ac_link) 2>&5
988 +  ac_status=$?
989 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
990 +  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
991 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
992 +  (eval $ac_try) 2>&5
993 +  ac_status=$?
994 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
995 +  (exit $ac_status); }; }; then
996 +
997 +    DLOPEN_LIBRPM="`cat conftest.out`"
998 +    if test "x$DLOPEN_LIBRPM" != "x"; then
999 +      HAVE_DLOPEN_LIBRPM=true
1000 +      echo "$as_me:$LINENO: result: $DLOPEN_LIBRPM" >&5
1001 +echo "${ECHO_T}$DLOPEN_LIBRPM" >&6
1002 +    fi
1003 +
1004 +else
1005 +  echo "$as_me: program exited with status $ac_status" >&5
1006 +echo "$as_me: failed program was:" >&5
1007 +sed 's/^/| /' conftest.$ac_ext >&5
1008 +
1009 +fi
1010 +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
1011 +fi
1012 +  rm -f conftest.out
1013 +
1014 +
1015 +
1016 +  if $HAVE_DLOPEN_LIBRPM; then
1017 +
1018 +    echo "$as_me:$LINENO: checking rpm library API compatibility" >&5
1019 +echo $ECHO_N "checking rpm library API compatibility... $ECHO_C" >&6
1020 +    # The compilation requires -Werror to verify anything.
1021 +    save_CFLAGS="$CFLAGS"
1022 +    CFLAGS="$CFLAGS -Werror"
1023 +    cat >conftest.$ac_ext <<_ACEOF
1024 +/* confdefs.h.  */
1025 +_ACEOF
1026 +cat confdefs.h >>conftest.$ac_ext
1027 +cat >>conftest.$ac_ext <<_ACEOF
1028 +/* end confdefs.h.  */
1029 +
1030 +/* Duplicate here the declarations to verify they match "symfile.c".  */
1031 +#include <rpm/rpmlib.h>
1032 +#include <rpm/rpmts.h>
1033 +#include <rpm/rpmdb.h>
1034 +#include <rpm/header.h>
1035 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1036 +extern int rpmReadConfigFiles(const char * file, const char * target);
1037 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1038 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1039 +extern rpmts rpmtsCreate(void);
1040 +extern rpmts rpmtsFree(rpmts ts);
1041 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1042 +                                           const void * keyp, size_t keylen);
1043 +
1044 +int
1045 +main ()
1046 +{
1047 +
1048 +  ;
1049 +  return 0;
1050 +}
1051 +_ACEOF
1052 +rm -f conftest.$ac_objext
1053 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
1054 +  (eval $ac_compile) 2>conftest.er1
1055 +  ac_status=$?
1056 +  grep -v '^ *+' conftest.er1 >conftest.err
1057 +  rm -f conftest.er1
1058 +  cat conftest.err >&5
1059 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
1060 +  (exit $ac_status); } &&
1061 +        { ac_try='test -z "$ac_c_werror_flag"
1062 +                        || test ! -s conftest.err'
1063 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
1064 +  (eval $ac_try) 2>&5
1065 +  ac_status=$?
1066 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
1067 +  (exit $ac_status); }; } &&
1068 +        { ac_try='test -s conftest.$ac_objext'
1069 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
1070 +  (eval $ac_try) 2>&5
1071 +  ac_status=$?
1072 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
1073 +  (exit $ac_status); }; }; then
1074 +
1075 +      LIBRPM_COMPAT=true
1076 +      echo "$as_me:$LINENO: result: yes" >&5
1077 +echo "${ECHO_T}yes" >&6
1078 +
1079 +else
1080 +  echo "$as_me: failed program was:" >&5
1081 +sed 's/^/| /' conftest.$ac_ext >&5
1082 +
1083 +
1084 +      LIBRPM_COMPAT=false
1085 +      echo "$as_me:$LINENO: result: no" >&5
1086 +echo "${ECHO_T}no" >&6
1087 +
1088 +fi
1089 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
1090 +    CFLAGS="$save_CFLAGS"
1091 +
1092 +    if ! $LIBRPM_COMPAT; then
1093 +      HAVE_DLOPEN_LIBRPM=false
1094 +    fi
1095 +  fi
1096 +
1097 +  if $HAVE_DLOPEN_LIBRPM; then
1098 +    DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
1099 +
1100 +cat >>confdefs.h <<_ACEOF
1101 +#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING
1102 +_ACEOF
1103 +
1104 +
1105 +cat >>confdefs.h <<\_ACEOF
1106 +#define HAVE_LIBRPM 1
1107 +_ACEOF
1108 +
1109 +  else
1110 +    echo "$as_me:$LINENO: result: no" >&5
1111 +echo "${ECHO_T}no" >&6
1112 +    LIBS="$save_LIBS"
1113 +    if $DLOPEN_REQUIRE; then
1114 +      { { echo "$as_me:$LINENO: error: Specific name $LIBRPM was requested but it could not be opened." >&5
1115 +echo "$as_me: error: Specific name $LIBRPM was requested but it could not be opened." >&2;}
1116 +   { (exit 1); exit 1; }; }
1117 +    fi
1118 +
1119 +
1120 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1121 +       if test -n "$ac_tool_prefix"; then
1122 +  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
1123 +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
1124 +echo "$as_me:$LINENO: checking for $ac_word" >&5
1125 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1126 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
1127 +  echo $ECHO_N "(cached) $ECHO_C" >&6
1128 +else
1129 +  case $PKG_CONFIG in
1130 +  [\\/]* | ?:[\\/]*)
1131 +  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
1132 +  ;;
1133 +  *)
1134 +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1135 +for as_dir in $PATH
1136 +do
1137 +  IFS=$as_save_IFS
1138 +  test -z "$as_dir" && as_dir=.
1139 +  for ac_exec_ext in '' $ac_executable_extensions; do
1140 +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1141 +    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
1142 +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1143 +    break 2
1144 +  fi
1145 +done
1146 +done
1147 +
1148 +  ;;
1149 +esac
1150 +fi
1151 +PKG_CONFIG=$ac_cv_path_PKG_CONFIG
1152 +
1153 +if test -n "$PKG_CONFIG"; then
1154 +  echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
1155 +echo "${ECHO_T}$PKG_CONFIG" >&6
1156 +else
1157 +  echo "$as_me:$LINENO: result: no" >&5
1158 +echo "${ECHO_T}no" >&6
1159 +fi
1160 +
1161 +fi
1162 +if test -z "$ac_cv_path_PKG_CONFIG"; then
1163 +  ac_pt_PKG_CONFIG=$PKG_CONFIG
1164 +  # Extract the first word of "pkg-config", so it can be a program name with args.
1165 +set dummy pkg-config; ac_word=$2
1166 +echo "$as_me:$LINENO: checking for $ac_word" >&5
1167 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1168 +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
1169 +  echo $ECHO_N "(cached) $ECHO_C" >&6
1170 +else
1171 +  case $ac_pt_PKG_CONFIG in
1172 +  [\\/]* | ?:[\\/]*)
1173 +  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
1174 +  ;;
1175 +  *)
1176 +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1177 +for as_dir in $PATH
1178 +do
1179 +  IFS=$as_save_IFS
1180 +  test -z "$as_dir" && as_dir=.
1181 +  for ac_exec_ext in '' $ac_executable_extensions; do
1182 +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1183 +    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
1184 +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1185 +    break 2
1186 +  fi
1187 +done
1188 +done
1189 +
1190 +  ;;
1191 +esac
1192 +fi
1193 +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
1194 +
1195 +if test -n "$ac_pt_PKG_CONFIG"; then
1196 +  echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5
1197 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6
1198 +else
1199 +  echo "$as_me:$LINENO: result: no" >&5
1200 +echo "${ECHO_T}no" >&6
1201 +fi
1202 +
1203 +  PKG_CONFIG=$ac_pt_PKG_CONFIG
1204 +else
1205 +  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
1206 +fi
1207 +
1208 +fi
1209 +if test -n "$PKG_CONFIG"; then
1210 +       _pkg_min_version=0.9.0
1211 +       echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5
1212 +echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6
1213 +       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1214 +               echo "$as_me:$LINENO: result: yes" >&5
1215 +echo "${ECHO_T}yes" >&6
1216 +       else
1217 +               echo "$as_me:$LINENO: result: no" >&5
1218 +echo "${ECHO_T}no" >&6
1219 +               PKG_CONFIG=""
1220 +       fi
1221 +
1222 +fi
1223 +
1224 +pkg_failed=no
1225 +echo "$as_me:$LINENO: checking for RPM" >&5
1226 +echo $ECHO_N "checking for RPM... $ECHO_C" >&6
1227 +
1228 +if test -n "$RPM_CFLAGS"; then
1229 +    pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
1230 + elif test -n "$PKG_CONFIG"; then
1231 +    if test -n "$PKG_CONFIG" && \
1232 +    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"rpm\"") >&5
1233 +  ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1234 +  ac_status=$?
1235 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
1236 +  (exit $ac_status); }; then
1237 +  pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null`
1238 +else
1239 +  pkg_failed=yes
1240 +fi
1241 + else
1242 +    pkg_failed=untried
1243 +fi
1244 +if test -n "$RPM_LIBS"; then
1245 +    pkg_cv_RPM_LIBS="$RPM_LIBS"
1246 + elif test -n "$PKG_CONFIG"; then
1247 +    if test -n "$PKG_CONFIG" && \
1248 +    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"rpm\"") >&5
1249 +  ($PKG_CONFIG --exists --print-errors "rpm") 2>&5
1250 +  ac_status=$?
1251 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
1252 +  (exit $ac_status); }; then
1253 +  pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null`
1254 +else
1255 +  pkg_failed=yes
1256 +fi
1257 + else
1258 +    pkg_failed=untried
1259 +fi
1260 +
1261 +
1262 +
1263 +if test $pkg_failed = yes; then
1264 +
1265 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1266 +        _pkg_short_errors_supported=yes
1267 +else
1268 +        _pkg_short_errors_supported=no
1269 +fi
1270 +        if test $_pkg_short_errors_supported = yes; then
1271 +               RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "rpm" 2>&1`
1272 +        else
1273 +               RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors "rpm" 2>&1`
1274 +        fi
1275 +       # Put the nasty error message in config.log where it belongs
1276 +       echo "$RPM_PKG_ERRORS" >&5
1277 +
1278 +       echo "$as_me:$LINENO: result: no" >&5
1279 +echo "${ECHO_T}no" >&6
1280 +                HAVE_LIBRPM=false
1281 +elif test $pkg_failed = untried; then
1282 +       HAVE_LIBRPM=false
1283 +else
1284 +       RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
1285 +       RPM_LIBS=$pkg_cv_RPM_LIBS
1286 +        echo "$as_me:$LINENO: result: yes" >&5
1287 +echo "${ECHO_T}yes" >&6
1288 +       HAVE_LIBRPM=true
1289 +fi
1290 +
1291 +    if $HAVE_LIBRPM; then
1292 +
1293 +    echo "$as_me:$LINENO: checking rpm library API compatibility" >&5
1294 +echo $ECHO_N "checking rpm library API compatibility... $ECHO_C" >&6
1295 +    # The compilation requires -Werror to verify anything.
1296 +    save_CFLAGS="$CFLAGS"
1297 +    CFLAGS="$CFLAGS -Werror"
1298 +    cat >conftest.$ac_ext <<_ACEOF
1299 +/* confdefs.h.  */
1300 +_ACEOF
1301 +cat confdefs.h >>conftest.$ac_ext
1302 +cat >>conftest.$ac_ext <<_ACEOF
1303 +/* end confdefs.h.  */
1304 +
1305 +/* Duplicate here the declarations to verify they match "symfile.c".  */
1306 +#include <rpm/rpmlib.h>
1307 +#include <rpm/rpmts.h>
1308 +#include <rpm/rpmdb.h>
1309 +#include <rpm/header.h>
1310 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1311 +extern int rpmReadConfigFiles(const char * file, const char * target);
1312 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1313 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1314 +extern rpmts rpmtsCreate(void);
1315 +extern rpmts rpmtsFree(rpmts ts);
1316 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1317 +                                           const void * keyp, size_t keylen);
1318 +
1319 +int
1320 +main ()
1321 +{
1322 +
1323 +  ;
1324 +  return 0;
1325 +}
1326 +_ACEOF
1327 +rm -f conftest.$ac_objext
1328 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
1329 +  (eval $ac_compile) 2>conftest.er1
1330 +  ac_status=$?
1331 +  grep -v '^ *+' conftest.er1 >conftest.err
1332 +  rm -f conftest.er1
1333 +  cat conftest.err >&5
1334 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
1335 +  (exit $ac_status); } &&
1336 +        { ac_try='test -z "$ac_c_werror_flag"
1337 +                        || test ! -s conftest.err'
1338 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
1339 +  (eval $ac_try) 2>&5
1340 +  ac_status=$?
1341 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
1342 +  (exit $ac_status); }; } &&
1343 +        { ac_try='test -s conftest.$ac_objext'
1344 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
1345 +  (eval $ac_try) 2>&5
1346 +  ac_status=$?
1347 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
1348 +  (exit $ac_status); }; }; then
1349 +
1350 +      LIBRPM_COMPAT=true
1351 +      echo "$as_me:$LINENO: result: yes" >&5
1352 +echo "${ECHO_T}yes" >&6
1353 +
1354 +else
1355 +  echo "$as_me: failed program was:" >&5
1356 +sed 's/^/| /' conftest.$ac_ext >&5
1357 +
1358 +
1359 +      LIBRPM_COMPAT=false
1360 +      echo "$as_me:$LINENO: result: no" >&5
1361 +echo "${ECHO_T}no" >&6
1362 +
1363 +fi
1364 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
1365 +    CFLAGS="$save_CFLAGS"
1366 +
1367 +      if ! $LIBRPM_COMPAT; then
1368 +       HAVE_LIBRPM=false
1369 +       RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1370 +      fi
1371 +    fi
1372 +
1373 +    if $HAVE_LIBRPM; then
1374 +
1375 +cat >>confdefs.h <<\_ACEOF
1376 +#define HAVE_LIBRPM 1
1377 +_ACEOF
1378 +
1379 +      CFLAGS="$CFLAGS $RPM_CFLAGS"
1380 +      LIBS="$LIBS $RPM_LIBS"
1381 +    else
1382 +      if $RPM_REQUIRE; then
1383 +       { { echo "$as_me:$LINENO: error: $RPM_PKG_ERRORS" >&5
1384 +echo "$as_me: error: $RPM_PKG_ERRORS" >&2;}
1385 +   { (exit 1); exit 1; }; }
1386 +      else
1387 +       { echo "$as_me:$LINENO: WARNING: $RPM_PKG_ERRORS" >&5
1388 +echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
1389 +      fi
1390 +    fi
1391 +  fi
1392 +fi
1393 +
1394  
1395  
1396  
1397 @@ -8623,7 +9181,6 @@ done
1398  # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
1399  # OS/2's system install, which has a completely different semantic
1400  # ./install, which can be erroneously created by make from ./install.sh.
1401 -# Reject install programs that cannot install multiple files.
1402  echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
1403  echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
1404  if test -z "$INSTALL"; then
1405 @@ -8657,18 +9214,8 @@ case $as_dir/ in
1406             # program-specific install script used by HP pwplus--don't use.
1407             :
1408           else
1409 -           rm -rf conftest.one conftest.two conftest.dir
1410 -           echo one > conftest.one
1411 -           echo two > conftest.two
1412 -           mkdir conftest.dir
1413 -           if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
1414 -             test -s conftest.one && test -s conftest.two &&
1415 -             test -s conftest.dir/conftest.one &&
1416 -             test -s conftest.dir/conftest.two
1417 -           then
1418 -             ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
1419 -             break 3
1420 -           fi
1421 +           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
1422 +           break 3
1423           fi
1424         fi
1425        done
1426 @@ -8677,16 +9224,15 @@ case $as_dir/ in
1427  esac
1428  done
1429  
1430 -rm -rf conftest.one conftest.two conftest.dir
1431  
1432  fi
1433    if test "${ac_cv_path_install+set}" = set; then
1434      INSTALL=$ac_cv_path_install
1435    else
1436 -    # As a last resort, use the slow shell script.  Don't cache a
1437 -    # value for INSTALL within a source directory, because that will
1438 +    # As a last resort, use the slow shell script.  We don't cache a
1439 +    # path for INSTALL within a source directory, because that will
1440      # break other packages using the cache if that directory is
1441 -    # removed, or if the value is a relative name.
1442 +    # removed, or if the path is relative.
1443      INSTALL=$ac_install_sh
1444    fi
1445  fi
1446 @@ -22270,6 +22816,10 @@ s,@am__fastdepCC_TRUE@,$am__fastdepCC_TR
1447  s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
1448  s,@GDB_DATADIR_PATH@,$GDB_DATADIR_PATH,;t t
1449  s,@pythondir@,$pythondir,;t t
1450 +s,@PKG_CONFIG@,$PKG_CONFIG,;t t
1451 +s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t
1452 +s,@RPM_CFLAGS@,$RPM_CFLAGS,;t t
1453 +s,@RPM_LIBS@,$RPM_LIBS,;t t
1454  s,@subdirs@,$subdirs,;t t
1455  s,@TARGET_OBS@,$TARGET_OBS,;t t
1456  s,@PKGVERSION@,$PKGVERSION,;t t
1457 Index: gdb-6.8.50.20090302/gdb/configure.ac
1458 ===================================================================
1459 --- gdb-6.8.50.20090302.orig/gdb/configure.ac   2009-03-07 17:13:33.000000000 +0100
1460 +++ gdb-6.8.50.20090302/gdb/configure.ac        2009-03-07 17:25:06.000000000 +0100
1461 @@ -162,6 +162,199 @@ else
1462  fi
1463  AC_SUBST(pythondir)
1464  
1465 +# Integration with rpm library to support missing debuginfo suggestions.
1466 +# --without-rpm: Disable any rpm support.
1467 +# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime.
1468 +#   Even with runtime missing `libname.so' GDB will still other run correctly.
1469 +#   Missing `libname.so' during ./configure will abort the configuration.
1470 +# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific
1471 +#   minor version first such as `librpm-4.6.so' as minor version differences
1472 +#   mean API+ABI incompatibility.  If the specific match versioned library name
1473 +#   could not be found still open dynamically at least `librpm.so'.
1474 +# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try
1475 +#   to find librpm for compilation-time linking by pkg-config.  GDB binary will
1476 +#   be probably linked with the version specific library (as `librpm-4.6.so').
1477 +#   Failure to find librpm by pkg-config will abort the configuration.
1478 +# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config
1479 +#   cannot find librpm use to the rpmless compilation (like `--without-rpm').
1480 +
1481 +AC_ARG_WITH([rpm],
1482 +  [AS_HELP_STRING([--with-rpm],
1483 +                  [query rpm database for missing debuginfos [yes/no, def. auto=librpm.so]])], [], [with_rpm="auto"])
1484 +
1485 +m4_pattern_allow([^AC_MSG_ERROR$])
1486 +m4_pattern_allow([^AC_MSG_WARN$])
1487 +if test "x$with_rpm" != "xno"; then
1488 +  if test "x$with_rpm" = "xyes"; then
1489 +    LIBRPM="librpm.so"
1490 +    RPM_REQUIRE=true
1491 +    DLOPEN_REQUIRE=false
1492 +  elif test "x$with_rpm" = "xauto"; then
1493 +    LIBRPM="librpm.so"
1494 +    RPM_REQUIRE=false
1495 +    DLOPEN_REQUIRE=false
1496 +  else
1497 +    LIBRPM="$with_rpm"
1498 +    RPM_REQUIRE=true
1499 +    DLOPEN_REQUIRE=true
1500 +  fi
1501 +  LIBRPM_STRING='"'"$LIBRPM"'"'
1502 +
1503 +  AC_MSG_CHECKING([specific librpm version])
1504 +  HAVE_DLOPEN_LIBRPM=false
1505 +  save_LIBS="$LIBS"
1506 +  LIBS="$LIBS -ldl"
1507 +  AC_RUN_IFELSE(AC_LANG_PROGRAM([[
1508 +#include <rpm/rpmlib.h>
1509 +#include <dlfcn.h>
1510 +#include <errno.h>
1511 +  ]], [[
1512 +    void *h;
1513 +    const char *const *rpmverp;
1514 +    FILE *f;
1515 +
1516 +    f = fopen ("conftest.out", "w");
1517 +    if (!f)
1518 +      {
1519 +       fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out",
1520 +                strerror (errno));
1521 +       return 1;
1522 +      }
1523 +    h = dlopen ($LIBRPM_STRING, RTLD_LAZY);
1524 +    if (!h)
1525 +      {
1526 +       fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ());
1527 +       return 1;
1528 +      }
1529 +    rpmverp = dlsym (h, "RPMVERSION");
1530 +    if (!rpmverp)
1531 +      {
1532 +       fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ());
1533 +       return 1;
1534 +      }
1535 +    fprintf (stderr, "RPMVERSION is: \"");
1536 +    fprintf (stderr, "%s\"\n", *rpmverp);
1537 +
1538 +    /* Try to find the specific librpm version only for "librpm.so" as we do
1539 +       not know how to assemble the version string otherwise.  */
1540 +
1541 +    if (strcmp ("librpm.so", $LIBRPM_STRING) != 0)
1542 +      {
1543 +       fprintf (f, "%s\n", $LIBRPM_STRING);
1544 +       return 0;
1545 +      }
1546 +    else
1547 +      {
1548 +       char *h2_name;
1549 +       void *h2;
1550 +       int major, minor;
1551 +
1552 +       if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2)
1553 +         {
1554 +           fprintf (stderr, "Unable to parse RPMVERSION.\n");
1555 +           fprintf (f, "%s\n", $LIBRPM_STRING);
1556 +           return 0;
1557 +         }
1558 +       /* Avoid the square brackets by malloc.  */
1559 +       h2_name = malloc (64);
1560 +       sprintf (h2_name, "librpm-%d.%d.so", major, minor);
1561 +       h2 = dlopen (h2_name, RTLD_LAZY);
1562 +       if (!h2)
1563 +         {
1564 +           fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ());
1565 +           fprintf (f, "%s\n", $LIBRPM_STRING);
1566 +           return 0;
1567 +         }
1568 +       if (h2 != h)
1569 +         {
1570 +           fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n",
1571 +                    $LIBRPM_STRING, h2_name);
1572 +           fprintf (f, "%s\n", $LIBRPM_STRING);
1573 +           return 0;
1574 +         }
1575 +       /* Found the valid .so name with a specific version.  */
1576 +       fprintf (f, "%s\n", h2_name);
1577 +       return 0;
1578 +      }
1579 +  ]]), [
1580 +    DLOPEN_LIBRPM="`cat conftest.out`"
1581 +    if test "x$DLOPEN_LIBRPM" != "x"; then
1582 +      HAVE_DLOPEN_LIBRPM=true
1583 +      AC_MSG_RESULT($DLOPEN_LIBRPM)
1584 +    fi
1585 +  ])
1586 +  rm -f conftest.out
1587 +
1588 +  m4_define([CHECK_LIBRPM_COMPAT], [
1589 +    AC_MSG_CHECKING([rpm library API compatibility])
1590 +    # The compilation requires -Werror to verify anything.
1591 +    save_CFLAGS="$CFLAGS"
1592 +    CFLAGS="$CFLAGS -Werror"
1593 +    AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
1594 +/* Duplicate here the declarations to verify they match "symfile.c".  */
1595 +#include <rpm/rpmlib.h>
1596 +#include <rpm/rpmts.h>
1597 +#include <rpm/rpmdb.h>
1598 +#include <rpm/header.h>
1599 +extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
1600 +extern int rpmReadConfigFiles(const char * file, const char * target);
1601 +extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
1602 +extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
1603 +extern rpmts rpmtsCreate(void);
1604 +extern rpmts rpmtsFree(rpmts ts);
1605 +extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
1606 +                                           const void * keyp, size_t keylen);
1607 +    ]]), [
1608 +      LIBRPM_COMPAT=true
1609 +      AC_MSG_RESULT(yes)
1610 +    ], [
1611 +      LIBRPM_COMPAT=false
1612 +      AC_MSG_RESULT(no)
1613 +    ])
1614 +    CFLAGS="$save_CFLAGS"
1615 +  ])
1616 +
1617 +  if $HAVE_DLOPEN_LIBRPM; then
1618 +    CHECK_LIBRPM_COMPAT
1619 +    if ! $LIBRPM_COMPAT; then
1620 +      HAVE_DLOPEN_LIBRPM=false
1621 +    fi
1622 +  fi
1623 +
1624 +  if $HAVE_DLOPEN_LIBRPM; then
1625 +    DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"'
1626 +    AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.])
1627 +    AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1628 +  else
1629 +    AC_MSG_RESULT(no)
1630 +    LIBS="$save_LIBS"
1631 +    if $DLOPEN_REQUIRE; then
1632 +      AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.])
1633 +    fi
1634 +    PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false])
1635 +
1636 +    if $HAVE_LIBRPM; then
1637 +      CHECK_LIBRPM_COMPAT
1638 +      if ! $LIBRPM_COMPAT; then
1639 +       HAVE_LIBRPM=false
1640 +       RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB"
1641 +      fi
1642 +    fi
1643 +
1644 +    if $HAVE_LIBRPM; then
1645 +      AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.])
1646 +      CFLAGS="$CFLAGS $RPM_CFLAGS"
1647 +      LIBS="$LIBS $RPM_LIBS"
1648 +    else
1649 +      if $RPM_REQUIRE; then
1650 +       AC_MSG_ERROR($RPM_PKG_ERRORS)
1651 +      else
1652 +       AC_MSG_WARN($RPM_PKG_ERRORS)
1653 +      fi
1654 +    fi
1655 +  fi
1656 +fi
1657 +
1658  
1659  AC_CONFIG_SUBDIRS(doc testsuite)
1660  
This page took 0.139818 seconds and 3 git commands to generate.