1 # intdiv0.m4 serial 2 (gettext-0.16.2)
2 dnl Copyright (C) 2002, 2007 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
11 AC_REQUIRE([AC_PROG_CC])dnl
12 AC_REQUIRE([AC_CANONICAL_HOST])dnl
14 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
15 gt_cv_int_divbyzero_sigfpe,
22 sigfpe_handler (int sig)
24 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
35 signal (SIGFPE, sigfpe_handler);
36 /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
37 #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
38 signal (SIGTRAP, sigfpe_handler);
40 /* Linux/SPARC yields signal SIGILL. */
41 #if defined (__sparc__) && defined (__linux__)
42 signal (SIGILL, sigfpe_handler);
49 ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
51 # Guess based on the CPU.
54 alpha* | i[34567]86 | x86_64 | m68k | s390*)
55 gt_cv_int_divbyzero_sigfpe="guessing yes";;
57 gt_cv_int_divbyzero_sigfpe="guessing no";;
62 case "$gt_cv_int_divbyzero_sigfpe" in
66 AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
67 [Define if integer division by zero raises signal SIGFPE.])