BUILD: make it possible to look for pcre in the default system paths
If running "make PCREDIR=" will not force to add -I nor -L anymore.
diff --git a/Makefile b/Makefile
index 587b4e0..d57c36a 100644
--- a/Makefile
+++ b/Makefile
@@ -438,13 +438,14 @@
ifneq ($(USE_PCRE),)
# PCREDIR is the directory hosting include/pcre.h and lib/libpcre.*. It is
-# automatically detected but can be forced if required.
+# automatically detected but can be forced if required. Forcing it to an empty
+# string will result in search only in the default paths.
ifeq ($(PCREDIR),)
PCREDIR := $(shell pcre-config --prefix 2>/dev/null || echo /usr/local)
endif
ifeq ($(USE_STATIC_PCRE),)
-OPTIONS_CFLAGS += -DUSE_PCRE -I$(PCREDIR)/include
-OPTIONS_LDFLAGS += -L$(PCREDIR)/lib -lpcreposix -lpcre
+OPTIONS_CFLAGS += -DUSE_PCRE $(if $(PCREDIR),-I$(PCREDIR)/include)
+OPTIONS_LDFLAGS += $(if $(PCREDIR),-L$(PCREDIR)/lib) -lpcreposix -lpcre
endif
BUILD_OPTIONS += $(call ignore_implicit,USE_PCRE)
endif
@@ -455,8 +456,8 @@
ifeq ($(PCREDIR),)
PCREDIR := $(shell pcre-config --prefix 2>/dev/null || echo /usr/local)
endif
-OPTIONS_CFLAGS += -DUSE_PCRE -I$(PCREDIR)/include
-OPTIONS_LDFLAGS += -L$(PCREDIR)/lib -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynamic
+OPTIONS_CFLAGS += -DUSE_PCRE $(if $(PCREDIR),-I$(PCREDIR)/include)
+OPTIONS_LDFLAGS += $(if $(PCREDIR),-L$(PCREDIR)/lib) -Wl,-Bstatic -lpcreposix -lpcre -Wl,-Bdynamic
BUILD_OPTIONS += $(call ignore_implicit,USE_STATIC_PCRE)
endif