diff mbox

[build] Allow building libobjc_gc on Tru64 UNIX, Darwin

Message ID yddbp08lqen.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth April 14, 2011, 5 p.m. UTC
I recently tried to build with --enable-libobjc-gc.  While this worked
out of the box on Solaris, I ran intro trouble on both Tru64 UNIX and
Darwin.

On Tru64 UNIX, one needs to compile with -pthread since the boehm-gc
headers include <pthread.h> which error out if -D_REENTRANT is missing.

On Darwin, the build stops with

make: *** No rule to make target `libobjc_gc.la', needed by `all'.  Stop.

This can be fixed by taking $(libsuffix) into account in OBJC_BOEHM_GC.

The following patch fixes both issues.  It was manually tested by fixing
the Makefile as below and successfully building libobjc_gc.la.  Full
bootstraps on alpha-dec-osf5.1b and i386-apple-darwin9.8.0 are in
progress.

Ok for mainline if both pass?

Btw., it would be considerably easier if --enable-libobjc-gc could be
enabled automatically if boehm-gc is configured.  Besides, it seems that
libobjc_gc isn't tested anywhere.

	Rainer


2011-04-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* Makefile.in (OBJC_GCFLAGS): Move ...
	* configure.ac (enable_objc_gc): ... here.
	Add $(libsuffix) to OBJC_BOEHM_GC.
	* configure: Regenerate.

Comments

Nicola Pero April 14, 2011, 6:55 p.m. UTC | #1
> I recently tried to build with --enable-libobjc-gc.  While this worked
> out of the box on Solaris, I ran intro trouble on both Tru64 UNIX and
> Darwin.
>
> [...]
>
> The following patch fixes both issues. [...]
>
> Ok for mainline if both pass?

Yes.

[and by the way, I think you're fixing PR libobjc/32037 in the process. :-)]

> Btw., it would be considerably easier if --enable-libobjc-gc could be
> enabled automatically if boehm-gc is configured.

Yes.

> Besides, it seems that libobjc_gc isn't tested anywhere.

Yes.

Thanks!
diff mbox

Patch

diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in
--- a/libobjc/Makefile.in
+++ b/libobjc/Makefile.in
@@ -93,7 +93,7 @@  LIBTOOL_INSTALL = $(LIBTOOL) --mode=inst
 LIBTOOL_CLEAN   = $(LIBTOOL) --mode=clean
 #LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
 
-OBJC_GCFLAGS=-DOBJC_WITH_GC=1
+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)
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -1,6 +1,6 @@ 
 # Process this file with autoconf to produce a configure script.
 #   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
-#   2005, 2006, 2009 Free Software Foundation, Inc.
+#   2005, 2006, 2009, 2011 Free Software Foundation, Inc.
 #   Originally contributed by Dave Love (d.love@dl.ac.uk).
 #
 #This file is part of GCC.
@@ -63,15 +63,25 @@  AC_ARG_ENABLE(objc-gc,
                           the GNU Objective-C runtime.],
 [case $enable_objc_gc in
   no)
+    OBJC_GCFLAGS=''
     OBJC_BOEHM_GC=''
     OBJC_BOEHM_GC_INCLUDES=''
     ;;
   *)
-    OBJC_BOEHM_GC=libobjc_gc.la
+    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'
+    case "${host}" in
+      alpha*-dec-osf*)
+        # boehm-gc headers include <pthread.h>, which needs to be compiled
+	# with -pthread on Tru64 UNIX.
+        OBJC_GCFLAGS="${OBJC_GCFLAGS} -pthread"
+	;;
+    esac
     ;;
 esac],
-[OBJC_BOEHM_GC=''; OBJC_BOEHM_GC_INCLUDES=''])
+[OBJC_GCFLAGS=''; OBJC_BOEHM_GC=''; OBJC_BOEHM_GC_INCLUDES=''])
+AC_SUBST(OBJC_GCFLAGS)
 AC_SUBST(OBJC_BOEHM_GC)
 AC_SUBST(OBJC_BOEHM_GC_INCLUDES)