Commit 79d306c8 authored by Peter Eisentraut's avatar Peter Eisentraut

Support for Sun Studio compiler on Linux

This basically takes some build system code that was previously labeled
"Solaris" and ties it to the compiler rather than the operating system.

Author: Julius Stroffek <Julius.Stroffek@Sun.COM>
parent 32765998
...@@ -686,6 +686,7 @@ CPPFLAGS ...@@ -686,6 +686,7 @@ CPPFLAGS
ac_ct_CC ac_ct_CC
EXEEXT EXEEXT
OBJEXT OBJEXT
SUN_STUDIO_CC
CPP CPP
GCC GCC
TAS TAS
...@@ -3758,6 +3759,54 @@ fi ...@@ -3758,6 +3759,54 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Check if it's Sun Studio compiler. We assume that
# __SUNPRO_C will be defined for Sun Studio compilers
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
#ifndef __SUNPRO_C
choke me
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
SUN_STUDIO_CC=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
SUN_STUDIO_CC=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
unset CFLAGS unset CFLAGS
# #
...@@ -26726,6 +26775,7 @@ CPPFLAGS!$CPPFLAGS$ac_delim ...@@ -26726,6 +26775,7 @@ CPPFLAGS!$CPPFLAGS$ac_delim
ac_ct_CC!$ac_ct_CC$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim
EXEEXT!$EXEEXT$ac_delim EXEEXT!$EXEEXT$ac_delim
OBJEXT!$OBJEXT$ac_delim OBJEXT!$OBJEXT$ac_delim
SUN_STUDIO_CC!$SUN_STUDIO_CC$ac_delim
CPP!$CPP$ac_delim CPP!$CPP$ac_delim
GCC!$GCC$ac_delim GCC!$GCC$ac_delim
TAS!$TAS$ac_delim TAS!$TAS$ac_delim
...@@ -26754,7 +26804,6 @@ ELF_SYS!$ELF_SYS$ac_delim ...@@ -26754,7 +26804,6 @@ ELF_SYS!$ELF_SYS$ac_delim
LDFLAGS_SL!$LDFLAGS_SL$ac_delim LDFLAGS_SL!$LDFLAGS_SL$ac_delim
LD!$LD$ac_delim LD!$LD$ac_delim
with_gnu_ld!$with_gnu_ld$ac_delim with_gnu_ld!$with_gnu_ld$ac_delim
ld_R_works!$ld_R_works$ac_delim
_ACEOF _ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
...@@ -26796,6 +26845,7 @@ _ACEOF ...@@ -26796,6 +26845,7 @@ _ACEOF
ac_delim='%!_!# ' ac_delim='%!_!# '
for ac_last_try in false false false false false :; do for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF cat >conf$$subs.sed <<_ACEOF
ld_R_works!$ld_R_works$ac_delim
RANLIB!$RANLIB$ac_delim RANLIB!$RANLIB$ac_delim
STRIP!$STRIP$ac_delim STRIP!$STRIP$ac_delim
STRIP_STATIC_LIB!$STRIP_STATIC_LIB$ac_delim STRIP_STATIC_LIB!$STRIP_STATIC_LIB$ac_delim
...@@ -26850,7 +26900,7 @@ vpath_build!$vpath_build$ac_delim ...@@ -26850,7 +26900,7 @@ vpath_build!$vpath_build$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF _ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 52; then if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 53; then
break break
elif $ac_last_try; then elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
......
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl $PostgreSQL: pgsql/configure.in,v 1.568 2008/10/29 09:27:24 petere Exp $ dnl $PostgreSQL: pgsql/configure.in,v 1.569 2008/10/29 16:06:46 petere Exp $
dnl dnl
dnl Developers, please strive to achieve this order: dnl Developers, please strive to achieve this order:
dnl dnl
...@@ -379,6 +379,14 @@ AC_TRY_COMPILE([], [@%:@ifndef __INTEL_COMPILER ...@@ -379,6 +379,14 @@ AC_TRY_COMPILE([], [@%:@ifndef __INTEL_COMPILER
choke me choke me
@%:@endif], [ICC=[yes]], [ICC=[no]]) @%:@endif], [ICC=[yes]], [ICC=[no]])
# Check if it's Sun Studio compiler. We assume that
# __SUNPRO_C will be defined for Sun Studio compilers
AC_TRY_COMPILE([], [@%:@ifndef __SUNPRO_C
choke me
@%:@endif], [SUN_STUDIO_CC=yes], [SUN_STUDIO_CC=no])
AC_SUBST(SUN_STUDIO_CC)
unset CFLAGS unset CFLAGS
# #
......
# -*-makefile-*- # -*-makefile-*-
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.244 2008/10/03 15:35:17 petere Exp $ # $PostgreSQL: pgsql/src/Makefile.global.in,v 1.245 2008/10/29 16:06:46 petere Exp $
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets, # All PostgreSQL makefiles include this file and use the variables it sets,
...@@ -213,6 +213,7 @@ endif # not PGXS ...@@ -213,6 +213,7 @@ endif # not PGXS
CC = @CC@ CC = @CC@
GCC = @GCC@ GCC = @GCC@
SUN_STUDIO_CC = @SUN_STUDIO_CC@
CFLAGS = @CFLAGS@ CFLAGS = @CFLAGS@
# Kind-of compilers # Kind-of compilers
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# be converted to Method 2. # be converted to Method 2.
# #
# IDENTIFICATION # IDENTIFICATION
# $PostgreSQL: pgsql/src/backend/port/Makefile,v 1.26 2008/02/19 15:29:58 petere Exp $ # $PostgreSQL: pgsql/src/backend/port/Makefile,v 1.27 2008/10/29 16:06:46 petere Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -33,8 +33,8 @@ endif ...@@ -33,8 +33,8 @@ endif
include $(top_srcdir)/src/backend/common.mk include $(top_srcdir)/src/backend/common.mk
tas.o: tas.s tas.o: tas.s
ifeq ($(PORTNAME), solaris) ifeq ($(SUN_STUDIO_CC), yes)
# preprocess assembler file with cpp, used by x86 # preprocess assembler file with cpp
$(CC) $(CFLAGS) -c -P $< $(CC) $(CFLAGS) -c -P $<
mv $*.i $*_cpp.s mv $*.i $*_cpp.s
$(CC) $(CFLAGS) -c $*_cpp.s -o $@ $(CC) $(CFLAGS) -c $*_cpp.s -o $@
......
!======================================================================= !-------------------------------------------------------------------------
! solaris_sparc.s -- compare and swap for solaris_sparc !
!======================================================================= ! sunstudio_sparc.s
! compare and swap for Sun Studio on Sparc
!
! Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
! Portions Copyright (c) 1994, Regents of the University of California
!
! IDENTIFICATION
! $PostgreSQL: pgsql/src/backend/port/tas/sunstudio_sparc.s,v 1.1 2008/10/29 16:06:47 petere Exp $
!
!-------------------------------------------------------------------------
! Fortunately the Sun compiler can process cpp conditionals with -P ! Fortunately the Sun compiler can process cpp conditionals with -P
......
/======================================================================= /-------------------------------------------------------------------------
/ solaris_i386.s -- compare and swap for solaris_i386 /
/======================================================================= / sunstudio_x86.s
/ compare and swap for Sun Studio on x86
/
/ Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
/ Portions Copyright (c) 1994, Regents of the University of California
/
/ IDENTIFICATION
/ $PostgreSQL: pgsql/src/backend/port/tas/sunstudio_x86.s,v 1.1 2008/10/29 16:06:47 petere Exp $
/
/-------------------------------------------------------------------------
/ Fortunately the Sun compiler can process cpp conditionals with -P / Fortunately the Sun compiler can process cpp conditionals with -P
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.164 2008/01/01 19:45:59 momjian Exp $ * $PostgreSQL: pgsql/src/include/storage/s_lock.h,v 1.165 2008/10/29 16:06:47 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -578,7 +578,7 @@ typedef unsigned char slock_t; ...@@ -578,7 +578,7 @@ typedef unsigned char slock_t;
#endif #endif
#endif /* __GNUC__ */ #endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */
...@@ -782,7 +782,7 @@ typedef unsigned char slock_t; ...@@ -782,7 +782,7 @@ typedef unsigned char slock_t;
#endif #endif
#if defined(__sun) && (defined(__i386) || defined(__x86_64__) || defined(__sparc__) || defined(__sparc)) #if defined(__SUNPRO_C) && (defined(__i386) || defined(__x86_64__) || defined(__sparc__) || defined(__sparc))
#define HAS_TEST_AND_SET #define HAS_TEST_AND_SET
#if defined(__i386) || defined(__x86_64__) || defined(__sparcv9) || defined(__sparcv8plus) #if defined(__i386) || defined(__x86_64__) || defined(__sparcv9) || defined(__sparcv8plus)
......
# $PostgreSQL: pgsql/src/template/linux,v 1.30 2007/09/21 02:33:46 tgl Exp $ # $PostgreSQL: pgsql/src/template/linux,v 1.31 2008/10/29 16:06:47 petere Exp $
# Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise # Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
# If --enable-profiling is specified, we need -DLINUX_PROFILE # If --enable-profiling is specified, we need -DLINUX_PROFILE
PLATFORM_PROFILE_FLAGS="-DLINUX_PROFILE" PLATFORM_PROFILE_FLAGS="-DLINUX_PROFILE"
if test "$SUN_STUDIO_CC" = "yes" ; then
CC="$CC -Xa" # relaxed ISO C mode
CFLAGS="-v" # -v is like gcc -Wall
if test "$enable_debug" != yes; then
CFLAGS="$CFLAGS -O" # any optimization breaks debug
fi
# Pick the right test-and-set (TAS) code for the Sun compiler.
# We would like to use in-line assembler, but the compiler
# requires *.il files to be on every compile line, making
# the build system too fragile.
case $host_cpu in
sparc)
need_tas=yes
tas_file=sunstudio_sparc.s
;;
i?86|x86_64)
need_tas=yes
tas_file=sunstudio_x86.s
;;
esac
fi
if test "$GCC" != yes ; then if test "$SUN_STUDIO_CC" = yes ; then
CC="$CC -Xa" # relaxed ISO C mode CC="$CC -Xa" # relaxed ISO C mode
CFLAGS="-v -DSUNOS4_CC" # -v is like gcc -Wall CFLAGS="-v" # -v is like gcc -Wall
if test "$enable_debug" != yes; then if test "$enable_debug" != yes; then
CFLAGS="$CFLAGS -O" # any optimization breaks debug CFLAGS="$CFLAGS -O" # any optimization breaks debug
fi fi
...@@ -9,14 +9,14 @@ if test "$GCC" != yes ; then ...@@ -9,14 +9,14 @@ if test "$GCC" != yes ; then
# We would like to use in-line assembler, but the compiler # We would like to use in-line assembler, but the compiler
# requires *.il files to be on every compile line, making # requires *.il files to be on every compile line, making
# the build system too fragile. # the build system too fragile.
case $host in case $host_cpu in
sparc-*-solaris*) sparc)
need_tas=yes need_tas=yes
tas_file=solaris_sparc.s tas_file=sunstudio_sparc.s
;; ;;
i?86-*-solaris*) i?86|x86_64)
need_tas=yes need_tas=yes
tas_file=solaris_x86.s tas_file=sunstudio_x86.s
;; ;;
esac esac
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment