Code

include math.h if needed for HUGE_VAL
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>
Wed, 3 Sep 2003 06:00:50 +0000 (06:00 +0000)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>
Wed, 3 Sep 2003 06:00:50 +0000 (06:00 +0000)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@710 f882894a-f735-0410-b71e-b25c423dba1c

configure.in
plugins/common.h

index c9c92d75f80ea20e9d5307acd3edadf5afe3fc35..1d36d35dbc50cc329e1c929e26cda4e903bc610f 100644 (file)
@@ -463,6 +463,20 @@ AC_CHECK_HEADERS(signal.h strings.h string.h syslog.h uio.h errno.h regex.h sys/
 AC_CHECK_HEADERS(features.h stdarg.h sys/unistd.h ctype.h stdlib.h)
 AC_CHECK_HEADERS(limits.h sys/param.h sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h fcntl.h sys/statfs.h sys/dustat.h sys/statvfs.h)
 
+# glibc 2.3.2 stdlib.h does not define HUGE_VAL (see man strtod)
+AC_MSG_CHECKING([for HUGE_VAL in <stdlib.h>])
+AC_TRY_COMPILE([#include <stdlib.h>],
+               [double x = HUGE_VAL;],
+               [AC_MSG_RESULT(yes)],
+               [AC_MSG_RESULT(no)
+                AC_MSG_CHECKING([for HUGE_VAL in <math.h>])
+                AC_TRY_COMPILE([#include <math.h>],
+                               [double x = HUGE_VAL;],
+                               [AC_MSG_RESULT(yes)
+                                AC_DEFINE_UNQUOTED(HUGE_VAL_NEEDS_MATH_H, 1,
+                                                  [Define if <math.h> is required for HUGE_VAL])],
+                               [AC_MSG_RESULT(no)])])
+
 # Define HAVE_INTTYPES_H if <inttypes.h> exists,
 # doesn't clash with <sys/types.h>, and declares uintmax_t.
 
index e55b0bbdbd6dec63eee25c128ab37ff45d6b9851..372e59acb771691cbda06845dcbdce3b4cbcb590 100644 (file)
 #include <stdlib.h>
 #include <errno.h>
 
+#ifdef HUGE_VAL_NEEDS_MATH_H
+#include <math.h>
+#endif
+
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
 #endif