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),
DOVECOT_WANT_TEXTCAT
DOVECOT_WANT_ICU
+DOVECOT_WANT_PCRE
DOVECOT_WANT_APPARMOR
--- /dev/null
+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")
+])