diff --git a/Makefile b/Makefile index bc6f59f08..e7e3e1c47 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,6 @@ # USE_PROMEX : enable the Prometheus exporter # USE_DEVICEATLAS : enable DeviceAtlas api. # USE_51DEGREES : enable third party device detection library from 51Degrees -# USE_51DEGREES_V4 : enable use of 51Degrees V4 engine with Hash algorithm # USE_WURFL : enable WURFL detection library from Scientiamobile # USE_SYSTEMD : enable sd_notify() support. # USE_OBSOLETE_LINKER : use when the linker fails to emit __start_init/__stop_init @@ -304,7 +303,7 @@ use_opts = USE_EPOLL USE_KQUEUE USE_NETFILTER \ USE_GETADDRINFO USE_OPENSSL USE_OPENSSL_WOLFSSL USE_LUA \ USE_ACCEPT4 USE_CLOSEFROM USE_ZLIB USE_SLZ USE_CPU_AFFINITY \ USE_TFO USE_NS USE_DL USE_RT USE_LIBATOMIC USE_MATH \ - USE_DEVICEATLAS USE_51DEGREES USE_51DEGREES_V4 \ + USE_DEVICEATLAS USE_51DEGREES \ USE_WURFL USE_SYSTEMD USE_OBSOLETE_LINKER USE_PRCTL USE_PROCCTL \ USE_THREAD_DUMP USE_EVPORTS USE_OT USE_QUIC USE_PROMEX \ USE_MEMORY_PROFILING USE_SHM_OPEN @@ -662,39 +661,43 @@ ifneq ($(USE_DEVICEATLAS),) endif # Use 51DEGREES_SRC and possibly 51DEGREES_INC and 51DEGREES_LIB to force path -# to 51degrees v3/v4 headers and libraries if needed. +# to 51degrees v3/v4 headers and libraries if needed. Note that the SRC/INC/ +# LIB/CFLAGS/LDFLAGS variables names all use 51DEGREES as the prefix, +# regardless of the version since they are mutually exclusive. The version +# (51DEGREES_VER) must be either 3 or 4, and defaults to 3 if not set. 51DEGREES_INC = $(51DEGREES_SRC) 51DEGREES_LIB = $(51DEGREES_SRC) +51DEGREES_VER = 3 -ifneq ($(USE_51DEGREES_V4),) # v4 here - ifneq ($(USE_51DEGREES),) - $(error cannot compile both 51Degrees V3 and V4 engine support) - endif - _51DEGREES_SRC = $(shell find $(51DEGREES_LIB) -maxdepth 2 -name '*.c') - OPTIONS_OBJS += $(_51DEGREES_SRC:%.c=%.o) - OPTIONS_CFLAGS += -DUSE_51DEGREES_V4 - ifeq ($(USE_THREAD),) - OPTIONS_CFLAGS += -DFIFTYONEDEGREES_NO_THREADING -DFIFTYONE_DEGREES_NO_THREADING - endif - OPTIONS_OBJS += addons/51degrees/51d.o - OPTIONS_CFLAGS += $(if $(51DEGREES_INC),-I$(51DEGREES_INC)) - OPTIONS_LDFLAGS += $(if $(51DEGREES_LIB),-L$(51DEGREES_LIB)) - USE_ATOMIC = implicit - USE_MATH = implicit -endif # USE_51DEGREES_V4 +ifneq ($(USE_51DEGREES),) + ifeq ($(51DEGREES_VER),4) # v4 here + _51DEGREES_SRC = $(shell find $(51DEGREES_LIB) -maxdepth 2 -name '*.c') + OPTIONS_OBJS += $(_51DEGREES_SRC:%.c=%.o) + 51DEGREES_CFLAGS += -DUSE_51DEGREES_V4 + ifeq ($(USE_THREAD),) + 51DEGREES_CFLAGS += -DFIFTYONEDEGREES_NO_THREADING -DFIFTYONE_DEGREES_NO_THREADING + endif + USE_ATOMIC = implicit + endif # 51DEGREES_VER==4 -ifneq ($(USE_51DEGREES),) # v3 here - OPTIONS_OBJS += $(51DEGREES_LIB)/../cityhash/city.o - OPTIONS_OBJS += $(51DEGREES_LIB)/51Degrees.o - ifeq ($(USE_THREAD),) - OPTIONS_CFLAGS += -DFIFTYONEDEGREES_NO_THREADING + ifeq ($(51DEGREES_VER),3) # v3 here + OPTIONS_OBJS += $(51DEGREES_LIB)/../cityhash/city.o + OPTIONS_OBJS += $(51DEGREES_LIB)/51Degrees.o + ifeq ($(USE_THREAD),) + 51DEGREES_CFLAGS += -DFIFTYONEDEGREES_NO_THREADING + else + OPTIONS_OBJS += $(51DEGREES_LIB)/../threading.o + endif else - OPTIONS_OBJS += $(51DEGREES_LIB)/../threading.o - endif - OPTIONS_OBJS += addons/51degrees/51d.o - OPTIONS_CFLAGS += $(if $(51DEGREES_INC),-I$(51DEGREES_INC)) - OPTIONS_LDFLAGS += $(if $(51DEGREES_LIB),-L$(51DEGREES_LIB)) - USE_MATH = implicit + ifneq ($(51DEGREES_VER),4) + $(error 51Degrees version (51DEGREES_VER) must be either 3 or 4) + endif + endif # 51DEGREES_VER==3 + + OPTIONS_OBJS += addons/51degrees/51d.o + 51DEGREES_CFLAGS += $(if $(51DEGREES_INC),-I$(51DEGREES_INC)) + 51DEGREES_LDFLAGS += $(if $(51DEGREES_LIB),-L$(51DEGREES_LIB)) + USE_MATH = implicit endif # USE_51DEGREES ifneq ($(USE_WURFL),) diff --git a/doc/51Degrees-device-detection.txt b/doc/51Degrees-device-detection.txt index b3d3421f6..2fa64e377 100644 --- a/doc/51Degrees-device-detection.txt +++ b/doc/51Degrees-device-detection.txt @@ -30,11 +30,11 @@ official git repository : git clone --recurse-submodules https://github.com/51Degrees/device-detection-cxx.git -then run 'make' with USE_51DEGREES or USE_51DEGREES_V4 (if using 51Degrees -version 4), and 51DEGREES_SRC set. Both 51DEGREES_INC and 51DEGREES_LIB may -additionally be used to force specific different paths for .o and .h, but -will default to 51DEGREES_SRC. Make sure to replace '51D_REPO_PATH' with -the path to the 51Degrees repository. +then run 'make' with USE_51DEGREES, optionally 51DEGREES_VER=4 (if using +51Degrees version 4), and 51DEGREES_SRC set. Both 51DEGREES_INC and +51DEGREES_LIB may additionally be used to force specific different paths for +.o and .h, but will default to 51DEGREES_SRC. Make sure to replace +'51D_REPO_PATH' with the path to the 51Degrees repository. 51Degrees provide 4 different detection algorithms: @@ -55,7 +55,7 @@ To use the 51Degrees Trie algorithm use the following command line. To build with the 51Degrees Device Detection V4 use the following command line. - $ make TARGET= USE_51DEGREES_V4=1 51DEGREES_SRC='51D_REPO_PATH'/src + $ make TARGET= USE_51DEGREES=1 51DEGREES_VER=4 51DEGREES_SRC='51D_REPO_PATH'/src A data file containing information about devices, browsers, operating systems and their associated signatures is then needed. 51Degrees provide a free @@ -77,7 +77,7 @@ Hash algorithm, build with: or $ make TARGET= USE_51DEGREES=1 51DEGREES_SRC=addons/51degrees/dummy/trie or - $ make TARGET= USE_51DEGREES_V4=1 51DEGREES_SRC=addons/51degrees/dummy/v4hash + $ make TARGET= USE_51DEGREES=1 51DEGREES_VER=4 51DEGREES_SRC=addons/51degrees/dummy/v4hash respectively. diff --git a/doc/configuration.txt b/doc/configuration.txt index f08e58c67..93f78cb8e 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -1176,7 +1176,7 @@ The following keywords are supported in the "global" section : file should be unzipped and accessible by HAProxy with relevant permissions. Please note that this option is only available when HAProxy has been - compiled with USE_51DEGREES or USE_51DEGREES_V4. + compiled with USE_51DEGREES. 51degrees-property-name-list [ ...] A list of 51Degrees property names to be load from the dataset. A full list @@ -1184,14 +1184,14 @@ The following keywords are supported in the "global" section : https://51degrees.com/resources/property-dictionary Please note that this option is only available when HAProxy has been - compiled with USE_51DEGREES or USE_51DEGREES_V4. + compiled with USE_51DEGREES. 51degrees-property-separator A char that will be appended to every property value in a response header containing 51Degrees results. If not set that will be set as ','. Please note that this option is only available when HAProxy has been - compiled with USE_51DEGREES or USE_51DEGREES_V4. + compiled with USE_51DEGREES. 51degrees-cache-size Sets the size of the 51Degrees converter cache to entries. This @@ -1199,40 +1199,40 @@ The following keywords are supported in the "global" section : By default, this cache is disabled. Please note that this option is only available when HAProxy has been - compiled with USE_51DEGREES or USE_51DEGREES_V4. + compiled with USE_51DEGREES. 51degrees-use-performance-graph { on | off } Enables ('on') or disables ('off') the use of the performance graph in the detection process. The default value depends on 51Degrees library. Please note that this option is only available when HAProxy has been - compiled with USE_51DEGREES_V4. + compiled with USE_51DEGREES and 51DEGREES_VER=4. 51degrees-use-predictive-graph { on | off } Enables ('on') or disables ('off') the use of the predictive graph in the detection process. The default value depends on 51Degrees library. Please note that this option is only available when HAProxy has been - compiled with USE_51DEGREES_V4. + compiled with USE_51DEGREES and 51DEGREES_VER=4. 51degrees-drift Sets the drift value that a detection can allow. Please note that this option is only available when HAProxy has been - compiled with USE_51DEGREES_V4. + compiled with USE_51DEGREES and 51DEGREES_VER=4. 51degrees-difference Sets the difference value that a detection can allow. Please note that this option is only available when HAProxy has been - compiled with USE_51DEGREES_V4. + compiled with USE_51DEGREES and 51DEGREES_VER=4. 51degrees-allow-unmatched { on | off } Enables ('on') or disables ('off') the use of unmatched nodes in the detection process. The default value depends on 51Degrees library. Please note that this option is only available when HAProxy has been - compiled with USE_51DEGREES_V4. + compiled with USE_51DEGREES and 51DEGREES_VER=4. ca-base Assigns a default directory to fetch SSL CA certificates and CRLs from when a