summaryrefslogtreecommitdiff
path: root/projects/sample/autoconf/m4/huge_val.m4
blob: 6c9a22eab002d3d6e04c505ca64bcc2ee4343339 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# This function determins if the HUGE_VAL macro is compilable with the 
# -pedantic switch or not. XCode < 2.4.1 doesn't get it right.
#
AC_DEFUN([AC_HUGE_VAL_CHECK],[
  AC_CACHE_CHECK([for HUGE_VAL sanity], [ac_cv_huge_val_sanity],[
    AC_LANG_PUSH([C++])
    ac_save_CXXFLAGS=$CXXFLAGS
    CXXFLAGS="$CXXFLAGS -pedantic"
    AC_RUN_IFELSE(
      AC_LANG_PROGRAM(
        [#include <math.h>],
        [double x = HUGE_VAL; return x != x; ]),
      [ac_cv_huge_val_sanity=yes],[ac_cv_huge_val_sanity=no],
      [ac_cv_huge_val_sanity=yes])
    CXXFLAGS=$ac_save_CXXFLAGS
    AC_LANG_POP([C++])
    ])
  AC_SUBST(HUGE_VAL_SANITY,$ac_cv_huge_val_sanity)
])