]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: makefile: properly report USE_PCRE/USE_PCRE2 in features
authorWilly Tarreau <w@1wt.eu>
Wed, 21 Dec 2022 16:27:46 +0000 (17:27 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 23 Dec 2022 15:53:35 +0000 (16:53 +0100)
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

index 88735a938e6ad690c2d17311201820bfe88afc7c..808a11212193fb900a9b16c4beeac37f0e5f7e6e 100644 (file)
--- 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),)