diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2004-12-15 20:51:47 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2004-12-15 20:51:47 +0000 |
commit | 6fff4bcdcf97412a6d1422991ea9fe5e8a203e75 (patch) | |
tree | 6494851815282f4b27829a7f10b8ca522aa7668e /m4/intdiv0.m4 | |
parent | 82d1989d3245791c9fac22ca848f5497f261c10b (diff) | |
download | monitoring-plugins-6fff4bcdcf97412a6d1422991ea9fe5e8a203e75.tar.gz |
Moving m4 files from lib/
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1028 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'm4/intdiv0.m4')
-rw-r--r-- | m4/intdiv0.m4 | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/m4/intdiv0.m4 b/m4/intdiv0.m4 new file mode 100644 index 00000000..55dddcf1 --- /dev/null +++ b/m4/intdiv0.m4 | |||
@@ -0,0 +1,72 @@ | |||
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. | ||
8 | |||
9 | dnl From Bruno Haible. | ||
10 | |||
11 | AC_DEFUN([gt_INTDIV0], | ||
12 | [ | ||
13 | AC_REQUIRE([AC_PROG_CC])dnl | ||
14 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | ||
15 | |||
16 | AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], | ||
17 | gt_cv_int_divbyzero_sigfpe, | ||
18 | [ | ||
19 | AC_TRY_RUN([ | ||
20 | #include <stdlib.h> | ||
21 | #include <signal.h> | ||
22 | |||
23 | static void | ||
24 | #ifdef __cplusplus | ||
25 | sigfpe_handler (int sig) | ||
26 | #else | ||
27 | sigfpe_handler (sig) int sig; | ||
28 | #endif | ||
29 | { | ||
30 | /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ | ||
31 | exit (sig != SIGFPE); | ||
32 | } | ||
33 | |||
34 | int x = 1; | ||
35 | int y = 0; | ||
36 | int z; | ||
37 | int nan; | ||
38 | |||
39 | int main () | ||
40 | { | ||
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); | ||
45 | #endif | ||
46 | /* Linux/SPARC yields signal SIGILL. */ | ||
47 | #if defined (__sparc__) && defined (__linux__) | ||
48 | signal (SIGILL, sigfpe_handler); | ||
49 | #endif | ||
50 | |||
51 | z = x / y; | ||
52 | nan = y / y; | ||
53 | exit (1); | ||
54 | } | ||
55 | ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, | ||
56 | [ | ||
57 | # Guess based on the CPU. | ||
58 | case "$host_cpu" in | ||
59 | alpha* | i[34567]86 | m68k | s390*) | ||
60 | gt_cv_int_divbyzero_sigfpe="guessing yes";; | ||
61 | *) | ||
62 | gt_cv_int_divbyzero_sigfpe="guessing no";; | ||
63 | esac | ||
64 | ]) | ||
65 | ]) | ||
66 | case "$gt_cv_int_divbyzero_sigfpe" in | ||
67 | *yes) value=1;; | ||
68 | *) value=0;; | ||
69 | esac | ||
70 | AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, | ||
71 | [Define if integer division by zero raises signal SIGFPE.]) | ||
72 | ]) | ||