===================================================================
@@ -120,6 +120,7 @@ host_modules= { module= lto-plugin; boot
extra_configure_flags='--enable-shared @extra_linker_plugin_flags@ @extra_linker_plugin_configure_flags@';
extra_make_flags='@extra_linker_plugin_flags@'; };
host_modules= { module= libcc1; extra_configure_flags=--enable-shared; };
+host_modules= { module= gotools; };
target_modules = { module= libstdc++-v3;
bootstrap=true;
@@ -363,6 +364,8 @@ dependencies = { module=all-lto-plugin;
dependencies = { module=configure-libcc1; on=configure-gcc; };
dependencies = { module=all-libcc1; on=all-gcc; };
+dependencies = { module=all-gotools; on=all-target-libgo; };
+
dependencies = { module=all-utils; on=all-libiberty; };
dependencies = { module=configure-mpfr; on=all-gmp; };
===================================================================
@@ -140,7 +140,7 @@ host_libs="intl libiberty opcodes bfd re
# binutils, gas and ld appear in that order because it makes sense to run
# "make check" in that particular order.
# If --enable-gold is used, "gold" may replace "ld".
-host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1"
+host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools"
# libgcj represents the runtime libraries only used by gcj.
libgcj="target-libffi \
===================================================================
@@ -29,6 +29,7 @@ language="go"
compilers="go1\$(exeext)"
target_libs="target-libgo target-libffi target-libbacktrace"
+lang_dirs="gotools"
# The Go frontend is written in C++, so we need to build the C++
# compiler during stage 1.
===================================================================
@@ -0,0 +1,114 @@
+# Makefile for gotools
+# Copyright 2015 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+ACLOCAL_AMFLAGS = -I ./config -I ../config
+
+gcc_version := $(shell $(GCC_FOR_TARGET) -dumpversion)
+
+libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
+
+mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
+PWD_COMMAND = $${PWDCMD-pwd}
+STAMP = echo timestamp >
+
+libgodir = ../$(target_noncanonical)/libgo
+LIBGODEP = $(libgodir)/libgo.la
+
+GOCFLAGS = $(CFLAGS_FOR_TARGET)
+GOCOMPILE = $(GOC) $(GOCFLAGS)
+
+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs -static-libgo
+GOLINK = $(GOC) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
+
+cmdsrcdir = $(srcdir)/../libgo/go/cmd
+
+go_cmd_go_files = \
+ $(cmdsrcdir)/go/build.go \
+ $(cmdsrcdir)/go/clean.go \
+ $(cmdsrcdir)/go/main.go \
+ $(cmdsrcdir)/go/signal.go \
+ $(cmdsrcdir)/go/version.go \
+ $(cmdsrcdir)/go/env.go \
+ $(cmdsrcdir)/go/help.go \
+ $(cmdsrcdir)/go/run.go \
+ $(cmdsrcdir)/go/tool.go \
+ $(cmdsrcdir)/go/vet.go \
+ $(cmdsrcdir)/go/context.go \
+ $(cmdsrcdir)/go/fix.go \
+ $(cmdsrcdir)/go/get.go \
+ $(cmdsrcdir)/go/http.go \
+ $(cmdsrcdir)/go/signal_unix.go \
+ $(cmdsrcdir)/go/vcs.go \
+ $(cmdsrcdir)/go/discovery.go \
+ $(cmdsrcdir)/go/fmt.go \
+ $(cmdsrcdir)/go/go11.go \
+ $(cmdsrcdir)/go/list.go \
+ $(cmdsrcdir)/go/pkg.go \
+ $(cmdsrcdir)/go/test.go \
+ $(cmdsrcdir)/go/testflag.go
+
+go_cmd_gofmt_files = \
+ $(cmdsrcdir)/gofmt/doc.go \
+ $(cmdsrcdir)/gofmt/gofmt.go \
+ $(cmdsrcdir)/gofmt/rewrite.go \
+ $(cmdsrcdir)/gofmt/simplify.go
+
+go_cmd_cgo_files = \
+ $(cmdsrcdir)/cgo/ast.go \
+ $(cmdsrcdir)/cgo/doc.go \
+ $(cmdsrcdir)/cgo/gcc.go \
+ $(cmdsrcdir)/cgo/godefs.go \
+ $(cmdsrcdir)/cgo/main.go \
+ $(cmdsrcdir)/cgo/out.go \
+ $(cmdsrcdir)/cgo/util.go
+
+GOC_INSTALL_NAME := $(shell echo gccgo|sed '$(program_transform_name)')
+GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
+GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
+
+zdefaultcc.go: s-zdefaultcc; @true
+s-zdefaultcc: Makefile
+ echo 'package main' > zdefaultcc.go.tmp
+ echo 'const defaultGOC = "$(bindir)/$(GOC_INSTALL_NAME)"' >> zdefaultcc.go.tmp
+ echo 'const defaultCC = "$(bindir)/$(GCC_INSTALL_NAME)"' >> zdefaultcc.go.tmp
+ echo 'const defaultCXX = "$(bindir)/$(GXX_INSTALL_NAME)"' >> zdefaultcc.go.tmp
+ $(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
+ $(STAMP) $@
+
+if NATIVE
+
+# For a native build we build the programs using the newly built libgo
+# and install them as regular programs.
+
+bin_PROGRAMS = go$(EXEEXT) gofmt$(EXEEXT)
+libexecsub_PROGRAMS = cgo$(EXEEXT)
+
+go$(EXEEXT): $(go_cmd_go_files) zdefaultcc.go $(LIBGODEP)
+ $(GOLINK) $(go_cmd_go_files) zdefaultcc.go
+gofmt$(EXEEXT): $(go_cmd_gofmt_files) $(LIBGODEP)
+ $(GOLINK) $(go_cmd_gofmt_files)
+cgo$(EXEEXT): $(go_cmd_cgo_files) zdefaultcc.go $(LIBGODEP)
+ $(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go
+
+else
+
+# For a non-native build we have to build the programs using a
+# previously built host (or build -> host) Go compiler. We should
+# only do this if such a compiler is available. Figure this out
+# later.
+
+endif
===================================================================
@@ -0,0 +1,92 @@
+dnl acinclude.m4 -- configure macros
+
+dnl Copyright 2009 The Go Authors. All rights reserved.
+dnl Use of this source code is governed by a BSD-style
+dnl license that can be found in the LICENSE file.
+
+dnl Go support--this could be in autoconf.
+dnl This version is probably autoconf 2.64 specific.
+
+AC_LANG_DEFINE([Go], [go], [GO], [],
+[ac_ext=go
+ac_compile='$GOC -c $GOCFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
+ac_link='$GOC -o conftest$ac_exeext $GOCFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
+ac_compile_gnu=yes
+])
+
+AU_DEFUN([AC_LANG_GO], [AC_LANG(Go)])
+
+m4_define([AC_LANG_PROGRAM(Go)],
+[package main
+$1
+func main() {
+$2
+}])
+
+m4_define([_AC_LANG_IO_PROGRAM(Go)],
+[AC_LANG_PROGRAM([import "os"],
+[if f, err := os.Create("conftest.out"), err != nil {
+ os.Exit(1);
+ }
+ if err := f.Close(); err != nil {
+ os.Exit(1);
+ }
+ os.Exit(0);
+])])
+
+m4_define([AC_LANG_CALL(Go)],
+[AC_LANG_PROGRAM([$1
+m4_if([$2], [main], ,
+[func $2();])],[$2();])])
+
+m4_define([AC_LANG_FUNC_LINK_TRY(Go)],
+[AC_LANG_PROGRAM(
+[func $1() int;
+var f := $1;
+], [return f();])])
+
+m4_define([AC_LANG_BOOL_COMPILE_TRY(Go)],
+[AC_LANG_PROGRAM([$1], [var test_array @<:@1 - 2 * !($2)@:>@;
+test_array @<:@0@:>@ = 0
+])])
+
+m4_define([AC_LANG_INT_SAVE(Go)],
+[AC_LANG_PROGRAM([$1
+import os
+func longval() long { return $2 }
+func ulongval() ulong { return $2 }],
+[panic("unimplemented")])])
+
+AC_DEFUN([AC_LANG_COMPILER(Go)],
+[AC_REQUIRE([AC_PROG_GO])])
+
+AN_MAKEVAR([GOC], [AC_PROG_GO])
+AN_PROGRAM([gccgo], [AC_PROG_GO])
+AC_DEFUN([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC], [Go compiler command])dnl
+AC_ARG_VAR([GOCFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+m4_ifval([$1],
+ [AC_CHECK_TOOLS(GOC, [$1])],
+[AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [$ac_tool_prefix}gccgo])
+ fi
+fi
+if test -z "$GOC"; then
+ AC_CHECK_PROG(GOC, gccgo, gccgo, , , gccgo)
+fi
+])
+
+# Provide some information about the compiler.
+_AS_ECHO_LOG([checking for _AC_LANG compiler version])
+set X $ac_compile
+ac_compiler=$[2]
+_AC_DO_LIMIT([$ac_compiler --version >&AS_MESSAGE_LOG_FD])
+m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
+m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
+GOCFLAGS="-g -O2"
+AC_LANG_POP(Go)dnl
+])# AC_PROG_GO
===================================================================
@@ -0,0 +1,53 @@
+# Configure script for gotools.
+# Copyright 2015 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+AC_INIT(package-unused, version-unused,, gotools)
+AC_PREREQ(2.64)
+AC_CONFIG_SRCDIR(Makefile.am)
+
+m4_include([config/go.m4])
+
+# Determine the noncanonical names used for directories.
+ACX_NONCANONICAL_BUILD
+ACX_NONCANONICAL_HOST
+ACX_NONCANONICAL_TARGET
+
+dnl Autoconf 2.5x and later will set a default program prefix if
+dnl --target was used, even if it was the same as --host. Disable
+dnl that behavior. This must be done before AC_CANONICAL_SYSTEM
+dnl to take effect.
+test "$host_noncanonical" = "$target_noncanonical" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_transform_name=s,y,y,
+
+AC_CANONICAL_SYSTEM
+AC_ARG_PROGRAM
+
+AM_INIT_AUTOMAKE([1.9.3 no-define foreign no-dist -Wall -Wno-portability])
+AM_MAINTAINER_MODE
+
+AC_PROG_INSTALL
+
+AC_PROG_CC
+AC_PROG_GO
+
+AM_CONDITIONAL(NATIVE, test "$host_noncanonical" = "$target_noncanonical")
+
+AC_CONFIG_FILES(Makefile)
+
+AC_OUTPUT
===================================================================
@@ -0,0 +1,13 @@
+This directory builds tools used by people working in the Go language.
+The source code for these tools lives in libgo/go/cmd, where it is
+copied from the master gofrontend repository. This directory contains
+only the configure/Makefile instructions required to build the tools.
+
+This directory builds two programs for general use: go and gofmt. It
+also builds one program for internal use by the go tool: cgo. For
+more information on these tools see the doc.go files in the relevant
+source code, which can also be seen hosted at golang.org:
+
+http://golang.org/cmd/go
+http://golang.org/cmd/gofmt
+http://golang.org/cmd/cgo