481.1.13
by Monty Taylor
Added tests for C99 math extensions for cmath. |
1 |
# We check two things: where the include file is for cmath. We |
2 |
# include AC_TRY_COMPILE for all the combinations we've seen in the |
|
3 |
# wild. We define one of HAVE_CMATH or HAVE_TR1_CMATH or
|
|
4 |
# HAVE_BOOST_CMATH depending
|
|
5 |
# on location.
|
|
6 |
||
520.9.3
by mordred
zomg. Solaris actually builds all the way!!! |
7 |
m4_define([_AH_NEED_FUNCS],
|
520.9.6
by Monty
Downgraded some m4 stuff for older machines. |
8 |
[AC_FOREACH([AC_Func], [$1],
|
9 |
[AH_TEMPLATE(AS_TR_CPP([NEED_]AC_Func),
|
|
10 |
[Define to 1 if you need to build a local version of `]AC_Func[' function.])])]) |
|
520.9.3
by mordred
zomg. Solaris actually builds all the way!!! |
11 |
|
481.1.13
by Monty Taylor
Added tests for C99 math extensions for cmath. |
12 |
AC_DEFUN([AC_CXX_CMATH], |
13 |
[AC_MSG_CHECKING(the location of cmath) |
|
520.9.3
by mordred
zomg. Solaris actually builds all the way!!! |
14 |
AC_LANG_PUSH(C++)
|
481.1.13
by Monty Taylor
Added tests for C99 math extensions for cmath. |
15 |
ac_cv_cxx_cmath=""
|
481.1.18
by Monty
Fixed m4 files for older C compilers that don't have ext/cstdint, etc. |
16 |
ac_cv_cxx_cmath_namespace=""
|
481.1.13
by Monty Taylor
Added tests for C99 math extensions for cmath. |
17 |
for location in tr1/cmath boost/cmath cmath; do
|
18 |
for namespace in __gnu_cxx "" std stdext std::tr1; do
|
|
19 |
if test -z "$ac_cv_cxx_cmath"; then
|
|
20 |
AC_TRY_COMPILE([#include <$location>], |
|
21 |
[$namespace::isfinite(1)], |
|
22 |
[ac_cv_cxx_cmath="<$location>"; |
|
489.1.10
by Monty Taylor
Slight tweaks to CMATH_NAMESPACE to make it match what Google's doing with Protobuf tests a little better. |
23 |
ac_cv_cxx_cmath_namespace="$namespace";]) |
481.1.13
by Monty Taylor
Added tests for C99 math extensions for cmath. |
24 |
fi |
25 |
done |
|
26 |
done |
|
27 |
if test -n "$ac_cv_cxx_cmath"; then |
|
28 |
AC_MSG_RESULT([$ac_cv_cxx_cmath]) |
|
29 |
else |
|
481.1.19
by Monty Taylor
One more cmath fix. |
30 |
ac_cv_cxx_cmath="<math.h>" |
31 |
ac_cv_cxx_cmath_namespace="" |
|
481.1.13
by Monty Taylor
Added tests for C99 math extensions for cmath. |
32 |
AC_MSG_RESULT() |
481.1.18
by Monty
Fixed m4 files for older C compilers that don't have ext/cstdint, etc. |
33 |
AC_MSG_WARN([Could not find a cmath header.]) |
520.9.3
by mordred
zomg. Solaris actually builds all the way!!! |
34 |
|
35 |
_AH_NEED_FUNCS([isinf isnan isfinite]) |
|
36 |
for ac_func in isinf isnan isfinite ; do |
|
37 |
AC_TRY_COMPILE([#include <math.h>], |
|
38 |
[double x=1.0; $ac_func(x)], |
|
39 |
[],[AC_DEFINE_UNQUOTED(AS_TR_CPP([NEED_$ac_func]))]) |
|
40 |
done |
|
481.1.13
by Monty Taylor
Added tests for C99 math extensions for cmath. |
41 |
fi |
481.1.18
by Monty
Fixed m4 files for older C compilers that don't have ext/cstdint, etc. |
42 |
AC_DEFINE_UNQUOTED(CMATH_H,$ac_cv_cxx_cmath, |
43 |
[the location of <cmath>]) |
|
572.1.4
by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf. |
44 |
if test "x$ac_cv_cxx_cmath_namespace" != "x" |
45 |
then |
|
46 |
AC_DEFINE_UNQUOTED(CMATH_NAMESPACE,$ac_cv_cxx_cmath_namespace, |
|
47 |
[the namespace of C99 math extensions]) |
|
48 |
fi |
|
520.9.3
by mordred
zomg. Solaris actually builds all the way!!! |
49 |
AC_LANG_POP() |
481.1.13
by Monty Taylor
Added tests for C99 math extensions for cmath. |
50 |
]) |