annotate m4/intdiv0.m4 @ 3386:3e9bc5fd5c36

merge
author Cristi Magherusan <majeru@atheme-project.org>
date Fri, 10 Aug 2007 14:21:21 +0300
parents cb178e5ad177
children 2df5e83c9bf4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 # intdiv0.m4 serial 1 (gettext-0.11.3)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 dnl Copyright (C) 2002 Free Software Foundation, Inc.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3 dnl This file is free software, distributed under the terms of the GNU
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 dnl General Public License. As a special exception to the GNU General
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 dnl Public License, this file may be distributed as part of a program
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 dnl that contains a configuration script generated by Autoconf, under
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 dnl the same distribution terms as the rest of that program.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 dnl From Bruno Haible.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 AC_DEFUN([gt_INTDIV0],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 [
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 AC_REQUIRE([AC_PROG_CC])dnl
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 AC_REQUIRE([AC_CANONICAL_HOST])dnl
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 gt_cv_int_divbyzero_sigfpe,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 [
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 AC_TRY_RUN([
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 #include <stdlib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21 #include <signal.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #ifdef __cplusplus
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25 sigfpe_handler (int sig)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 #else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 sigfpe_handler (sig) int sig;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 exit (sig != SIGFPE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 int x = 1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 int y = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 int z;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 int nan;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 int main ()
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41 signal (SIGFPE, sigfpe_handler);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42 /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43 #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 signal (SIGTRAP, sigfpe_handler);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 /* Linux/SPARC yields signal SIGILL. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 #if defined (__sparc__) && defined (__linux__)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 signal (SIGILL, sigfpe_handler);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 z = x / y;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 nan = y / y;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 exit (1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 [
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 # Guess based on the CPU.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 case "$host_cpu" in
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 alpha* | i[34567]86 | m68k | s390*)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 gt_cv_int_divbyzero_sigfpe="guessing yes";;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 *)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 gt_cv_int_divbyzero_sigfpe="guessing no";;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 esac
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 ])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 ])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 case "$gt_cv_int_divbyzero_sigfpe" in
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 *yes) value=1;;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 *) value=0;;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 esac
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 [Define if integer division by zero raises signal SIGFPE.])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 ])