diff mbox

PATCH RFA: Build system: Check lang_requires_boot_languages

Message ID mcrr5f2mn33.fsf@google.com
State New
Headers show

Commit Message

Ian Lance Taylor Nov. 3, 2010, 3:41 p.m. UTC
This patch adds a new feature to gcc's config-lang.in files: if the
config-lang.in file for language L1 sets lang_requires_boot_languages to
L2, L3, ..., then if L1 is enabled, then L2, L3, ... are automatically
enabled during stage 1.  This is necessary to bootstrap a frontend which
is not written in C.  This feature will be used by the Go frontend when
it is committed.

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

Ian


2010-11-03  Ian Lance Taylor  <iant@google.com>

	* configure.ac: Check for lang_requires_boot_languages in
	config-lang.in files.
	* configure: Rebuild.

Comments

Ralf Wildenhues Nov. 11, 2010, 9:12 p.m. UTC | #1
* Ian Lance Taylor wrote on Wed, Nov 03, 2010 at 04:41:20PM CET:
> This patch adds a new feature to gcc's config-lang.in files: if the
> config-lang.in file for language L1 sets lang_requires_boot_languages to
> L2, L3, ..., then if L1 is enabled, then L2, L3, ... are automatically
> enabled during stage 1.  This is necessary to bootstrap a frontend which
> is not written in C.  This feature will be used by the Go frontend when
> it is committed.
> 
> Bootstrapped on x86_64-unknown-linux-gnu.  OK for mainline?

This patch doesn't seem to be sufficient to me: If I
  configure --enable-languages=go,lto

then that won't add c++ to --enable-languages, only to stage1_languages.
That means libstdc++-v3 won't be built in stage 1, and in stage 2, CXX
will not be set to in-tree g++:

g++ -c -I ../../gccgo/gcc/go -I ../../gccgo/gcc/go/gofrontend -I. -Igo -I../../gccgo/gcc -I../../gccgo/gcc/go  -I../../gccgo/gcc/../include   -I../../gccgo/gcc/../libcpp/include -I../../gccgo/gcc/../libdecnumber -I../../gccgo/gcc/../libdecnumber/bid -I../libdecnumber     -g -O2 -gtoggle -DIN_GCC -DGO_DEBUGGING_INFO -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common -DHAVE_CONFIG_H -g -O2 ../../gccgo/gcc/go/gofrontend/dataflow.cc -o go/dataflow.o
cc1plus: error: unrecognised debug output level "toggle"
../../gccgo/gcc/go/Make-lang.in:157: recipe for target `go/dataflow.o' failed
make[3]: *** [go/dataflow.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory `/tmp/gcc/build-go/gcc'
Makefile:5341: recipe for target `all-stage2-gcc' failed
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/tmp/gcc/build-go'
Makefile:18792: recipe for target `stage2-bubble' failed
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/tmp/gcc/build-go'
Makefile:871: recipe for target `all' failed

This may be an instance of a more general issue: that currently you
cannot have languages built in stage 1 that are not built in later
stages.  However, even if the general issue isn't fixed I think the
logic in the patch should work around it, no?

Thanks,
Ralf

> 2010-11-03  Ian Lance Taylor  <iant@google.com>
> 
> 	* configure.ac: Check for lang_requires_boot_languages in
> 	config-lang.in files.
> 	* configure: Rebuild.

> --- configure.ac	(revision 166249)
> +++ configure.ac	(working copy)
> @@ -1735,9 +1735,11 @@ if test -d ${srcdir}/gcc; then
>        # an apparent bug in bash 1.12 on linux.
>        ${srcdir}/gcc/[[*]]/config-lang.in) ;;
>        *)
> -        # From the config-lang.in, get $language, $lang_requires
> +        # From the config-lang.in, get $language, $lang_requires, and
> +        # $lang_requires_boot_languages.
>          language=
>          lang_requires=
> +        lang_requires_boot_languages=
>          . ${lang_frag}
>          for other in ${lang_requires} ; do
>            case ,${enable_languages}, in
> @@ -1749,6 +1751,22 @@ if test -d ${srcdir}/gcc; then
>  	      ;;
>  	  esac
>          done
> +	for other in ${lang_requires_boot_languages} ; do
> +	  if test "$other" != "c"; then
> +	    case ,${enable_stage1_languages}, in
> +	      *,$other,*) ;;
> +	      *,all,*) ;;
> +	      *)
> +		case ,${enable_languages}, in
> +		  *,$language,*)
> +		    echo " '$other' language required by '$language' in stage 1; enabling" 1>&2
> +		    enable_stage1_languages="$enable_stage1_languages,${other}"
> +		    ;;
> +		esac
> +		;;
> +	    esac
> +          fi
> +        done
>          ;;
>      esac
>    done
diff mbox

Patch

Index: configure.ac
===================================================================
--- configure.ac	(revision 166249)
+++ configure.ac	(working copy)
@@ -1735,9 +1735,11 @@  if test -d ${srcdir}/gcc; then
       # an apparent bug in bash 1.12 on linux.
       ${srcdir}/gcc/[[*]]/config-lang.in) ;;
       *)
-        # From the config-lang.in, get $language, $lang_requires
+        # From the config-lang.in, get $language, $lang_requires, and
+        # $lang_requires_boot_languages.
         language=
         lang_requires=
+        lang_requires_boot_languages=
         . ${lang_frag}
         for other in ${lang_requires} ; do
           case ,${enable_languages}, in
@@ -1749,6 +1751,22 @@  if test -d ${srcdir}/gcc; then
 	      ;;
 	  esac
         done
+	for other in ${lang_requires_boot_languages} ; do
+	  if test "$other" != "c"; then
+	    case ,${enable_stage1_languages}, in
+	      *,$other,*) ;;
+	      *,all,*) ;;
+	      *)
+		case ,${enable_languages}, in
+		  *,$language,*)
+		    echo " '$other' language required by '$language' in stage 1; enabling" 1>&2
+		    enable_stage1_languages="$enable_stage1_languages,${other}"
+		    ;;
+		esac
+		;;
+	    esac
+          fi
+        done
         ;;
     esac
   done