Hello,
if libtool detects Sun C++ compiler in _LT_SYS_HIDDEN_LIBDEPS it
adds '-library=Cstd -library=Crun' to $postdeps. There is an
extra check that prevents this behavior if CXX or CXXFLAGS
contain '-library=stlport4'. The attached patch adds a similar
check for '-library=stdcxx4'. I also noticed that using only
'-library=stlport4' (or '-library=stdcxx4') without
'-library=Crun' doesn't work for me (linkage problems) so I added
them explicitly too.

-- 
Petr Pavlu

>From b99e0557e7bf85dcdadb9290e21d6cea41d78eb8 Mon Sep 17 00:00:00 2001
From: Petr Pavlu <se...@dagobah.cz>
Date: Mon, 21 Mar 2011 21:26:04 +0100
Subject: [PATCH] Don't use Cstd with Sun C++ compiler if stdcxx4 is explicitly 
specified.

* libltdl/m4/libtool.m4 (_LT_SYS_HIDDEN_LIBDEPS): Don't set $postdeps
to '-library=Cstd' if '-library=stdcxx4' is set in CXX or CXXFLAGS as
stdcxx4 C++ library is incompatible with Cstd C++ library. Always use
'-library=Crun'.
---
 ChangeLog             |    8 ++++++++
 libltdl/m4/libtool.m4 |   28 ++++++++++++++++++----------
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4ed09a3..2ca1a23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-03-21  Petr Pavlu  <se...@dagobah.cz>
+
+       Don't use Cstd with Sun C++ compiler if stdcxx4 is explicitly specified.
+       * libltdl/m4/libtool.m4 (_LT_SYS_HIDDEN_LIBDEPS): Don't set $postdeps
+       to '-library=Cstd' if '-library=stdcxx4' is set in CXX or CXXFLAGS as
+       stdcxx4 C++ library is incompatible with Cstd C++ library. Always use
+       '-library=Crun'.
+
 2011-03-14  Ralf Wildenhues  <ralf.wildenh...@gmx.de>
 
        libtoolize: detect -I<dir> (without space) in ACLOCAL_AMFLAGS.
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 5cc027b..3343386 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -7092,17 +7092,21 @@ linux*)
   *Sun\ C*)
     # Sun C++ 5.9
 
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
+    # The more standards-conforming stlport4 and stdcxx4 libraries are
+    # incompatible with the Cstd library. Avoid specifying it if it's in
+    # CXX or CXXFLAGS.
     case " $CXX $CXXFLAGS " in
     *" -library=stlport4 "*)
       solaris_use_stlport4=yes
       ;;
+    *" -library=stdcxx4 "*)
+      solaris_use_stdcxx4=yes
+      ;;
     esac
 
-    if test "$solaris_use_stlport4" != yes; then
+    if test "$solaris_use_stlport4" = yes -o "$solaris_use_stdcxx4" = yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Crun'
+    else
       _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
     fi
     ;;
@@ -7112,20 +7116,24 @@ linux*)
 solaris*)
   case $cc_basename in
   CC* | sunCC*)
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
+    # The more standards-conforming stlport4 and stdcxx4 libraries are
+    # incompatible with the Cstd library. Avoid specifying it if it's in
+    # CXX or CXXFLAGS.
     case " $CXX $CXXFLAGS " in
     *" -library=stlport4 "*)
       solaris_use_stlport4=yes
       ;;
+    *" -library=stdcxx4 "*)
+      solaris_use_stdcxx4=yes
+      ;;
     esac
 
     # Adding this requires a known-good setup of shared libraries for
     # Sun compiler versions before 5.6, else PIC objects from an old
     # archive will be linked into the output, leading to subtle bugs.
-    if test "$solaris_use_stlport4" != yes; then
+    if test "$solaris_use_stlport4" = yes -o "$solaris_use_stdcxx4" = yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Crun'
+    else
       _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
     fi
     ;;
-- 
1.7.4

Reply via email to