Since M_CHECK_ACTION is only defined in <malloc.h>, it is confusing that the test program tests it _before_ having included <malloc.h>. (Fortunately this does not produce a bug, since HAVE_DECL_ALARM is 1 on glibc.) But anyway, it's better written like this:
2024-10-26 Bruno Haible <br...@clisp.org> regex: Make configure test more maintainable. * m4/regex.m4 (gl_REGEX): Include <malloc.h> before testing for M_CHECK_ACTION. diff --git a/m4/regex.m4 b/m4/regex.m4 index 64fa7e9146..18f36804c4 100644 --- a/m4/regex.m4 +++ b/m4/regex.m4 @@ -1,5 +1,5 @@ # regex.m4 -# serial 75 +# serial 76 dnl Copyright (C) 1996-2001, 2003-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -40,15 +40,15 @@ AC_DEFUN([gl_REGEX] #include <limits.h> #include <string.h> + #if HAVE_MALLOC_H + # include <malloc.h> /* defines M_CHECK_ACTION on glibc */ + #endif + #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); }