From 38fc1545fe8cf8b97ff3b23f4a4279a0eb344881 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Wed, 23 Jul 2025 11:04:30 +0300 Subject: [PATCH] autoconf: Add libcpre2 detection --- configure.ac | 6 ++++++ m4/want_pcre.m4 | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 m4/want_pcre.m4 diff --git a/configure.ac b/configure.ac index 1bbca6cee3..73c2fa4970 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index 0000000000..ccf10ceb71 --- /dev/null +++ b/m4/want_pcre.m4 @@ -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") +]) -- 2.47.3