diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a5951b8573..4d067f3ce2 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,22 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-12-12 23:29 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbsetup.h + * harbour/include/hbdefs.h + * harbour/include/hbthread.h + * harbour/src/common/hbver.c + * harbour/bin/hb-func.sh + * harbour/bin/postinst.sh + * harbour/config/linux/gcc.mk + + harbour/config/linux/open64.mk + + added support for Open64 C/C++ compiler in Linux builds + + * harbour/src/common/hbver.c + * removed unnecessary casting compiler version number parameters + to 'short' + * extended the size of szBuf buffer as requested by Tamas + 2009-12-12 21:24 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/tests/testmapi.prg * contrib/hbwin/mapi.c diff --git a/harbour/bin/hb-func.sh b/harbour/bin/hb-func.sh index 9f0be240d3..45d593f3f1 100755 --- a/harbour/bin/hb-func.sh +++ b/harbour/bin/hb-func.sh @@ -299,6 +299,7 @@ mk_hbtools() # set environment variables export HB_PLATFORM="${HB_PLATFORM}" export HB_COMPILER="${HB_COMPILER}" +export HB_BUILD_MODE="${HB_BUILD_MODE}" [ -z "\${HB_BIN_INSTALL}" ] && export HB_BIN_INSTALL="${HB_BIN_INSTALL}" [ -z "\${HB_INC_INSTALL}" ] && export HB_INC_INSTALL="${HB_INC_INSTALL}" [ -z "\${HB_LIB_INSTALL}" ] && export HB_LIB_INSTALL="${HB_LIB_INSTALL}" @@ -306,12 +307,32 @@ export HB_COMPILER="${HB_COMPILER}" # be sure that ${name} binaries are in your path export PATH="\${HB_BIN_INSTALL}${hb_path_separator}${hb_ccpath}\${PATH}" -if [ "\${HB_COMPILER}" == "gpp" ]; then +if [ "\${HB_COMPILER}" = "icc" ]; then + if [ "\${HB_BUILD_MODE}" = "cpp" ]; then + HB_CC="icpc" + else + HB_CC="icc" + fi +elif [ "\${HB_COMPILER}" = "open64" ]; then + if [ "\${HB_BUILD_MODE}" = "cpp" ]; then + HB_CC="openCC" + else + HB_CC="opencc" + fi +elif [ "\${HB_COMPILER}" = "sunpro" ]; then + if [ "\${HB_BUILD_MODE}" = "cpp" ]; then + HB_CC="sunCC" + else + HB_CC="suncc" + fi +elif [ "\${HB_COMPILER}" = "gpp" ]; then HB_CC="g++" -elif [ "\${HB_COMPILER}" == "icc" ]; then - HB_CC="icc" else - HB_CC="gcc" + if [ "\${HB_BUILD_MODE}" = "cpp" ]; then + HB_CC="g++" + else + HB_CC="gcc" + fi fi if [ \$# = 0 ]; then diff --git a/harbour/bin/postinst.sh b/harbour/bin/postinst.sh index 2ea3277165..625660bf2e 100755 --- a/harbour/bin/postinst.sh +++ b/harbour/bin/postinst.sh @@ -49,7 +49,8 @@ if [ "$HB_COMPILER" = "gcc" ] || \ [ "$HB_COMPILER" = "cygwin" ] || \ [ "$HB_COMPILER" = "djgpp" ] || \ [ "$HB_COMPILER" = "icc" ] || \ - [ "$HB_COMPILER" = "sunpro" ] + [ "$HB_COMPILER" = "sunpro" ] || \ + [ "$HB_COMPILER" = "open64" ] then if [ -n "${HB_TOOLS_PREF}" ]; then hb_mkdyn="${HB_INST_PKGPREF}${HB_BIN_INSTALL}/${HB_TOOLS_PREF}-mkdyn" @@ -72,6 +73,11 @@ then sed -e "s/gcc -shared/suncc -G ${lnopt} ${HB_ISAOPT}/g" \ "${hb_root}/bin/hb-mkdyn.sh" > "${hb_mkdyn}" && \ chmod 755 "${hb_mkdyn}" + elif [ "$HB_COMPILER" = "open64" ]; then + hb_mkdyn="${HB_INST_PKGPREF}${HB_BIN_INSTALL}/hb-mkdyn" + rm -f "${hb_mkdyn}" + sed -e "s/gcc/opencc/g" "${hb_root}/bin/hb-mkdyn.sh" > "${hb_mkdyn}" && \ + chmod 755 "${hb_mkdyn}" elif [ "${HB_PLATFORM}" = "sunos" ] || \ [ "${HB_PLATFORM}" = "hpux" ] || \ ! which install &>/dev/null; then diff --git a/harbour/config/linux/gcc.mk b/harbour/config/linux/gcc.mk index e1b7394ef6..2564685ae3 100644 --- a/harbour/config/linux/gcc.mk +++ b/harbour/config/linux/gcc.mk @@ -2,10 +2,12 @@ # $Id$ # -ifeq ($(HB_BUILD_MODE),cpp) - HB_CMP := g++ -else - HB_CMP := gcc +ifeq ($(HB_CMP),) + ifeq ($(HB_BUILD_MODE),cpp) + HB_CMP := g++ + else + HB_CMP := gcc + endif endif OBJ_EXT := .o diff --git a/harbour/config/linux/open64.mk b/harbour/config/linux/open64.mk new file mode 100644 index 0000000000..a517cbb3e8 --- /dev/null +++ b/harbour/config/linux/open64.mk @@ -0,0 +1,14 @@ +# +# $Id$ +# + +ifeq ($(HB_BUILD_MODE),cpp) + HB_CMP := openCC +else + HB_CMP := opencc +endif + +# it supports most of GCC switches (at least as dummy parameters) so we do +# not have to create separate configurations for Open64 compiler + +include $(TOP)$(ROOT)config/$(HB_PLATFORM)/gcc.mk diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index 2ad53e2b79..16c3470a85 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -855,7 +855,7 @@ typedef unsigned char HB_U8; #if defined( __GNUC__ ) # if ( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 3 ) ) && \ - ! defined( __ICC ) + ! defined( __ICC ) && !defined( __OPENCC__ ) # define HB_BUILTIN_BSWAP 1 # else # define HB_BUILTIN_BSWAP 0 diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index d7ecef211a..02bb846071 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -507,14 +507,15 @@ #define HB_NORETURN_ATTR # endif # if ( ( __GNUC__ > 4 ) || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 1 ) ) && \ - !defined( __ICC ) && !defined( HB_NO_FLATTEN ) && !defined( __clang__ ) + !defined( __ICC ) && !defined( __clang__ ) && \ + !defined( HB_NO_FLATTEN ) #define HB_FLATTEN_ATTR \ __attribute__ (( flatten )) # else #define HB_FLATTEN_ATTR # endif # if ( ( __GNUC__ > 4 ) || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 3 ) ) && \ - !defined( __ICC ) + !defined( __ICC ) && !defined( __OPENCC__ ) #define HB_ALLOC_SIZE_ATTR( _nParam ) \ __attribute__ (( alloc_size (_nParam))) # else diff --git a/harbour/include/hbthread.h b/harbour/include/hbthread.h index e325f96377..96a8cc68c7 100644 --- a/harbour/include/hbthread.h +++ b/harbour/include/hbthread.h @@ -439,7 +439,8 @@ extern BOOL hb_threadMutexSyncWait( PHB_ITEM pItemMtx, ULONG ulMilliSec, PHB_ITE defined( __GLIBC__ ) && defined( __GLIBC_MINOR__ ) && \ ( __GLIBC__ > 2 || ( __GLIBC__ == 2 && __GLIBC_MINOR__ >= 6 ) ) && \ defined( HB_OS_LINUX ) && \ - ( defined( __i386__ ) || defined( __x86_64__ ) ) + ( defined( __i386__ ) || defined( __x86_64__ ) ) && \ + ( !defined( __OPENCC__ ) || !defined( HB_DYNLIB ) ) # define HB_USE_TLS # endif #endif diff --git a/harbour/src/common/hbver.c b/harbour/src/common/hbver.c index 3745b6c1ee..c78550c45b 100644 --- a/harbour/src/common/hbver.c +++ b/harbour/src/common/hbver.c @@ -430,7 +430,7 @@ char * hb_verCompiler( void ) { char * pszCompiler; const char * pszName; - char szSub[ 32 ]; + char szSub[ 64 ]; int iVerMajor; int iVerMinor; int iVerPatch; @@ -509,6 +509,18 @@ char * hb_verCompiler( void ) iVerMinor = __ICC % 100; iVerPatch = 0; +#elif defined( __OPENCC__ ) + + pszName = "Open64 C"; + + #if defined( __cplusplus ) + hb_strncpy( szSub, "++", sizeof( szSub ) - 1 ); + #endif + + iVerMajor = __OPENCC__; + iVerMinor = __OPENCC_MINOR__; + iVerPatch = __OPENCC_PATCHLEVEL__; + #elif defined( _MSC_VER ) #if ( _MSC_VER >= 800 ) @@ -681,9 +693,9 @@ char * hb_verCompiler( void ) if( pszName ) { if( iVerPatch != 0 ) - hb_snprintf( pszCompiler, COMPILER_BUF_SIZE, "%s%s %hd.%hd.%hd", pszName, szSub, iVerMajor, iVerMinor, iVerPatch ); + hb_snprintf( pszCompiler, COMPILER_BUF_SIZE, "%s%s %d.%d.%d", pszName, szSub, iVerMajor, iVerMinor, iVerPatch ); else if( iVerMajor != 0 || iVerMinor != 0 ) - hb_snprintf( pszCompiler, COMPILER_BUF_SIZE, "%s%s %hd.%hd", pszName, szSub, iVerMajor, iVerMinor ); + hb_snprintf( pszCompiler, COMPILER_BUF_SIZE, "%s%s %d.%d", pszName, szSub, iVerMajor, iVerMinor ); else hb_snprintf( pszCompiler, COMPILER_BUF_SIZE, "%s%s", pszName, szSub ); }