blob: c5e4b199c6704eeeeaea51d04308eb57b84f3596 [file] [log] [blame]
Reid Spencerb15e69a2004-09-07 06:56:14 +00001dnl AC_SINGLE_CXX_CHECK(DEFINEVAR, CACHEVAR, FUNCTION, HEADER, PROGRAM)
2dnl $1, $2, $3, $4, $5
3dnl
4AC_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
15AC_DEFUN([AC_FUNC_ISNAN],[
16AC_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);}])
20AC_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);}])
24AC_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
30AC_DEFUN([AC_FUNC_ISINF],[
31AC_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);}])
35AC_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);}])
39AC_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);}])
43AC_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