From 1e8757ff5758dc530cbcfedeead665411f855771 Mon Sep 17 00:00:00 2001
From: PeiYong Zhang <peiyongz@apache.org>
Date: Tue, 27 Jul 2004 22:06:03 +0000
Subject: [PATCH] build on aix xlC_r v6 with v5 comptiable name mangling scheme

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@175971 13f79535-47bb-0310-9956-ffa450edef68
---
 samples/Makefile.incl      |  8 +++++++-
 samples/runConfigure       |  7 ++++++-
 scripts/packageBinaries.pl | 24 +++++++++++++++++++++---
 src/xercesc/Makefile.incl  |  8 ++++++--
 src/xercesc/runConfigure   |  9 +++++++--
 tests/Makefile.incl        |  8 +++++++-
 tests/runConfigure         |  7 ++++++-
 7 files changed, 60 insertions(+), 11 deletions(-)

diff --git a/samples/Makefile.incl b/samples/Makefile.incl
index 33cbbc7e6..53512d0ad 100644
--- a/samples/Makefile.incl
+++ b/samples/Makefile.incl
@@ -156,7 +156,13 @@ endif
 
 #================= AIX SPECIFIC OPTIONS ===========================
 ifeq (${PLATFORM}, AIX)
-CMP= -c ${CXXFLAGS} -qnotempinc
+
+ifeq (${CXXVER}, v5compat)
+   CMP= -c ${CXXFLAGS} -qnotempinc -qnamemangling=v5   
+else
+   CMP= -c ${CXXFLAGS} -qnotempinc -qnamemangling=ansi
+endif
+
 CC=${COMPILER} -D${PLATFORM}
 LINK =  ${COMPILER} ${LDFLAGS}
 # the compiler knows about this two
diff --git a/samples/runConfigure b/samples/runConfigure
index 2b7b1ff65..0683fd2a3 100755
--- a/samples/runConfigure
+++ b/samples/runConfigure
@@ -90,7 +90,7 @@ platforms"
             [required: no default]"
     echo "       -c <C compiler name> (e.g. gcc, cc, xlc_r, icc or ecc)"
     echo "            [default is make default; cc for gnu make]"
-    echo "       -x <C++ compiler name> (e.g. g++, CC, aCC, aCC05, xlC_r, icc or ecc)"
+    echo "       -x <C++ compiler name> (e.g. g++, CC, aCC, aCC05, xlC_r, xlC_rv5compat, icc or ecc)"
     echo "            [default is make default; g++ for gnu make]"
     echo "       -d (specifies that you want to build debug version) [default: not debug]"
     echo "       -r <thread option> can be 'pthread' or 'dce'
@@ -470,6 +470,11 @@ fi
 # Set the C compiler and C++ compiler environment variables
 #
 case $cppcompiler in
+   xlC_rv5compat)
+      CXX="xlC_r"
+      CXXVER="v5compat"
+      ;;
+      
    xlC* | xlc* | g++ | c++ | cc | CC | aCC | icc | ICC | cxx | ecc)
       CXX="$cppcompiler"      
       ;;
diff --git a/scripts/packageBinaries.pl b/scripts/packageBinaries.pl
index 5cb6acd6f..9b9b991c2 100644
--- a/scripts/packageBinaries.pl
+++ b/scripts/packageBinaries.pl
@@ -497,8 +497,13 @@ if ( ($platform =~ m/AIX/i)      ||
         if ($opt_c eq "") {$opt_c = "xlc_r"; }
         if ($opt_x eq "") {$opt_x = "xlC_r"; }
 
-        $icu_cxxflags = '"-w -O2 -qmaxmem=-1"';
-        $icu_cflags = '"-w -O2 -qmaxmem=-1"';
+        if ($opt_x eq "xlC_rv5compat") {
+            $icu_cxxflags = '"-w -O2 -qmaxmem=-1 -qnamemangling=v5"';
+            $icu_cflags   = '"-w -O2 -qmaxmem=-1 -qnamemangling=v5"';        	
+        } else {
+            $icu_cxxflags = '"-w -O2 -qmaxmem=-1"';
+            $icu_cflags = '"-w -O2 -qmaxmem=-1"';
+        }
 
         if ($opt_m =~ m/icu/i) {
         	$ENV{'LIBPATH'}="$ICUROOT/lib:$XERCESCROOT/lib:$ENV{'LIBPATH'}";
@@ -704,8 +709,21 @@ if ( ($platform =~ m/AIX/i)      ||
                 }
                 else {
                     psystem ("CC=$opt_c CXX=$cXX CXXFLAGS=$icu_cxxflags CFLAGS=$icu_cflags sh ./configure --prefix=$ICUROOT");
-                }                                   
+                }         
+           }elsif ($platform eq 'aix') {
+
+                my $cXX = $opt_x;                 
+                if ($opt_x eq "xlC_rv5compat") {
+                    $cXX = "xlC_r";
+                }
 
+                if ($opt_b eq "32") {
+                    psystem ("CC=$opt_c CXX=$cXX CXXFLAGS=$icu_cxxflags CFLAGS=$icu_cflags sh ./configure --prefix=$ICUROOT --disable-64bit-libs");
+                }
+                else {
+                    psystem ("CC=$opt_c CXX=$cXX CXXFLAGS=$icu_cxxflags CFLAGS=$icu_cflags sh ./configure --prefix=$ICUROOT");
+                }
+                                                    
             } else {
             # set the 32 bit or 64 bit
                 if ($opt_b eq "32") {
diff --git a/src/xercesc/Makefile.incl b/src/xercesc/Makefile.incl
index 82fb9be66..6e52b55af 100644
--- a/src/xercesc/Makefile.incl
+++ b/src/xercesc/Makefile.incl
@@ -253,8 +253,12 @@ ifeq (${MESSAGELOADER}, ICU)
     ALLLIBS = ${LIBS} -L/usr/lpp/xlC/lib -licuuc30 -licudata30 -lXercesMessages25
 endif
 
-PLATFORM_COMPILE_OPTIONS = -qnotempinc -D_THREAD_SAFE
-
+ifeq (${CXXVER}, v5compat)
+   PLATFORM_COMPILE_OPTIONS = -qnotempinc -D_THREAD_SAFE -qnamemangling=v5
+else
+   PLATFORM_COMPILE_OPTIONS = -qnotempinc -D_THREAD_SAFE -qnamemangling=ansi
+endif
+    
 ifeq (${BITSTOBUILD}, 64)
     MAKE_SHARED = makeC++SharedLib_r -p 5000 ${LDFLAGS} -X64
     MAKE_SHARED_C = makeC++SharedLib_r -p 5000 ${LDFLAGS} -X64
diff --git a/src/xercesc/runConfigure b/src/xercesc/runConfigure
index 39b8dc725..2f1e2e647 100755
--- a/src/xercesc/runConfigure
+++ b/src/xercesc/runConfigure
@@ -92,7 +92,7 @@ usage()
             [required; no default]"
     echo "       -c <C compiler name> (e.g. gcc, cc, xlc_r, qcc, icc or ecc) 
             [default is make default; cc for gnu make]"
-    echo "       -x <C++ compiler name> (e.g. g++, CC, aCC, aCC05, xlC_r, QCC, 
+    echo "       -x <C++ compiler name> (e.g. g++, CC, aCC, aCC05, xlC_r, xlC_rv5compat, QCC, 
             icc or ecc) [default is make default; g++ for gnu make]"
     echo "       -d (specifies that you want to build debug version)
             [default: no debug]"
@@ -661,10 +661,15 @@ export NETACCESSOR
 #
 
 case $cppcompiler in
+   xlC_rv5compat)
+      CXX="xlC_r"
+      CXXVER="v5compat"
+      ;;
+      
    xlC* | xlc* | g++ | c++ | cc | CC | aCC | icc | ICC | cxx | ecc | QCC )
       CXX="$cppcompiler"
       ;;
-      
+    
    aCC05)
       CXX="aCC"
       CXXVER="aCC05"
diff --git a/tests/Makefile.incl b/tests/Makefile.incl
index f09d721bf..757a6bae8 100644
--- a/tests/Makefile.incl
+++ b/tests/Makefile.incl
@@ -155,7 +155,13 @@ endif
 
 #================= AIX SPECIFIC OPTIONS ===========================
 ifeq (${PLATFORM}, AIX)
-CMP= -c ${CXXFLAGS} -qnotempinc
+
+ifeq (${CXXVER}, v5compat)
+   CMP= -c ${CXXFLAGS} -qnotempinc -qnamemangling=v5   
+else
+   CMP= -c ${CXXFLAGS} -qnotempinc -qnamemangling=ansi
+endif
+
 CC=${COMPILER} -D${PLATFORM}
 LINK =  ${COMPILER} ${LDFLAGS}
 # the compiler knows about this two
diff --git a/tests/runConfigure b/tests/runConfigure
index b2fda4966..8b4e7b6fa 100755
--- a/tests/runConfigure
+++ b/tests/runConfigure
@@ -89,7 +89,7 @@ usage()
             [required: no default]"
     echo "       -c <C compiler name> (e.g. gcc, cc, xlc_r, icc or ecc)"
     echo "            [default is make default; cc for gnu make]"
-    echo "       -x <C++ compiler name> (e.g. g++, CC, aCC, aCC05, xlC_r, icc or ecc)"
+    echo "       -x <C++ compiler name> (e.g. g++, CC, aCC, aCC05, xlC_r, xlC_rv5compate, icc or ecc)"
     echo "            [default is make default; g++ for gnu make]"
     echo "       -d (specifies that you want to build debug version) [default: not debug]"
     echo "       -r <thread option> can be 'pthread' or 'dce'
@@ -469,6 +469,11 @@ fi
 # Set the C compiler and C++ compiler environment variables
 #
 case $cppcompiler in
+   xlC_rv5compat)
+      CXX="xlC_r"
+      CXXVER="v5compat"
+      ;;
+      
    xlC* | xlc* | g++ | c++ | cc | CC | aCC | icc | ICC | cxx | ecc)
    CXX="$cppcompiler"
       ;;
-- 
GitLab