Patchwork PATCH RFA: Add Go support to top level configure and Makefiles

login
register
mail settings
Submitter Ian Taylor
Date Nov. 18, 2010, 9:33 p.m.
Message ID <mcrpqu2pb9t.fsf@google.com>
Download mbox | patch
Permalink /patch/72150/
State New
Headers show

Comments

Ian Taylor - Nov. 18, 2010, 9:33 p.m.
This patch adds Go support to the top level configure.ac and
Makefile.tpl/Makefile.def.  The Go support isn't actually committed yet;
this is just in preparation.  Since the directories are not present this
will have no particular effect, just as if one downloaded the gcc-core
tarball without additional language support.

Bootstrapped and tested on x86_64-unknown-linux-gnu.  OK for mainline?

Ian


2010-11-18  Ian Lance Taylor  <iant@google.com>
	    Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* configure.ac: Add target-libgo to target_libraries.  Set
	and substitute GOC_FOR_BUILD and GOC_FOR_TARGET.  If we are building
	target-libgo, build target-libffi.
	* Makefile.tpl (BUILD_EXPORTS): Add GOC and GOCFLAGS.
	(HOST_EXPORTS): Add GOC.
	(BASE_TARGET_EXPORTS): Add GOC.
	(GOC_FOR_BUILD, GOCFLAGS, GOC_FOR_TARGET): New variables.
	(GOCFLAGS_FOR_TARGET): New variable.
	(EXTRA_HOST_FLAGS): Add GOC.
	(EXTRA_TARGET_FLAGS): Add GOC and GOCFLAGS.
	* Makefile.def (target_modules): Add libgo.
	(flags_to_pass): Add GOC_FOR_TARGET and GOCFLAGS_FOR_TARGET.
	(dependencies): Add dependency from configure-target-libgo to
	configure-target-libffi and all-target-libstdc++-v3.  Add
	dependencies from all-target-libgo to all-target-libffi.
	(languages): Add go.
	* configure: Rebuild.
	* Makefile.in: Rebuild.
Ralf Wildenhues - Nov. 19, 2010, 8:14 p.m.
* Ian Lance Taylor wrote on Thu, Nov 18, 2010 at 10:33:34PM CET:
> This patch adds Go support to the top level configure.ac and
> Makefile.tpl/Makefile.def.  The Go support isn't actually committed yet;
> this is just in preparation.  Since the directories are not present this
> will have no particular effect, just as if one downloaded the gcc-core
> tarball without additional language support.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu.  OK for mainline?

This patch looks straight-forward with the exception of one hunk, see
below.

Thanks,
Ralf

> 2010-11-18  Ian Lance Taylor  <iant@google.com>
> 	    Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
> 
> 	* configure.ac: Add target-libgo to target_libraries.  Set
> 	and substitute GOC_FOR_BUILD and GOC_FOR_TARGET.  If we are building
> 	target-libgo, build target-libffi.
> 	* Makefile.tpl (BUILD_EXPORTS): Add GOC and GOCFLAGS.
> 	(HOST_EXPORTS): Add GOC.
> 	(BASE_TARGET_EXPORTS): Add GOC.
> 	(GOC_FOR_BUILD, GOCFLAGS, GOC_FOR_TARGET): New variables.
> 	(GOCFLAGS_FOR_TARGET): New variable.
> 	(EXTRA_HOST_FLAGS): Add GOC.
> 	(EXTRA_TARGET_FLAGS): Add GOC and GOCFLAGS.
> 	* Makefile.def (target_modules): Add libgo.
> 	(flags_to_pass): Add GOC_FOR_TARGET and GOCFLAGS_FOR_TARGET.
> 	(dependencies): Add dependency from configure-target-libgo to
> 	configure-target-libffi and all-target-libstdc++-v3.  Add
> 	dependencies from all-target-libgo to all-target-libffi.
> 	(languages): Add go.
> 	* configure: Rebuild.
> 	* Makefile.in: Rebuild.

> --- configure.ac	(revision 166919)
> +++ configure.ac	(working copy)

> @@ -1990,6 +1993,14 @@ for dir in . $skipdirs $noconfigdirs ; d
>    fi
>  done
>  
> +# If target-libgo is in $target_configdirs, then put target-libffi in
> +# there too.  It may have been removed because it is currently treated
> +# as a Java target library.
> +if echo " ${target_configdirs} " | grep " target-libgo " >/dev/null 2>&1 \
> +   && test -f $srcdir/libgo/configure -a -f $srcdir/libffi/configure; then

Prefer '&& test' instead of -a.

Conceptually, this code is the wrong thing to do: it should not happen
after the $skipdirs and $noconfigdirs elimination.  That may not have
any impact on the systems that gccgo currently works on, but the code
might be ported; and the snippet may set a precedent for other code.

I think the logic could come shortly before the noconfigdirs
elimination.


Aside, I see that libgo/configure handles --disable-libffi.  Since this
option is also used at the toplevel to disable the libffi target
directories, that seems to imply that, if used, it is always an in-tree
libffi that is used.  Is that correct?

> +  target_configdirs="${target_configdirs} target-libffi"
> +fi
> +
>  # Sometimes the tools are distributed with libiberty but with no other
>  # libraries.  In that case, we don't want to build target-libiberty.
>  # Don't let libgcc imply libiberty either.

Patch

Index: configure.ac
===================================================================
--- configure.ac	(revision 166919)
+++ configure.ac	(working copy)
@@ -200,7 +200,8 @@  target_libraries="target-libgcc \
 		target-boehm-gc \
 		${libgcj} \
 		target-libobjc \
-		target-libada"
+		target-libada \
+		target-libgo"
 
 # these tools are built using the target libraries, and are intended to
 # run only in the target environment
@@ -1209,6 +1210,7 @@  if test "${build}" != "${host}" ; then
   CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
   GCJ_FOR_BUILD=${GCJ_FOR_BUILD-gcj}
   GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
+  GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
   DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool}
   LD_FOR_BUILD=${LD_FOR_BUILD-ld}
   NM_FOR_BUILD=${NM_FOR_BUILD-nm}
@@ -1222,6 +1224,7 @@  else
   CXX_FOR_BUILD="\$(CXX)"
   GCJ_FOR_BUILD="\$(GCJ)"
   GFORTRAN_FOR_BUILD="\$(GFORTRAN)"
+  GOC_FOR_BUILD="\$(GOC)"
   DLLTOOL_FOR_BUILD="\$(DLLTOOL)"
   LD_FOR_BUILD="\$(LD)"
   NM_FOR_BUILD="\$(NM)"
@@ -1990,6 +1993,14 @@  for dir in . $skipdirs $noconfigdirs ; d
   fi
 done
 
+# If target-libgo is in $target_configdirs, then put target-libffi in
+# there too.  It may have been removed because it is currently treated
+# as a Java target library.
+if echo " ${target_configdirs} " | grep " target-libgo " >/dev/null 2>&1 \
+   && test -f $srcdir/libgo/configure -a -f $srcdir/libffi/configure; then
+  target_configdirs="${target_configdirs} target-libffi"
+fi
+
 # Sometimes the tools are distributed with libiberty but with no other
 # libraries.  In that case, we don't want to build target-libiberty.
 # Don't let libgcc imply libiberty either.
@@ -3052,6 +3063,7 @@  AC_SUBST(CXX_FOR_BUILD)
 AC_SUBST(DLLTOOL_FOR_BUILD)
 AC_SUBST(GCJ_FOR_BUILD)
 AC_SUBST(GFORTRAN_FOR_BUILD)
+AC_SUBST(GOC_FOR_BUILD)
 AC_SUBST(LDFLAGS_FOR_BUILD)
 AC_SUBST(LD_FOR_BUILD)
 AC_SUBST(NM_FOR_BUILD)
@@ -3162,6 +3174,7 @@  NCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TA
 NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET})
 NCN_STRICT_CHECK_TARGET_TOOLS(GCJ_FOR_TARGET, gcj)
 NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran)
+NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo)
 
 ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
 ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
@@ -3192,6 +3205,8 @@  GCC_TARGET_TOOL(gcj, GCJ_FOR_TARGET, GCJ
 		[gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc/], java)
 GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN,
 		[gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran)
+GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC,
+		[gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go)
 GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
 GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
 GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
Index: Makefile.tpl
===================================================================
--- Makefile.tpl	(revision 166919)
+++ Makefile.tpl	(working copy)
@@ -160,6 +160,8 @@  BUILD_EXPORTS = \
 	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
 	GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \
 	GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
+	GOC="$(GOC_FOR_BUILD)"; export GOC; \
+	GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
 	DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
 	LD="$(LD_FOR_BUILD)"; export LD; \
 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
@@ -196,6 +198,7 @@  HOST_EXPORTS = \
 	CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
 	GCJ="$(GCJ)"; export GCJ; \
 	GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
+	GOC="$(GOC)"; export GOC; \
 	AR="$(AR)"; export AR; \
 	AS="$(AS)"; export AS; \
 	CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
@@ -276,6 +279,7 @@  BASE_TARGET_EXPORTS = \
 	CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
 	GCJ="$(GCJ_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GCJ; \
 	GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
+	GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
 	DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
 	LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
 	LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
@@ -342,6 +346,7 @@  CXX_FOR_BUILD = @CXX_FOR_BUILD@
 DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
 GCJ_FOR_BUILD = @GCJ_FOR_BUILD@
 GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
+GOC_FOR_BUILD = @GOC_FOR_BUILD@
 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
 LD_FOR_BUILD = @LD_FOR_BUILD@
 NM_FOR_BUILD = @NM_FOR_BUILD@
@@ -404,6 +409,7 @@  LDFLAGS = @LDFLAGS@
 LIBCFLAGS = $(CFLAGS)
 CXXFLAGS = @CXXFLAGS@
 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
+GOCFLAGS = $(CFLAGS)
 
 TFLAGS =
 
@@ -469,6 +475,7 @@  CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_
 RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@
 GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@
 GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
+GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
 LD_FOR_TARGET=@LD_FOR_TARGET@
 
@@ -490,6 +497,7 @@  CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARG
 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
 LDFLAGS_FOR_TARGET = 
+GOCFLAGS_FOR_TARGET = -O2 -g
 
 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
@@ -567,6 +575,7 @@  EXTRA_HOST_FLAGS = \
 	'DLLTOOL=$(DLLTOOL)' \
 	'GCJ=$(GCJ)' \
 	'GFORTRAN=$(GFORTRAN)' \
+	'GOC=$(GOC)' \
 	'LD=$(LD)' \
 	'LIPO=$(LIPO)' \
 	'NM=$(NM)' \
@@ -615,6 +624,8 @@  EXTRA_TARGET_FLAGS = \
 	'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
 	'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
 	'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+	'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+	'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
 	'LD=$(COMPILER_LD_FOR_TARGET)' \
 	'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
 	'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
Index: Makefile.def
===================================================================
--- Makefile.def	(revision 166919)
+++ Makefile.def	(working copy)
@@ -158,6 +158,7 @@  target_modules = { module= libgcc; boots
 target_modules = { module= libquadmath; };
 target_modules = { module= libgfortran; };
 target_modules = { module= libobjc; };
+target_modules = { module= libgo; };
 target_modules = { module= libtermcap; no_check=true;
                    missing=mostlyclean;
                    missing=clean;
@@ -287,6 +288,8 @@  flags_to_pass = { flag= DLLTOOL_FOR_TARG
 flags_to_pass = { flag= FLAGS_FOR_TARGET ; };
 flags_to_pass = { flag= GCJ_FOR_TARGET ; };
 flags_to_pass = { flag= GFORTRAN_FOR_TARGET ; };
+flags_to_pass = { flag= GOC_FOR_TARGET ; };
+flags_to_pass = { flag= GOCFLAGS_FOR_TARGET ; };
 flags_to_pass = { flag= LD_FOR_TARGET ; };
 flags_to_pass = { flag= LIPO_FOR_TARGET ; };
 flags_to_pass = { flag= LDFLAGS_FOR_TARGET ; };
@@ -539,6 +542,9 @@  dependencies = { module=configure-target
 dependencies = { module=configure-target-fastjar; on=configure-target-zlib; };
 dependencies = { module=all-target-fastjar; on=all-target-zlib; };
 dependencies = { module=all-target-fastjar; on=all-target-libiberty; };
+dependencies = { module=configure-target-libgo; on=configure-target-libffi; };
+dependencies = { module=configure-target-libgo; on=all-target-libstdc++-v3; };
+dependencies = { module=all-target-libgo; on=all-target-libffi; };
 dependencies = { module=configure-target-libjava; on=configure-target-zlib; };
 dependencies = { module=configure-target-libjava; on=configure-target-boehm-gc; };
 dependencies = { module=configure-target-libjava; on=configure-target-qthreads; };
@@ -587,6 +593,8 @@  languages = { language=ada;	gcc-check-ta
 languages = { language=objc;	gcc-check-target=check-objc;
 				lib-check-target=check-target-libobjc; };
 languages = { language=obj-c++;	gcc-check-target=check-obj-c++; };
+languages = { language=go;	gcc-check-target=check-go;
+				lib-check-target=check-target-libgo; };
 
 // Toplevel bootstrap
 bootstrap_stage = { id=1 ; };