dnl CF_REGEX_H_FUNCS version: 8 updated: 2023/01/05 18:54:42
dnl ----------------
dnl Tests for the <regex.h> include-file, and the functions associated with it.
AC_DEFUN([CF_REGEX_H_FUNCS],
[
AC_CHECK_LIB(regex,regcomp,[LIBS="-lregex $LIBS"])
AC_CACHE_CHECK(regcomp/regexec functions, cf_cv_REGEX_H,[
	AC_TRY_RUN([
$ac_includes_default

#include <regex.h>

int main(void)
{
		regex_t e;
		char *p = "foo";
		char *s = "foobar";
		if (regcomp(&e, p, 0) != 0
		 || regexec(&e, s, 0, (regmatch_t*)0, 0) < 0)
			${cf_cv_main_return:-return}(1);
		regfree(&e);
		${cf_cv_main_return:-return}(0);
}
	],
	[cf_cv_REGEX_H=yes],
	[cf_cv_REGEX_H=no],
	[cf_cv_REGEX_H=unknown])
])
test "$cf_cv_REGEX_H" = yes && AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 if we have regcomp/regexec functions])
])dnl
