2011-10-04 23:59 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* include/hbthread.h
  * include/hbsetup.h
  * src/3rd/zlib/Makefile
  * utils/hbmk2/hbmk2.prg
  * config/detplat.mk
  * config/global.mk
  + config/aix
  + config/aix/libs.mk
  + config/aix/gcc.mk
  + config/aix/global.mk
    + added IBM AIX support to Harbour
      Patch by Aleksander Czajczynski
This commit is contained in:
Viktor Szakats
2011-10-04 22:00:25 +00:00
parent 373a56828b
commit d707da35d0
10 changed files with 213 additions and 11 deletions

View File

@@ -16,6 +16,20 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-10-04 23:59 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* include/hbthread.h
* include/hbsetup.h
* src/3rd/zlib/Makefile
* utils/hbmk2/hbmk2.prg
* config/detplat.mk
* config/global.mk
+ config/aix
+ config/aix/libs.mk
+ config/aix/gcc.mk
+ config/aix/global.mk
+ added IBM AIX support to Harbour
Patch by Aleksander Czajczynski
2011-10-04 23:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* tests/testpre.prg
! updated for Harbour 3.1.x

100
harbour/config/aix/gcc.mk Normal file
View File

@@ -0,0 +1,100 @@
#
# $Id$
#
ifeq ($(HB_BUILD_MODE),cpp)
HB_CMP := g++
else
HB_CMP := gcc
endif
OBJ_EXT := .o
LIB_PREF := lib
LIB_EXT := .a
HB_DYN_COPT := -DHB_DYNLIB -fPIC
CC := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX)
CC_IN := -c
CC_OUT := -o
CFLAGS += -I. -I$(HB_HOST_INC)
# uncomment this if you want to force creating 64bit binaries
#CFLAGS += -maix64
#LDFLAGS += -maix64 -Wl,-b64
#DFLAGS += -maix64 -Wl,-b64
#ARFLAGS += -X64
ifneq ($(HB_BUILD_WARN),no)
CFLAGS += -W -Wall
else
CFLAGS += -Wmissing-braces -Wreturn-type -Wformat
ifneq ($(HB_BUILD_MODE),cpp)
CFLAGS += -Wimplicit-int -Wimplicit-function-declaration
endif
endif
ifneq ($(HB_BUILD_OPTIM),no)
CFLAGS += -O3
endif
ifeq ($(HB_BUILD_DEBUG),yes)
CFLAGS += -g
endif
LD := $(CC)
LD_OUT := -o
LIBPATHS := $(foreach dir,$(LIB_DIR) $(SYSLIBPATHS),-L$(dir))
LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib))
LDFLAGS += $(LIBPATHS) # -Wl,-bnoquiet
# uncomment following block for AIX linker workaround (linking all symbols issue)
# order of libraries is more important this way
define aix_ld_hblib
$(LD) -Wl,-r,-bgc,-bkeepfile:__applnk__.o -nostartfiles $(LDFLAGS) $(HB_LDFLAGS) $(HB_USER_LDFLAGS) -o__apptmp__.o __applnk__.o -l$(lib)
mv __apptmp__.o __applnk__.o
endef
define aix_ld
$(LD) -Wl,-r $(LDFLAGS) $(HB_LDFLAGS) $(HB_USER_LDFLAGS) -o__apptmp__.o $(^F)
mv __apptmp__.o __applnk__.o
$(foreach lib,$(HB_USER_LIBS) $(LIBS),$(aix_ld_hblib))
$(LD) -nostartfiles $(LDFLAGS) $(HB_LDFLAGS) $(HB_USER_LDFLAGS) $(LD_OUT)$(subst /,$(DIRSEP),$(BIN_DIR)/$@) __applnk__.o $(foreach lib,$(SYSLIBS),-l$(lib)) $(LDSTRIP)
$(RM) __applnk__.o
endef
LD_RULE = $(aix_ld)
# end of workaround block
AR := $(HB_CCPREFIX)ar
AR_RULE = ( $(AR) $(ARFLAGS) $(HB_AFLAGS) $(HB_USER_AFLAGS) rc $(LIB_DIR)/$@ $(^F) $(ARSTRIP) ) || ( $(RM) $(LIB_DIR)/$@ && $(FALSE) )
DY := $(CC)
DFLAGS += -shared -Wl,-G $(LIBPATHS)
# TOFIX: CHECKME, there was space between -o and output name
#DY_OUT := -o$(subst x,x, )
DY_OUT := $(LD_OUT)
DLIBS := $(foreach lib,$(HB_USER_LIBS) $(SYSLIBS),-l$(lib))
# NOTE: The empty line directly before 'endef' HAVE TO exist!
#define dynlib_object
# @$(ECHO) $(ECHOQUOTE)INPUT($(subst \,/,$(file)))$(ECHOQUOTE) >> __dyn__.tmp
#endef
#define create_dynlib
# $(if $(wildcard __dyn__.tmp),@$(RM) __dyn__.tmp,)
# $(foreach file,$^,$(dynlib_object))
# $(DY) $(DFLAGS) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ __dyn__.tmp $(DLIBS) $(DYSTRIP) && $(LN) $(@F) $(DYN_FILE_NVR) && $(LN) $(@F) $(DYN_FILE_CPT)
#endef
#DY_RULE = $(create_dynlib)
DY_RULE = $(DY) $(DFLAGS) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ $^ $(DLIBS) $(DYSTRIP) && $(LN) $(@F) $(DYN_FILE_NVR) && $(LN) $(@F) $(DYN_FILE_CPT)
include $(TOP)$(ROOT)config/rules.mk

View File

@@ -0,0 +1,16 @@
#
# $Id$
#
all : first
BIN_EXT :=
DYN_EXT := .so
DYN_PREF := lib
HB_GT_LIBS += gttrm
ifneq ($(filter $(HB_BUILD_STRIP),all bin),)
LDSTRIP := -s
DYSTRIP := -s
endif

View File

@@ -0,0 +1,44 @@
#
# $Id$
#
# When compiling and linking with -pthread, the library search path should
# include -L/usr/lib/threads at the beginning of the path.
# http://www.ibm.com/developerworks/aix/library/au-gnu.html
# (libc is there)
ifeq ($(HB_LINKING_VMMT),yes)
SYSLIBPATHS := /usr/lib/threads
else
SYSLIBPATHS :=
endif
ifneq ($(HB_LINKING_RTL),)
ifeq ($(HB_LIBNAME_CURSES),)
HB_LIBNAME_CURSES := xcurses
endif
ifneq ($(HB_HAS_CURSES),)
SYSLIBS += $(HB_LIBNAME_CURSES)
endif
ifneq ($(HB_HAS_SLANG),)
SYSLIBS += slang
endif
ifneq ($(HB_HAS_X11),)
SYSLIBS += X11
SYSLIBPATHS += /usr/X11R6/lib
endif
ifneq ($(HB_HAS_PCRE),)
ifeq ($(HB_HAS_PCRE_LOCAL),)
SYSLIBS += pcre
endif
endif
ifeq ($(HB_HAS_ZLIB_LOCAL),)
SYSLIBS += z
endif
SYSLIBS += rt
ifneq ($(HB_LINKING_VMMT),)
SYSLIBS += pthread
endif
endif
SYSLIBS += m

View File

@@ -72,6 +72,10 @@ ifneq ($(findstring QNX,$(_DETPLAT_STR)),)
else
ifneq ($(findstring Minix,$(_DETPLAT_STR)),)
HB_HOST_PLAT := minix
else
ifneq ($(findstring AIX,$(_DETPLAT_STR)),)
HB_HOST_PLAT := aix
endif
endif
endif
endif

View File

@@ -823,7 +823,7 @@ ifeq ($(HB_COMPILER),)
endif
endif
else
ifneq ($(filter $(HB_PLATFORM),hpux bsd beos qnx cygwin),)
ifneq ($(filter $(HB_PLATFORM),aix hpux bsd beos qnx cygwin),)
HB_COMP_PATH := $(call find_in_path,gcc)
ifneq ($(HB_COMP_PATH),)
HB_COMPILER := gcc
@@ -1494,6 +1494,10 @@ ifneq ($(HB_HOST_PLAT)$(HB_HOST_CPU),$(HB_PLATFORM)$(HB_CPU))
else
ifeq ($(HB_PLATFORM),minix)
HB_PRGFLAGS += -D__PLATFORM__MINIX -D__PLATFORM__UNIX
else
ifeq ($(HB_PLATFORM),aix)
HB_PRGFLAGS += -D__PLATFORM__AIX -D__PLATFORM__UNIX
endif
endif
endif
endif

View File

@@ -428,6 +428,12 @@
#endif
#endif
#ifndef HB_OS_AIX
#if defined( _AIX ) || defined( __aix__ )
#define HB_OS_AIX
#endif
#endif
#ifndef HB_OS_UNIX
#if defined( HB_OS_LINUX ) || \
defined( HB_OS_DARWIN ) || \
@@ -440,7 +446,8 @@
defined( HB_OS_SYMBIAN ) || \
defined( HB_OS_ANDROID ) || \
defined( HB_OS_CYGWIN ) || \
defined( HB_OS_MINIX )
defined( HB_OS_MINIX ) || \
defined( HB_OS_AIX )
#define HB_OS_UNIX
#endif
#endif

View File

@@ -65,7 +65,8 @@
defined( HB_OS_SUNOS ) || defined( HB_OS_HPUX ) || \
defined( HB_OS_BSD ) || defined( HB_OS_BEOS ) || \
defined( HB_OS_QNX ) || defined( HB_OS_VXWORKS ) || \
defined( HB_OS_SYMBIAN ) || defined( HB_OS_CYGWIN )
defined( HB_OS_SYMBIAN ) || defined( HB_OS_CYGWIN ) || \
defined( HB_OS_AIX )
# include <pthread.h>
# define HB_PTHREAD_API
# if defined( HB_OS_VXWORKS )

View File

@@ -37,6 +37,10 @@ ifneq ($(HB_HAS_ZLIB_LOCAL),)
# To suppress new warnings in version 1.2.5
ifneq ($(filter $(HB_COMPILER),mingw mingw64 mingwarm cygwin djgpp),)
HB_CFLAGS += -DNO_VIZ
else
ifneq ($(filter $(HB_PLATFORM),aix),)
HB_CFLAGS += -DNO_VIZ
endif
endif
include $(TOP)$(ROOT)config/lib.mk
else

View File

@@ -1329,7 +1329,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel )
cBin_CompPRG := "harbour" + l_cHBPOSTFIX
DO CASE
CASE HBMK_ISPLAT( "darwin|bsd|hpux|sunos|beos|qnx|android|vxworks|symbian|linux|cygwin|minix" )
CASE HBMK_ISPLAT( "darwin|bsd|hpux|sunos|beos|qnx|android|vxworks|symbian|linux|cygwin|minix|aix" )
DO CASE
CASE hbmk[ _HBMK_cPLAT ] == "linux"
aCOMPSUP := { "gcc", "clang", "icc", "watcom", "sunpro", "open64", "pcc" }
@@ -1639,7 +1639,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel )
IF Empty( hbmk[ _HBMK_cCOMP ] ) .OR. hbmk[ _HBMK_cCOMP ] == "bld"
IF Len( aCOMPSUP ) == 1
hbmk[ _HBMK_cCOMP ] := aCOMPSUP[ 1 ]
ELSEIF HBMK_ISPLAT( "darwin|bsd|hpux|sunos|beos|qnx|android|vxworks|linux|cygwin|minix" ) .OR. ;
ELSEIF HBMK_ISPLAT( "darwin|bsd|hpux|sunos|beos|qnx|android|vxworks|linux|cygwin|minix|aix" ) .OR. ;
hbmk[ _HBMK_cCOMP ] == "bld"
hbmk[ _HBMK_cCOMP ] := hb_Version( HB_VERSION_BUILD_COMP )
IF AScan( aCOMPSUP, { |tmp | tmp == hbmk[ _HBMK_cCOMP ] } ) == 0
@@ -1943,7 +1943,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel )
/* Build with shared libs by default, if we're installed to default system locations. */
IF lSysLoc .AND. HBMK_ISPLAT( "darwin|bsd|hpux|sunos|beos|qnx|android|vxworks|linux|cygwin" )
IF lSysLoc .AND. HBMK_ISPLAT( "darwin|bsd|hpux|sunos|beos|qnx|android|vxworks|linux|cygwin|aix" )
hbmk[ _HBMK_lSHARED ] := .T.
hbmk[ _HBMK_lSTATICFULL ] := .F.
ELSE
@@ -3234,7 +3234,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel )
ENDIF
DO CASE
CASE HBMK_ISPLAT( "darwin|bsd|linux|hpux|beos|qnx|android|vxworks|sunos|minix" )
CASE HBMK_ISPLAT( "darwin|bsd|linux|hpux|beos|qnx|android|vxworks|sunos|minix|aix" )
IF Empty( l_cDynLibDir )
l_aLIBSHARED := { cHarbourDyn + cPostfix }
ELSE
@@ -3339,7 +3339,8 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel )
( hbmk[ _HBMK_cPLAT ] == "darwin" .AND. hbmk[ _HBMK_cCOMP ] == "pcc" ) .OR. ;
( hbmk[ _HBMK_cPLAT ] == "linux" .AND. hbmk[ _HBMK_cCOMP ] == "pcc" ) .OR. ;
( hbmk[ _HBMK_cPLAT ] == "sunos" .AND. hbmk[ _HBMK_cCOMP ] == "pcc" ) .OR. ;
( hbmk[ _HBMK_cPLAT ] == "minix" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" )
( hbmk[ _HBMK_cPLAT ] == "minix" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" ) .OR. ;
( hbmk[ _HBMK_cPLAT ] == "aix" .AND. hbmk[ _HBMK_cCOMP ] == "gcc" )
#if defined( __PLATFORM__UNIX )
hbmk[ _HBMK_nCmd_Esc ] := _ESC_NIX
@@ -3556,7 +3557,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel )
ENDIF
IF hbmk[ _HBMK_lPIC ] .AND. ! HBMK_ISPLAT( "darwin|cygwin" )
IF HBMK_ISPLAT( "bsd|hpux|sunos|linux|android" )
IF HBMK_ISPLAT( "bsd|hpux|sunos|linux|android|aix" )
AAdd( hbmk[ _HBMK_aOPTC ], "-fPIC" )
ELSE
AAdd( hbmk[ _HBMK_aOPTC ], "-fpic" )
@@ -10167,6 +10168,9 @@ STATIC PROCEDURE PlatformPRGFlags( hbmk, aOPTPRG )
#elif defined( __PLATFORM__CYGWIN )
AAdd( aUn, "__PLATFORM__CYGWIN" )
AAdd( aUn, "__PLATFORM__UNIX" )
#elif defined( __PLATFORM__AIX )
AAdd( aUn, "__PLATFORM__AIX" )
AAdd( aUn, "__PLATFORM__UNIX" )
#endif
#if defined( __ARCH16BIT__ )
@@ -10241,6 +10245,9 @@ STATIC PROCEDURE PlatformPRGFlags( hbmk, aOPTPRG )
CASE hbmk[ _HBMK_cPLAT ] == "minix"
AAdd( aDf, "__PLATFORM__MINIX" )
AAdd( aDf, "__PLATFORM__UNIX" )
CASE hbmk[ _HBMK_cPLAT ] == "aix"
AAdd( aDf, "__PLATFORM__AIX" )
AAdd( aDf, "__PLATFORM__UNIX" )
ENDCASE
/* Setup those CPU flags which we can be sure about.
@@ -11265,7 +11272,7 @@ FUNCTION hbmk_KEYW( hbmk, cKeyword, cValue, cOperator )
CASE "lngc" ; RETURN hbmk[ _HBMK_lCPP ] != NIL .AND. ! hbmk[ _HBMK_lCPP ]
CASE "winuni" ; RETURN hbmk[ _HBMK_lWINUNI ]
CASE "winansi" ; RETURN ! hbmk[ _HBMK_lWINUNI ]
CASE "unix" ; RETURN HBMK_ISPLAT( "bsd|hpux|sunos|beos|qnx|android|vxworks|symbian|linux|darwin|cygwin|minix" )
CASE "unix" ; RETURN HBMK_ISPLAT( "bsd|hpux|sunos|beos|qnx|android|vxworks|symbian|linux|darwin|cygwin|minix|aix" )
CASE "allwin" ; RETURN HBMK_ISPLAT( "win|wce" )
CASE "allgcc" ; RETURN HBMK_ISCOMP( "gcc|mingw|mingw64|mingwarm|djgpp|gccomf|clang|open64|pcc" )
CASE "allmingw" ; RETURN HBMK_ISCOMP( "mingw|mingw64|mingwarm" )
@@ -11286,7 +11293,7 @@ FUNCTION hbmk_KEYW( hbmk, cKeyword, cValue, cOperator )
ENDIF
IF ! HBMK_IS_IN( cKeyword, "|win|wce|dos|os2" + ;
"|bsd|hpux|sunos|beos|qnx|android|vxworks|symbian|linux|darwin|cygwin|minix" + ;
"|bsd|hpux|sunos|beos|qnx|android|vxworks|symbian|linux|darwin|cygwin|minix|aix" + ;
"|msvc|msvc64|msvcia64|msvcarm" + ;
"|pocc|pocc64|poccarm|xcc" + ;
"|mingw|mingw64|mingwarm|bcc|watcom" + ;
@@ -12172,6 +12179,7 @@ STATIC PROCEDURE ShowHelp( hbmk, lLong )
" - symbian : gcc",;
" - cygwin : gcc",;
" - minix : gcc, clang, ack",;
" - aix : gcc",;
" - sunos : gcc, sunpro, pcc" }
LOCAL aOpt_Basic := {;