-LIBRARY_PCRE_ONLY=#
-STATIC_PCRE_ONLY=
-AC_ARG_ENABLE(static-pcre,
-[ --disable-static-pcre Link dynamically with the pcre and pcreposix
- libraries. You must build the libraries seperately.],
-[if test $enableval = no; then
- LIBRARY_PCRE_ONLY=
+dnl pcre/pcrs is needed for CGI anyway, so
+dnl the choice is only between static and
+dnl dynamic:
+
+AC_ARG_ENABLE(regex-matching,
+[ --enable-regex-matching=pcre Use perl-compatible regex for actionsfile pattern matching (default)
+ --enable-regex-matching=gnu Use gnu style regex for actionsfile pattern matching (-> bigger binary)
+ --disable-regex-matching Don't use regex matching, compare URL prefix instead (won't shrink birary)],
+[ regex_matching=$enableval ],
+[ regex_matching=pcre ])
+
+AC_ARG_ENABLE(dynamic-pcre,
+[ --disable-dynamic-pcre Use the built-in, static pcre, even if libpcre is available],
+[ if test $enableval = "no"; then have_pcre=no; fi ])
+
+AC_ARG_ENABLE(dynamic-pcrs,
+[ --disable-dynamic-pcrs Use the built-in, static pcrs, even if libpcrs is available],
+[ if test $enableval = "no"; then have_pcrs=no; fi ])
+
+
+# Is the regex URL matching based on libpcreposix, but we
+# don't have that library?
+#
+if test $have_pcreposix = "yes" -o $regex_matching != "pcre"; then
+ dont_miss_pcreposix=yes
+else
+ dont_miss_pcreposix=no
+fi
+
+# If we have libpcre and either we also have pcreposix or
+# we don't need pcreposix, then link pcre dynamically; else
+# build it and link statically
+#
+if test $have_pcre = "yes" -a $dont_miss_pcreposix = "yes"; then
+ echo "using libpcre"
+ pcre_dyn=yes