configure.ac, Makefile.am, pcre.c, regexp.c: Overhaul conditional building.
[anag] / configure.ac
index f1cac47..272fe9c 100644 (file)
@@ -40,9 +40,15 @@ dnl--------------------------------------------------------------------------
 dnl C programming environment.
 
 AC_CHECK_FUNCS([regcomp])
-
-AC_SEARCH_LIBS([pcre_fullinfo], [pcre],
-  [AC_DEFINE([HAVE_PCRE], [1], [Define if you have libpcre available.])])
+AM_CONDITIONAL([HAVE_REGCOMP], [test $ac_cv_func_regcomp = yes])
+
+mdw_have_pcre2=nil mdw_have_pcre=nil
+PKG_CHECK_MODULES([PCRE], [libpcre],
+  [mdw_have_pcre=t AM_CFLAGS="$AM_CFLAGS $PCRE_CFLAGS"], [])
+AM_CONDITIONAL([HAVE_PCRE], [test $mdw_have_pcre = t])
+case $mdw_have_pcre in
+  t) AC_DEFINE([HAVE_PCRE], [1], [PCRE library is available.]) ;;
+esac
 
 dnl--------------------------------------------------------------------------
 dnl Java.