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.
This commit is contained in:
Willy Tarreau 2022-12-21 17:27:46 +01:00
parent f297b18eac
commit 8ea58f5c76
1 changed files with 7 additions and 3 deletions

View File

@ -732,6 +732,8 @@ endif
# Forcing PCREDIR to an empty string will let the compiler use the default # Forcing PCREDIR to an empty string will let the compiler use the default
# locations. # locations.
# in case only USE_STATIC_PCRE/USE_PCRE_JIT were set
USE_PCRE := $(if $(USE_PCRE),$(USE_PCRE),implicit)
PCRE_CONFIG := pcre-config PCRE_CONFIG := pcre-config
PCREDIR := $(shell $(PCRE_CONFIG) --prefix 2>/dev/null || echo /usr/local) PCREDIR := $(shell $(PCRE_CONFIG) --prefix 2>/dev/null || echo /usr/local)
ifneq ($(PCREDIR),) ifneq ($(PCREDIR),)
@ -741,16 +743,18 @@ endif
ifeq ($(USE_STATIC_PCRE),) ifeq ($(USE_STATIC_PCRE),)
# dynamic 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 OPTIONS_LDFLAGS += $(if $(PCRE_LIB),-L$(PCRE_LIB)) -lpcreposix -lpcre
else else
# static PCRE # 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 OPTIONS_LDFLAGS += $(if $(PCRE_LIB),-L$(PCRE_LIB)) -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynamic
endif endif
endif endif
ifneq ($(USE_PCRE2)$(USE_STATIC_PCRE2)$(USE_PCRE2_JIT),) 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 PCRE2_CONFIG := pcre2-config
PCRE2DIR := $(shell $(PCRE2_CONFIG) --prefix 2>/dev/null || echo /usr/local) PCRE2DIR := $(shell $(PCRE2_CONFIG) --prefix 2>/dev/null || echo /usr/local)
ifneq ($(PCRE2DIR),) ifneq ($(PCRE2DIR),)
@ -780,7 +784,7 @@ PCRE2_LDFLAGS += -lpcre2-posix
endif endif
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)) OPTIONS_CFLAGS += $(if $(PCRE2_INC), -I$(PCRE2_INC))
ifneq ($(USE_STATIC_PCRE2),) ifneq ($(USE_STATIC_PCRE2),)