summaryrefslogtreecommitdiffstats
path: root/gl/m4/regex.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/regex.m4')
-rw-r--r--gl/m4/regex.m445
1 files changed, 26 insertions, 19 deletions
diff --git a/gl/m4/regex.m4 b/gl/m4/regex.m4
index c89a1432..49a8059f 100644
--- a/gl/m4/regex.m4
+++ b/gl/m4/regex.m4
@@ -1,10 +1,10 @@
1# serial 73 1# regex.m4
2 2# serial 81
3# Copyright (C) 1996-2001, 2003-2023 Free Software Foundation, Inc. 3dnl Copyright (C) 1996-2001, 2003-2025 Free Software Foundation, Inc.
4# 4dnl This file is free software; the Free Software Foundation
5# This file is free software; the Free Software Foundation 5dnl gives unlimited permission to copy and/or distribute it,
6# gives unlimited permission to copy and/or distribute it, 6dnl with or without modifications, as long as this notice is preserved.
7# with or without modifications, as long as this notice is preserved. 7dnl This file is offered as-is, without any warranty.
8 8
9dnl Initially derived from code in GNU grep. 9dnl Initially derived from code in GNU grep.
10dnl Mostly written by Jim Meyering. 10dnl Mostly written by Jim Meyering.
@@ -15,7 +15,7 @@ AC_DEFUN([gl_REGEX],
15[ 15[
16 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 16 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
17 AC_ARG_WITH([included-regex], 17 AC_ARG_WITH([included-regex],
18 [AS_HELP_STRING([--without-included-regex], 18 [AS_HELP_STRING([[--without-included-regex]],
19 [don't compile regex; this is the default on systems 19 [don't compile regex; this is the default on systems
20 with recent-enough versions of the GNU C Library 20 with recent-enough versions of the GNU C Library
21 (use with caution on other systems).])]) 21 (use with caution on other systems).])])
@@ -40,19 +40,24 @@ AC_DEFUN([gl_REGEX],
40 #include <limits.h> 40 #include <limits.h>
41 #include <string.h> 41 #include <string.h>
42 42
43 #if defined M_CHECK_ACTION || HAVE_DECL_ALARM 43 #if HAVE_MALLOC_H
44 # include <signal.h> 44 # include <malloc.h> /* defines M_CHECK_ACTION on glibc */
45 # include <unistd.h>
46 #endif 45 #endif
47 46
48 #if HAVE_MALLOC_H 47 #if defined __HAIKU__ || defined M_CHECK_ACTION || HAVE_DECL_ALARM
49 # include <malloc.h> 48 # include <signal.h>
49 # include <unistd.h>
50 #endif 50 #endif
51 51
52 #ifdef M_CHECK_ACTION 52 #if defined __HAIKU__ || defined M_CHECK_ACTION
53 /* Exit with distinguishable exit code. */ 53 /* Exit with distinguishable exit code. */
54 static void sigabrt_no_core (int sig) { raise (SIGTERM); } 54 static void sigabrt_no_core (int sig) { raise (SIGTERM); }
55 #endif 55 #endif
56
57 /* There is no need to check whether RE_SYNTAX_EMACS is
58 (RE_CHAR_CLASSES | RE_INTERVALS), corresponding to
59 Emacs 21 (2001) and later, because Gnulib's lib/regex.h
60 is always used and has this value. */
56 ]], 61 ]],
57 [[int result = 0; 62 [[int result = 0;
58 static struct re_pattern_buffer regex; 63 static struct re_pattern_buffer regex;
@@ -68,6 +73,9 @@ AC_DEFUN([gl_REGEX],
68 signal (SIGALRM, SIG_DFL); 73 signal (SIGALRM, SIG_DFL);
69 alarm (2); 74 alarm (2);
70#endif 75#endif
76#ifdef __HAIKU__
77 signal (SIGABRT, sigabrt_no_core);
78#endif
71#ifdef M_CHECK_ACTION 79#ifdef M_CHECK_ACTION
72 signal (SIGABRT, sigabrt_no_core); 80 signal (SIGABRT, sigabrt_no_core);
73 mallopt (M_CHECK_ACTION, 2); 81 mallopt (M_CHECK_ACTION, 2);
@@ -327,10 +335,10 @@ AC_DEFUN([gl_REGEX],
327 [gl_cv_func_re_compile_pattern_working=yes], 335 [gl_cv_func_re_compile_pattern_working=yes],
328 [gl_cv_func_re_compile_pattern_working=no], 336 [gl_cv_func_re_compile_pattern_working=no],
329 [case "$host_os" in 337 [case "$host_os" in
330 # Guess no on native Windows. 338 # Guess no on native Windows.
331 mingw*) gl_cv_func_re_compile_pattern_working="guessing no" ;; 339 mingw* | windows*) gl_cv_func_re_compile_pattern_working="guessing no" ;;
332 # Otherwise obey --enable-cross-guesses. 340 # Otherwise obey --enable-cross-guesses.
333 *) gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;; 341 *) gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;;
334 esac 342 esac
335 ]) 343 ])
336 ]) 344 ])
@@ -389,7 +397,6 @@ AC_DEFUN([gl_PREREQ_REGEX],
389 AC_REQUIRE([AC_C_INLINE]) 397 AC_REQUIRE([AC_C_INLINE])
390 AC_REQUIRE([AC_C_RESTRICT]) 398 AC_REQUIRE([AC_C_RESTRICT])
391 AC_REQUIRE([AC_TYPE_MBSTATE_T]) 399 AC_REQUIRE([AC_TYPE_MBSTATE_T])
392 AC_REQUIRE([gl_EEMALLOC])
393 AC_CHECK_HEADERS([libintl.h]) 400 AC_CHECK_HEADERS([libintl.h])
394 AC_CHECK_FUNCS_ONCE([isblank iswctype]) 401 AC_CHECK_FUNCS_ONCE([isblank iswctype])
395 AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]]) 402 AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]])