From 1913c1bf5c031fdc5dbdd1ce8e62d4977575a0d6 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 30 Aug 2017 18:27:17 +0000 Subject: [PATCH] configure.ac: Substitute GOC_FOR_TARGET and GCC_FOR_TARGET. * configure.ac: Substitute GOC_FOR_TARGET and GCC_FOR_TARGET. * Makefile.am (MOSTLYCLEANFILES): Add check-gcc. (check-gccgo): Create via a temporary file. (check-gcc): New target. (CHECK_ENV): Set CC. (ECHO_ENV): Report CC. (check-go-tool): Depend on check-gcc. (check-runtime, check-cgo-test, check-carchive-test): Likewise. * configure, Makefile.in: Rebuild. From-SVN: r251540 --- gotools/ChangeLog | 12 ++++++++++++ gotools/Makefile.am | 34 ++++++++++++++++++++++++---------- gotools/Makefile.in | 36 ++++++++++++++++++++++++++---------- gotools/configure | 7 +++++++ gotools/configure.ac | 5 +++++ 5 files changed, 74 insertions(+), 20 deletions(-) diff --git a/gotools/ChangeLog b/gotools/ChangeLog index 18cbf119933..1864293f4c6 100644 --- a/gotools/ChangeLog +++ b/gotools/ChangeLog @@ -1,3 +1,15 @@ +2017-08-30 Ian Lance Taylor + + * configure.ac: Substitute GOC_FOR_TARGET and GCC_FOR_TARGET. + * Makefile.am (MOSTLYCLEANFILES): Add check-gcc. + (check-gccgo): Create via a temporary file. + (check-gcc): New target. + (CHECK_ENV): Set CC. + (ECHO_ENV): Report CC. + (check-go-tool): Depend on check-gcc. + (check-runtime, check-cgo-test, check-carchive-test): Likewise. + * configure, Makefile.in: Rebuild. + 2017-07-26 Ian Lance Taylor PR go/81548 diff --git a/gotools/Makefile.am b/gotools/Makefile.am index b9dced4a5d7..41a2c72dc5b 100644 --- a/gotools/Makefile.am +++ b/gotools/Makefile.am @@ -109,7 +109,8 @@ s-zdefaultcc: Makefile MOSTLYCLEANFILES = \ zdefaultcc.go s-zdefaultcc \ - check-gccgo gotools.head *-testlog gotools.sum gotools.log *.sent + check-gccgo check-gcc gotools.head *-testlog gotools.sum gotools.log \ + *.sent mostlyclean-local: rm -rf check-go-dir check-runtime-dir cgo-test-dir carchive-test-dir @@ -155,11 +156,22 @@ check-head: # check-gccgo is a little shell script that executes gccgo with the # options to pick up the newly built libgo. check-gccgo: Makefile - rm -f $@ - echo "#!/bin/sh" > $@ + rm -f $@ $@.tmp + echo "#!/bin/sh" > $@.tmp abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ - echo "$(GOCOMPILE)" '"$$@"' "-I $${abs_libgodir} -L $${abs_libgodir} -L $${abs_libgodir}/.libs" >> $@ - chmod +x $@ + echo "$(GOCOMPILE)" '"$$@"' "-I $${abs_libgodir} -L $${abs_libgodir} -L $${abs_libgodir}/.libs" >> $@.tmp + chmod +x $@.tmp + mv -f $@.tmp $@ + +# check-gcc is a little shell script that executes the newly built gcc +# with the options to pick up the newly built libgo. +check-gcc: Makefile + rm -f $@ $@.tmp + echo "#!/bin/sh" > $@.tmp + abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ + echo "$(GCC_FOR_TARGET)" '"$$@"' "-L $${abs_libgodir} -L $${abs_libgodir}/.libs" >> $@.tmp + chmod +x $@.tmp + mv -f $@.tmp $@ # CHECK_ENV sets up the environment to run the newly built go tool. # If you change this, change ECHO_ENV, below. @@ -168,6 +180,8 @@ CHECK_ENV = \ export PATH; \ GCCGO="$(abs_builddir)/check-gccgo"; \ export GCCGO; \ + CC="$(abs_builddir)/check-gcc"; \ + export CC; \ GCCGOTOOLDIR="$(abs_builddir)"; \ export GCCGOTOOLDIR; \ GO_TESTING_GOTOOLS=yes; \ @@ -180,10 +194,10 @@ CHECK_ENV = \ # ECHO_ENV is a variant of CHECK_ENV to put into a testlog file. # It assumes that abs_libgodir is set. -ECHO_ENV = PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` GCCGO='$(abs_builddir)/check-gccgo' GCCGOTOOLDIR='$(abs_builddir)' GO_TESTING_GOTOOLS=yes LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` GOROOT=`echo $${abs_libgodir}` +ECHO_ENV = PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` GCCGO='$(abs_builddir)/check-gccgo' CC='$(abs_builddir)/check-gcc' GCCGOTOOLDIR='$(abs_builddir)' GO_TESTING_GOTOOLS=yes LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` GOROOT=`echo $${abs_libgodir}` # check-go-tools runs `go test cmd/go` in our environment. -check-go-tool: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo +check-go-tool: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo check-gcc rm -rf check-go-dir cmd_go-testlog $(MKDIR_P) check-go-dir/src/cmd/go cp $(cmdsrcdir)/go/*.go check-go-dir/src/cmd/go/ @@ -203,7 +217,7 @@ check-go-tool: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo # The runtime package is also tested as part of libgo, # but the runtime tests use the go tool heavily, so testing # here too will catch more problems. -check-runtime: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo +check-runtime: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo check-gcc rm -rf check-runtime-dir runtime-testlog $(MKDIR_P) check-runtime-dir @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ @@ -222,7 +236,7 @@ check-runtime: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' # check-cgo-test runs `go test misc/cgo/test` in our environment. -check-cgo-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo +check-cgo-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo check-gcc rm -rf cgo-test-dir cgo-testlog $(MKDIR_P) cgo-test-dir/misc/cgo cp -r $(libgomiscdir)/cgo/test cgo-test-dir/misc/cgo/ @@ -236,7 +250,7 @@ check-cgo-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo # check-carchive-test runs `go test misc/cgo/testcarchive/carchive_test.go` # in our environment. -check-carchive-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo +check-carchive-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo check-gcc rm -rf carchive-test-dir carchive-testlog $(MKDIR_P) carchive-test-dir/misc/cgo cp -r $(libgomiscdir)/cgo/testcarchive carchive-test-dir/misc/cgo/ diff --git a/gotools/Makefile.in b/gotools/Makefile.in index 9c0084e2e18..148665a46e9 100644 --- a/gotools/Makefile.in +++ b/gotools/Makefile.in @@ -160,8 +160,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EXEEXT = @EXEEXT@ +GCC_FOR_TARGET = @GCC_FOR_TARGET@ GOC = @GOC@ GOCFLAGS = $(CFLAGS_FOR_TARGET) +GOC_FOR_TARGET = @GOC_FOR_TARGET@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -316,7 +318,8 @@ GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)') GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)') MOSTLYCLEANFILES = \ zdefaultcc.go s-zdefaultcc \ - check-gccgo gotools.head *-testlog gotools.sum gotools.log *.sent + check-gccgo check-gcc gotools.head *-testlog gotools.sum gotools.log \ + *.sent # For a native build we build the programs using the newly built libgo @@ -332,6 +335,8 @@ MOSTLYCLEANFILES = \ @NATIVE_TRUE@ export PATH; \ @NATIVE_TRUE@ GCCGO="$(abs_builddir)/check-gccgo"; \ @NATIVE_TRUE@ export GCCGO; \ +@NATIVE_TRUE@ CC="$(abs_builddir)/check-gcc"; \ +@NATIVE_TRUE@ export CC; \ @NATIVE_TRUE@ GCCGOTOOLDIR="$(abs_builddir)"; \ @NATIVE_TRUE@ export GCCGOTOOLDIR; \ @NATIVE_TRUE@ GO_TESTING_GOTOOLS=yes; \ @@ -345,7 +350,7 @@ MOSTLYCLEANFILES = \ # ECHO_ENV is a variant of CHECK_ENV to put into a testlog file. # It assumes that abs_libgodir is set. -@NATIVE_TRUE@ECHO_ENV = PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` GCCGO='$(abs_builddir)/check-gccgo' GCCGOTOOLDIR='$(abs_builddir)' GO_TESTING_GOTOOLS=yes LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` GOROOT=`echo $${abs_libgodir}` +@NATIVE_TRUE@ECHO_ENV = PATH=`echo $(abs_builddir):$${PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` GCCGO='$(abs_builddir)/check-gccgo' CC='$(abs_builddir)/check-gcc' GCCGOTOOLDIR='$(abs_builddir)' GO_TESTING_GOTOOLS=yes LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` GOROOT=`echo $${abs_libgodir}` all: all-am .SUFFIXES: @@ -734,14 +739,25 @@ mostlyclean-local: # check-gccgo is a little shell script that executes gccgo with the # options to pick up the newly built libgo. @NATIVE_TRUE@check-gccgo: Makefile -@NATIVE_TRUE@ rm -f $@ -@NATIVE_TRUE@ echo "#!/bin/sh" > $@ +@NATIVE_TRUE@ rm -f $@ $@.tmp +@NATIVE_TRUE@ echo "#!/bin/sh" > $@.tmp @NATIVE_TRUE@ abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ -@NATIVE_TRUE@ echo "$(GOCOMPILE)" '"$$@"' "-I $${abs_libgodir} -L $${abs_libgodir} -L $${abs_libgodir}/.libs" >> $@ -@NATIVE_TRUE@ chmod +x $@ +@NATIVE_TRUE@ echo "$(GOCOMPILE)" '"$$@"' "-I $${abs_libgodir} -L $${abs_libgodir} -L $${abs_libgodir}/.libs" >> $@.tmp +@NATIVE_TRUE@ chmod +x $@.tmp +@NATIVE_TRUE@ mv -f $@.tmp $@ + +# check-gcc is a little shell script that executes the newly built gcc +# with the options to pick up the newly built libgo. +@NATIVE_TRUE@check-gcc: Makefile +@NATIVE_TRUE@ rm -f $@ $@.tmp +@NATIVE_TRUE@ echo "#!/bin/sh" > $@.tmp +@NATIVE_TRUE@ abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ +@NATIVE_TRUE@ echo "$(GCC_FOR_TARGET)" '"$$@"' "-L $${abs_libgodir} -L $${abs_libgodir}/.libs" >> $@.tmp +@NATIVE_TRUE@ chmod +x $@.tmp +@NATIVE_TRUE@ mv -f $@.tmp $@ # check-go-tools runs `go test cmd/go` in our environment. -@NATIVE_TRUE@check-go-tool: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo +@NATIVE_TRUE@check-go-tool: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo check-gcc @NATIVE_TRUE@ rm -rf check-go-dir cmd_go-testlog @NATIVE_TRUE@ $(MKDIR_P) check-go-dir/src/cmd/go @NATIVE_TRUE@ cp $(cmdsrcdir)/go/*.go check-go-dir/src/cmd/go/ @@ -761,7 +777,7 @@ mostlyclean-local: # The runtime package is also tested as part of libgo, # but the runtime tests use the go tool heavily, so testing # here too will catch more problems. -@NATIVE_TRUE@check-runtime: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo +@NATIVE_TRUE@check-runtime: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo check-gcc @NATIVE_TRUE@ rm -rf check-runtime-dir runtime-testlog @NATIVE_TRUE@ $(MKDIR_P) check-runtime-dir @NATIVE_TRUE@ @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ @@ -780,7 +796,7 @@ mostlyclean-local: @NATIVE_TRUE@ grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' # check-cgo-test runs `go test misc/cgo/test` in our environment. -@NATIVE_TRUE@check-cgo-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo +@NATIVE_TRUE@check-cgo-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo check-gcc @NATIVE_TRUE@ rm -rf cgo-test-dir cgo-testlog @NATIVE_TRUE@ $(MKDIR_P) cgo-test-dir/misc/cgo @NATIVE_TRUE@ cp -r $(libgomiscdir)/cgo/test cgo-test-dir/misc/cgo/ @@ -794,7 +810,7 @@ mostlyclean-local: # check-carchive-test runs `go test misc/cgo/testcarchive/carchive_test.go` # in our environment. -@NATIVE_TRUE@check-carchive-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo +@NATIVE_TRUE@check-carchive-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo check-gcc @NATIVE_TRUE@ rm -rf carchive-test-dir carchive-testlog @NATIVE_TRUE@ $(MKDIR_P) carchive-test-dir/misc/cgo @NATIVE_TRUE@ cp -r $(libgomiscdir)/cgo/testcarchive carchive-test-dir/misc/cgo/ diff --git a/gotools/configure b/gotools/configure index a1addc3b6a9..44e25701bd6 100755 --- a/gotools/configure +++ b/gotools/configure @@ -558,6 +558,8 @@ LIBOBJS NET_LIBS NATIVE_FALSE NATIVE_TRUE +GCC_FOR_TARGET +GOC_FOR_TARGET GOCFLAGS GOC am__fastdepCC_FALSE @@ -3783,6 +3785,11 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu +# These should be defined by the top-level configure. +# Copy them into Makefile. + + + if test "$host_alias" = "$target_alias"; then NATIVE_TRUE= NATIVE_FALSE='#' diff --git a/gotools/configure.ac b/gotools/configure.ac index 81afe9ed886..5b0920448e3 100644 --- a/gotools/configure.ac +++ b/gotools/configure.ac @@ -46,6 +46,11 @@ AC_PROG_INSTALL AC_PROG_CC AC_PROG_GO +# These should be defined by the top-level configure. +# Copy them into Makefile. +AC_SUBST(GOC_FOR_TARGET) +AC_SUBST(GCC_FOR_TARGET) + AM_CONDITIONAL(NATIVE, test "$host_alias" = "$target_alias") dnl Test for -lsocket and -lnsl. Copied from libjava/configure.ac. -- 2.30.2