]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
autoconf: Add libcpre2 detection
authorAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 23 Jul 2025 08:04:30 +0000 (11:04 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 29 Aug 2025 08:41:41 +0000 (11:41 +0300)
configure.ac
m4/want_pcre.m4 [new file with mode: 0644]

index 1bbca6cee3ab4f751f4b69024e6d7662f61002c1..73c2fa4970490745142362a461390b0be4633334 100644 (file)
@@ -171,6 +171,11 @@ AS_HELP_STRING([--with-icu], [Build with libicu support (for lib-language normal
   want_icu=$withval,
   want_icu=auto)
 
+AC_ARG_WITH(pcre2,
+AS_HELP_STRING([--with-pcre2], [Build with libpcre2 support (for regular expression support) (auto)]),
+  want_pcre=$withval,
+  want_pcre=auto)
+
 AC_ARG_WITH(solr,
 AS_HELP_STRING([--with-solr], [Build with Solr full text search support]),
   TEST_WITH(solr, $withval),
@@ -721,6 +726,7 @@ DOVECOT_WANT_STEMMER
 DOVECOT_WANT_TEXTCAT
 
 DOVECOT_WANT_ICU
+DOVECOT_WANT_PCRE
 
 DOVECOT_WANT_APPARMOR
 
diff --git a/m4/want_pcre.m4 b/m4/want_pcre.m4
new file mode 100644 (file)
index 0000000..ccf10ce
--- /dev/null
@@ -0,0 +1,19 @@
+AC_DEFUN([DOVECOT_WANT_PCRE], [
+  have_pcre=no
+
+  AS_IF([test "$want_pcre" != "no"], [
+    PKG_CHECK_MODULES([LIBPCRE], [libpcre2-32], [have_pcre=yes], [
+      have_pcre=no
+
+      AS_IF([test "$want_pcre" = "yes"], [
+        AC_MSG_ERROR(cannot build with pcre support: pcre library (libpcre2-32) not found)
+      ])
+    ])
+  ])
+
+  AS_IF([test "$have_pcre" != "no"], [
+    AC_DEFINE(HAVE_LIBPCRE,, [Define if you have libpcre2 backed regular expressions])
+  ])
+
+  AM_CONDITIONAL(BUILD_LIBREGEX, test "$have_pcre" = "yes")
+])