* 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
+2017-08-30 Ian Lance Taylor <iant@google.com>
+
+ * 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 <iant@golang.org>
PR go/81548
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
# 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.
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; \
# 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/
# 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)`; \
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/
# 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/
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@
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
@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; \
# 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:
# 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/
# 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)`; \
@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/
# 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/
NET_LIBS
NATIVE_FALSE
NATIVE_TRUE
+GCC_FOR_TARGET
+GOC_FOR_TARGET
GOCFLAGS
GOC
am__fastdepCC_FALSE
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='#'
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.