Author: sebor
Date: Tue Mar  6 18:10:03 2007
New Revision: 515423

URL: http://svn.apache.org/viewvc?view=rev&rev=515423
Log:
2007-03-06  Martin Sebor  <[EMAIL PROTECTED]>

        STDCXX-286
        * vacpp.config (PRELINKFLAGS): Used -qmkshrobj only when building
        a shared library (including a shared archive), and not an ordinary
        archive.
        (DEFAULT_SHROBJ): Set only when using -qmkshrobj.
        (use_tempinc): Removed a temporary file when done.

Modified:
    incubator/stdcxx/trunk/etc/config/vacpp.config

Modified: incubator/stdcxx/trunk/etc/config/vacpp.config
URL: 
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/vacpp.config?view=diff&rev=515423&r1=515422&r2=515423
==============================================================================
--- incubator/stdcxx/trunk/etc/config/vacpp.config (original)
+++ incubator/stdcxx/trunk/etc/config/vacpp.config Tue Mar  6 18:10:03 2007
@@ -1,32 +1,34 @@
+# -*- Makefile -*-
 #
 # $Id$
 #
-# configuration file for xlc on AIX
+# configuration file for IBM VisualAge and XLC++
 #
 ##############################################################################
 
 # see if the xlCcore command exists and use it in preference to xlC
-# xlCcore, available in VAC++ 6.0 patches released since 4/2004,
-# avoids linking with the native C++ Standard Library (see PR #28212)
+# xlCcore, available in VAC++ 6.0 patches released since 4/2004, and
+# later, avoids linking with the native C++ Standard Library
 ifneq ($(shell xlCcore /dev/null >/dev/null 2>&1; echo $$?),127)
     CXX := xlCcore
 
-    shared_archive = $(findstring shared,$(BUILDMODE))_$(findstring 
archive,$(BUILDMODE))
-
-    ifeq ($(shared_archive),shared_archive)
-        rtl_enabled = 0
-    else
-        rtl_enabled  = 1
+    # enable Run-Time Linking for true shared libraries
+    # (i.e., .so's but not AIX shared archives)
+    ifneq (,$(findstring shared,$(BUILDMODE)))
+        ifeq (,$(findstring archive,$(BUILDMODE)))
+            rtl_enabled = 1
+        endif
     endif
 else
     ifeq ($(OSNAME),AIX)
         CXX := xlC
+        # Run-Time Linking not enabled as its known to cause conflicts
+        # with the native VAC++ C++ Standard Library on AIX, libC.a
     else   # assume Linux
         # use xlc on Linux to prevent linking in the native
         # C++ Standard Library (gcc's libstdc++)
         CXX := xlc
     endif
-    rtl_enabled = 0
 endif
 
 # _r suffix links with reentrant versions of system libraries
@@ -69,7 +71,26 @@
 # enable C++ C library headers (the <cname> kind)
 CPPFLAGS        = -I$(TOPDIR)/include/ansi
 
-PRELINKFLAGS    = -qmkshrobj
+
+# use -qmkshrobj with VAC++ 6.0 and prior or when building
+# a shared library (either a shared archive or a .so)
+ifneq (,$(findstring shared,$(BUILDMODE)))
+  shared = 1
+else
+  ifneq (,$(findstring |$(BUILDTYPE)|,|8d|8D|11d|11D|12d|12D|15d|15D|))
+    shared = 1
+  endif
+endif
+
+ifneq ($(shared),)
+  PRELINKFLAGS = -qmkshrobj
+else
+  ifeq ($(shell expr $(CXX_MAJOR) \< 7),1)
+    PRELINKFLAGS = -qmkshrobj
+  endif
+endif
+
+
 LDFLAGS         = $(CPPFLAGS)
 
 ifeq ($(OSNAME),AIX)
@@ -131,8 +152,10 @@
 SHARED_LDFLAGS  =
 
 ifeq ($(rtl_enabled),1)
+  # Run-Time Loadable shared library
   SHARED_SUFFIX = .so
 else
+  # archive or shared archive
   SHARED_SUFFIX = .a
 endif
 
@@ -179,7 +202,9 @@
 
 ifeq ($(OSNAME),AIX)
   # default shared object on AIX (not on Linux)
-  DEFAULT_SHROBJ = shr.o
+  ifneq ($(shared),)
+    DEFAULT_SHROBJ = shr.o
+  endif
 endif
 
 
@@ -187,7 +212,7 @@
 use_tempinc=$(shell    echo "int i;" >/tmp/foo.$$$$.c              \
                     && $(CXX) -c -qmaxerr=1:w -qtemplateregistry   \
                               /tmp/foo.$$$$.c >/dev/null 2>&1;     \
-                    echo $$?)
+                    echo $$?; rm /tmp/foo.$$$$.c)
 
 # template repository/registry name override
 


Reply via email to