2007-09-11  Martin Sebor  <sebor@roguewave.com>

	* libc_decl.sh: Merged with r573411 of trunk:
	http://svn.apache.org/viewvc?view=rev&revision=573411.
	* acc.config: Same.


git-svn-id: https://svn.apache.org/repos/asf/incubator/stdcxx/branches/4.2.0@574783 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/etc/config/acc.config b/etc/config/acc.config
index ec58054..1730d4e 100644
--- a/etc/config/acc.config
+++ b/etc/config/acc.config
@@ -4,12 +4,32 @@
 #
 # configuration file for HP aCC on HP-UX
 #
-##############################################################################
+########################################################################
+#
+# Licensed to the Apache Software  Foundation (ASF) under one or more
+# contributor  license agreements.  See  the NOTICE  file distributed
+# with  this  work  for  additional information  regarding  copyright
+# ownership.   The ASF  licenses this  file to  you under  the Apache
+# License, Version  2.0 (the  "License"); you may  not use  this file
+# except in  compliance with the License.   You may obtain  a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the  License is distributed on an  "AS IS" BASIS,
+# WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+# implied.   See  the License  for  the  specific language  governing
+# permissions and limitations under the License.
+#
+# Copyright 1999-2007 Rogue Wave Software, Inc.
+#
+########################################################################
 
 CXX       = aCC
 
 CCVER     := $(shell   $(CXX) -V 2>&1 \
-                     | sed "s/.* \(A\.[0-9][0-9]*\.[0-9][0-9]\) .*/\1/")
+                     | sed "s/.* \(A\.[0-9][0-9]*\.[0-9][0-9]\)[^0-9]*.*/\1/")
 aCC_MAJOR := $(shell echo $(CCVER) | sed "s/[^.]*\.\([0-9]*\)\..*/\1/")
 aCC_MINOR := $(shell echo $(CCVER) | sed "s/[^.]*\.[^.]*\.\([0-9]*\)/\1/")
 
@@ -72,13 +92,16 @@
 # of the respective variables w/o underscores on HP-UX where the latter are
 # used directly by the compiler and linker, respectively
 
-ifeq ($(shell [ $(aCC_MAJOR) -ge 5 ] && echo 1),1)
-#  use -AA with aCC 5 and 6
+# use -AA by default, allow -Aa as an option
+use_Aa := $(filter -Aa,$(_CXXOPTS))
+
+ifneq ($(use_Aa),-Aa)
 CXXFLAGS        = -AA "$$"(_CXXOPTS)
 CXXPRELINK      = 
 CPPFLAGS        = "$$"(_CPPOPTS)
 LDFLAGS         = -AA +nostl -Wl,+s "$$"(_LDOPTS)
 else
+# -Aa was specified in _CXXOPTS
 CXXFLAGS        = -Aa +nostl "$$"(_CXXOPTS)
 CXXPRELINK      = 
 CPPFLAGS        = -I$(TOPDIR)/include/ansi -I/usr/include "$$"(_CPPOPTS)
diff --git a/etc/config/src/libc_decl.sh b/etc/config/src/libc_decl.sh
index e81ec02..a6171ab 100755
--- a/etc/config/src/libc_decl.sh
+++ b/etc/config/src/libc_decl.sh
@@ -20,7 +20,7 @@
 # implied.   See  the License  for  the  specific language  governing
 # permissions and limitations under the License.
 #
-# Copyright 2001-2006 Rogue Wave Software.
+# Copyright 2001-2007 Rogue Wave Software, Inc.
 #
 ##############################################################################
 #
@@ -82,9 +82,13 @@
 if [ "$CXX" = "aCC" ] ; then
 
     cxx_major="`echo $CXX_VER | sed 's/.*\.\([0-9][0-9]*\)\..*/\1/'`"
+    echo $CXXFLAGS | grep '[-]Aa' >/dev/null 2>&1
+    has_Aa=$?
 
-    if [ "$cxx_major" -le "05" ] ; then
-        # prepend -I/usr/include to CXXOPTS for HP aCC on PA but not IPF
+    if [ "$cxx_major" -le "05" -a $has_Aa -eq 0 ] ; then
+        # prepend -I/usr/include to CXXOPTS for HP aCC when the -Aa
+        # command line option is specified (aCC 3 and 5 but not aCC
+        # 6 on IPF)
         CXXFLAGS="$CXXFLAGS -I/usr/include"
     fi