diff mbox

PATCH RFA: Fix --enable-build-with-cxx

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

Commit Message

Ian Lance Taylor Nov. 12, 2010, 6:18 p.m. UTC
The only current problem with the default languages with
--enable-build-with-cxx is in libcpp.  Back in 2009-07-17
libcpp/configure.ac picked up a test which switches AC_LANG based on
--enable-build-with-cxx.  That seems superficially desirable but
autoconf does not actually support conditionally changing AC_LANG.  With
a small bit of care, changing AC_LANG is unnecessary when switching
between C and C++.  Note in particular that gcc/configure.ac does not do
it.

This patch removes the switch of AC_LANG in libcpp/configure.ac, and
adds AC_USE_SYSTEM_EXTENSIONS which eliminates some relevant differences
between the C and C++ header files when using glibc.  This fixes
--enable-build-with-cxx.

Bootstrapped on x86_64-unknown-linux-gnu with and without
--enable-build-with-cxx.  OK for mainline?

Ian


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

	* configure.ac: Use AC_USE_SYSTEM_EXTENSIONS.  Remove switch of
	AC_LANG based on ENABLE_BUILD_WITH_CXX.

Comments

Diego Novillo Nov. 12, 2010, 6:21 p.m. UTC | #1
On Fri, Nov 12, 2010 at 13:18, Ian Lance Taylor <iant@google.com> wrote:

> Bootstrapped on x86_64-unknown-linux-gnu with and without
> --enable-build-with-cxx.  OK for mainline?

I'll defer to our build maintainers to review this, but after this
goes in could we make --enable-build-with-cxx the default?


Diego.
Diego Novillo Nov. 12, 2010, 6:24 p.m. UTC | #2
On Fri, Nov 12, 2010 at 13:21, Diego Novillo <dnovillo@google.com> wrote:
> On Fri, Nov 12, 2010 at 13:18, Ian Lance Taylor <iant@google.com> wrote:
>
>> Bootstrapped on x86_64-unknown-linux-gnu with and without
>> --enable-build-with-cxx.  OK for mainline?
>
> I'll defer to our build maintainers to review this, but after this
> goes in could we make --enable-build-with-cxx the default?

I implied doing this for next stage 1.  Sorry I wasn't clear.


Diego.
Eric Botcazou Nov. 12, 2010, 6:25 p.m. UTC | #3
> I'll defer to our build maintainers to review this, but after this
> goes in could we make --enable-build-with-cxx the default?

This will break Ada though, see PR ada/44431.
Alexandre Oliva Nov. 13, 2010, 7:47 p.m. UTC | #4
On Nov 12, 2010, Ian Lance Taylor <iant@google.com> wrote:

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

> 	* configure.ac: Use AC_USE_SYSTEM_EXTENSIONS.  Remove switch of
> 	AC_LANG based on ENABLE_BUILD_WITH_CXX.

Ok, thanks!
Laurent GUERBY Nov. 15, 2010, 6:17 p.m. UTC | #5
On Fri, 2010-11-12 at 19:25 +0100, Eric Botcazou wrote:
> > I'll defer to our build maintainers to review this, but after this
> > goes in could we make --enable-build-with-cxx the default?
> 
> This will break Ada though, see PR ada/44431.  

I've added Arnaud in the loop.

Laurent
Ian Lance Taylor Nov. 15, 2010, 7:05 p.m. UTC | #6
Eric Botcazou <ebotcazou@adacore.com> writes:

>> I'll defer to our build maintainers to review this, but after this
>> goes in could we make --enable-build-with-cxx the default?
>
> This will break Ada though, see PR ada/44431.  

I want to make clear to all that my proposed patch, still awaiting
review, will not break Ada.

Eric is saying that making --enable-build-with-cxx the default will
break Ada.  That is independent of my proposed patch.

Ian
Mark Mitchell Nov. 15, 2010, 7:53 p.m. UTC | #7
On 11/12/2010 10:24 AM, Diego Novillo wrote:

>> I'll defer to our build maintainers to review this, but after this
>> goes in could we make --enable-build-with-cxx the default?
> 
> I implied doing this for next stage 1. 

It's definitely time to do this.  We've debated it for years, reached a
consensus (not without some dissent, but a consensus none-the-less).
So, in GCC 4.6, Stage 1, let's flip the switch; the obvious patch is
pre-approved.

Thank you,
Arnaud Charlet Nov. 15, 2010, 9:56 p.m. UTC | #8
> > > I'll defer to our build maintainers to review this, but after this
> > > goes in could we make --enable-build-with-cxx the default?
> > 
> > This will break Ada though, see PR ada/44431.  
> 
> I've added Arnaud in the loop.

I'd suggest always using the C compiler for now to build GNAT, that should
solve the issue of enabling --enable-build-with-cxx without having to modify
any C file (only some Makefile changes).

Since we require an older GNAT to bootstrap GNAT anyway, and GNAT always comes
with a C compiler, that would not add any extra requirement.

Arno
Richard Biener Nov. 15, 2010, 10:01 p.m. UTC | #9
On Mon, Nov 15, 2010 at 8:53 PM, Mark Mitchell <mark@codesourcery.com> wrote:
> On 11/12/2010 10:24 AM, Diego Novillo wrote:
>
>>> I'll defer to our build maintainers to review this, but after this
>>> goes in could we make --enable-build-with-cxx the default?
>>
>> I implied doing this for next stage 1.
>
> It's definitely time to do this.  We've debated it for years, reached a
> consensus (not without some dissent, but a consensus none-the-less).
> So, in GCC 4.6, Stage 1, let's flip the switch; the obvious patch is
> pre-approved.

Btw., I suggested earlier that an intermediate step to not break C++ build
and to excercise the various problems with installing and testing with
C++ built GCC without at the same time requiring a C++ host compiler
would be to build stage1 with a C compiler and stage2 and stage3 with
GCC as C++ compiler.  That will also keep us stay in the C/C++ intersection
until a useful use of C++ comes up (one might argue that building stage1
with C++ and stage2 and stage3 with C avoids regressions because of the
use of C++ of course).

Richard.

> Thank you,
>
> --
> Mark Mitchell
> CodeSourcery
> mark@codesourcery.com
> (650) 331-3385 x713
>
Mark Mitchell Nov. 15, 2010, 10:31 p.m. UTC | #10
On 11/15/2010 2:01 PM, Richard Guenther wrote:

> Btw., I suggested earlier that an intermediate step to not break C++ build
> and to excercise the various problems with installing and testing with
> C++ built GCC without at the same time requiring a C++ host compiler
> would be to build stage1 with a C compiler and stage2 and stage3 with
> GCC as C++ compiler.

That's a clever idea, but I think we should just bite the bullet.  Do
you see a need to do it in this way?  We're talking about developers of
GCC here, not end-users.

Thanks,
Richard Biener Nov. 15, 2010, 10:39 p.m. UTC | #11
On Mon, Nov 15, 2010 at 11:31 PM, Mark Mitchell <mark@codesourcery.com> wrote:
> On 11/15/2010 2:01 PM, Richard Guenther wrote:
>
>> Btw., I suggested earlier that an intermediate step to not break C++ build
>> and to excercise the various problems with installing and testing with
>> C++ built GCC without at the same time requiring a C++ host compiler
>> would be to build stage1 with a C compiler and stage2 and stage3 with
>> GCC as C++ compiler.
>
> That's a clever idea, but I think we should just bite the bullet.  Do
> you see a need to do it in this way?  We're talking about developers of
> GCC here, not end-users.

I was thinking that keeping the C host compiler would make the switch
possible during this stage3 (there were only very recent reports of fails
to use other than GCC host C++ compilers).  It basically decouples the
host compiler issue from all the rest.  And it would make sure that for
the next few month a bootstrap with C++ is actually possible, so patches
for 4.7 could be developed with the possible use of C++ in mind.

Thanks,
Richard.

> Thanks,
>
> --
> Mark Mitchell
> CodeSourcery
> mark@codesourcery.com
> (650) 331-3385 x713
>
Mark Mitchell Nov. 15, 2010, 10:42 p.m. UTC | #12
On 11/15/2010 2:39 PM, Richard Guenther wrote:

> I was thinking that keeping the C host compiler would make the switch
> possible during this stage3 (there were only very recent reports of fails
> to use other than GCC host C++ compilers). 

OK, I think that's plausible -- you're basically suggesting a more
aggressive timetable than I was.  This is a bit of a stretch for Stage
3, but we could try it, and fall back if it blows up.

Thanks,
diff mbox

Patch

Index: configure.ac
===================================================================
--- configure.ac	(revision 166441)
+++ configure.ac	(working copy)
@@ -14,6 +14,7 @@  AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_RANLIB
 
+AC_USE_SYSTEM_EXTENSIONS
 AC_SYS_LARGEFILE
 
 # See if we are building gcc with C++.
@@ -58,18 +59,8 @@  fi
 AC_HEADER_TIME
 ACX_HEADER_STRING
 
-# AC_CHECK_HEADERS is repeated to work around apparent autoconf 2.59 bug.  If
-# AC_CHECK_HEADERS comes after the if clause, the last AC_LANG call gets used,
-# no matter which branch is taken.
-if test "$ENABLE_BUILD_WITH_CXX" = "no"; then
-   AC_LANG(C)
-   AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \
+AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \
 	stdlib.h strings.h string.h sys/file.h unistd.h)
-else
-   AC_LANG(C++)
-   AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \
-	stdlib.h strings.h string.h sys/stat.h sys/file.h unistd.h)
-fi
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_BIGENDIAN