Sun C++ supports two C++ libraries, -library=Cstd (default), and the
newer -library=stlport4. They are incompatible. Therefore, libtool's
use of -lCstd (equivalent to -library=Cstd) should not be assigned to
$postdeps if -library=stlport4 is in CXXFLAGS. Patch attached.

Patch against branch-1-5 and branch-2.0 attached.

2006-07-31  Albert Chin <[EMAIL PROTECTED]>

        * libtool.m4 (AC_LIBTOOL_POSTDEP_PREDEP) [ solaris ]:
        Don't set $postdeps to "-lCstd -lCrun" if
        "-library=stlport4" set in CXXFLAGS as stlport4 C++
        library incompatible with Cstd C++ library. Use
        '-library=Cstd -library=Crun' instead of '-lCstd -lCrun'.

2006-07-31  Albert Chin <[EMAIL PROTECTED]>

        * m4/libtool.m4 (_LT_SYS_HIDDEN_LIBDEPS) [ solaris ]:
        Don't set $postdeps to "-lCstd -lCrun" if
        "-library=stlport4" set in CXXFLAGS as stlport4 C++
        library incompatible with Cstd C++ library. Use
        '-library=Cstd -library=Crun' instead of '-lCstd -lCrun'.

-- 
albert chin ([EMAIL PROTECTED])
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/libtool.m4,v
retrieving revision 1.314.2.160
diff -u -p -r1.314.2.160 libtool.m4
--- libtool.m4  28 Jul 2006 16:57:36 -0000      1.314.2.160
+++ libtool.m4  1 Aug 2006 04:28:45 -0000
@@ -3921,10 +3928,25 @@ linux*)
 solaris*)
   case $cc_basename in
   CC*)
+    # 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.
+    for cc_flag in $CXXFLAGS; do
+      case $cc_flag in
+      *-library=stlport4*)
+       solaris_use_stlport4=yes
+       break
+       ;;
+      esac
+    done
+
     # 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.
-    _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun'
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
     ;;
   esac
   ;;
Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/Attic/libtool.m4,v
retrieving revision 1.125.2.76
diff -u -p -r1.125.2.76 libtool.m4
--- m4/libtool.m4       24 Aug 2005 15:05:20 -0000      1.125.2.76
+++ m4/libtool.m4       1 Aug 2006 04:28:53 -0000
@@ -5919,7 +5919,22 @@ m4_if([$1], [CXX],
 solaris*)
   case $cc_basename in
   CC*)
-    _LT_TAGVAR(postdeps,$1)='-lCstd -lCrun'
+    # 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.
+    for cc_flag in $CXXFLAGS; do
+      case $cc_flag in
+      *-library=stlport4*)
+       solaris_use_stlport4=yes
+       break
+       ;;
+      esac
+    done
+
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
     ;;
   esac
 esac

Reply via email to