]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
fenv-exceptions-state-c99: Avoid a Haiku crash dialog at configure time.
authorBruno Haible <bruno@clisp.org>
Sat, 17 Jan 2026 01:22:22 +0000 (02:22 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 17 Jan 2026 01:22:22 +0000 (02:22 +0100)
* m4/fenv-exceptions-state.m4 (gl_FENV_EXCEPTIONS_STATE): In the test
program, add a signal handler, like in m4/nocrash.m4.

ChangeLog
m4/fenv-exceptions-state.m4

index b393e61cfeacdcf6b20bea0963557a8e683a9090..c013b8e60e35b60b84afd0290278d4a4e2a3574c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-01-16  Bruno Haible  <bruno@clisp.org>
+
+       fenv-exceptions-state-c99: Avoid a Haiku crash dialog at configure time.
+       * m4/fenv-exceptions-state.m4 (gl_FENV_EXCEPTIONS_STATE): In the test
+       program, add a signal handler, like in m4/nocrash.m4.
+
 2026-01-16  Bruno Haible  <bruno@clisp.org>
 
        selinux-h: Add tests.
index 3d227450e2e7980228c0916644d97b8b15c33be2..2b70e7702c85b25d1a0663822f21e1fe3ba4416e 100644 (file)
@@ -1,5 +1,5 @@
 # fenv-exceptions-state.m4
-# serial 5
+# serial 6
 dnl Copyright (C) 2023-2026 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -74,10 +74,27 @@ AC_DEFUN([gl_FENV_EXCEPTIONS_STATE],
            AC_RUN_IFELSE(
              [AC_LANG_PROGRAM([[
                 #include <fenv.h>
+                #if !(defined _WIN32 && !defined __CYGWIN__
+                /* Avoid a crash on POSIX systems.  */
+                #include <signal.h>
+                #include <unistd.h>
+                /* A POSIX signal handler.  */
+                static void exception_handler (int sig)
+                {
+                  _exit (1);
+                }
+                static void nocrash_init (void)
+                {
+                  signal (SIGFPE, exception_handler);
+                }
+                #else
+                static void nocrash_init (void) {}
+                #endif
                 static volatile double a, b;
                 static volatile long double al, bl;
                 ]],
-                [[fexcept_t saved_flags;
+                [[nocrash_init ();
+                  fexcept_t saved_flags;
                   if (feraiseexcept (FE_INVALID) == 0
                       && fegetexceptflag (&saved_flags, FE_INVALID) == 0
                       && feclearexcept (FE_INVALID) == 0