From d522f048c887deb30df4dee2afccd340c5320b76 Mon Sep 17 00:00:00 2001 From: Ginn Chen Date: Mon, 9 Feb 2009 14:21:09 +0800 Subject: [PATCH] Bug 476448 -KPIC is obsolete in Sun Studio 12 SPARC r=jim --- config/autoconf.mk.in | 4 +++ config/rules.mk | 6 ++-- configure.in | 69 ++++++++++++++++++++++++------------ js/src/config/autoconf.mk.in | 4 +++ js/src/config/rules.mk | 6 ++-- js/src/configure.in | 69 ++++++++++++++++++++++++------------ 6 files changed, 106 insertions(+), 52 deletions(-) diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 66bb4f46daf..b9a8ccb989c 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -561,6 +561,10 @@ OS_TEST=@OS_TEST@ TARGET_DEVICE = @TARGET_DEVICE@ +# For Solaris build +SOLARIS_SUNPRO_CC = @SOLARIS_SUNPRO_CC@ +SOLARIS_SUNPRO_CXX = @SOLARIS_SUNPRO_CXX@ + # For AIX build AIX_OBJMODEL = @AIX_OBJMODEL@ diff --git a/config/rules.mk b/config/rules.mk index 7e87c02b29c..321d2c7fb04 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -431,11 +431,9 @@ endif # the Solaris WorkShop template repository cache. it occasionally can get # out of sync, so targets like clobber should kill it. # -ifeq ($(OS_ARCH),SunOS) -ifeq ($(GNU_CXX),) +ifeq ($(SOLARIS_SUNPRO_CXX),1) GARBAGE_DIRS += SunWS_cache endif -endif ifeq ($(OS_ARCH),OpenVMS) GARBAGE += $(wildcard *.*_defines) @@ -1327,7 +1325,7 @@ endif ifdef MOZ_AUTO_DEPS ifdef COMPILER_DEPEND -ifeq (__SunOS,$(GNU_CC)_$(GNU_CXX)_$(OS_ARCH)) +ifeq ($(SOLARIS_SUNPRO_CC),1) _MDDEPFILE = $(MDDEPDIR)/$(@F).pp define MAKE_DEPS_AUTO_CC diff --git a/configure.in b/configure.in index ec6a4daa307..1a2d7ede3bf 100644 --- a/configure.in +++ b/configure.in @@ -1100,6 +1100,21 @@ linux*) ;; solaris*) HOST_OS_ARCH=SunOS + SOLARIS_SUNPRO_CC= + SOLARIS_SUNPRO_CXX= + if test -z "$GNU_CC"; then + if test "`$_SUBDIR_CC -V 2>&1 | grep -c 'Sun C '`" != "0"; then + SOLARIS_SUNPRO_CC=1 + fi + fi + + if test -z "$GNU_CXX"; then + if test "`$_SUBDIR_CXX -V 2>&1 | grep -c 'Sun C++ '`" != "0"; then + SOLARIS_SUNPRO_CXX=1 + fi + fi + AC_SUBST(SOLARIS_SUNPRO_CC) + AC_SUBST(SOLARIS_SUNPRO_CXX) ;; BSD_386) HOST_OS_ARCH=BSD @@ -1370,6 +1385,24 @@ if test "$GNU_CC"; then _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT' _USE_CPP_INCLUDE_FLAG=1 +elif test "$SOLARIS_SUNPRO_CC"; then + MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@' + MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@' + + DSO_LDOPTS='-shared' + if test "$GNU_LD"; then + # Don't allow undefined symbols in libraries + DSO_LDOPTS="$DSO_LDOPTS -z defs" + fi + + DSO_CFLAGS='' + if test "$CPU_ARCH" = "sparc"; then + # for Sun Studio on Solaris/SPARC + DSO_PIC_CFLAGS='-xcode=pic32' + else + DSO_PIC_CFLAGS='-KPIC' + fi + _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT' else MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@' MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@' @@ -2456,21 +2489,13 @@ dnl the qsort routine under solaris is faulty # libraries one level up (e.g. libnspr4.so) LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'" MOZ_MEMORY=1 - if test -z "$GNU_CC"; then + if test "$SOLARIS_SUNPRO_CC"; then LIBS="-lCrun -lCstd $LIBS" NS_USE_NATIVE=1 MOZ_FIX_LINK_PATHS= AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) - - if test "$CPU_ARCH" != "sparc"; then - CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all" - CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath" - else - # Do not use -xbuiltin on SPARC to get around a bug of compiler - CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none" - CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath" - fi - + CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all" + CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath" LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS" if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then _SAVE_LDFLAGS=$LDFLAGS @@ -2496,19 +2521,19 @@ dnl the qsort routine under solaris is faulty ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0" AS_DASH_C_FLAG='' TARGET_COMPILER_ABI="sunc" - CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'` - CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'` - AC_MSG_CHECKING([for Forte compiler version >= WS6U2]) + CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'` + CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'` + AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9]) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([], - [#if (__SUNPRO_CC < 0x530) + [#if (__SUNPRO_CC < 0x590) #error "Denied" #endif], _BAD_COMPILER=,_BAD_COMPILER=1) if test -n "$_BAD_COMPILER"; then _res="no" - AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .]) + AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .]) else _res="yes" fi @@ -2948,7 +2973,7 @@ EOF fi # GNU_CC # visibility hidden flag for Sun Studio on Solaris -if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then +if test "$SOLARIS_SUNPRO_CC"; then VISIBILITY_FLAGS='-xldscope=hidden' fi # Sun Studio on Solaris @@ -3306,8 +3331,8 @@ then ;; *-*-solaris*) - AC_DEFINE(_REENTRANT) - if test ! "$GNU_CC"; then + AC_DEFINE(_REENTRANT) + if test "$SOLARIS_SUNPRO_CC"; then CFLAGS="$CFLAGS -mt" CXXFLAGS="$CXXFLAGS -mt" fi @@ -7007,7 +7032,7 @@ if test -n "$INTEL_CC"; then fi dnl Sun Studio on Solaris -if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then +if test "$SOLARIS_SUNPRO_CC"; then PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application" PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application" if test "$CPU_ARCH" != "sparc"; then @@ -7197,7 +7222,7 @@ MOZ_ARG_DISABLE_BOOL(md, _cpp_md_flag=1 fi dnl Default is to use -xM if using Sun Studio on Solaris - if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then + if test "$SOLARIS_SUNPRO_CC"; then _cpp_md_flag=1 fi]) if test "$_cpp_md_flag"; then @@ -7208,7 +7233,7 @@ if test "$_cpp_md_flag"; then _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)' fi dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk - if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then + if test "$SOLARIS_SUNPRO_CC"; then _DEPEND_CFLAGS= fi else diff --git a/js/src/config/autoconf.mk.in b/js/src/config/autoconf.mk.in index 62e56743b5a..e06aae17e0a 100644 --- a/js/src/config/autoconf.mk.in +++ b/js/src/config/autoconf.mk.in @@ -312,6 +312,10 @@ OS_TEST=@OS_TEST@ TARGET_DEVICE = @TARGET_DEVICE@ +# For Solaris build +SOLARIS_SUNPRO_CC = @SOLARIS_SUNPRO_CC@ +SOLARIS_SUNPRO_CXX = @SOLARIS_SUNPRO_CXX@ + # For AIX build AIX_OBJMODEL = @AIX_OBJMODEL@ diff --git a/js/src/config/rules.mk b/js/src/config/rules.mk index 7e87c02b29c..321d2c7fb04 100644 --- a/js/src/config/rules.mk +++ b/js/src/config/rules.mk @@ -431,11 +431,9 @@ endif # the Solaris WorkShop template repository cache. it occasionally can get # out of sync, so targets like clobber should kill it. # -ifeq ($(OS_ARCH),SunOS) -ifeq ($(GNU_CXX),) +ifeq ($(SOLARIS_SUNPRO_CXX),1) GARBAGE_DIRS += SunWS_cache endif -endif ifeq ($(OS_ARCH),OpenVMS) GARBAGE += $(wildcard *.*_defines) @@ -1327,7 +1325,7 @@ endif ifdef MOZ_AUTO_DEPS ifdef COMPILER_DEPEND -ifeq (__SunOS,$(GNU_CC)_$(GNU_CXX)_$(OS_ARCH)) +ifeq ($(SOLARIS_SUNPRO_CC),1) _MDDEPFILE = $(MDDEPDIR)/$(@F).pp define MAKE_DEPS_AUTO_CC diff --git a/js/src/configure.in b/js/src/configure.in index f636b123232..3fbcaaefc8e 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -1017,6 +1017,21 @@ linux*) ;; solaris*) HOST_OS_ARCH=SunOS + SOLARIS_SUNPRO_CC= + SOLARIS_SUNPRO_CXX= + if test -z "$GNU_CC"; then + if test "`$_SUBDIR_CC -V 2>&1 | grep -c 'Sun C '`" != "0"; then + SOLARIS_SUNPRO_CC=1 + fi + fi + + if test -z "$GNU_CXX"; then + if test "`$_SUBDIR_CXX -V 2>&1 | grep -c 'Sun C++ '`" != "0"; then + SOLARIS_SUNPRO_CXX=1 + fi + fi + AC_SUBST(SOLARIS_SUNPRO_CC) + AC_SUBST(SOLARIS_SUNPRO_CXX) ;; BSD_386) HOST_OS_ARCH=BSD @@ -1288,6 +1303,24 @@ if test "$GNU_CC"; then _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT' _USE_CPP_INCLUDE_FLAG=1 +elif test "$SOLARIS_SUNPRO_CC"; then + MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@' + MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@' + + DSO_LDOPTS='-shared' + if test "$GNU_LD"; then + # Don't allow undefined symbols in libraries + DSO_LDOPTS="$DSO_LDOPTS -z defs" + fi + + DSO_CFLAGS='' + if test "$CPU_ARCH" = "sparc"; then + # for Sun Studio on Solaris/SPARC + DSO_PIC_CFLAGS='-xcode=pic32' + else + DSO_PIC_CFLAGS='-KPIC' + fi + _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT' else MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@' MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@' @@ -2271,21 +2304,13 @@ dnl the qsort routine under solaris is faulty # $ORIGIN/.. is for shared libraries under components/ to locate shared # libraries one level up (e.g. libnspr4.so) LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'" - if test -z "$GNU_CC"; then + if test "$SOLARIS_SUNPRO_CC"; then LIBS="-lCrun -lCstd $LIBS" NS_USE_NATIVE=1 MOZ_FIX_LINK_PATHS= AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) - - if test "$CPU_ARCH" != "sparc"; then - CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all" - CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath" - else - # Do not use -xbuiltin on SPARC to get around a bug of compiler - CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none" - CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath" - fi - + CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all" + CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath" LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS" if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then _SAVE_LDFLAGS=$LDFLAGS @@ -2311,19 +2336,19 @@ dnl the qsort routine under solaris is faulty ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0" AS_DASH_C_FLAG='' TARGET_COMPILER_ABI="sunc" - CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'` - CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'` - AC_MSG_CHECKING([for Forte compiler version >= WS6U2]) + CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'` + CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'` + AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9]) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_TRY_COMPILE([], - [#if (__SUNPRO_CC < 0x530) + [#if (__SUNPRO_CC < 0x590) #error "Denied" #endif], _BAD_COMPILER=,_BAD_COMPILER=1) if test -n "$_BAD_COMPILER"; then _res="no" - AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .]) + AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .]) else _res="yes" fi @@ -2855,7 +2880,7 @@ EOF fi # GNU_CC # visibility hidden flag for Sun Studio on Solaris -if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then +if test "$SOLARIS_SUNPRO_CC"; then VISIBILITY_FLAGS='-xldscope=hidden' fi # Sun Studio on Solaris @@ -3108,8 +3133,8 @@ then ;; *-*-solaris*) - AC_DEFINE(_REENTRANT) - if test ! "$GNU_CC"; then + AC_DEFINE(_REENTRANT) + if test "$SOLARIS_SUNPRO_CC"; then CFLAGS="$CFLAGS -mt" CXXFLAGS="$CXXFLAGS -mt" fi @@ -4612,7 +4637,7 @@ if test -n "$INTEL_CC"; then fi dnl Sun Studio on Solaris -if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then +if test "$SOLARIS_SUNPRO_CC"; then PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application" PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application" if test "$CPU_ARCH" != "sparc"; then @@ -4816,7 +4841,7 @@ MOZ_ARG_DISABLE_BOOL(md, _cpp_md_flag=1 fi dnl Default is to use -xM if using Sun Studio on Solaris - if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then + if test "$SOLARIS_SUNPRO_CC"; then _cpp_md_flag=1 fi]) if test "$_cpp_md_flag"; then @@ -4827,7 +4852,7 @@ if test "$_cpp_md_flag"; then _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)' fi dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk - if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then + if test "$SOLARIS_SUNPRO_CC"; then _DEPEND_CFLAGS= fi else