Make it possible to use a locally augmented gnulib.
[gnulib.git] / m4 / regex.m4
index c6490d2..cd71366 100644 (file)
@@ -1,4 +1,4 @@
-#serial 35
+#serial 37
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
 # 2006 Free Software Foundation, Inc.
@@ -28,7 +28,7 @@ AC_DEFUN([gl_REGEX],
   yes|no) ac_use_included_regex=$with_included_regex
        ;;
   '')
-    # If the system regex support is good enough that it passes the the
+    # If the system regex support is good enough that it passes the
     # following run test, then default to *not* using the included regex.c.
     # If cross compiling, assume the test would fail and use the included
     # regex.c.  The first failing regular expression is from `Spencer ere
@@ -38,13 +38,19 @@ AC_DEFUN([gl_REGEX],
       [AC_RUN_IFELSE(
        [AC_LANG_PROGRAM(
          [AC_INCLUDES_DEFAULT
+          #include <limits.h>
           #include <regex.h>
           ],
          [[static struct re_pattern_buffer regex;
+           unsigned char folded_chars[UCHAR_MAX + 1];
+           int i;
            const char *s;
            struct re_registers regs;
            re_set_syntax (RE_SYNTAX_POSIX_EGREP);
            memset (&regex, 0, sizeof (regex));
+           for (i = 0; i <= UCHAR_MAX; i++)
+             folded_chars[i] = i;
+           regex.translate = folded_chars;
            s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, &regex);
            /* This should fail with _Invalid character class name_ error.  */
            if (!s)
@@ -160,5 +166,6 @@ AC_DEFUN([gl_PREREQ_REGEX],
   AC_REQUIRE([gl_C_RESTRICT])
   AC_REQUIRE([AM_LANGINFO_CODESET])
   AC_CHECK_HEADERS_ONCE([locale.h wchar.h wctype.h])
-  AC_CHECK_FUNCS_ONCE([isblank mbrtowc mempcpy wcrtomb wcscoll])
+  AC_CHECK_FUNCS_ONCE([mbrtowc mempcpy wcrtomb wcscoll])
+  AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
 ])