-AC_CHECK_LIB(pcre, pcre_compile,
- [AC_SUBST(LIBPCRE,[-lpcre])],
- [missing_libraries="$missing_libraries libpcre"])
+PKG_CHECK_MODULES([PCRE2], [libpcre2-8], [have_pcre2=yes], [have_pcre2=no])
+case $have_pcre2 in
+ yes)
+ CFLAGS="$CFLAGS $PCRE2_CFLAGS" LIBPCRE=$PCRE2_LIBS
+ AC_DEFINE([HAVE_LIBPCRE2], [1], [Define if building with libpcre2.])
+ ;;
+ no)
+ AC_CHECK_LIB(pcre, pcre_compile,
+ [AC_SUBST(LIBPCRE,[-lpcre])],
+ [missing_libraries="$missing_libraries libpcre"])
+ ;;
+esac