From 9a060b37a175859748dce4d4cb7265642b0ea848 Mon Sep 17 00:00:00 2001
From: Bryce McKinlay <mckinlay@redhat.com>
Date: Sun, 2 Jan 2005 03:35:57 +0000
Subject: [PATCH] boehm-gc.h: Include gc_ext_config.h, not gc_config.h.

2005-01-01  Bryce McKinlay  <mckinlay@redhat.com>

	* include/boehm-gc.h: Include gc_ext_config.h, not gc_config.h.

2005-01-01  Bryce McKinlay  <mckinlay@redhat.com>

	* configure.ac (AC_CONFIG_HEADERS): Build both include/gc_config.h
	and include/gc_ext_config.h.
	* include/gc_ext_config.h: New file. Define only THREAD_LOCAL_ALLOC.
	* include/gc.h: Undef PACKAGE_* before including gc_config.h.

From-SVN: r92801
---
 boehm-gc/ChangeLog                  |  7 +++++++
 boehm-gc/configure                  |  3 ++-
 boehm-gc/configure.ac               |  2 +-
 boehm-gc/include/gc.h               | 22 ++++++++++++++++++++++
 boehm-gc/include/gc_ext_config.h.in |  5 +++++
 libjava/ChangeLog                   |  4 ++++
 libjava/include/boehm-gc.h          |  2 +-
 7 files changed, 42 insertions(+), 3 deletions(-)
 create mode 100644 boehm-gc/include/gc_ext_config.h.in

diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index bf95106fcbdc..5bb9d45a4354 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,3 +1,10 @@
+2005-01-01  Bryce McKinlay  <mckinlay@redhat.com>
+
+	* configure.ac (AC_CONFIG_HEADERS): Build both include/gc_config.h 
+	and include/gc_ext_config.h.
+	* include/gc_ext_config.h: New file. Define only THREAD_LOCAL_ALLOC.
+	* include/gc.h: Undef PACKAGE_* before including gc_config.h.
+
 2004-12-13  Kelley Cook  <kcook@gcc.gnu.org>
 
 	* configure: Regenerate.
diff --git a/boehm-gc/configure b/boehm-gc/configure
index 0f659721a878..36243d4c58b0 100755
--- a/boehm-gc/configure
+++ b/boehm-gc/configure
@@ -6580,7 +6580,7 @@ else
   multilib_arg=
 fi
 
-          ac_config_headers="$ac_config_headers include/gc_config.h"
+                    ac_config_headers="$ac_config_headers include/gc_config.h include/gc_ext_config.h"
 
 
                     ac_config_files="$ac_config_files Makefile include/Makefile"
@@ -7178,6 +7178,7 @@ do
   "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
   "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
   "include/gc_config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/gc_config.h" ;;
+  "include/gc_ext_config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/gc_ext_config.h" ;;
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
diff --git a/boehm-gc/configure.ac b/boehm-gc/configure.ac
index 7d1c6e3df1b3..208a91608721 100644
--- a/boehm-gc/configure.ac
+++ b/boehm-gc/configure.ac
@@ -468,7 +468,7 @@ else
   multilib_arg=
 fi
 
-AC_CONFIG_HEADERS([include/gc_config.h])
+AC_CONFIG_HEADERS([include/gc_config.h include/gc_ext_config.h])
 
 AC_CONFIG_FILES(Makefile include/Makefile)
 AC_OUTPUT
diff --git a/boehm-gc/include/gc.h b/boehm-gc/include/gc.h
index e1f2aa8f80fe..0781a611bb09 100644
--- a/boehm-gc/include/gc.h
+++ b/boehm-gc/include/gc.h
@@ -30,6 +30,28 @@
 
 # define _GC_H
 
+/* 
+ * As this header includes gc_config.h, preprocessor conflicts can occur with 
+ * clients that include their own autoconf headers. The following #undef's 
+ * work around some likely conflicts.
+ */
+
+# ifdef PACKAGE_NAME
+#   undef PACKAGE_NAME
+# endif
+# ifdef PACKAGE_BUGREPORT
+#  undef PACKAGE_BUGREPORT
+# endif
+# ifdef PACKAGE_STRING
+#  undef PACKAGE_STRING
+# endif
+# ifdef PACKAGE_TARNAME
+#  undef PACKAGE_TARNAME
+# endif
+# ifdef PACKAGE_VERSION
+#  undef PACKAGE_VERSION
+# endif
+
 # include <gc_config.h>
 # include "gc_config_macros.h"
 
diff --git a/boehm-gc/include/gc_ext_config.h.in b/boehm-gc/include/gc_ext_config.h.in
new file mode 100644
index 000000000000..52a662dcf0bf
--- /dev/null
+++ b/boehm-gc/include/gc_ext_config.h.in
@@ -0,0 +1,5 @@
+/* include/gc_ext_config.h.in.  This contains definitions needed by
+external clients that do not want to include the full gc.h.  Currently this
+is used by libjava/include/boehm-gc.h. */
+
+#undef THREAD_LOCAL_ALLOC
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 0ea15994a068..8ad5dbfe0f6f 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,7 @@
+2005-01-01  Bryce McKinlay  <mckinlay@redhat.com>
+
+	* include/boehm-gc.h: Include gc_ext_config.h, not gc_config.h.
+
 2004-12-31  Andreas Jaeger  <aj@suse.de>
 
 	* testsuite/lib/libjava.exp (libjava_find_gij): Handle multilibs.
diff --git a/libjava/include/boehm-gc.h b/libjava/include/boehm-gc.h
index 61e007ff501a..e7802b68035c 100644
--- a/libjava/include/boehm-gc.h
+++ b/libjava/include/boehm-gc.h
@@ -26,7 +26,7 @@ extern "C"
 #include <java/lang/Class.h>
 #include <string.h>
 
-#include <gc_config.h>
+#include <gc_ext_config.h> // for THREAD_LOCAL_ALLOC
 
 extern "C" void * GC_gcj_malloc(size_t, void *);
 extern "C" void * GC_malloc_atomic(size_t);
-- 
GitLab