From f533da4d92a7db840fb01072f23ca2352b710c73 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 1 Aug 2009 14:58:20 +0000 Subject: [PATCH] 2009-08-01 16:56 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * INSTALL * bin/postinst.sh * source/vm/fm.c * source/common/hbver.c + config/sunos/sunpro64.cf * config/sunos/sunpro.cf * ChangeLog + Applied second SunPro patch sent by Tamas Tevesz. Addressed these former TODOs: + Added sunpro64 target. + Finalized C compiler options (including warning level settings). + Added compiler identification code to hbver.c. + dynamic lib creation. * utils/hbmk2/hbmk2.prg ! Fixed RTE when run on sunos. Needs further work to discover how it could run onto that codepath, normally it shouldn't. * bin/postinst.sh % Cleaned a few remaining 'gpp' HB_COMPILER value checks. --- harbour/ChangeLog | 32 +++++++++++++++++++++++++++----- harbour/INSTALL | 19 ++++++++++++++++--- harbour/bin/postinst.sh | 20 +++++++++++++++++--- harbour/config/sunos/sunpro.cf | 26 ++++++++++++-------------- harbour/config/sunos/sunpro64.cf | 7 +++++++ harbour/source/common/hbver.c | 15 +++++++++++++++ harbour/source/vm/fm.c | 3 ++- harbour/utils/hbmk2/hbmk2.prg | 2 +- 8 files changed, 97 insertions(+), 27 deletions(-) create mode 100644 harbour/config/sunos/sunpro64.cf diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8ff858c489..2d6d2dc1bd 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,28 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-01 16:56 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * INSTALL + * bin/postinst.sh + * source/vm/fm.c + * source/common/hbver.c + + config/sunos/sunpro64.cf + * config/sunos/sunpro.cf + * ChangeLog + + Applied second SunPro patch sent by Tamas Tevesz. + Addressed these former TODOs: + + Added sunpro64 target. + + Finalized C compiler options (including warning level settings). + + Added compiler identification code to hbver.c. + + dynamic lib creation. + + * utils/hbmk2/hbmk2.prg + ! Fixed RTE when run on sunos. Needs further work to discover how + it could run onto that codepath, normally it shouldn't. + + * bin/postinst.sh + % Cleaned a few remaining 'gpp' HB_COMPILER value checks. + 2009-08-01 15:35 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * config/global.cf * config/lib.cf @@ -173,13 +195,13 @@ + Added first round of Sun Pro (Sun Studio) compiler support. Contribution of Tamas Tevesz. ; TODO: - + Add other Sun Pro CPU targets. + + Add other Sun Pro CPU targets. [DONE] * Finalize __inline keyword usage. (currently in fm.c) - Przemek, could you take a look at it? - ! Fix warning option. - + Add compiler identification code to hbver.c. + Przemek, could you take a look at it? [OKAY] + ! Fix warning option. [DONE] + + Add compiler identification code to hbver.c. [DONE] + hbmk2 support. - + dynamic lib creation. + + dynamic lib creation. [DONE] * utils/hbmk2/hbmk2.prg * Minor rename. diff --git a/harbour/INSTALL b/harbour/INSTALL index 832eec6458..2ae27d17ad 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -27,7 +27,7 @@ HOW TO BUILD AND INSTALL HARBOUR FROM SOURCE Linux/Darwin/BSD/HP-UX/Solaris ------------------------------ - $ export HB_COMPILER=<[gcc]|watcom|icc> + $ export HB_COMPILER=<[gcc]|watcom|icc|sunpro|sunpro64> $ export HB_INSTALL_PREFIX= $ ./make_gnu.sh $ sudo ./make_gnu.sh install @@ -37,6 +37,13 @@ HOW TO BUILD AND INSTALL HARBOUR FROM SOURCE $ ./hello You should see 'Hello world!' on screen. + NOTE for sunpro/sunpro64 on Solaris: + ------------------------------------ + If you have any GNU binutils stuff installed, do make sure + /usr/ccs/bin (the location of the native Sun C compilation + system tools) come *before* the GNU binutils components in + your $PATH. + Windows/Windows CE ------------------ Platform specific prerequisites: @@ -181,10 +188,16 @@ SUPPORTED C COMPILERS UNDER DIFFERENT PLATFORMS watcom - Open Watcom C++ icc - Intel(R) C/C++ - Darwin/BSD/HP-UX/Solaris - ------------------------ + Darwin/BSD/HP-UX + ---------------- gcc - GNU C + Solaris + ------- + gcc - GNU C + sunpro - Sun Studio C/C++ (32-bit target) + sunpro64 - Sun Studio C/C++ (64-bit target) + Windows (recommended) ------- mingw - MinGW GNU C 3.4.2 and above diff --git a/harbour/bin/postinst.sh b/harbour/bin/postinst.sh index b6d2df35fb..77fb5c2ad1 100755 --- a/harbour/bin/postinst.sh +++ b/harbour/bin/postinst.sh @@ -41,13 +41,14 @@ fi . ${hb_root}/bin/hb-func.sh if [ "$HB_COMPILER" = "gcc" ] || \ - [ "$HB_COMPILER" = "gpp" ] || \ [ "$HB_COMPILER" = "mingw" ] || \ [ "$HB_COMPILER" = "mingw64" ] || \ [ "$HB_COMPILER" = "mingwarm" ] || \ [ "$HB_COMPILER" = "cygwin" ] || \ [ "$HB_COMPILER" = "djgpp" ] || \ - [ "$HB_COMPILER" = "icc" ] + [ "$HB_COMPILER" = "icc" ] || \ + [ "$HB_COMPILER" = "sunpro" ] || \ + [ "$HB_COMPILER" = "sunpro64" ] then RANLIB="" MAKE=make @@ -55,6 +56,7 @@ then AR_OPT="" if [ "${HB_ARCHITECTURE}" = "bsd" ] || \ [ "${HB_ARCHITECTURE}" = "hpux" ] || \ + [ "${HB_ARCHITECTURE}" = "sunos" ] || \ [ `uname` = "FreeBSD" ]; then MAKE=gmake elif [ "${HB_ARCHITECTURE}" = "darwin" ]; then @@ -76,6 +78,17 @@ then rm -f "${hb_mkdyn}" sed -e "s/gcc/icc/g" "${hb_root}/bin/hb-mkdyn.sh" > "${hb_mkdyn}" && \ chmod 755 "${hb_mkdyn}" + elif [ "$HB_COMPILER" = "sunpro" ] || \ + [ "$HB_COMPILER" = "sunpro64" ]; then + hb_mkdyn="${HB_BIN_INSTALL}/hb-mkdyn" + rm -f "${hb_mkdyn}" + if [ "$HB_COMPILER" = "sunos" ]; then + sed -e "s/gcc -shared -fPIC/cc -G -xcode=pic32/g" "${hb_root}/bin/hb-mkdyn.sh" > "${hb_mkdyn}" && \ + chmod 755 "${hb_mkdyn}" + else + sed -e "s/gcc -shared -fPIC/cc -G -Kpic/g" "${hb_root}/bin/hb-mkdyn.sh" > "${hb_mkdyn}" && \ + chmod 755 "${hb_mkdyn}" + fi elif [ "${HB_ARCHITECTURE}" = "sunos" ] || \ [ "${HB_ARCHITECTURE}" = "hpux" ] || \ ! which install &>/dev/null; then @@ -98,10 +111,11 @@ then mk_hbtools "${HB_BIN_INSTALL}" "$@" if [ "$HB_COMPILER" = "gcc" ] || \ - [ "$HB_COMPILER" = "gpp" ] || \ [ "$HB_COMPILER" = "mingw" ] || \ [ "$HB_COMPILER" = "mingw64" ] || \ [ "$HB_COMPILER" = "mingwarm" ] || \ + [ "$HB_COMPILER" = "sunpro" ] || \ + [ "$HB_COMPILER" = "sunpro64" ] || \ [ "$HB_COMPILER" = "icc" ]; then mk_hblibso "${hb_root}" fi diff --git a/harbour/config/sunos/sunpro.cf b/harbour/config/sunos/sunpro.cf index ba2b6317cd..72a3c4e26c 100644 --- a/harbour/config/sunos/sunpro.cf +++ b/harbour/config/sunos/sunpro.cf @@ -21,30 +21,28 @@ CC_OUT = -o$(subst x,x, ) CPPFLAGS = -I. -I$(HB_INC_COMPILE) -CFLAGS = +# may inherit -m64 from sunpro64.cf, which supersedes -xarch=v8 +CFLAGS ?= -xarch=v8 LDFLAGS = -ifneq ($(HB_BUILD_WARN),no) -# XXX: -# gmake[2]: Entering directory `/home/ice/harbour-build/source/rtl' -# gmake[3]: Entering directory `/home/ice/harbour-build/source/rtl/obj/sunos/sunpro' -# cc -I. -I../../../../../include -errwarn=%all -O -xcode=pic32 -c browdbx.c -o browdbx.o -# "browdbx.c", line 8: warning: empty translation unit -# cc: acomp failed for browdbx.c -# gmake[3]: *** [browdbx.o] Error 2 -# gmake[3]: Leaving directory `/home/ice/harbour-build/source/rtl/obj/sunos/sunpro' -# CFLAGS += -errwarn=%all -CFLAGS += +ifeq ($(HB_BUILD_WARN),no) +CFLAGS += -erroff=%all +else +CFLAGS += -erroff=%none endif ifneq ($(HB_BUILD_OPTIM),no) -CFLAGS += -O +# Together with -xarch=v8 above, these are supposed to (somewhat) +# conform to the Blastwave build standards, see +# http://wiki.blastwave.org/mediawiki/index.php/Build_Standards +# Try to keep them this way. +CFLAGS += -O -fast -xstrconst -xnolibmopt endif ifeq ($(findstring sparc,$(shell isalist)),sparc) CFLAGS += -xcode=pic32 else -CFLAGS += -KPIC +CFLAGS += -Kpic endif ifeq ($(HB_BUILD_DEBUG),yes) diff --git a/harbour/config/sunos/sunpro64.cf b/harbour/config/sunos/sunpro64.cf new file mode 100644 index 0000000000..1f2a49a6d7 --- /dev/null +++ b/harbour/config/sunos/sunpro64.cf @@ -0,0 +1,7 @@ +# +# $Id$ +# + +CFLAGS = -m64 + +include $(TOP)$(ROOT)config/sunos/sunpro.cf diff --git a/harbour/source/common/hbver.c b/harbour/source/common/hbver.c index 5c6c9899f5..d5e98a3cf7 100644 --- a/harbour/source/common/hbver.c +++ b/harbour/source/common/hbver.c @@ -617,6 +617,21 @@ char * hb_verCompiler( void ) #else iVerPatch = 0; #endif + +#elif defined( __SUNPRO_C ) + + pszName = "Sun C"; + iVerMajor = __SUNPRO_C / 0x100; + iVerMinor = ( __SUNPRO_C & 0xff ) / 0x10; + iVerPatch = __SUNPRO_C & 0xf; + +#elif defined( __SUNPRO_CC ) + + pszName = "Sun C++"; + iVerMajor = __SUNPRO_CC / 0x100; + iVerMinor = ( __SUNPRO_CC & 0xff ) / 0x10; + iVerPatch = __SUNPRO_CC & 0xf; + #else pszName = ( char * ) NULL; diff --git a/harbour/source/vm/fm.c b/harbour/source/vm/fm.c index de6087f7c0..958de5560e 100644 --- a/harbour/source/vm/fm.c +++ b/harbour/source/vm/fm.c @@ -77,8 +77,9 @@ # define _GNU_SOURCE #endif +/* For Sun C, a more generic solution would be nice */ #if defined( __SUNPRO_C ) - #define __inline __inline__ +# define __inline __inline__ #endif /* NOTE: For OS/2. Must be ahead of any and all #include statements */ diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index d78c946a1b..e0ab6cae95 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -1944,7 +1944,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) IF ! lStopAfterInit .AND. ! lStopAfterHarbour - IF hbmk[ _HBMK_cGT ] == hbmk[ _HBMK_cGTDEFAULT ] + IF hbmk[ _HBMK_cGT ] != NIL .AND. hbmk[ _HBMK_cGT ] == hbmk[ _HBMK_cGTDEFAULT ] hbmk[ _HBMK_cGT ] := NIL ENDIF