Individual autoconf function broken out of acincludes.m4. This change
[oota-llvm.git] / autoconf / m4 / single_cxx_check.m4
1 dnl AC_SINGLE_CXX_CHECK(DEFINEVAR, CACHEVAR, FUNCTION, HEADER, PROGRAM)
2 dnl                     $1,        $2,       $3,       $4,     $5
3 dnl 
4 AC_DEFUN([AC_SINGLE_CXX_CHECK],
5 [AC_CACHE_CHECK([for $3 in $4], [$2],
6  [AC_LANG_PUSH(C++)
7   AC_COMPILE_IFELSE(AC_LANG_SOURCE([$5]),[$2=yes],[$2=no])
8  AC_LANG_POP(C++)])
9  if test "$$2" = "yes"
10  then
11    AC_DEFINE($1, 1, [Define to 1 if your compiler defines $3 in the $4
12                      header file.])
13  fi])
14
15 AC_DEFUN([AC_FUNC_ISNAN],[
16 AC_SINGLE_CXX_CHECK([HAVE_ISNAN_IN_MATH_H],    [ac_cv_func_isnan_in_math_h],   
17                     [isnan], [<math.h>],
18                     [#include <math.h>
19                      int foo(float f) {return isnan(f);}])
20 AC_SINGLE_CXX_CHECK([HAVE_ISNAN_IN_CMATH],     [ac_cv_func_isnan_in_cmath],    
21                     [isnan], [<cmath>],
22                     [#include <cmath>
23                      int foo(float f) {return isnan(f);}])
24 AC_SINGLE_CXX_CHECK([HAVE_STD_ISNAN_IN_CMATH], [ac_cv_func_std_isnan_in_cmath],
25                     [std::isnan], [<cmath>],
26                     [#include <cmath>
27                      using std::isnan; int foo(float f) {return isnan(f);}])
28 ])
29
30 AC_DEFUN([AC_FUNC_ISINF],[
31 AC_SINGLE_CXX_CHECK([HAVE_ISINF_IN_MATH_H],    [ac_cv_func_isinf_in_math_h],   
32                     [isinf], [<math.h>],
33                     [#include <math.h>
34                      int foo(float f) {return isinf(f);}])
35 AC_SINGLE_CXX_CHECK([HAVE_ISINF_IN_CMATH],     [ac_cv_func_isinf_in_cmath],    
36                     [isinf], [<cmath>],
37                     [#include <cmath>
38                      int foo(float f) {return isinf(f);}])
39 AC_SINGLE_CXX_CHECK([HAVE_STD_ISINF_IN_CMATH], [ac_cv_func_std_isinf_in_cmath],
40                     [std::isinf], [<cmath>],
41                     [#include <cmath>
42                      using std::isinf; int foo(float f) {return isinf(f);}])
43 AC_SINGLE_CXX_CHECK([HAVE_FINITE_IN_IEEEFP_H], [ac_cv_func_finite_in_ieeefp_h],
44                     [finite], [<ieeefp.h>],
45                     [#include <ieeefp.h>
46                      int foo(float f) {return finite(f);}])
47 ])
48