debian/copyright updates; clscan: fix formatting
[gnulib.git] / m4 / regex.m4
index 0089c08..08bd46a 100644 (file)
@@ -1,6 +1,6 @@
 # serial 65
 
-# Copyright (C) 1996-2001, 2003-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2001, 2003-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -38,13 +38,20 @@ AC_DEFUN([gl_REGEX],
             #include <locale.h>
             #include <limits.h>
             #include <string.h>
-            #if HAVE_DECL_ALARM
-            # include <unistd.h>
+
+            #if defined M_CHECK_ACTION || HAVE_DECL_ALARM
             # include <signal.h>
+            # include <unistd.h>
             #endif
+
             #if HAVE_MALLOC_H
             # include <malloc.h>
             #endif
+
+            #ifdef M_CHECK_ACTION
+            /* Exit with distinguishable exit code.  */
+            static void sigabrt_no_core (int sig) { raise (SIGTERM); }
+            #endif
           ]],
           [[int result = 0;
             static struct re_pattern_buffer regex;
@@ -61,7 +68,8 @@ AC_DEFUN([gl_REGEX],
             alarm (2);
 #endif
 #ifdef M_CHECK_ACTION
-            mallopt(M_CHECK_ACTION, 2);
+            signal (SIGABRT, sigabrt_no_core);
+            mallopt (M_CHECK_ACTION, 2);
 #endif
 
             if (setlocale (LC_ALL, "en_US.UTF-8"))