diff mbox

Delete GCJ

Message ID 885027a6-080b-ec6f-89df-533be4132b36@ubuntu.com
State New
Headers show

Commit Message

Matthias Klose Nov. 20, 2016, 8:42 p.m. UTC
On 10.10.2016 09:58, Iain Sandoe wrote:
> 

>> On 10 Oct 2016, at 05:03, Matthias Klose <doko@ubuntu.com> wrote:

>>

>> On 07.10.2016 10:30, Iain Sandoe wrote:

>>>

>>>> On 7 Oct 2016, at 00:58, Matthias Klose <doko@ubuntu.com> wrote:

>>>>

>>>> On 06.10.2016 20:00, Mike Stump wrote:

>>>>> On Oct 6, 2016, at 9:56 AM, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote:

>>>>>> I wouldn't hard-fail, but completely disable objc-gc with an appropriate

>>>>>> warning.  The Objective-C maintainers may have other preferences, though.

>>>>

>>>> I think I can't do that in the top level make file very well (currently I only

>>>> have the pkg-config check there for an early failure, but that check doesn't

>>>> tell me if the library is present for all multilib variants). And I can't check

>>>> for multilibs because I don't know if the bootstrap compiler is multilib aware.

>>>

>>> hrm, so perhaps we need a —with-target-boehm-gc= type arrangement, and it’s the configurer’s responsibility to provide a path with appropriate headers/libs for the multi-lib configuration being attempted.

>>

>> I don't understand what you are proposing here.

> 

> given that:

>  auto-detection of the capabilities could be quite difficult (or, in the general case, unachievable) for the reasons you gave.

>  the chosen target libraries might be in a non-standard place.

> 

> making it an explicit requirement to point to them, and to ensure that the versions/multi-libs provided are suitable, (by putting —with-target-boehm-gc=/path/to/suitable/) would mean that the dependent configury (for objc-gc) could be just conditional upon the  presence of the "with-target-boehm-gc”.

> 

> I suppose that one could make "—with-target-boehm-gc” (no attached path) declare that the library (and requisite mult-lib versions) will be found in the sysroot without any additional work.

> 

> The point here was to simplify the dependent configury so that it only needs to test something that the configuring user specifies (i.e. if they specify objc-gc, then they need also to specify the place that the gc lib can be found).


So here is the next proposal, I hope the added documentation in install.texi
makes the usage clear.

<toplevel>

2016-11-19  Matthias Klose  <doko@ubuntu.com>

	* Makefile.def: Remove reference to boehm-gc target module.
  	* configure.ac: Include pkg.m4, check for --with-target-bdw-gc
	options and for the bdw-gc pkg-config module.
	* configure: Regenerate.
	* Makefile.in: Regenerate.

gcc/

2016-11-19  Matthias Klose  <doko@ubuntu.com>

	* doc/install.texi: Document configure options --enable-objc-gc
	and --with-target-bdw-gc.

config/

2016-11-19  Matthias Klose  <doko@ubuntu.com>

	* pkg.m4: New file.

libobjc/

2016-11-19  Matthias Klose  <doko@ubuntu.com>

	* configure.ac (--enable-objc-gc): Allow to configure with a
	system provided boehm-gc.
	* configure: Regenerate.
	* Makefile.in (OBJC_BOEHM_GC_LIBS): Get value from configure.
	* gc.c: Include system bdw-gc headers.
	* memory.c: Likewise
	* objects.c: Likewise

boehm-gc/

2016-11-19  Matthias Klose  <doko@ubuntu.com>

	Remove

Comments

Sandra Loosemore Nov. 21, 2016, 5:34 a.m. UTC | #1
On 11/20/2016 01:42 PM, Matthias Klose wrote:

> +The options @option{--with-target-bdw-gc-include} and

> +@option{--with-target-bdw-gc-include} must always specified together for

> +each multilib variant and take precedence over

> +@option{--with-target-bdw-gc-include}.  If none of these options are

> +specified, the values are taken from the @command{pkg-config}

> +@samp{bdw-gc} module.


This paragraph makes no sense to me.  :-(

-Sandra
Iain Sandoe Nov. 21, 2016, 10:23 a.m. UTC | #2
> On 20 Nov 2016, at 20:42, Matthias Klose <doko@ubuntu.com> wrote:

> 

> On 10.10.2016 09:58, Iain Sandoe wrote:

>> 


>> The point here was to simplify the dependent configury so that it only needs to test something that the configuring user specifies (i.e. if they specify objc-gc, then they need also to specify the place that the gc lib can be found).

> 

> So here is the next proposal, I hope the added documentation in install.texi

> makes the usage clear.


thanks for working on this!

> 

> <toplevel>

> 

> 2016-11-19  Matthias Klose  <doko@ubuntu.com>

> 

> 	* Makefile.def: Remove reference to boehm-gc target module.

>  	* configure.ac: Include pkg.m4, check for --with-target-bdw-gc

> 	options and for the bdw-gc pkg-config module.

> 	* configure: Regenerate.

> 	* Makefile.in: Regenerate.



+AC_ARG_ENABLE(objc-gc,
+[AS_HELP_STRING([--enable-objc-gc],
+		[enable use of Boehm's garbage collector with the
+		 GNU Objective-C runtime])])
+AC_ARG_WITH([target-bdw-gc],
+[AS_HELP_STRING([--with-target-bdw-gc=PATHLIST],
+		[specify prefix directory for installed bdw-gc package.
+		 Equivalent to --with-bdw-gc-include=PATH/include
+		 plus --with-bdw-gc-lib=PATH/lib])])

missing “target” in the --with-bdw-gc-*

> 

> gcc/

> 

> 2016-11-19  Matthias Klose  <doko@ubuntu.com>

> 

> 	* doc/install.texi: Document configure options --enable-objc-gc

> 	and --with-target-bdw-gc.


As per Sandra’s comment,  should we understand the priority of options is

--with-target-bdw-gc-*

which overrides…

--with-target-bdw-gc=<list>

which overrides automatic discovery using pkg_config?

Iain
Matthias Klose Nov. 21, 2016, 12:57 p.m. UTC | #3
On 21.11.2016 11:23, Iain Sandoe wrote:
> 

>> On 20 Nov 2016, at 20:42, Matthias Klose <doko@ubuntu.com> wrote:

>>

>> On 10.10.2016 09:58, Iain Sandoe wrote:

>>>

> 

>>> The point here was to simplify the dependent configury so that it only needs to test something that the configuring user specifies (i.e. if they specify objc-gc, then they need also to specify the place that the gc lib can be found).

>>

>> So here is the next proposal, I hope the added documentation in install.texi

>> makes the usage clear.

> 

> thanks for working on this!

> 

>>

>> <toplevel>

>>

>> 2016-11-19  Matthias Klose  <doko@ubuntu.com>

>>

>> 	* Makefile.def: Remove reference to boehm-gc target module.

>>  	* configure.ac: Include pkg.m4, check for --with-target-bdw-gc

>> 	options and for the bdw-gc pkg-config module.

>> 	* configure: Regenerate.

>> 	* Makefile.in: Regenerate.

> 

> 

> +AC_ARG_ENABLE(objc-gc,

> +[AS_HELP_STRING([--enable-objc-gc],

> +		[enable use of Boehm's garbage collector with the

> +		 GNU Objective-C runtime])])

> +AC_ARG_WITH([target-bdw-gc],

> +[AS_HELP_STRING([--with-target-bdw-gc=PATHLIST],

> +		[specify prefix directory for installed bdw-gc package.

> +		 Equivalent to --with-bdw-gc-include=PATH/include

> +		 plus --with-bdw-gc-lib=PATH/lib])])

> 

> missing “target” in the --with-bdw-gc-*


thanks, fixed.

>> gcc/

>>

>> 2016-11-19  Matthias Klose  <doko@ubuntu.com>

>>

>> 	* doc/install.texi: Document configure options --enable-objc-gc

>> 	and --with-target-bdw-gc.

> 

> As per Sandra’s comment,  should we understand the priority of options is

> 

> --with-target-bdw-gc-*

> 

> which overrides…

> 

> --with-target-bdw-gc=<list>

> 

> which overrides automatic discovery using pkg_config?


--with-target-bdw-gc=/opt/bdw-gc,32=/opt/bdw-gc32

sets the include and lib dirs by appending include and lib to the paths. If you
have options --with-target-bdw-gc-include= and --with-target-bdw-gc-lib= as
well, it overrides the settings done in --with-target-bdw-gc=. This is copied
from the setting of the gmp/mpfr options.

Any of these options override the automatic discovery using pkg-config.

Please suggest a better wording; I thought that was clear enough (and better
than the undocumented --enable-libobjc-gc anyway ;)

Matthias
Sandra Loosemore Nov. 21, 2016, 4:23 p.m. UTC | #4
On 11/21/2016 05:57 AM, Matthias Klose wrote:
>

> --with-target-bdw-gc=/opt/bdw-gc,32=/opt/bdw-gc32

>

> sets the include and lib dirs by appending include and lib to the paths. If you

> have options --with-target-bdw-gc-include= and --with-target-bdw-gc-lib= as

> well, it overrides the settings done in --with-target-bdw-gc=. This is copied

> from the setting of the gmp/mpfr options.

>

> Any of these options override the automatic discovery using pkg-config.

>

> Please suggest a better wording; I thought that was clear enough (and better

> than the undocumented --enable-libobjc-gc anyway ;)


FAOD, my complaint about your patch is that it essentially said

"The options --with-foo and --with-foo must also be specified together 
and override --with-foo."

I'm sure you didn't mean exactly the same --with-foo in all 3 places, 
but I'm a dummy about what you really intended to say here.

-Sandra
Matthias Klose Nov. 21, 2016, 4:40 p.m. UTC | #5
On 21.11.2016 17:23, Sandra Loosemore wrote:
> On 11/21/2016 05:57 AM, Matthias Klose wrote:

>>

>> --with-target-bdw-gc=/opt/bdw-gc,32=/opt/bdw-gc32

>>

>> sets the include and lib dirs by appending include and lib to the paths. If you

>> have options --with-target-bdw-gc-include= and --with-target-bdw-gc-lib= as

>> well, it overrides the settings done in --with-target-bdw-gc=. This is copied

>> from the setting of the gmp/mpfr options.

>>

>> Any of these options override the automatic discovery using pkg-config.

>>

>> Please suggest a better wording; I thought that was clear enough (and better

>> than the undocumented --enable-libobjc-gc anyway ;)

> 

> FAOD, my complaint about your patch is that it essentially said

> 

> "The options --with-foo and --with-foo must also be specified together and

> override --with-foo."

> 

> I'm sure you didn't mean exactly the same --with-foo in all 3 places, but I'm a

> dummy about what you really intended to say here.


ahh, didn't see that :-/ Now fixed, is this clearer now?

The options @option{--with-target-bdw-gc-include} and
@option{--with-target-bdw-gc-lib} must always specified together for
each multilib variant and take precedence over
@option{--with-target-bdw-gc}.  If none of these options are
specified, the values are taken from the @command{pkg-config}
@samp{bdw-gc} module.

Matthias
Peter Bergner Nov. 21, 2016, 5:16 p.m. UTC | #6
On 11/21/16 10:40 AM, Matthias Klose wrote:
> On 21.11.2016 17:23, Sandra Loosemore wrote:

>> On 11/21/2016 05:57 AM, Matthias Klose wrote:

>> I'm sure you didn't mean exactly the same --with-foo in all 3 places, but I'm a

>> dummy about what you really intended to say here.

>

> ahh, didn't see that :-/ Now fixed, is this clearer now?

>

> The options @option{--with-target-bdw-gc-include} and

> @option{--with-target-bdw-gc-lib} must always specified together for

> each multilib variant and take precedence over

> @option{--with-target-bdw-gc}.  If none of these options are

> specified, the values are taken from the @command{pkg-config}

> @samp{bdw-gc} module.


s/must always specified/must always be specified/

and possibly:

s/variant and take precedence/variant and they take precedence/ ???


Peter
Rainer Orth Nov. 21, 2016, 5:16 p.m. UTC | #7
Hi Matthias,

> ahh, didn't see that :-/ Now fixed, is this clearer now?

>

> The options @option{--with-target-bdw-gc-include} and

> @option{--with-target-bdw-gc-lib} must always specified together for

                                               ^ be 
	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
diff mbox

Patch

<toplevel>

2016-11-19  Matthias Klose  <doko@ubuntu.com>

	* Makefile.def: Remove reference to boehm-gc target module.
  	* configure.ac: Include pkg.m4, check for --with-target-bdw-gc
	options and for the bdw-gc pkg-config module.
	* configure: Regenerate.
	* Makefile.in: Regenerate.

gcc/

2016-11-19  Matthias Klose  <doko@ubuntu.com>

	* doc/install.texi: Document configure options --enable-objc-gc
	and --with-target-bdw-gc.

config/

2016-11-19  Matthias Klose  <doko@ubuntu.com>

	* pkg.m4: New file.

libobjc/

2016-11-19  Matthias Klose  <doko@ubuntu.com>

	* configure.ac (--enable-objc-gc): Allow to configure with a
	system provided boehm-gc.
	* configure: Regenerate.
	* Makefile.in (OBJC_BOEHM_GC_LIBS): Get value from configure.
	* gc.c: Include system bdw-gc headers.
	* memory.c: Likewise
	* objects.c: Likewise

boehm-gc/

2016-11-19  Matthias Klose  <doko@ubuntu.com>

	Remove

Index: Makefile.def
===================================================================
--- Makefile.def	(revision 242638)
+++ Makefile.def	(working copy)
@@ -166,7 +166,6 @@ 
 target_modules = { module= libgloss; no_check=true; };
 target_modules = { module= libffi; no_install=true; };
 target_modules = { module= zlib; };
-target_modules = { module= boehm-gc; };
 target_modules = { module= rda; };
 target_modules = { module= libada; };
 target_modules = { module= libgomp; bootstrap= true; lib_path=.libs; };
@@ -543,7 +542,6 @@ 
 // a dependency on libgcc for native targets to configure.
 lang_env_dependencies = { module=libiberty; no_c=true; };
 
-dependencies = { module=configure-target-boehm-gc; on=all-target-libstdc++-v3; };
 dependencies = { module=configure-target-fastjar; on=configure-target-zlib; };
 dependencies = { module=all-target-fastjar; on=all-target-zlib; };
 dependencies = { module=configure-target-libgo; on=configure-target-libffi; };
@@ -551,8 +549,6 @@ 
 dependencies = { module=all-target-libgo; on=all-target-libbacktrace; };
 dependencies = { module=all-target-libgo; on=all-target-libffi; };
 dependencies = { module=all-target-libgo; on=all-target-libatomic; };
-dependencies = { module=configure-target-libobjc; on=configure-target-boehm-gc; };
-dependencies = { module=all-target-libobjc; on=all-target-boehm-gc; };
 dependencies = { module=configure-target-libstdc++-v3; on=configure-target-libgomp; };
 dependencies = { module=configure-target-liboffloadmic; on=configure-target-libgomp; };
 dependencies = { module=configure-target-libsanitizer; on=all-target-libstdc++-v3; };
Index: configure.ac
===================================================================
--- configure.ac	(revision 242638)
+++ configure.ac	(working copy)
@@ -29,6 +29,7 @@ 
 m4_include([ltversion.m4])
 m4_include([lt~obsolete.m4])
 m4_include([config/isl.m4])
+m4_include([config/pkg.m4])
 
 AC_INIT(move-if-change)
 AC_PREREQ(2.64)
@@ -161,7 +162,6 @@ 
 		target-libssp \
 		target-libquadmath \
 		target-libgfortran \
-		target-boehm-gc \
 		target-libffi \
 		target-libobjc \
 		target-libada \
@@ -2060,22 +2060,36 @@ 
 AC_ARG_ENABLE(objc-gc,
 [AS_HELP_STRING([--enable-objc-gc],
 		[enable use of Boehm's garbage collector with the
-		 GNU Objective-C runtime])],
-[case ,${enable_languages},:${enable_objc_gc}:${noconfigdirs} in
-  *,objc,*:*:yes:*target-boehm-gc*)
-    AC_MSG_ERROR([Boehm's garbage collector was requested yet not supported in this configuration])
-    ;;
-esac])
-
-# Make sure we only build Boehm's garbage collector if required.
-case ,${enable_languages},:${enable_objc_gc} in
-  *,objc,*:yes)
-    # Keep target-boehm-gc if requested for Objective-C.
-    ;;
-  *)
-    # Otherwise remove target-boehm-gc.
-    noconfigdirs="$noconfigdirs target-boehm-gc"
-    ;;
+		 GNU Objective-C runtime])])
+AC_ARG_WITH([target-bdw-gc],
+[AS_HELP_STRING([--with-target-bdw-gc=PATHLIST],
+		[specify prefix directory for installed bdw-gc package.
+		 Equivalent to --with-bdw-gc-include=PATH/include
+		 plus --with-bdw-gc-lib=PATH/lib])])
+AC_ARG_WITH([target-bdw-gc-include],
+[AS_HELP_STRING([--with-target-bdw-gc-include=PATHLIST],
+		[specify directories for installed bdw-gc include files])])
+AC_ARG_WITH([target-bdw-gc-lib],
+[AS_HELP_STRING([--with-target-bdw-gc-lib=PATHLIST],
+		[specify directories for installed bdw-gc library])])
+		  
+case ,${enable_languages},:${enable_objc_gc} in *,objc,*:yes|*,objc,*:auto)
+  AC_MSG_CHECKING([for bdw garbage collector])
+  if test "x$with_target_bdw_gc$with_target_bdw_gc_include$with_target_bdw_gc_lib" = x; then
+    dnl no bdw-gw options, fall back to the bdw-gc pkg-config module
+    PKG_CHECK_EXISTS(bdw-gc,
+      AC_MSG_RESULT([using bdw-gc pkg-config module]),
+      AC_MSG_ERROR([no --with-target-bdw-gc options and no bdw-gc pkg-config module found]))
+  else
+    dnl bdw-gw options, first error checking, complete checking in libobjc
+    if test "x$with_target_bdw_gc_include" = x && test "x$with_target_bdw_gc_lib" != x; then
+      AC_MSG_ERROR([found --with-target-bdw-gc-lib but --with-target-bdw-gc-include missing])
+    elif test "x$with_target_bdw_gc_include" != x && test "x$with_target_bdw_gc_lib" = x; then
+      AC_MSG_ERROR([found --with-target-bdw-gc-include but --with-target-bdw-gc-lib missing])
+    else
+      AC_MSG_RESULT([using paths configured with --with-target-bdw-gc options])
+    fi
+  fi
 esac
 
 # Disable libcilkrts, libitm, libsanitizer, libvtv, liboffloadmic if we're not building C++
Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi	(revision 242638)
+++ gcc/doc/install.texi	(working copy)
@@ -2143,6 +2143,36 @@ 
 overrides, you can pass a setting for @env{CONFIG_SITE} and set
 variables in the site file.
 
+@subheading Objective-C-Specific Options
+
+The following options apply to the build of the Objective-C runtime library.
+
+@table @code
+@item --enable-objc-gc
+Specify that an additional variant of the GNU Objective-C runtime library
+is built, using an external build of the Boehm-Demers-Weiser garbage
+collector (@uref{http://www.hboehm.info/gc/}).  This library needs to be
+available for each multilib variant, unless configured with
+@option{--enable-objc-gc=@samp{auto}} in which case the build of the
+additional runtime library is skipped and the build continues.
+
+@item --with-target-bdw-gc=@var{list}
+@itemx --with-target-bdw-gc-include=@var{list}
+@itemx --with-target-bdw-gc-lib=@var{list}
+Specify search directories for the garbage collector header files and
+libraries. @var{list} is a comma separated list of key value pairs of the
+form @samp{@var{multilibdir}@=@var{path}}, where the default multilib key
+is named as @samp{.} (dot), or is omitted (e.g.
+@samp{--with-target-bdw-gc=/opt/bdw-gc,32=/opt-bdw-gc32}).
+
+The options @option{--with-target-bdw-gc-include} and
+@option{--with-target-bdw-gc-include} must always specified together for
+each multilib variant and take precedence over
+@option{--with-target-bdw-gc-include}.  If none of these options are
+specified, the values are taken from the @command{pkg-config}
+@samp{bdw-gc} module.
+@end table
+
 @html
 <hr />
 <p>
Index: libobjc/Makefile.in
===================================================================
--- libobjc/Makefile.in	(revision 242638)
+++ libobjc/Makefile.in	(working copy)
@@ -47,8 +47,6 @@ 
 
 top_builddir = .
 
--include ../boehm-gc/threads.mk
-
 libdir = $(exec_prefix)/lib
 libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
 
@@ -95,7 +93,7 @@ 
 OBJC_GCFLAGS=@OBJC_GCFLAGS@
 OBJC_BOEHM_GC=@OBJC_BOEHM_GC@
 OBJC_BOEHM_GC_INCLUDES=@OBJC_BOEHM_GC_INCLUDES@
-OBJC_BOEHM_GC_LIBS=../boehm-gc/libgcjgc_convenience.la $(thread_libs_and_flags)
+OBJC_BOEHM_GC_LIBS=@OBJC_BOEHM_GC_LIBS@
 
 INCLUDES = -I$(srcdir)/$(MULTISRCTOP)../gcc \
   -I$(srcdir)/$(MULTISRCTOP)../gcc/config \
Index: libobjc/configure.ac
===================================================================
--- libobjc/configure.ac	(revision 242638)
+++ libobjc/configure.ac	(working copy)
@@ -18,6 +18,8 @@ 
 #along with GCC; see the file COPYING3.  If not see
 #<http://www.gnu.org/licenses/>.
 
+m4_include([../config/pkg.m4])
+
 AC_PREREQ(2.64)
 AC_INIT(package-unused, version-unused,, libobjc)
 AC_CONFIG_SRCDIR([objc/objc.h])
@@ -57,26 +59,6 @@ 
 [version_specific_libs=no])
 AC_MSG_RESULT($version_specific_libs)
 
-AC_ARG_ENABLE(objc-gc,
-[  --enable-objc-gc       enable the use of Boehm's garbage collector with
-                          the GNU Objective-C runtime.],
-[case $enable_objc_gc in
-  no)
-    OBJC_GCFLAGS=''
-    OBJC_BOEHM_GC=''
-    OBJC_BOEHM_GC_INCLUDES=''
-    ;;
-  *)
-    OBJC_GCFLAGS='-DOBJC_WITH_GC=1'
-    OBJC_BOEHM_GC='libobjc_gc$(libsuffix).la'
-    OBJC_BOEHM_GC_INCLUDES='-I$(top_srcdir)/../boehm-gc/include -I../boehm-gc/include'
-    ;;
-esac],
-[OBJC_GCFLAGS=''; OBJC_BOEHM_GC=''; OBJC_BOEHM_GC_INCLUDES=''])
-AC_SUBST(OBJC_GCFLAGS)
-AC_SUBST(OBJC_BOEHM_GC)
-AC_SUBST(OBJC_BOEHM_GC_INCLUDES)
-
 # -----------
 # Directories
 # -----------
@@ -214,6 +196,163 @@ 
 
 gt_BITFIELD_TYPE_MATTERS
 
+# -----------
+# boehm-gc
+# -----------
+
+AC_ARG_ENABLE(objc-gc,
+[AS_HELP_STRING([--enable-objc-gc],
+		[enable use of Boehm's garbage collector with the
+		 GNU Objective-C runtime])])
+AC_ARG_WITH([target-bdw-gc],
+[AS_HELP_STRING([--with-target-bdw-gc=PATHLIST],
+		[specify prefix directory for installed bdw-gc package.
+		 Equivalent to --with-bdw-gc-include=PATH/include
+		 plus --with-bdw-gc-lib=PATH/lib])])
+AC_ARG_WITH([target-bdw-gc-include],
+[AS_HELP_STRING([--with-target-bdw-gc-include=PATHLIST],
+		[specify directories for installed bdw-gc include files])])
+AC_ARG_WITH([target-bdw-gc-lib],
+[AS_HELP_STRING([--with-target-bdw-gc-lib=PATHLIST],
+		[specify directories for installed bdw-gc library])])
+		  
+case "$enable_objc_gc" in
+no)
+  use_bdw_gc=no
+  ;;
+*)
+  AC_MSG_CHECKING([for bdw garbage collector])
+  if test "x$with_target_bdw_gc$with_target_bdw_gc_include$with_target_bdw_gc_lib" = x; then
+    dnl no bdw-gw options, fall back to the bdw-gc pkg-config module
+    PKG_CHECK_EXISTS(bdw-gc,
+      AC_MSG_RESULT([using bdw-gc pkg-config module]),
+      AC_MSG_ERROR([no --with-target-bdw-gc options and no bdw-gc pkg-config module found]))
+  else
+    dnl bdw-gw options, first error checking, complete checking in libobjc
+    if test "x$with_target_bdw_gc_include" = x && test "x$with_target_bdw_gc_lib" != x; then
+      AC_MSG_ERROR([found --with-target-bdw-gc-lib but --with-target-bdw-gc-include missing])
+    elif test "x$with_target_bdw_gc_include" != x && test "x$with_target_bdw_gc_lib" = x; then
+      AC_MSG_ERROR([found --with-target-bdw-gc-include but --with-target-bdw-gc-lib missing])
+    else
+      AC_MSG_RESULT([using paths configured with --with-target-bdw-gc options])
+    fi
+  fi
+  mldir=`${CC-gcc} --print-multi-directory 2>/dev/null`
+  bdw_val=
+  if test "x$with_target_bdw_gc" != x; then
+    for i in `echo $with_target_bdw_gc | tr ',' ' '`; do
+      case "$i" in
+        *=*) sd=${i%%=*}; d=${i#*=} ;;
+        *) sd=.; d=$i ;;
+      esac
+      if test "$mldir" = "$sd"; then
+        bdw_val=$d
+      fi
+    done
+    if test "x$bdw_val" = x; then
+      AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-gc])
+    fi
+    bdw_inc_dir="$bdw_val/include"
+    bdw_lib_dir="$bdw_val/lib"
+  fi
+  bdw_val=
+  if test "x$with_target_bdw_gc_include" != x; then
+    for i in `echo $with_target_bdw_gc_include | tr ',' ' '`; do
+      case "$i" in
+        *=*) sd=${i%%=*}; d=${i#*=} ;;
+        *) sd=.; d=$i ;;
+      esac
+      if test "$mldir" = "$sd"; then
+        bdw_val=$d
+      fi
+    done
+    if test "x$bdw_val" = x; then
+      AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-gc-include])
+    fi
+    bdw_inc_dir="$bdw_val"
+  fi
+  bdw_val=
+  if test "x$with_target_bdw_gc_lib" != x; then
+    for i in `echo $with_target_bdw_gc_lib | tr ',' ' '`; do
+      case "$i" in
+        *=*) sd=${i%%=*}; d=${i#*=} ;;
+        *) sd=.; d=$i ;;
+      esac
+      if test "$mldir" = "$sd"; then
+        bdw_val=$d
+      fi
+    done
+    if test "x$bdw_val" = x; then
+      AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-gc-lib])
+    fi
+    bdw_lib_dir="$bdw_val"
+  fi
+  if test "x$bdw_inc_dir" = x; then
+    AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-gc-include])
+  fi
+  if test "x$bdw_lib_dir" = x; then
+    AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-gc-lib])
+  fi
+  BDW_GC_CFLAGS="-I$bdw_inc_dir"
+  BDW_GC_LIBS="-L$bdw_lib_dir -lgc"
+  AC_MSG_RESULT([found])
+  use_bdw_gc=maybe
+esac
+
+if test "$use_bdw_gc" = maybe; then
+  AC_MSG_CHECKING([for system boehm-gc])
+  save_CFLAGS=$CFLAGS
+  save_LIBS=$LIBS
+  CFLAGS="$CFLAGS $BDW_GC_CFLAGS"
+  LIBS="$LIBS $BDW_GC_LIBS"
+  dnl the link test is not good enough for ARM32 multilib detection,
+  dnl first check to link, then to run
+  AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM([#include <gc/gc.h>],[GC_init()])],
+    [
+      AC_RUN_IFELSE([AC_LANG_SOURCE([[
+        #include <gc/gc.h>
+        int main() {
+          GC_init();
+          return 0;
+        }
+        ]])],
+        [system_bdw_gc_found=yes],
+        [system_bdw_gc_found=no],
+        dnl assume no system boehm-gc for cross builds ...
+        [system_bdw_gc_found=no]
+      )
+    ],
+    [system_bdw_gc_found=no])
+  CFLAGS=$save_CFLAGS
+  LIBS=$save_LIBS
+  if test x$enable_objc_gc = xauto && test x$system_bdw_gc_found = xno; then
+    AC_MSG_WARN([system bdw-gc not found, not building libobjc_gc])
+    use_bdw_gc=no
+  elif test x$enable_objc_gc = xyes && test x$system_bdw_gc_found = xno; then
+    AC_MSG_ERROR([system bdw-gc required but not found])
+  else
+    use_bdw_gc=yes
+    AC_MSG_RESULT([found])
+  fi
+fi
+
+if test "$use_bdw_gc" = no; then
+  OBJC_GCFLAGS=''
+  OBJC_BOEHM_GC=''
+  OBJC_BOEHM_GC_INCLUDES=''
+  OBJC_BOEHM_GC_LIBS=''
+else
+  OBJC_GCFLAGS='-DOBJC_WITH_GC=1'
+  OBJC_BOEHM_GC='libobjc_gc$(libsuffix).la'
+  OBJC_BOEHM_GC_INCLUDES=$BDW_GC_CFLAGS
+  OBJC_BOEHM_GC_LIBS=$BDW_GC_LIBS
+fi
+AC_SUBST(OBJC_GCFLAGS)
+AC_SUBST(OBJC_BOEHM_GC)
+AC_SUBST(OBJC_BOEHM_GC_INCLUDES)
+AC_SUBST(OBJC_BOEHM_GC_LIBS)
+
 # ------
 # Output
 # ------
Index: libobjc/gc.c
===================================================================
--- libobjc/gc.c	(revision 242638)
+++ libobjc/gc.c	(working copy)
@@ -36,7 +36,7 @@ 
 #include "objc/runtime.h"
 #include "objc-private/module-abi-8.h"
 
-#include <gc.h>
+#include <gc/gc.h>
 #include <limits.h>
 
 /* gc_typed.h uses the following but doesn't declare them */
@@ -44,7 +44,7 @@ 
 typedef GC_signed_word signed_word;
 #define BITS_PER_WORD (CHAR_BIT * sizeof (word))
 
-#include <gc_typed.h>
+#include <gc/gc_typed.h>
 
 /* The following functions set up in `mask` the corresponding pointers.
    The offset is incremented with the size of the type.  */
Index: libobjc/memory.c
===================================================================
--- libobjc/memory.c	(revision 242638)
+++ libobjc/memory.c	(working copy)
@@ -41,7 +41,7 @@ 
 #include "objc/runtime.h"
 
 #if OBJC_WITH_GC
-#include <gc.h>
+#include <gc/gc.h>
 
 void *
 objc_malloc (size_t size)
Index: libobjc/objects.c
===================================================================
--- libobjc/objects.c	(revision 242638)
+++ libobjc/objects.c	(working copy)
@@ -31,8 +31,8 @@ 
 #include <string.h>                     /* For memcpy()  */
 
 #if OBJC_WITH_GC
-# include <gc.h>
-# include <gc_typed.h>
+# include <gc/gc.h>
+# include <gc/gc_typed.h>
 #endif
 
 /* FIXME: The semantics of extraBytes are not really clear.  */