From 8ea58f5c768b5afc54307bbf0f34d25010427e60 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 21 Dec 2022 17:27:46 +0100 Subject: [PATCH] BUILD: makefile: properly report USE_PCRE/USE_PCRE2 in features The PCRE/PCRE2 CFLAGS forcefully add -DUSE_PCRE or -DUSE_PCRE2 because we want that USE_STATIC_PCRE or USE_PCRE_JIT implicitly enables them. However, doing it this way is incorrect because the option is not visible in BUILD_FEATURES, and for example, some regtests depending on such features (such as map_redirect.vtc) would be skipped if only the static or jit versions are enabled. The correct way to do this is to always set USE_PCRE feature for such variants instead of adding the define. This could almost be backported but would require to backport other makefile patches and likely only has effects on the reg-tests at the moment, so it's probably not worth the hassle. --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 88735a938..808a11212 100644 --- a/Makefile +++ b/Makefile @@ -732,6 +732,8 @@ endif # Forcing PCREDIR to an empty string will let the compiler use the default # locations. +# in case only USE_STATIC_PCRE/USE_PCRE_JIT were set +USE_PCRE := $(if $(USE_PCRE),$(USE_PCRE),implicit) PCRE_CONFIG := pcre-config PCREDIR := $(shell $(PCRE_CONFIG) --prefix 2>/dev/null || echo /usr/local) ifneq ($(PCREDIR),) @@ -741,16 +743,18 @@ endif ifeq ($(USE_STATIC_PCRE),) # dynamic PCRE -OPTIONS_CFLAGS += -DUSE_PCRE $(if $(PCRE_INC),-I$(PCRE_INC)) +OPTIONS_CFLAGS += $(if $(PCRE_INC),-I$(PCRE_INC)) OPTIONS_LDFLAGS += $(if $(PCRE_LIB),-L$(PCRE_LIB)) -lpcreposix -lpcre else # static PCRE -OPTIONS_CFLAGS += -DUSE_PCRE $(if $(PCRE_INC),-I$(PCRE_INC)) +OPTIONS_CFLAGS += $(if $(PCRE_INC),-I$(PCRE_INC)) OPTIONS_LDFLAGS += $(if $(PCRE_LIB),-L$(PCRE_LIB)) -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynamic endif endif ifneq ($(USE_PCRE2)$(USE_STATIC_PCRE2)$(USE_PCRE2_JIT),) +# in case only USE_STATIC_PCRE2/USE_PCRE2_JIT were set +USE_PCRE2 := $(if $(USE_PCRE2),$(USE_PCRE2),implicit) PCRE2_CONFIG := pcre2-config PCRE2DIR := $(shell $(PCRE2_CONFIG) --prefix 2>/dev/null || echo /usr/local) ifneq ($(PCRE2DIR),) @@ -780,7 +784,7 @@ PCRE2_LDFLAGS += -lpcre2-posix endif endif -OPTIONS_CFLAGS += -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=$(PCRE2_WIDTH) +OPTIONS_CFLAGS += -DPCRE2_CODE_UNIT_WIDTH=$(PCRE2_WIDTH) OPTIONS_CFLAGS += $(if $(PCRE2_INC), -I$(PCRE2_INC)) ifneq ($(USE_STATIC_PCRE2),)