2009-08-26 17:55 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

+ config/detfun.mk
  + config/detect.mk
  * config/global.mk
    + Added generic external component detection function.
    + Added central detection for optional external components
      used by Harbour core. These are: openssl, gpm, slang, curses, x11
      Easy to extend with new ones.
      The detection code will run once per make session and
      results can be used in all our make files by checking HB_HAS_*
      variable. If it's empty we cannot use the component, if
      it's not we can. In this case it contains dir where headers
      were located. It's possible that it's a list of paths.
      Users can control these components by using HB_INC_* variable
      the following way: if it's left empty, Harbour make system
      will automatically look into default locations, this usually
      works on *nix systems. If set to a path (or a list of paths),
      this list will be checked. Finally to explicitly disable a
      component, user can set the variable to 'no'.
      Following legacy control variables are yet understood, but
      the will be removed in the near future:
          HB_WITHOUT_GTCRS=yes is the same as HB_INC_CURSES=no
          HB_WITHOUT_SLANG=yes is the same as HB_INC_SLANG=no
          HB_WITHOUT_GTXWC=yes is the same as HB_INC_X11=no
      Notice that these settings aren't meant to allow user control
      of actual Harbour components (like gtxwc). If we need something
      like this, we can do it, but it wasn't the subject of this change.
      HB_GPM_MOUSE var is still set for compatibility with internals.
      NOTE: I've left verbose output on to see what's happening, this will
            tuned after testing.
    ; TODO: Remove reliance on legacy settings in our own codebase.
    ; TODO: Start using HB_HAS_* values for dynamic lib syslib list assembly
            and in GT Makefiles.

  * contrib/hbtip/hbtipssl/Makefile
  * contrib/hbtip/Makefile
  * contrib/hbssl/Makefile
    * HB_HAS_OPENSSL works a little differently now, not empty
      means 'yes', empty means 'no'.
This commit is contained in:
Viktor Szakats
2009-08-26 16:00:07 +00:00
parent 58db3ccf8a
commit a0ab9cd07a
7 changed files with 244 additions and 45 deletions

View File

@@ -17,6 +17,46 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-08-26 17:55 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
+ config/detfun.mk
+ config/detect.mk
* config/global.mk
+ Added generic external component detection function.
+ Added central detection for optional external components
used by Harbour core. These are: openssl, gpm, slang, curses, x11
Easy to extend with new ones.
The detection code will run once per make session and
results can be used in all our make files by checking HB_HAS_*
variable. If it's empty we cannot use the component, if
it's not we can. In this case it contains dir where headers
were located. It's possible that it's a list of paths.
Users can control these components by using HB_INC_* variable
the following way: if it's left empty, Harbour make system
will automatically look into default locations, this usually
works on *nix systems. If set to a path (or a list of paths),
this list will be checked. Finally to explicitly disable a
component, user can set the variable to 'no'.
Following legacy control variables are yet understood, but
the will be removed in the near future:
HB_WITHOUT_GTCRS=yes is the same as HB_INC_CURSES=no
HB_WITHOUT_SLANG=yes is the same as HB_INC_SLANG=no
HB_WITHOUT_GTXWC=yes is the same as HB_INC_X11=no
Notice that these settings aren't meant to allow user control
of actual Harbour components (like gtxwc). If we need something
like this, we can do it, but it wasn't the subject of this change.
HB_GPM_MOUSE var is still set for compatibility with internals.
NOTE: I've left verbose output on to see what's happening, this will
tuned after testing.
; TODO: Remove reliance on legacy settings in our own codebase.
; TODO: Start using HB_HAS_* values for dynamic lib syslib list assembly
and in GT Makefiles.
* contrib/hbtip/hbtipssl/Makefile
* contrib/hbtip/Makefile
* contrib/hbssl/Makefile
* HB_HAS_OPENSSL works a little differently now, not empty
means 'yes', empty means 'no'.
2009-08-26 13:47 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rtl/filebuf.c
* reverted the alternative IO API look up order

146
harbour/config/detect.mk Normal file
View File

@@ -0,0 +1,146 @@
#
# $Id$
#
# ---------------------------------------------------------------
# Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
# See COPYING for licensing terms.
#
# This make file will detect optional external components
# used in Harbour core code.
# ---------------------------------------------------------------
# NOTE:
# INPUT:
# HB_INC_* variable with following possible contents:
# (empty) - Will enable external component if found on default locations
# no - Will disable external component
# <dirlist> - Will specify locations to check for the external component
# OUTPUT:
# HB_HAS_* variable with following possible contents:
# (empty) - We can't use this component
# <dirlist> - Component headers were found at these locations
# config/conf.mk if found, will
ifeq ($(DETECT_MK_),)
export DETECT_MK_ := yes
# Reset everything to default
export HB_HAS_OPENSSL :=
export HB_HAS_GPM :=
export HB_HAS_SLANG :=
export HB_HAS_CURSES :=
export HB_HAS_X11 :=
# Allow detection by external (generated) config file
-include $(TOP)$(ROOT)config/conf.mk
# Exclude Harbour-wide features prohibiting commercial use
ifeq ($(HB_COMMERCE),yes)
export HB_INC_GPM := no
export HB_INC_SLANG := no
endif
# Compatibility inputs (deprecated)
ifeq ($(HB_WITHOUT_GTCRS),yes)
export HB_INC_CURSES := no
endif
ifeq ($(HB_WITHOUT_SLANG),yes)
export HB_INC_SLANG := no
endif
ifeq ($(HB_WITHOUT_GTXWC),yes)
export HB_INC_X11 := no
endif
# Detect OpenSSL
_DET_DSP_NAME := OpenSSL
_DET_VAR_INC_ := HB_INC_OPENSSL
_DET_VAR_HAS_ := HB_HAS_OPENSSL
_DET_UNS_PLAT := dos
_DET_UNS_COMP := watcom
_DET_INC_DEFP := /usr/include /usr/local/ssl/include
_DET_INC_HEAD := /openssl/ssl.h
include $(TOP)$(ROOT)config/detfun.mk
# Detect GPM mouse
_DET_DSP_NAME := GPM
_DET_VAR_INC_ := HB_INC_GPM
_DET_VAR_HAS_ := HB_HAS_GPM
_DET_UNS_PLAT := linux
_DET_UNS_COMP :=
_DET_INC_DEFP := /usr/include /usr/local/include
_DET_INC_HEAD := /gpm.h
include $(TOP)$(ROOT)config/detfun.mk
# Detect slang
_DET_DSP_NAME := slang
_DET_VAR_INC_ := HB_INC_SLANG
_DET_VAR_HAS_ := HB_HAS_SLANG
_DET_UNS_PLAT :=
_DET_UNS_COMP :=
_DET_INC_DEFP :=
_DET_INC_HEAD := /slang.h
ifeq ($(HB_LOCAL_SLN),yes)
_DET_INC_DEFP += /usr/local/include /usr/local/include/slang
else
_DET_INC_DEFP += /usr/include /usr/include/slang
_DET_INC_DEFP += /usr/usr/local/include /usr/local/include/slang
_DET_INC_DEFP += /sw/include /sw/include/slang
_DET_INC_DEFP += /opt/local/include /opt/local/include/slang
endif
include $(TOP)$(ROOT)config/detfun.mk
# Detect curses
_DET_DSP_NAME := curses
_DET_VAR_INC_ := HB_INC_CURSES
_DET_VAR_HAS_ := HB_HAS_CURSES
_DET_UNS_PLAT := os2
_DET_UNS_COMP :=
_DET_INC_DEFP :=
_DET_INC_HEAD := /curses.h
ifeq ($(HB_NCURSES_194),yes)
_DET_INC_DEFP += /usr/include/ncur194
else
_DET_INC_DEFP += /usr/include /usr/local/include /sw/include /opt/local/include
endif
ifeq ($(HB_COMPILER),djgpp)
_DET_INC_DEFP += $(foreach d, $(subst $(PTHSEP), ,$(PATH)), $(d)/../include)
endif
include $(TOP)$(ROOT)config/detfun.mk
# Detect X11
_DET_DSP_NAME := X11
_DET_VAR_INC_ := HB_INC_X11
_DET_VAR_HAS_ := HB_HAS_X11
_DET_UNS_PLAT :=
_DET_UNS_COMP :=
_DET_INC_DEFP := /usr/include
_DET_INC_HEAD := /X11/Xlib.h
include $(TOP)$(ROOT)config/detfun.mk
# Finished
# Compatibility outputs (deprecated)
ifeq ($(HB_HAS_GPM),)
HB_GPM_MOUSE := no
else
HB_GPM_MOUSE := yes
endif
endif # DETECT_MK_

51
harbour/config/detfun.mk Normal file
View File

@@ -0,0 +1,51 @@
#
# $Id$
#
# ---------------------------------------------------------------
# Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
# See COPYING for licensing terms.
#
# This make file will detect optional external components
# used in Harbour core code. Generic function.
# ---------------------------------------------------------------
# Show verbose information
_DET_SHOW_RES := yes
ifeq ($(_DET_SHOW_RES),yes)
do_info = $(info ! Component: $(1))
else
do_info =
endif
ifeq ($($(_DET_VAR_HAS_)),)
ifneq ($($(_DET_VAR_INC_)),no)
ifeq ($(filter $(HB_PLATFORM),$(_DET_UNS_PLAT)),)
ifeq ($(filter $(HB_COMPILER),$(_DET_UNS_COMP)),)
$(_DET_VAR_HAS_) := $($(_DET_VAR_INC_))
ifeq ($($(_DET_VAR_HAS_)),)
ifeq ($(HB_XBUILD),)
$(_DET_VAR_HAS_) := $(_DET_INC_DEFP)
endif
endif
ifneq ($($(_DET_VAR_HAS_)),)
$(_DET_VAR_HAS_) := $(strip $(foreach d,$($(_DET_VAR_HAS_)),$(if $(wildcard $(d)$(_DET_INC_HEAD)),$(d),)))
ifeq ($($(_DET_VAR_HAS_)),)
$(call do_info,$(_DET_DSP_NAME) not found)
else
$(call do_info,$(_DET_DSP_NAME) found in $($(_DET_VAR_HAS_)))
endif
else
$(call do_info,$(_DET_DSP_NAME) location not specified)
endif
else
$(call do_info,$(_DET_DSP_NAME) not supported with $(HB_COMPILER) compiler)
endif
else
$(call do_info,$(_DET_DSP_NAME) not supported on $(HB_PLATFORM) platform)
endif
else
$(call do_info,$(_DET_DSP_NAME) explicitly deselected)
endif
endif

View File

@@ -27,8 +27,8 @@
# NOTE: $(realpath/abspath) need GNU Make 3.81 or upper
# NOTE: $(eval) needs GNU Make 3.80 or upper
ifeq ($(GLOBAL_CF_),)
GLOBAL_CF_ := yes
ifeq ($(GLOBAL_MK_),)
GLOBAL_MK_ := yes
HB_VER_MAJOR := 2
HB_VER_MINOR := 0
@@ -36,8 +36,6 @@ HB_VER_RELEASE := 0
HB_VER_STATUS := beta2
HB_VER_STATUS_SH := b2
-include $(TOP)$(ROOT)config/conf.mk
# Arbitrary pattern which we don't expect to occur in real-world path names
substpat := !@!@
@@ -1073,43 +1071,7 @@ ifneq ($(HB_HOST_PLAT)$(HB_HOST_CPU),$(HB_PLATFORM)$(HB_CPU))
endif
endif
# Exclude Harbour-wide features prohibiting commercial usage
ifeq ($(HB_COMMERCE),yes)
export HB_GPM_MOUSE := no
export HB_WITHOUT_GTSLN := yes
endif
# Detect OpenSSL lib
ifeq ($(HB_HAS_OPENSSL),)
HB_HAS_OPENSSL := no
ifneq ($(HB_PLATFORM),dos)
ifneq ($(HB_COMPILER),watcom)
ifeq ($(HB_INC_OPENSSL),)
ifeq ($(HB_XBUILD),)
HB_INC_OPENSSL := /usr/include /usr/local/ssl/include
endif
endif
HB_INC_OPENSSL := $(strip $(foreach d,$(HB_INC_OPENSSL),$(if $(wildcard $(d)/openssl/ssl.h),$(d),)))
ifneq ($(HB_INC_OPENSSL),)
HB_HAS_OPENSSL := yes
export HB_INC_OPENSSL
endif
endif
endif
export HB_HAS_OPENSSL
endif
# Detect GPM mouse lib
ifeq ($(HB_GPM_MOUSE),)
HB_GPM_MOUSE := no
ifeq ($(HB_INC_GPM),)
HB_INC_GPM := /usr/include /usr/local/include
endif
ifneq ($(strip $(foreach d,$(HB_INC_GPM),$(if $(wildcard $(d)/gpm.h),$(d),))),)
HB_GPM_MOUSE := yes
endif
export HB_GPM_MOUSE
endif
include $(TOP)$(ROOT)config/detect.mk
# Names of portable GT drivers
HB_GT_LIBS := \
@@ -1330,4 +1292,4 @@ include $(TOP)$(ROOT)config/globsh.mk
endif
endif # GLOBAL_CF_
endif # GLOBAL_MK_

View File

@@ -8,7 +8,7 @@ include $(TOP)$(ROOT)config/global.mk
LIBNAME := hbssl
ifeq ($(HB_HAS_OPENSSL),yes)
ifneq ($(HB_HAS_OPENSSL),)
HB_CFLAGS += -I$(HB_INC_OPENSSL)
ifeq ($(HB_PLATFORM),darwin)

View File

@@ -42,7 +42,7 @@ INSTALL_RULE_HEADERS := $(INSTALL_RULE)
include $(TOP)$(ROOT)config/lib.mk
DIRS :=
ifeq ($(HB_HAS_OPENSSL),yes)
ifneq ($(HB_HAS_OPENSSL),)
DIRS += hbtipssl
endif

View File

@@ -11,7 +11,7 @@ vpath %.prg ../
LIBNAME := hbtipssl
ifeq ($(HB_HAS_OPENSSL),yes)
ifneq ($(HB_HAS_OPENSSL),)
HB_PRGFLAGS += -DHB_HAS_OPENSSL
HB_INC_DEPEND := -I$(TOP)$(ROOT)contrib/hbssl