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