2007-08-24 Andrew Black <ablack@roguewave.com>
STDCXX-470
STDCXX-479
STDCXX-481
* etc/config/src/LIMITS.cpp: Revert
http://svn.apache.org/viewvc?view=rev&revision=554421 ,
accidentally merged to 4.2.0 prematurely as part of
http://svn.apache.org/viewvc?view=rev&revision=569152 .
* GNUmakefile: Deploy
http://svn.apache.org/viewcvs?view=rev&rev=555061 to enable
building with Sun C++ 5.9 (Sun Studio 12).
* etc/config/GNUmakefile.cfg: Ditto.
* etc/config/sunpro.config: Ditto.
* etc/config/makefile.rules: Ditto.
git-svn-id: https://svn.apache.org/repos/asf/incubator/stdcxx/branches/4.2.0@569584 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/GNUmakefile b/GNUmakefile
index c04081a..9f6b44f 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -588,7 +588,10 @@
&& echo "PICFLAGS = $(PICFLAGS)" >> $(MAKEFILE_IN) \
&& echo "CPPFLAGS = $(CPPFLAGS)" >> $(MAKEFILE_IN) \
&& echo "WARNFLAGS = $(WARNFLAGS)" >> $(MAKEFILE_IN) \
- && echo "DEPENDFLAGS = $(DEPENDFLAGS)" >> $(MAKEFILE_IN) \
+ && echo "DEPENDFLAGS = $(DEPENDFLAGS)" >> $(MAKEFILE_IN) \
+ && echo "DEPENDFLAGS.cpp = $(DEPENDFLAGS.cpp)" >> $(MAKEFILE_IN) \
+ && echo "DEPENDFLAGS$(AS_EXT) = $(value DEPENDFLAGS$(AS_EXT))" \
+ >> $(MAKEFILE_IN) \
&& echo "AS_EXT = $(AS_EXT)" >> $(MAKEFILE_IN) \
&& echo "LD = $(LD)" >> $(MAKEFILE_IN) \
&& echo "LDFLAGS = $(LDFLAGS)" >> $(MAKEFILE_IN) \
diff --git a/etc/config/GNUmakefile.cfg b/etc/config/GNUmakefile.cfg
index e5c1f8f..1778bd8 100644
--- a/etc/config/GNUmakefile.cfg
+++ b/etc/config/GNUmakefile.cfg
@@ -145,6 +145,11 @@
# (re)create config.h; do not change timestamp if the new file is the same
# make .o first to make sure the %.o: %.cpp rule gets invoked (make bug?)
# run a configure script as the last step (e.g., to remove unwanted files)
+
+# creates a file named vars.sh, containing shell assignments corresponding
+# to makefile variables defined in $(BUILDDIR)/makefile.in (variables with
+# invalid names (those containing periods) are commented out); vars.sh is
+# used in libc_decl.sh to invoke the compiler and linker
config: clean sane
@([ -f config.h ] && mv config.h config.h.~ ; \
echo "// configured for $(CCNAME) on `uname -sr`" >config.h ; \
@@ -163,6 +168,7 @@
if [ ! -f vars.sh ] ; then \
cat ../makefile.in \
| sed -e "s/= *\([^ ][^ ]* .*\)/=\"\1\"/" \
+ -e "s/^\( *[^=]*\.[^=]*=.*\)/# \1/" \
-e "s/^\([^ ]*\) *= *\(.*\)/\1=\2 ; export \1/" \
-e 's/$$(\([^)]*\))/${\1}/g' >vars.sh ; \
fi ; \
diff --git a/etc/config/makefile.rules b/etc/config/makefile.rules
index 1c41896..e8b4f0d 100644
--- a/etc/config/makefile.rules
+++ b/etc/config/makefile.rules
@@ -119,8 +119,9 @@
PATH=$$PATH:.; \
TOPDIR=$(TOPDIR); \
TMP=$${TMP:-/tmp}/stdcxx-run-$$$$; \
+ TZ=MST+7; \
export TMP; \
- export LD_LIBRARY_PATH PATH TMP TOPDIR; \
+ export LD_LIBRARY_PATH PATH TMP TOPDIR TZ; \
trap "rm -rf $$TMP" HUP INT QUIT TERM EXIT; \
mkdir -p $$TMP; \
./run $(RUNFLAGS) $(RUNTARGET); \
@@ -133,8 +134,9 @@
PATH=$$PATH:$(LIBDIR):.; \
TOPDIR=$(TOPDIR); \
TMP=$${TMP:-/tmp}/stdcxx-run-$$$$; \
+ TZ=MST+7; \
export TMP; \
- export LD_LIBRARY_PATH PATH TMP TOPDIR; \
+ export LD_LIBRARY_PATH PATH TMP TOPDIR TZ; \
trap "rm -rf $$TMP" HUP INT QUIT TERM EXIT; \
mkdir -p $$TMP; \
./run $(RUNFLAGS) $(RUNTARGET); \
@@ -164,8 +166,6 @@
endif # eq ($(findstring clean,$(MAKECMDGOALS)),)
-ifneq ($(DEPENDFLAGS),)
-
# generate dependencies only if they don't yet exist, removing anything
# not under $(TOPDIR) or $(BUILDDIR) (e.g., system headers) from the list
# this is done by splitting up dependencies using tr so that there is just
@@ -186,8 +186,9 @@
s:$$RWTSRCDIR:$$""(TOPDIR)/\.\./rwtest:gp; \
s:$(TOPDIR):$$""(TOPDIR):gp; \
s:$(BUILDDIR):$$""(BUILDDIR):gp" ; \
- \
- $(CXX) $(DEPENDFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \
+ depflags="$(value DEPENDFLAGS$(depsuffix))"; \
+ echo "$(CXX) $$depflags $(CPPFLAGS) $(CXXFLAGS) $<"; \
+ $(CXX) $$depflags $(CPPFLAGS) $(CXXFLAGS) $< \
| sed "$$sedexp1" | tr "@" "\n" | sed -n "$$sedexp2" >$@ ; \
if [ ! -s $@ ]; then \
depfile=$*.u; \
@@ -205,14 +206,36 @@
$(DEPENDDIR):
@[ ! -d $(DEPENDDIR) ] && mkdir -p $(DEPENDDIR)
+
+ifeq ($(DEPENDFLAGS),)
+ # if DEPENDFLAGS is empty or not defined, set it to the concatenation
+ # of the variables specific to each type of a source file
+ DEPENDFLAGS = $(DEPENDFLAGS.cpp) $(value DEPENDFLAGS$(AS_EXT))
+else
+ DEPENDFLAGS.cpp := $(DEPENDFLAGS)
+ DEPENDFLAGS.S := $(DEPENDFLAGS)
+ DEPENDFLAGS.s := $(DEPENDFLAGS)
+endif
+
+ifneq ($(DEPENDFLAGS),)
+
+# set depsuffix to the suffix of the first prerequisite
+$(DEPENDDIR)/%.d: depsuffix = $(suffix $<)
+
+ ifneq ($(DEPENDFLAGS.cpp),)
+
# rule to make dependencies for C++ source files
$(DEPENDDIR)/%.d: %.cpp $(DEPENDDIR)
$(makedep)
+ endif # DEPENDFLAGS.cpp
+ ifneq ($(value DEPENDFLAGS$(AS_EXT)),)
+
# rule to make dependencies for assembly files
$(DEPENDDIR)/%.d: %$(AS_EXT) $(DEPENDDIR)
$(makedep)
+ endif # DEPENDFLAGS.as
else # ifeq ($(DEPENDFLAGS),)
diff --git a/etc/config/src/LIMITS.cpp b/etc/config/src/LIMITS.cpp
index 24961c8..49455fd 100644
--- a/etc/config/src/LIMITS.cpp
+++ b/etc/config/src/LIMITS.cpp
@@ -336,14 +336,14 @@
#ifndef _RWSTD_NO_WCHAR_T
- printf ("#define _RWSTD_WCHAR_SIZE %2u /* sizeof (wchar_t) */\n",
+ printf ("#define _RWSTD_WCHAR_T_SIZE %2u /* sizeof (wchar_t) */\n",
SIZEOF (wchar_t));
const char *suffix = "U";
if ((wchar_t)~0 < (wchar_t)0)
suffix = "";
- MKLIMITS (wchar_t, "WCHAR", suffix, "wchar_t");
+ MKLIMITS (wchar_t, "WCHAR_T", suffix, "wchar_t");
#endif // _RWSTD_NO_WCHAR_T
diff --git a/etc/config/sunpro.config b/etc/config/sunpro.config
index 46a9959..ffa4edd 100644
--- a/etc/config/sunpro.config
+++ b/etc/config/sunpro.config
@@ -10,9 +10,24 @@
# extract the "C++ m.n" substring from version string (whcih changes
# from one release of the compiler to another)
-CCVER := $(shell $(CXX) -V 2>&1 | head -n1 | sed 's/.*C\+\+ *\([^ ]*\).*/\1/')
+CCVER := $(shell $(CXX) -V 2>&1 | head -n1 \
+ | sed 's/.*C\+\+ *\([^ ]*\).*/\1/')
+CCMAJOR := $(shell echo $(CCVER) | cut -f1 -d'.')
+CCMINOR := $(shell echo $(CCVER) | cut -f2 -d'.')
+
+ifeq ($(shell expr $(CCMAJOR) = 5 \& $(CCMINOR) = 9),1)
+ # in Sun C++ 5.9 -xM can only be used with C and C++ files
+ # and it produces the wrong results with .{S,s} files
+ DEPENDFLAGS.cpp = -xM
+
+ # deliberately undefined:
+ # DEPENDFLAGS.S =
+ # DEPENDFLAGS =
+else
+ DEPENDFLAGS = -xM
+endif
+
WARNFLAGS = +w
-DEPENDFLAGS = -xM
PICFLAGS = -KPIC
LDSOFLAGS =
CXXFLAGS = -library=%none
@@ -77,21 +92,38 @@
SINGL_CPPFLAGS =
SINGL_LDFLAGS =
-# (try to) determine the architecture via the (non-standard) -p option
-# recognized on (at least) Linux and Solaris
-arch=$(shell uname -p 2>/dev/null)
+ifeq ($(shell expr $(CCMAJOR) \>= 5 \& $(CCMINOR) \>= 9),1)
-ifeq ($(arch),sparc)
- # wide (64-bit) flags -- must be set explicitly
- # narrow (32-bit) flags are implicit on SPARC
- wide_flags = -xarch=v9
- narrow_flags = -xarch=v8
+ # starting with Sun C++ 5.9, the compiler prefers the generic
+ # -m32 and -m64 options to the architecture specific -xarch
+ # options some of which have been deprecated
+ wide_flags = -m64
+ narrow_flags = -m32
else
- # wide (64-bit) flags -- must be set explicitly
- # narrow (32-bit) flags are implicit on AMD64
- ifeq ($(arch),amd64)
- wide_flags = -xarch=amd64
- narrow_flags =
+ # (try to) determine the architecture via the (non-standard)
+ # -p option recognized on (at least) Linux and Solaris
+ arch := $(shell uname -p 2>/dev/null)
+
+ ifeq ($(arch),sparc)
+ # wide (64-bit) flags -- must be set explicitly
+ # narrow (32-bit) flags are implicit on SPARC
+ wide_flags = -xarch=v9
+ narrow_flags = -xarch=v8
+ else
+ # wide (64-bit) flags -- must be set explicitly
+ # narrow (32-bit) flags are implicit on AMD64
+ ifeq ($(OSNAME),SunOS)
+ # Solaris uname -p prints i386 on AMD64, use the optisa
+ # command to deterrmine "the best" architecture
+ arch := $(shell optisa amd64)
+ endif
+ ifeq ($(arch),amd64)
+ wide_flags = -xarch=amd64
+ narrow_flags = -xarch=386 # the default (same as generic)
+ else
+ wide_flags = -xarch=generic64
+ narrow_flags = -xarch=generic # the default (same as 386)
+ endif
endif
endif