+dnl ------------------------------------------------------------------------
+dnl Check for regex libraries
+dnl ------------------------------------------------------------------------
+
+REGEX_INCLUDE=
+if test "$wxUSE_REGEX" != "no"; then
+ dnl according to Unix 98 specs, regcomp() is in libc but I believe that
+ dnl on some old systems it may be in libregex - check for it too?
+ AC_CHECK_HEADER(regex.h, AC_CHECK_FUNCS(regcomp))
+
+ if test "x$ac_cv_func_regcomp" != "xyes"; then
+ dnl we were asked to use the system version of regex lib only but it
+ dnl is not available
+ if test "$wxUSE_REGEX" = "sys"; then
+ AC_MSG_ERROR([system regex library not found! Use --with-regex to use the built-in regex library.])
+ fi
+
+ dnl fallback to the built in code
+ REGEX_INCLUDE="-I\${top_srcdir}/src/regex"
+ fi
+
+ AC_DEFINE(wxUSE_REGEX)
+fi
+