From 9797fb4e49a0ce9fad6f011571cc04417d053516 Mon Sep 17 00:00:00 2001 From: Andres Mejia Date: Sat, 2 Feb 2013 23:46:44 -0500 Subject: [PATCH] Make POSIX regex checks cleaner. --- configure.ac | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c44d3001f..7f405d76e 100644 --- a/configure.ac +++ b/configure.ac @@ -359,12 +359,23 @@ posix_regex_lib_found= if test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libc" || test "$enable_posix_regex_lib" = "libregex"; then AC_CHECK_HEADERS([regex.h]) if test "x$ac_cv_header_regex_h" != "xno"; then - AC_CHECK_FUNC(regcomp, posix_regex_lib_found=1, [AC_CHECK_LIB(regex,regcomp,posix_regex_lib_found=1;LIBS="-lregex $LIBS";AC_DEFINE([HAVE_LIBREGEX], [1], [Define to 1 if you have the `regex' library (-lregex).]))]) + AC_CHECK_FUNC(regcomp) + if test "x$ac_cv_func_regcomp" = xyes; then + posix_regex_lib_found=1 + else + AC_CHECK_LIB(regex,regcomp) + if test "x$ac_cv_lib_regex_regcomp" = xyes; then + posix_regex_lib_found=1 + fi + fi fi fi if test -z $posix_regex_lib_found && (test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libpcreposix"); then AC_CHECK_HEADERS([pcreposix.h]) - AC_CHECK_LIB(pcreposix,regcomp,posix_regex_lib_found=1;LIBS="-lpcreposix $LIBS";AC_DEFINE([HAVE_LIBPCREPOSIX], [1], [Define to 1 if you have the `pcreposix' library (-lpcreposix).])) + AC_CHECK_LIB(pcreposix,regcomp) + if test "x$ac_cv_lib_pcreposix_regcomp" = xyes; then + posix_regex_lib_found=1 + fi fi # TODO: Give the user the option of using a pre-existing system -- 2.47.2