Patchwork [build] Link with libstdc++ for libpwl test (PR bootstrap/48120)

login
register
mail settings
Submitter Rainer Orth
Date March 21, 2011, 11:48 a.m.
Message ID <yddsjugg0e0.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/87751/
State New
Headers show

Comments

Rainer Orth - March 21, 2011, 11:48 a.m.
As reported in the PR, the toplevel configure test for libpwl doesn't
work since it fails to link with libstdc++.  The following patch
corrects this.

There were a couple of issues:

* One cannot use LDFLAGS here since that is passed to $CC before -lpwl,
  which of course fails with a static libpwl.  I'm using LIBS instead.

* It was suggested to add $stage1_libs to LIBS, but I go for -lstdc++
  -lm instead.  I seriously doubt we can make bootstrap work with a
  non-g++ C++ compiler here, especially with Go included which is
  written in C++ itself.  This would mean linking both the foreign C++
  runtime libraries and libstdc++ into the executables, which seems to
  be a recipe for disaster.

This patch allowed a i386-pc-solaris2.11 with ppl/cloog to finish and
all graphite tests passed.

Ok for mainline?

	Rainer


2011-03-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR bootstrap/48120:
	* configure.ac (pwllib): Use LIBS instead of LDFLAGS.
	Add -lstdc++ -lm to LIBS.
	* configure: Regenerate.
Paolo Bonzini - March 21, 2011, 11:51 a.m.
On 03/21/2011 12:48 PM, Rainer Orth wrote:
> As reported in the PR, the toplevel configure test for libpwl doesn't
> work since it fails to link with libstdc++.  The following patch
> corrects this.
>
> There were a couple of issues:
>
> * One cannot use LDFLAGS here since that is passed to $CC before -lpwl,
>    which of course fails with a static libpwl.  I'm using LIBS instead.
>

It's better anyway.

Patch is okay.

Paolo
Rainer Orth - March 21, 2011, 12:40 p.m.
Paolo Bonzini <bonzini@gnu.org> writes:

> On 03/21/2011 12:48 PM, Rainer Orth wrote:
>> As reported in the PR, the toplevel configure test for libpwl doesn't
>> work since it fails to link with libstdc++.  The following patch
>> corrects this.
>>
>> There were a couple of issues:
>>
>> * One cannot use LDFLAGS here since that is passed to $CC before -lpwl,
>>    which of course fails with a static libpwl.  I'm using LIBS instead.
>>
>
> It's better anyway.
>
> Patch is okay.

Thanks, applied.  Should I sync to src, too?

	Rainer
Paolo Bonzini - March 21, 2011, 12:49 p.m.
On 03/21/2011 01:40 PM, Rainer Orth wrote:
> Paolo Bonzini<bonzini@gnu.org>  writes:
>
>> On 03/21/2011 12:48 PM, Rainer Orth wrote:
>>> As reported in the PR, the toplevel configure test for libpwl doesn't
>>> work since it fails to link with libstdc++.  The following patch
>>> corrects this.
>>>
>>> There were a couple of issues:
>>>
>>> * One cannot use LDFLAGS here since that is passed to $CC before -lpwl,
>>>     which of course fails with a static libpwl.  I'm using LIBS instead.
>>>
>>
>> It's better anyway.
>>
>> Patch is okay.
>
> Thanks, applied.  Should I sync to src, too?

Yes, always (except for libiberty/ and include/).

Paolo

Patch

diff -r 3786717045e5 configure.ac
--- a/configure.ac	Sat Mar 19 10:35:20 2011 +0100
+++ b/configure.ac	Sat Mar 19 21:57:26 2011 +0100
@@ -1677,10 +1677,10 @@ 
 
 if test "x$with_ppl" != xno; then
   if test "x$pwllib" = x; then
-    saved_LDFLAGS="$LDFLAGS"
-    LDFLAGS="$LDFLAGS $ppllibs"
-    AC_CHECK_LIB(pwl,PWL_handle_timeout,[pwllib="-lpwl"])
-    LDFLAGS="$saved_LDFLAGS"
+    saved_LIBS="$LIBS"
+    LIBS="$LIBS $ppllibs -lstdc++ -lm"
+    AC_CHECK_LIB(pwl, PWL_handle_timeout, [pwllib="-lpwl"])
+    LIBS="$saved_LIBS"
   fi
 
   ppllibs="$ppllibs -lppl_c -lppl $pwllib -lgmpxx"