1 # intdiv0.m4 serial 6 (gettext-0.18.2)
2 dnl Copyright (C) 2002, 2007-2008, 2010-2013 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,
17 gt_cv_int_divbyzero_sigfpe=
20 macos* | darwin[6-9]* | darwin[1-9][0-9]*)
21 # On Mac OS X 10.2 or newer, just assume the same as when cross-
22 # compiling. If we were to perform the real test, 1 Crash Report
23 # dialog window would pop up.
26 gt_cv_int_divbyzero_sigfpe="guessing yes" ;;
31 if test -z "$gt_cv_int_divbyzero_sigfpe"; then
38 sigfpe_handler (int sig)
40 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
51 signal (SIGFPE, sigfpe_handler);
52 /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
53 #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
54 signal (SIGTRAP, sigfpe_handler);
56 /* Linux/SPARC yields signal SIGILL. */
57 #if defined (__sparc__) && defined (__linux__)
58 signal (SIGILL, sigfpe_handler);
66 [gt_cv_int_divbyzero_sigfpe=yes],
67 [gt_cv_int_divbyzero_sigfpe=no],
69 # Guess based on the CPU.
72 alpha* | i[34567]86 | x86_64 | m68k | s390*)
73 gt_cv_int_divbyzero_sigfpe="guessing yes";;
75 gt_cv_int_divbyzero_sigfpe="guessing no";;
81 case "$gt_cv_int_divbyzero_sigfpe" in
85 AC_DEFINE_UNQUOTED([INTDIV0_RAISES_SIGFPE], [$value],
86 [Define if integer division by zero raises signal SIGFPE.])