Mercurial > gnulib
annotate m4/regex.m4 @ 40029:6160efb8efef
regex: work around a bug in glibc-2.27 and prior
* m4/regex.m4 (gl_REGEX): Reject any system regexp that gets a failed
assertion for /0|()0|\1|0/.
* tests/test-regex.c (main): Add the same test here.
author | Jim Meyering <meyering@fb.com> |
---|---|
date | Sat, 15 Dec 2018 15:24:21 -0800 |
parents | 10eb9086bea0 |
children | 6df8a54850e1 |
rev | line source |
---|---|
40029
6160efb8efef
regex: work around a bug in glibc-2.27 and prior
Jim Meyering <meyering@fb.com>
parents:
19484
diff
changeset
|
1 # serial 68 |
5611
87c42e194f4a
Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
2 |
19484
10eb9086bea0
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
19439
diff
changeset
|
3 # Copyright (C) 1996-2001, 2003-2018 Free Software Foundation, Inc. |
5611
87c42e194f4a
Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
4 # |
87c42e194f4a
Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
5 # This file is free software; the Free Software Foundation |
87c42e194f4a
Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
6 # gives unlimited permission to copy and/or distribute it, |
87c42e194f4a
Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5016
diff
changeset
|
7 # with or without modifications, as long as this notice is preserved. |
1403 | 8 |
1698
4059f896cb68
Add a run-time Test for proper operation of re_compile_pattern.
Jim Meyering <jim@meyering.net>
parents:
1623
diff
changeset
|
9 dnl Initially derived from code in GNU grep. |
4059f896cb68
Add a run-time Test for proper operation of re_compile_pattern.
Jim Meyering <jim@meyering.net>
parents:
1623
diff
changeset
|
10 dnl Mostly written by Jim Meyering. |
1403 | 11 |
6121
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
12 AC_PREREQ([2.50]) |
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
13 |
4108
c1d472db5c30
An independent .m4 file for each module.
Bruno Haible <bruno@clisp.org>
parents:
3339
diff
changeset
|
14 AC_DEFUN([gl_REGEX], |
c1d472db5c30
An independent .m4 file for each module.
Bruno Haible <bruno@clisp.org>
parents:
3339
diff
changeset
|
15 [ |
18993
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
16 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
6121
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
17 AC_ARG_WITH([included-regex], |
9878 | 18 [AS_HELP_STRING([--without-included-regex], |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
19 [don't compile regex; this is the default on systems |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
20 with recent-enough versions of the GNU C Library |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
21 (use with caution on other systems).])]) |
1698
4059f896cb68
Add a run-time Test for proper operation of re_compile_pattern.
Jim Meyering <jim@meyering.net>
parents:
1623
diff
changeset
|
22 |
6720
af0d674cde4f
* regex.m4 (gl_REGEX): Fix a longstanding typo in the
Paul Eggert <eggert@cs.ucla.edu>
parents:
6719
diff
changeset
|
23 case $with_included_regex in #( |
6121
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
24 yes|no) ac_use_included_regex=$with_included_regex |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
25 ;; |
6121
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
26 '') |
6939
c34c3fd8f414
Commentary sync from coreutils.
Paul Eggert <eggert@cs.ucla.edu>
parents:
6932
diff
changeset
|
27 # If the system regex support is good enough that it passes the |
6121
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
28 # following run test, then default to *not* using the included regex.c. |
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
29 # If cross compiling, assume the test would fail and use the included |
8113
0bd33ddd6bf3
* m4/regex.m4 (gl_REGEX): Check for glibc bug #3957.
Paul Eggert <eggert@cs.ucla.edu>
parents:
8073
diff
changeset
|
30 # regex.c. |
17355
9855b352e525
regex: port to mingw's recent addition of undeclared alarm
Eric Blake <eblake@redhat.com>
parents:
17310
diff
changeset
|
31 AC_CHECK_DECLS_ONCE([alarm]) |
17555
03f254f02330
regex: avoid glibc deadlock during configure
Eric Blake <eblake@redhat.com>
parents:
17521
diff
changeset
|
32 AC_CHECK_HEADERS_ONCE([malloc.h]) |
6121
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
33 AC_CACHE_CHECK([for working re_compile_pattern], |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
34 [gl_cv_func_re_compile_pattern_working], |
6121
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
35 [AC_RUN_IFELSE( |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
36 [AC_LANG_PROGRAM( |
17310
a9f418d6d676
regex-tests, regex: fix bug: memset undeclared
Paul Eggert <eggert@cs.ucla.edu>
parents:
17306
diff
changeset
|
37 [[#include <regex.h> |
a9f418d6d676
regex-tests, regex: fix bug: memset undeclared
Paul Eggert <eggert@cs.ucla.edu>
parents:
17306
diff
changeset
|
38 |
a9f418d6d676
regex-tests, regex: fix bug: memset undeclared
Paul Eggert <eggert@cs.ucla.edu>
parents:
17306
diff
changeset
|
39 #include <locale.h> |
a9f418d6d676
regex-tests, regex: fix bug: memset undeclared
Paul Eggert <eggert@cs.ucla.edu>
parents:
17306
diff
changeset
|
40 #include <limits.h> |
a9f418d6d676
regex-tests, regex: fix bug: memset undeclared
Paul Eggert <eggert@cs.ucla.edu>
parents:
17306
diff
changeset
|
41 #include <string.h> |
17558
77b12978b89b
regex: suppress core dumps from detection code
Pádraig Brady <P@draigBrady.com>
parents:
17555
diff
changeset
|
42 |
77b12978b89b
regex: suppress core dumps from detection code
Pádraig Brady <P@draigBrady.com>
parents:
17555
diff
changeset
|
43 #if defined M_CHECK_ACTION || HAVE_DECL_ALARM |
77b12978b89b
regex: suppress core dumps from detection code
Pádraig Brady <P@draigBrady.com>
parents:
17555
diff
changeset
|
44 # include <signal.h> |
17310
a9f418d6d676
regex-tests, regex: fix bug: memset undeclared
Paul Eggert <eggert@cs.ucla.edu>
parents:
17306
diff
changeset
|
45 # include <unistd.h> |
a9f418d6d676
regex-tests, regex: fix bug: memset undeclared
Paul Eggert <eggert@cs.ucla.edu>
parents:
17306
diff
changeset
|
46 #endif |
17558
77b12978b89b
regex: suppress core dumps from detection code
Pádraig Brady <P@draigBrady.com>
parents:
17555
diff
changeset
|
47 |
17555
03f254f02330
regex: avoid glibc deadlock during configure
Eric Blake <eblake@redhat.com>
parents:
17521
diff
changeset
|
48 #if HAVE_MALLOC_H |
03f254f02330
regex: avoid glibc deadlock during configure
Eric Blake <eblake@redhat.com>
parents:
17521
diff
changeset
|
49 # include <malloc.h> |
03f254f02330
regex: avoid glibc deadlock during configure
Eric Blake <eblake@redhat.com>
parents:
17521
diff
changeset
|
50 #endif |
17558
77b12978b89b
regex: suppress core dumps from detection code
Pádraig Brady <P@draigBrady.com>
parents:
17555
diff
changeset
|
51 |
77b12978b89b
regex: suppress core dumps from detection code
Pádraig Brady <P@draigBrady.com>
parents:
17555
diff
changeset
|
52 #ifdef M_CHECK_ACTION |
77b12978b89b
regex: suppress core dumps from detection code
Pádraig Brady <P@draigBrady.com>
parents:
17555
diff
changeset
|
53 /* Exit with distinguishable exit code. */ |
77b12978b89b
regex: suppress core dumps from detection code
Pádraig Brady <P@draigBrady.com>
parents:
17555
diff
changeset
|
54 static void sigabrt_no_core (int sig) { raise (SIGTERM); } |
77b12978b89b
regex: suppress core dumps from detection code
Pádraig Brady <P@draigBrady.com>
parents:
17555
diff
changeset
|
55 #endif |
17310
a9f418d6d676
regex-tests, regex: fix bug: memset undeclared
Paul Eggert <eggert@cs.ucla.edu>
parents:
17306
diff
changeset
|
56 ]], |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
57 [[int result = 0; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
58 static struct re_pattern_buffer regex; |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
59 unsigned char folded_chars[UCHAR_MAX + 1]; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
60 int i; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
61 const char *s; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
62 struct re_registers regs; |
7344
72030a247f35
* lib/regex_internal.c (re_string_reconstruct): Handle
Paul Eggert <eggert@cs.ucla.edu>
parents:
7172
diff
changeset
|
63 |
17555
03f254f02330
regex: avoid glibc deadlock during configure
Eric Blake <eblake@redhat.com>
parents:
17521
diff
changeset
|
64 /* Some builds of glibc go into an infinite loop on this |
03f254f02330
regex: avoid glibc deadlock during configure
Eric Blake <eblake@redhat.com>
parents:
17521
diff
changeset
|
65 test. Use alarm to force death, and mallopt to avoid |
03f254f02330
regex: avoid glibc deadlock during configure
Eric Blake <eblake@redhat.com>
parents:
17521
diff
changeset
|
66 malloc recursion in diagnosing the corrupted heap. */ |
17355
9855b352e525
regex: port to mingw's recent addition of undeclared alarm
Eric Blake <eblake@redhat.com>
parents:
17310
diff
changeset
|
67 #if HAVE_DECL_ALARM |
17305
19e841152153
regex: avoid infinite configure test
Eric Blake <eblake@redhat.com>
parents:
17302
diff
changeset
|
68 signal (SIGALRM, SIG_DFL); |
19e841152153
regex: avoid infinite configure test
Eric Blake <eblake@redhat.com>
parents:
17302
diff
changeset
|
69 alarm (2); |
19e841152153
regex: avoid infinite configure test
Eric Blake <eblake@redhat.com>
parents:
17302
diff
changeset
|
70 #endif |
17555
03f254f02330
regex: avoid glibc deadlock during configure
Eric Blake <eblake@redhat.com>
parents:
17521
diff
changeset
|
71 #ifdef M_CHECK_ACTION |
17558
77b12978b89b
regex: suppress core dumps from detection code
Pádraig Brady <P@draigBrady.com>
parents:
17555
diff
changeset
|
72 signal (SIGABRT, sigabrt_no_core); |
77b12978b89b
regex: suppress core dumps from detection code
Pádraig Brady <P@draigBrady.com>
parents:
17555
diff
changeset
|
73 mallopt (M_CHECK_ACTION, 2); |
17555
03f254f02330
regex: avoid glibc deadlock during configure
Eric Blake <eblake@redhat.com>
parents:
17521
diff
changeset
|
74 #endif |
03f254f02330
regex: avoid glibc deadlock during configure
Eric Blake <eblake@redhat.com>
parents:
17521
diff
changeset
|
75 |
14186
cd4635d4dbe6
assume <ctype.h>, ..., <time.h> exist
Paul Eggert <eggert@cs.ucla.edu>
parents:
14079
diff
changeset
|
76 if (setlocale (LC_ALL, "en_US.UTF-8")) |
cd4635d4dbe6
assume <ctype.h>, ..., <time.h> exist
Paul Eggert <eggert@cs.ucla.edu>
parents:
14079
diff
changeset
|
77 { |
17302
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
78 { |
19192
d86e08b1f555
all: Replace many more http URLs by https URLs. Update stale URLs.
Bruno Haible <bruno@clisp.org>
parents:
18993
diff
changeset
|
79 /* https://sourceware.org/ml/libc-hacker/2006-09/msg00008.html |
17302
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
80 This test needs valgrind to catch the bug on Debian |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
81 GNU/Linux 3.1 x86, but it might catch the bug better |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
82 on other platforms and it shouldn't hurt to try the |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
83 test here. */ |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
84 static char const pat[] = "insert into"; |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
85 static char const data[] = |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
86 "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
87 re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
88 | RE_ICASE); |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
89 memset (®ex, 0, sizeof regex); |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
90 s = re_compile_pattern (pat, sizeof pat - 1, ®ex); |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
91 if (s) |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
92 result |= 1; |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
93 else if (re_search (®ex, data, sizeof data - 1, |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
94 0, sizeof data - 1, ®s) |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
95 != -1) |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
96 result |= 1; |
18240
8f47f3e77c8e
misc: port better to gcc -fsanitize=address
Paul Eggert <eggert@cs.ucla.edu>
parents:
18189
diff
changeset
|
97 regfree (®ex); |
17302
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
98 } |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
99 |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
100 { |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
101 /* This test is from glibc bug 15078. |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
102 The test case is from Andreas Schwab in |
19192
d86e08b1f555
all: Replace many more http URLs by https URLs. Update stale URLs.
Bruno Haible <bruno@clisp.org>
parents:
18993
diff
changeset
|
103 <https://sourceware.org/ml/libc-alpha/2013-01/msg00967.html>. |
17302
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
104 */ |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
105 static char const pat[] = "[^x]x"; |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
106 static char const data[] = |
17366
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
107 /* <U1000><U103B><U103D><U1014><U103A><U102F><U1015><U103A> */ |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
108 "\xe1\x80\x80" |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
109 "\xe1\x80\xbb" |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
110 "\xe1\x80\xbd" |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
111 "\xe1\x80\x94" |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
112 "\xe1\x80\xba" |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
113 "\xe1\x80\xaf" |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
114 "\xe1\x80\x95" |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
115 "\xe1\x80\xba" |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
116 "x"; |
17302
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
117 re_set_syntax (0); |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
118 memset (®ex, 0, sizeof regex); |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
119 s = re_compile_pattern (pat, sizeof pat - 1, ®ex); |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
120 if (s) |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
121 result |= 1; |
17366
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
122 else |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
123 { |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
124 i = re_search (®ex, data, sizeof data - 1, |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
125 0, sizeof data - 1, 0); |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
126 if (i != 0 && i != 21) |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
127 result |= 1; |
e192356f48c2
regex-tests, regex: allow glibc re_search behavior
Dmitry V. Levin <ldv@altlinux.org>
parents:
17355
diff
changeset
|
128 } |
18240
8f47f3e77c8e
misc: port better to gcc -fsanitize=address
Paul Eggert <eggert@cs.ucla.edu>
parents:
18189
diff
changeset
|
129 regfree (®ex); |
17302
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
130 } |
0e5a583a2a8d
regex: test for buffer overrun
Paul Eggert <eggert@cs.ucla.edu>
parents:
17249
diff
changeset
|
131 |
14186
cd4635d4dbe6
assume <ctype.h>, ..., <time.h> exist
Paul Eggert <eggert@cs.ucla.edu>
parents:
14079
diff
changeset
|
132 if (! setlocale (LC_ALL, "C")) |
cd4635d4dbe6
assume <ctype.h>, ..., <time.h> exist
Paul Eggert <eggert@cs.ucla.edu>
parents:
14079
diff
changeset
|
133 return 1; |
cd4635d4dbe6
assume <ctype.h>, ..., <time.h> exist
Paul Eggert <eggert@cs.ucla.edu>
parents:
14079
diff
changeset
|
134 } |
7344
72030a247f35
* lib/regex_internal.c (re_string_reconstruct): Handle
Paul Eggert <eggert@cs.ucla.edu>
parents:
7172
diff
changeset
|
135 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
136 /* This test is from glibc bug 3957, reported by Andrew Mackey. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
137 re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
138 memset (®ex, 0, sizeof regex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
139 s = re_compile_pattern ("a[^x]b", 6, ®ex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
140 if (s) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
141 result |= 2; |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
142 /* This should fail, but succeeds for glibc-2.5. */ |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
143 else if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
144 result |= 2; |
8113
0bd33ddd6bf3
* m4/regex.m4 (gl_REGEX): Check for glibc bug #3957.
Paul Eggert <eggert@cs.ucla.edu>
parents:
8073
diff
changeset
|
145 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
146 /* This regular expression is from Spencer ere test number 75 |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
147 in grep-2.3. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
148 re_set_syntax (RE_SYNTAX_POSIX_EGREP); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
149 memset (®ex, 0, sizeof regex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
150 for (i = 0; i <= UCHAR_MAX; i++) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
151 folded_chars[i] = i; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
152 regex.translate = folded_chars; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
153 s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, ®ex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
154 /* This should fail with _Invalid character class name_ error. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
155 if (!s) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
156 result |= 4; |
2320
0439e930b0bf
Make sure re_compile_pattern accepts patterns like `{1'.
Jim Meyering <jim@meyering.net>
parents:
2253
diff
changeset
|
157 |
13013
91cd971b278e
regex.m4: correct the reversed range endpoint ([b-a]) test
Jim Meyering <meyering@redhat.com>
parents:
12846
diff
changeset
|
158 /* Ensure that [b-a] is diagnosed as invalid, when |
91cd971b278e
regex.m4: correct the reversed range endpoint ([b-a]) test
Jim Meyering <meyering@redhat.com>
parents:
12846
diff
changeset
|
159 using RE_NO_EMPTY_RANGES. */ |
91cd971b278e
regex.m4: correct the reversed range endpoint ([b-a]) test
Jim Meyering <meyering@redhat.com>
parents:
12846
diff
changeset
|
160 re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_NO_EMPTY_RANGES); |
12846
47a829b330dc
ensure that the regexp [b-a] is diagnosed as invalid
Jim Meyering <meyering@redhat.com>
parents:
12559
diff
changeset
|
161 memset (®ex, 0, sizeof regex); |
47a829b330dc
ensure that the regexp [b-a] is diagnosed as invalid
Jim Meyering <meyering@redhat.com>
parents:
12559
diff
changeset
|
162 s = re_compile_pattern ("a[b-a]", 6, ®ex); |
47a829b330dc
ensure that the regexp [b-a] is diagnosed as invalid
Jim Meyering <meyering@redhat.com>
parents:
12559
diff
changeset
|
163 if (s == 0) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
164 result |= 8; |
12846
47a829b330dc
ensure that the regexp [b-a] is diagnosed as invalid
Jim Meyering <meyering@redhat.com>
parents:
12559
diff
changeset
|
165 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
166 /* This should succeed, but does not for glibc-2.1.3. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
167 memset (®ex, 0, sizeof regex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
168 s = re_compile_pattern ("{1", 2, ®ex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
169 if (s) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
170 result |= 8; |
3159
1bc481dd8d15
(jm_INCLUDED_REGEX): Add a test for the latest bug.
Jim Meyering <jim@meyering.net>
parents:
2958
diff
changeset
|
171 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
172 /* The following example is derived from a problem report |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
173 against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
174 memset (®ex, 0, sizeof regex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
175 s = re_compile_pattern ("[an\371]*n", 7, ®ex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
176 if (s) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
177 result |= 8; |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
178 /* This should match, but does not for glibc-2.2.1. */ |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
179 else if (re_match (®ex, "an", 2, 0, ®s) != 2) |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
180 result |= 8; |
3159
1bc481dd8d15
(jm_INCLUDED_REGEX): Add a test for the latest bug.
Jim Meyering <jim@meyering.net>
parents:
2958
diff
changeset
|
181 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
182 memset (®ex, 0, sizeof regex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
183 s = re_compile_pattern ("x", 1, ®ex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
184 if (s) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
185 result |= 8; |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
186 /* glibc-2.2.93 does not work with a negative RANGE argument. */ |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
187 else if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
188 result |= 8; |
4231
dc7c057d3930
(jm_INCLUDED_REGEX): Detect broken re_search in e.g. glibc-2.2.93.
Jim Meyering <jim@meyering.net>
parents:
4189
diff
changeset
|
189 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
190 /* The version of regex.c in older versions of gnulib |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
191 ignored RE_ICASE. Detect that problem too. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
192 re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
193 memset (®ex, 0, sizeof regex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
194 s = re_compile_pattern ("x", 1, ®ex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
195 if (s) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
196 result |= 16; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
197 else if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
198 result |= 16; |
5968
541fed6ae301
* modules/regex (Files): Add lib/regex_internal.c,
Paul Eggert <eggert@cs.ucla.edu>
parents:
5611
diff
changeset
|
199 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
200 /* Catch a bug reported by Vin Shelton in |
19439
8bfc20b57265
maint: shorten https://lists.gnu.org/archive/html/... links
Jim Meyering <meyering@fb.com>
parents:
19192
diff
changeset
|
201 https://lists.gnu.org/r/bug-coreutils/2007-06/msg00089.html |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
202 */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
203 re_set_syntax (RE_SYNTAX_POSIX_BASIC |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
204 & ~RE_CONTEXT_INVALID_DUP |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
205 & ~RE_NO_EMPTY_RANGES); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
206 memset (®ex, 0, sizeof regex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
207 s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, ®ex); |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
208 if (s) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
209 result |= 32; |
8975
b70a0b36c501
* m4/regex.m4 (gl_REGEX): Catch a bug with [[:alnum:]_-] reported by
Paul Eggert <eggert@cs.ucla.edu>
parents:
8921
diff
changeset
|
210 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
211 /* REG_STARTEND was added to glibc on 2004-01-15. |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
212 Reject older versions. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
213 if (! REG_STARTEND) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
214 result |= 64; |
1698
4059f896cb68
Add a run-time Test for proper operation of re_compile_pattern.
Jim Meyering <jim@meyering.net>
parents:
1623
diff
changeset
|
215 |
40029
6160efb8efef
regex: work around a bug in glibc-2.27 and prior
Jim Meyering <meyering@fb.com>
parents:
19484
diff
changeset
|
216 /* Matching with the compiled form of this regexp would provoke |
6160efb8efef
regex: work around a bug in glibc-2.27 and prior
Jim Meyering <meyering@fb.com>
parents:
19484
diff
changeset
|
217 an assertion failure prior to glibc-2.28: |
6160efb8efef
regex: work around a bug in glibc-2.27 and prior
Jim Meyering <meyering@fb.com>
parents:
19484
diff
changeset
|
218 regexec.c:1375: pop_fail_stack: Assertion 'num >= 0' failed |
6160efb8efef
regex: work around a bug in glibc-2.27 and prior
Jim Meyering <meyering@fb.com>
parents:
19484
diff
changeset
|
219 With glibc-2.28, compilation fails and reports the invalid |
6160efb8efef
regex: work around a bug in glibc-2.27 and prior
Jim Meyering <meyering@fb.com>
parents:
19484
diff
changeset
|
220 back reference. */ |
6160efb8efef
regex: work around a bug in glibc-2.27 and prior
Jim Meyering <meyering@fb.com>
parents:
19484
diff
changeset
|
221 re_set_syntax (RE_SYNTAX_POSIX_EGREP); |
6160efb8efef
regex: work around a bug in glibc-2.27 and prior
Jim Meyering <meyering@fb.com>
parents:
19484
diff
changeset
|
222 memset (®ex, 0, sizeof regex); |
6160efb8efef
regex: work around a bug in glibc-2.27 and prior
Jim Meyering <meyering@fb.com>
parents:
19484
diff
changeset
|
223 s = re_compile_pattern ("0|()0|\\1|0", 10, ®ex); |
6160efb8efef
regex: work around a bug in glibc-2.27 and prior
Jim Meyering <meyering@fb.com>
parents:
19484
diff
changeset
|
224 if (!s || strcmp (s, "Invalid back reference")) |
6160efb8efef
regex: work around a bug in glibc-2.27 and prior
Jim Meyering <meyering@fb.com>
parents:
19484
diff
changeset
|
225 result |= 64; |
6160efb8efef
regex: work around a bug in glibc-2.27 and prior
Jim Meyering <meyering@fb.com>
parents:
19484
diff
changeset
|
226 |
13672
e07237e12926
regex: Pass the system regex if its only problem is 32-bit regoff_t.
Paolo Bonzini <pbonzini@redhat.com>
parents:
13013
diff
changeset
|
227 #if 0 |
e07237e12926
regex: Pass the system regex if its only problem is 32-bit regoff_t.
Paolo Bonzini <pbonzini@redhat.com>
parents:
13013
diff
changeset
|
228 /* It would be nice to reject hosts whose regoff_t values are too |
e07237e12926
regex: Pass the system regex if its only problem is 32-bit regoff_t.
Paolo Bonzini <pbonzini@redhat.com>
parents:
13013
diff
changeset
|
229 narrow (including glibc on hosts with 64-bit ptrdiff_t and |
e07237e12926
regex: Pass the system regex if its only problem is 32-bit regoff_t.
Paolo Bonzini <pbonzini@redhat.com>
parents:
13013
diff
changeset
|
230 32-bit int), but we should wait until glibc implements this |
e07237e12926
regex: Pass the system regex if its only problem is 32-bit regoff_t.
Paolo Bonzini <pbonzini@redhat.com>
parents:
13013
diff
changeset
|
231 feature. Otherwise, support for equivalence classes and |
e07237e12926
regex: Pass the system regex if its only problem is 32-bit regoff_t.
Paolo Bonzini <pbonzini@redhat.com>
parents:
13013
diff
changeset
|
232 multibyte collation symbols would always be broken except |
e07237e12926
regex: Pass the system regex if its only problem is 32-bit regoff_t.
Paolo Bonzini <pbonzini@redhat.com>
parents:
13013
diff
changeset
|
233 when compiling --without-included-regex. */ |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
234 if (sizeof (regoff_t) < sizeof (ptrdiff_t) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11409
diff
changeset
|
235 || sizeof (regoff_t) < sizeof (ssize_t)) |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
236 result |= 64; |
13672
e07237e12926
regex: Pass the system regex if its only problem is 32-bit regoff_t.
Paolo Bonzini <pbonzini@redhat.com>
parents:
13013
diff
changeset
|
237 #endif |
6184
f1728546eca4
On 64-bit hosts (where size_t is 64 bits and int is 32 bits), the
Paul Eggert <eggert@cs.ucla.edu>
parents:
6121
diff
changeset
|
238 |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
239 return result; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13672
diff
changeset
|
240 ]])], |
18993
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
241 [gl_cv_func_re_compile_pattern_working=yes], |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
242 [gl_cv_func_re_compile_pattern_working=no], |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
243 [case "$host_os" in |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
244 # Guess no on native Windows. |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
245 mingw*) gl_cv_func_re_compile_pattern_working="guessing no" ;; |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
246 # Otherwise, assume it is not working. |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
247 *) gl_cv_func_re_compile_pattern_working="guessing no" ;; |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
248 esac |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
249 ]) |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
250 ]) |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
251 case "$gl_cv_func_re_compile_pattern_working" in #( |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
252 *yes) ac_use_included_regex=no;; #( |
a75cfc731331
Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
253 *no) ac_use_included_regex=yes;; |
6720
af0d674cde4f
* regex.m4 (gl_REGEX): Fix a longstanding typo in the
Paul Eggert <eggert@cs.ucla.edu>
parents:
6719
diff
changeset
|
254 esac |
6121
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
255 ;; |
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
256 *) AC_MSG_ERROR([Invalid value for --with-included-regex: $with_included_regex]) |
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
257 ;; |
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
258 esac |
6083
7f315cf586d6
* regex.m4 (gl_INCLUDED_REGEX): Remove; no longer used.
Paul Eggert <eggert@cs.ucla.edu>
parents:
6080
diff
changeset
|
259 |
6121
61e0b7c597d5
* m4/regex.m4: Add AC_PREREQ(2.50).
Paul Eggert <eggert@cs.ucla.edu>
parents:
6101
diff
changeset
|
260 if test $ac_use_included_regex = yes; then |
16650
8ad751eaba31
regex: allow inclusion of <regex.h> before <limits.h>
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
261 AC_DEFINE([_REGEX_INCLUDE_LIMITS_H], [1], |
8ad751eaba31
regex: allow inclusion of <regex.h> before <limits.h>
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
262 [Define if you want <regex.h> to include <limits.h>, so that it |
8ad751eaba31
regex: allow inclusion of <regex.h> before <limits.h>
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
263 consistently overrides <limits.h>'s RE_DUP_MAX.]) |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
10952
diff
changeset
|
264 AC_DEFINE([_REGEX_LARGE_OFFSETS], [1], |
6707
d0a48e08c98d
* lib/regex.h (regoff_t) [defined _REGEX_LARGE_OFFSETS]:
Paul Eggert <eggert@cs.ucla.edu>
parents:
6461
diff
changeset
|
265 [Define if you want regoff_t to be at least as wide POSIX requires.]) |
6288
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
266 AC_DEFINE([re_syntax_options], [rpl_re_syntax_options], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
267 [Define to rpl_re_syntax_options if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
268 AC_DEFINE([re_set_syntax], [rpl_re_set_syntax], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
269 [Define to rpl_re_set_syntax if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
270 AC_DEFINE([re_compile_pattern], [rpl_re_compile_pattern], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
271 [Define to rpl_re_compile_pattern if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
272 AC_DEFINE([re_compile_fastmap], [rpl_re_compile_fastmap], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
273 [Define to rpl_re_compile_fastmap if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
274 AC_DEFINE([re_search], [rpl_re_search], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
275 [Define to rpl_re_search if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
276 AC_DEFINE([re_search_2], [rpl_re_search_2], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
277 [Define to rpl_re_search_2 if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
278 AC_DEFINE([re_match], [rpl_re_match], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
279 [Define to rpl_re_match if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
280 AC_DEFINE([re_match_2], [rpl_re_match_2], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
281 [Define to rpl_re_match_2 if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
282 AC_DEFINE([re_set_registers], [rpl_re_set_registers], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
283 [Define to rpl_re_set_registers if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
284 AC_DEFINE([re_comp], [rpl_re_comp], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
285 [Define to rpl_re_comp if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
286 AC_DEFINE([re_exec], [rpl_re_exec], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
287 [Define to rpl_re_exec if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
288 AC_DEFINE([regcomp], [rpl_regcomp], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
289 [Define to rpl_regcomp if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
290 AC_DEFINE([regexec], [rpl_regexec], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
291 [Define to rpl_regexec if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
292 AC_DEFINE([regerror], [rpl_regerror], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
293 [Define to rpl_regerror if the replacement should be used.]) |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
294 AC_DEFINE([regfree], [rpl_regfree], |
a6b3996fab54
(gl_REGEX): If replacing, define regcomp to rpl_regcomp,
Paul Eggert <eggert@cs.ucla.edu>
parents:
6184
diff
changeset
|
295 [Define to rpl_regfree if the replacement should be used.]) |
6083
7f315cf586d6
* regex.m4 (gl_INCLUDED_REGEX): Remove; no longer used.
Paul Eggert <eggert@cs.ucla.edu>
parents:
6080
diff
changeset
|
296 fi |
7f315cf586d6
* regex.m4 (gl_INCLUDED_REGEX): Remove; no longer used.
Paul Eggert <eggert@cs.ucla.edu>
parents:
6080
diff
changeset
|
297 ]) |
4108
c1d472db5c30
An independent .m4 file for each module.
Bruno Haible <bruno@clisp.org>
parents:
3339
diff
changeset
|
298 |
5968
541fed6ae301
* modules/regex (Files): Add lib/regex_internal.c,
Paul Eggert <eggert@cs.ucla.edu>
parents:
5611
diff
changeset
|
299 # Prerequisites of lib/regex.c and lib/regex_internal.c. |
5016
7141ea4946af
Change jm_ to gl_ in AC_DEFINE'd names. Update all uses.
Jim Meyering <jim@meyering.net>
parents:
4673
diff
changeset
|
300 AC_DEFUN([gl_PREREQ_REGEX], |
4108
c1d472db5c30
An independent .m4 file for each module.
Bruno Haible <bruno@clisp.org>
parents:
3339
diff
changeset
|
301 [ |
9209
5a0294ce5372
Track CVS Autoconf on AC_USE_SYSTEM_EXTENSIONS.
Eric Blake <ebb9@byu.net>
parents:
8975
diff
changeset
|
302 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) |
12542
ea823743f290
Use AC_C_INLINE where necessary.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
303 AC_REQUIRE([AC_C_INLINE]) |
7099 | 304 AC_REQUIRE([AC_C_RESTRICT]) |
9809
b17288dc1d83
Fix regex compilation error on HP-UX 11.
Bruno Haible <bruno@clisp.org>
parents:
9209
diff
changeset
|
305 AC_REQUIRE([AC_TYPE_MBSTATE_T]) |
17235
e101c2620c25
regex: port to hosts where malloc (0) == NULL
Paul Eggert <eggert@cs.ucla.edu>
parents:
16650
diff
changeset
|
306 AC_REQUIRE([gl_EEMALLOC]) |
17448
bbdfd5c3b6d3
regex: port to non-glibc/lock-using systems
Jim Meyering <meyering@fb.com>
parents:
17366
diff
changeset
|
307 AC_REQUIRE([gl_GLIBC21]) |
9910
048d2d32a55c
Check for libintl.h. Needed for HAVE_LIBINTL_H.
Bruno Haible <bruno@clisp.org>
parents:
9878
diff
changeset
|
308 AC_CHECK_HEADERS([libintl.h]) |
17521
4144f2fad332
regex: don't depend on wcscoll
Jim Meyering <meyering@fb.com>
parents:
17448
diff
changeset
|
309 AC_CHECK_FUNCS_ONCE([isblank iswctype]) |
15618
9d4b273deacd
Properly quote AC_CHECK_DECLS' 4th argument.
Bruno Haible <bruno@clisp.org>
parents:
15078
diff
changeset
|
310 AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]]) |
4108
c1d472db5c30
An independent .m4 file for each module.
Bruno Haible <bruno@clisp.org>
parents:
3339
diff
changeset
|
311 ]) |