From 3684d331fd35f49e4022ac6906dc879552af0442 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Fri, 17 Jan 2020 15:14:56 +0000
Subject: Fix gdbsupport build

I'm seeing this on F27 (a clean build from scratch):

~~~~~~~~~~~~~~~~~~~~~~~~~~~
 make[3]: Entering directory '/home/pedro/brno/pedro/gdb/binutils-gdb/build/gdbsupport'
   CC       gdb_tilde_expand.o
 In file included from /home/pedro/gdb/binutils-gdb/src/gdbsupport/../gnulib/import/libc-config.h:33:0,
                  from ../gnulib/import/glob.h:544,
                  from /home/pedro/gdb/binutils-gdb/src/gdbsupport/gdb_tilde_expand.c:22:
 ../bfd/config.h:7:4: error: #error config.h must be #included before system headers
  #  error config.h must be #included before system headers
     ^~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~

libc-config.h, where it includes config.h, says:

~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /* This is intended to be a good-enough substitute for glibc system
    macros like those defined in <sys/cdefs.h>, so that Gnulib code
    shared with glibc can do this as the first #include:

      #ifndef _LIBC
      # include <libc-config.h>
      #endif

    When compiled as part of glibc this is a no-op; when compiled as
    part of Gnulib this includes Gnulib's <config.h> and defines macros
    that glibc library code would normally assume.  */

 #include <config.h>
~~~~~~~~~~~~~~~~~~~~~~~~~~~

The issue is that that '#include <config.h>' picks up bfd's config.h
instead of gnulib's.

This problem doesn't trigger in the gdb dir because there we generate
config.h under that exact name so gnulib's libc-config.h ends up
picking gdb's config.h instead of gnulib.c and that ends up harmless.

In gdbsupport, the config.h file is really named support-config.h, so
that '#include <config.h>' in libc-config.h doesn't pick it like it
would if it had the conventional config.h name.

This patch fixes it by simply renaming gdbserver's support-config.h to
config.h.

gdbsupport/ChangeLog:
2020-01-17  Pedro Alves  <palves@redhat.com>

	* configure.ac: Generate config.h instead of support-config.h.
	* common-defs.h: Include <gdbsupport/config.h> instead of
	<gdbsupport/support-config.h>.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
---
 gdbsupport/configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'gdbsupport/configure.ac')

diff --git a/gdbsupport/configure.ac b/gdbsupport/configure.ac
index af14d7b..6002871 100644
--- a/gdbsupport/configure.ac
+++ b/gdbsupport/configure.ac
@@ -18,7 +18,7 @@ dnl Process this file with autoconf to produce a configure script.
 
 AC_INIT([gdbsupport], 1.0)
 AC_CONFIG_SRCDIR(common-defs.h)
-AC_CONFIG_HEADER(support-config.h:config.in)
+AC_CONFIG_HEADER(config.h:config.in)
 AC_CANONICAL_SYSTEM
 AM_MAINTAINER_MODE
 AC_CONFIG_AUX_DIR(..)
-- 
cgit v1.1