1 # intdiv0.m4 serial 1 (gettext-0.11.3)
2 dnl Copyright (C) 2002 Free Software Foundation, Inc.
3 dnl This file is free software, distributed under the terms of the GNU
4 dnl General Public License. As a special exception to the GNU General
5 dnl Public License, this file may be distributed as part of a program
6 dnl that contains a configuration script generated by Autoconf, under
7 dnl the same distribution terms as the rest of that program.
11 AC_DEFUN([gt_INTDIV0],
13 AC_REQUIRE([AC_PROG_CC])dnl
14 AC_REQUIRE([AC_CANONICAL_HOST])dnl
16 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
17 gt_cv_int_divbyzero_sigfpe,
25 sigfpe_handler (int sig)
27 sigfpe_handler (sig) int sig;
30 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
41 signal (SIGFPE, sigfpe_handler);
42 /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
43 #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
44 signal (SIGTRAP, sigfpe_handler);
46 /* Linux/SPARC yields signal SIGILL. */
47 #if defined (__sparc__) && defined (__linux__)
48 signal (SIGILL, sigfpe_handler);
55 ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
57 # Guess based on the CPU.
59 alpha* | i[34567]86 | m68k | s390*)
60 gt_cv_int_divbyzero_sigfpe="guessing yes";;
62 gt_cv_int_divbyzero_sigfpe="guessing no";;
66 case "$gt_cv_int_divbyzero_sigfpe" in
70 AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
71 [Define if integer division by zero raises signal SIGFPE.])