maint: update all copyright year number ranges
[gnulib.git] / m4 / regex.m4
index e95962b..b3a6b1c 100644 (file)
@@ -1,7 +1,6 @@
-# serial 57
+# serial 61
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996-2001, 2003-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -14,8 +13,6 @@ AC_PREREQ([2.50])
 
 AC_DEFUN([gl_REGEX],
 [
-  AC_CHECK_HEADERS_ONCE([locale.h])
-
   AC_ARG_WITH([included-regex],
     [AS_HELP_STRING([--without-included-regex],
                     [don't compile regex; this is the default on systems
@@ -35,9 +32,7 @@ AC_DEFUN([gl_REGEX],
       [AC_RUN_IFELSE(
         [AC_LANG_PROGRAM(
           [AC_INCLUDES_DEFAULT[
-           #if HAVE_LOCALE_H
-            #include <locale.h>
-           #endif
+           #include <locale.h>
            #include <limits.h>
            #include <regex.h>
            ]],
@@ -48,31 +43,29 @@ AC_DEFUN([gl_REGEX],
             const char *s;
             struct re_registers regs;
 
-            #if HAVE_LOCALE_H
-              /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html
-                 This test needs valgrind to catch the bug on Debian
-                 GNU/Linux 3.1 x86, but it might catch the bug better
-                 on other platforms and it shouldn't hurt to try the
-                 test here.  */
-              if (setlocale (LC_ALL, "en_US.UTF-8"))
-                {
-                  static char const pat[] = "insert into";
-                  static char const data[] =
-                    "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK";
-                  re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE
-                                 | RE_ICASE);
-                  memset (&regex, 0, sizeof regex);
-                  s = re_compile_pattern (pat, sizeof pat - 1, &regex);
-                  if (s)
-                    result |= 1;
-                  else if (re_search (&regex, data, sizeof data - 1,
-                                      0, sizeof data - 1, &regs)
-                           != -1)
-                    result |= 1;
-                  if (! setlocale (LC_ALL, "C"))
-                    return 1;
-                }
-            #endif
+            /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html
+               This test needs valgrind to catch the bug on Debian
+               GNU/Linux 3.1 x86, but it might catch the bug better
+               on other platforms and it shouldn't hurt to try the
+               test here.  */
+            if (setlocale (LC_ALL, "en_US.UTF-8"))
+              {
+                static char const pat[] = "insert into";
+                static char const data[] =
+                  "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK";
+                re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE
+                               | RE_ICASE);
+                memset (&regex, 0, sizeof regex);
+                s = re_compile_pattern (pat, sizeof pat - 1, &regex);
+                if (s)
+                  result |= 1;
+                else if (re_search (&regex, data, sizeof data - 1,
+                                    0, sizeof data - 1, &regs)
+                         != -1)
+                  result |= 1;
+                if (! setlocale (LC_ALL, "C"))
+                  return 1;
+              }
 
             /* This test is from glibc bug 3957, reported by Andrew Mackey.  */
             re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE);
@@ -182,6 +175,9 @@ AC_DEFUN([gl_REGEX],
   esac
 
   if test $ac_use_included_regex = yes; then
+    AC_DEFINE([_REGEX_INCLUDE_LIMITS_H], [1],
+      [Define if you want <regex.h> to include <limits.h>, so that it
+       consistently overrides <limits.h>'s RE_DUP_MAX.])
     AC_DEFINE([_REGEX_LARGE_OFFSETS], [1],
       [Define if you want regoff_t to be at least as wide POSIX requires.])
     AC_DEFINE([re_syntax_options], [rpl_re_syntax_options],
@@ -214,8 +210,6 @@ AC_DEFUN([gl_REGEX],
       [Define to rpl_regerror if the replacement should be used.])
     AC_DEFINE([regfree], [rpl_regfree],
       [Define to rpl_regfree if the replacement should be used.])
-    AC_LIBOBJ([regex])
-    gl_PREREQ_REGEX
   fi
 ])
 
@@ -226,7 +220,8 @@ AC_DEFUN([gl_PREREQ_REGEX],
   AC_REQUIRE([AC_C_INLINE])
   AC_REQUIRE([AC_C_RESTRICT])
   AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  AC_REQUIRE([gl_EEMALLOC])
   AC_CHECK_HEADERS([libintl.h])
   AC_CHECK_FUNCS_ONCE([isblank iswctype wcscoll])
-  AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
+  AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]])
 ])