BUILD/MEDIUM: da Adding pcre2 support.

The DeviceAtlas Detection API now supports also the pcre2 library,
 and some users wish to have exclusively this version in their
environment.
Also, there is no longer new development happening in the legacy
 pcre(1) counterpart.
Simple check in the build process as the mutual exclusivity check between the
 two are already taking care of early on. Moving the check to the part
only when we build haproxy + the API from source as the other case the API is
 already built with the chosen regex library separately.
diff --git a/Makefile b/Makefile
index a21f738..d5c3f4c 100644
--- a/Makefile
+++ b/Makefile
@@ -616,9 +616,6 @@
 endif
 
 ifneq ($(USE_DEVICEATLAS),)
-ifeq ($(USE_PCRE),)
-$(error the DeviceAtlas module needs the PCRE library in order to compile)
-endif
 # Use DEVICEATLAS_SRC and possibly DEVICEATLAS_INC and DEVICEATLAS_LIB to force path
 # to DeviceAtlas headers and libraries if needed.
 DEVICEATLAS_SRC =
@@ -627,6 +624,14 @@
 ifeq ($(DEVICEATLAS_SRC),)
 OPTIONS_LDFLAGS += -lda
 else
+ifeq ($(USE_PCRE),)
+ifeq ($(USE_PCRE2),)
+$(error the DeviceAtlas module needs the PCRE or the PCRE2 library in order to compile)
+endif
+endif
+ifneq ($(USE_PCRE2),)
+OPTIONS_CFLAGS  += -DDA_REGEX_HDR=\"dac_pcre2.c\" -DDA_REGEX_TAG=2
+endif
 OPTIONS_OBJS	+= $(DEVICEATLAS_LIB)/json.o
 OPTIONS_OBJS	+= $(DEVICEATLAS_LIB)/dac.o
 endif