re-expand CXX_FOR_TARGET after libstdc++-v3 is configured

Alexandre Oliva aoliva@redhat.com
Sat Nov 13 20:04:00 GMT 2010


I got a report from RTH and Aldy that libitm (in the
transactional-memory branch) would fail to build at first, but once you
retried, it would succeed.  What's new about libitm is that it expects
CXX to be a functional C++ compiler, with usual C++ headers in place.
Other libraries that require a C++ compiler don't seem to depend on the
C++ headers.

It turns out the problem is that CXX_FOR_TARGET is shell-evaluated and
passed down to sub-makes before libstdc++-v3 is configured, but it can
only get the right -I flags after libstdc++-v3 is configured.  Thus the
first build fails, but the subsequent one overrides the incorrect CXX
settings passed to libitm and it works out in the end.

This patch changes our handling of CXX_FOR_TARGET in two ways:

- before libstdc++-v3 is configured, we add an invalid flag
  (-funconfigured-libstdc++-v3) to CXX_FOR_TARGET, to make sure it isn't
  used (libstdc++-v3 and libjava use RAW_CXX_FOR_TARGET)

- we do *not* pass CXX_FOR_TARGET to a sub-make if its shell expansion
  contains -funconfigured-, so that the Makefile definition prevails and
  gets expanded at every use within the sub-make.  I considered a
  cheaper make test rather than a $(shell) expansion, but it doesn't
  have the desired effect: only the shell knows how to evaluate the
  backticks in CXX_FOR_TARGET, so we end up not ever passing down an
  expansion, because the macro definition contains the -funconfigured-*
  word within backticks.  I guess it would be possible to make it a make
  test, testing for the backticks too, but it's not as robust, and
  probably not worth it.


Here's the patch.  I'll install it soon if there aren't any objections.
Tested on x86_64-linux-gnu.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: toplev-delay-cxx-for-target.patch
Type: text/x-diff
Size: 7620 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101113/86af9c30/attachment.bin>
-------------- next part --------------

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer


More information about the Gcc-patches mailing list