Patchwork PATCH RFA: Build system: Check lang_requires_boot_languages

login
register
mail settings
Submitter Ian Taylor
Date Nov. 12, 2010, 11:05 p.m.
Message ID <mcrbp5ujg7n.fsf@google.com>
Download mbox | patch
Permalink /patch/71029/
State New
Headers show

Comments

Ian Taylor - Nov. 12, 2010, 11:05 p.m.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:

> * 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++:

Good point.  Thanks.  I applied the obvious fix, as follows.

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

Ian


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

	* configure.ac: Check for lang_requires_boot_languages in
	config-lang.in files.
	* configure: Rebuild.
Ralf Wildenhues - Nov. 14, 2010, 4:06 p.m.
* Ian Lance Taylor wrote on Sat, Nov 13, 2010 at 12:05:16AM CET:
> Ralf Wildenhues writes:
> > 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++:
> 
> Good point.  Thanks.  I applied the obvious fix, as follows.

If that fixes it then the patch looks good to me.  Cannot approve it yet
though.

Thanks,
Ralf

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

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

> --- configure.ac	(revision 166677)
> +++ configure.ac	(working copy)
> @@ -1706,11 +1706,13 @@ 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
> +        for other in ${lang_requires} ${lang_requires_boot_languages}; do
>            case ,${enable_languages}, in
>  	    *,$other,*) ;;
>  	    *,all,*) ;;
> @@ -1720,6 +1722,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

Patch

Index: configure.ac
===================================================================
--- configure.ac	(revision 166677)
+++ configure.ac	(working copy)
@@ -1706,11 +1706,13 @@  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
+        for other in ${lang_requires} ${lang_requires_boot_languages}; do
           case ,${enable_languages}, in
 	    *,$other,*) ;;
 	    *,all,*) ;;
@@ -1720,6 +1722,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