Skip to content

Commit 05ccaa2

Browse files
committed
regex: allow pcre3 library
1 parent aad6b85 commit 05ccaa2

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

modules/regex/Makefile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,29 @@ NAME=regex.so
88
# the autodetection
99
# CROSS_COMPILE=true
1010

11+
PCRE_LIB ?= pcre2-8
12+
PCRE_VERSION ?= $(word 1,$(subst -, , $(PCRE_LIB)))
13+
PCRE_CONFIG ?= $(PCRE_VERSION)-config
14+
1115
ifeq ($(CROSS_COMPILE),)
1216
PCRE_BUILDER := $(shell \
13-
if which pcre2-config >/dev/null 2>/dev/null; then \
14-
echo 'pcre2-config'; \
15-
elif pkg-config --exists libpcre2-8; then \
16-
echo 'pkg-config libpcre2-8'; \
17+
if which $(PCRE_CONFIG) >/dev/null 2>/dev/null; then \
18+
echo '$(PCRE_CONFIG)'; \
19+
elif pkg-config --exists lib$(PCRE_LIB); then \
20+
echo 'pkg-config lib$(PCRE_LIB)'; \
1721
fi)
1822
endif
1923

2024
ifeq ($(PCRE_BUILDER),)
2125
DEFS += -I$(SYSBASE)/include \
2226
-I$(LOCALBASE)/include
2327
LIBS += -L$(SYSBASE)/lib \
24-
-L$(LOCALBASE)/lib -lpcre2-8
28+
-L$(LOCALBASE)/lib -l$(PCRE_LIB)
2529
else
2630
DEFS += $(shell $(PCRE_BUILDER) --cflags)
27-
LIBS += $(shell $(PCRE_BUILDER) --libs8)
31+
LIBS += $(shell $(PCRE_BUILDER) --libs 2>/dev/null) \
32+
$(shell $(PCRE_BUILDER) --libs$(word 2,$(subst -, ,$(PCRE_LIB))) 2>/dev/null)
2833
endif
34+
DEFS += -D$(shell echo $(PCRE_VERSION) | tr 'a-z' 'A-Z')_LIB
2935

3036
include ../../Makefile.modules

0 commit comments

Comments
 (0)