summaryrefslogtreecommitdiff
path: root/autoconf/m4/single_cxx_check.m4
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-09-07 06:56:14 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-09-07 06:56:14 +0000
commit491f6812ef173989612d987fa8706fd38e2e673f (patch)
tree0ba6404a9be355d9bbd5e526efe32e3b0bc29afa /autoconf/m4/single_cxx_check.m4
parent10c0a2e7f955cbe6cc8c842e6d8aebc10ac91f4c (diff)
downloadllvm-491f6812ef173989612d987fa8706fd38e2e673f.tar.gz
llvm-491f6812ef173989612d987fa8706fd38e2e673f.tar.bz2
llvm-491f6812ef173989612d987fa8706fd38e2e673f.tar.xz
Individual autoconf function broken out of acincludes.m4. This change
per the recommended style guide for autoconf and so that individual autoconf functions can more easily be shared across projects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16223 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'autoconf/m4/single_cxx_check.m4')
-rw-r--r--autoconf/m4/single_cxx_check.m448
1 files changed, 48 insertions, 0 deletions
diff --git a/autoconf/m4/single_cxx_check.m4 b/autoconf/m4/single_cxx_check.m4
new file mode 100644
index 0000000000..c5e4b199c6
--- /dev/null
+++ b/autoconf/m4/single_cxx_check.m4
@@ -0,0 +1,48 @@
+dnl AC_SINGLE_CXX_CHECK(DEFINEVAR, CACHEVAR, FUNCTION, HEADER, PROGRAM)
+dnl $1, $2, $3, $4, $5
+dnl
+AC_DEFUN([AC_SINGLE_CXX_CHECK],
+[AC_CACHE_CHECK([for $3 in $4], [$2],
+ [AC_LANG_PUSH(C++)
+ AC_COMPILE_IFELSE(AC_LANG_SOURCE([$5]),[$2=yes],[$2=no])
+ AC_LANG_POP(C++)])
+ if test "$$2" = "yes"
+ then
+ AC_DEFINE($1, 1, [Define to 1 if your compiler defines $3 in the $4
+ header file.])
+ fi])
+
+AC_DEFUN([AC_FUNC_ISNAN],[
+AC_SINGLE_CXX_CHECK([HAVE_ISNAN_IN_MATH_H], [ac_cv_func_isnan_in_math_h],
+ [isnan], [<math.h>],
+ [#include <math.h>
+ int foo(float f) {return isnan(f);}])
+AC_SINGLE_CXX_CHECK([HAVE_ISNAN_IN_CMATH], [ac_cv_func_isnan_in_cmath],
+ [isnan], [<cmath>],
+ [#include <cmath>
+ int foo(float f) {return isnan(f);}])
+AC_SINGLE_CXX_CHECK([HAVE_STD_ISNAN_IN_CMATH], [ac_cv_func_std_isnan_in_cmath],
+ [std::isnan], [<cmath>],
+ [#include <cmath>
+ using std::isnan; int foo(float f) {return isnan(f);}])
+])
+
+AC_DEFUN([AC_FUNC_ISINF],[
+AC_SINGLE_CXX_CHECK([HAVE_ISINF_IN_MATH_H], [ac_cv_func_isinf_in_math_h],
+ [isinf], [<math.h>],
+ [#include <math.h>
+ int foo(float f) {return isinf(f);}])
+AC_SINGLE_CXX_CHECK([HAVE_ISINF_IN_CMATH], [ac_cv_func_isinf_in_cmath],
+ [isinf], [<cmath>],
+ [#include <cmath>
+ int foo(float f) {return isinf(f);}])
+AC_SINGLE_CXX_CHECK([HAVE_STD_ISINF_IN_CMATH], [ac_cv_func_std_isinf_in_cmath],
+ [std::isinf], [<cmath>],
+ [#include <cmath>
+ using std::isinf; int foo(float f) {return isinf(f);}])
+AC_SINGLE_CXX_CHECK([HAVE_FINITE_IN_IEEEFP_H], [ac_cv_func_finite_in_ieeefp_h],
+ [finite], [<ieeefp.h>],
+ [#include <ieeefp.h>
+ int foo(float f) {return finite(f);}])
+])
+