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 |
||
7 |
AC_DEFUN([AC_CXX_CMATH], |
|
8 |
[AC_MSG_CHECKING(the location of cmath) |
|
9 |
AC_LANG_SAVE
|
|
10 |
AC_LANG_CPLUSPLUS
|
|
11 |
ac_cv_cxx_cmath=""
|
|
481.1.18
by Monty
Fixed m4 files for older C compilers that don't have ext/cstdint, etc. |
12 |
ac_cv_cxx_cmath_namespace=""
|
481.1.13
by Monty Taylor
Added tests for C99 math extensions for cmath. |
13 |
for location in tr1/cmath boost/cmath cmath; do
|
14 |
for namespace in __gnu_cxx "" std stdext std::tr1; do
|
|
15 |
if test -z "$ac_cv_cxx_cmath"; then
|
|
16 |
AC_TRY_COMPILE([#include <$location>], |
|
17 |
[$namespace::isfinite(1)], |
|
18 |
[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. |
19 |
ac_cv_cxx_cmath_namespace="$namespace";]) |
481.1.13
by Monty Taylor
Added tests for C99 math extensions for cmath. |
20 |
fi |
21 |
done |
|
22 |
done |
|
23 |
if test -n "$ac_cv_cxx_cmath"; then |
|
24 |
AC_MSG_RESULT([$ac_cv_cxx_cmath]) |
|
25 |
else |
|
481.1.19
by Monty Taylor
One more cmath fix. |
26 |
ac_cv_cxx_cmath="<math.h>" |
27 |
ac_cv_cxx_cmath_namespace="" |
|
481.1.13
by Monty Taylor
Added tests for C99 math extensions for cmath. |
28 |
AC_MSG_RESULT() |
481.1.18
by Monty
Fixed m4 files for older C compilers that don't have ext/cstdint, etc. |
29 |
AC_MSG_WARN([Could not find a cmath header.]) |
481.1.13
by Monty Taylor
Added tests for C99 math extensions for cmath. |
30 |
fi |
481.1.18
by Monty
Fixed m4 files for older C compilers that don't have ext/cstdint, etc. |
31 |
AC_DEFINE_UNQUOTED(CMATH_H,$ac_cv_cxx_cmath, |
32 |
[the location of <cmath>]) |
|
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. |
33 |
AC_DEFINE_UNQUOTED(CMATH_NAMESPACE,$ac_cv_cxx_cmath_namespace, |
481.1.18
by Monty
Fixed m4 files for older C compilers that don't have ext/cstdint, etc. |
34 |
[the namespace of C99 math extensions]) |
481.1.13
by Monty Taylor
Added tests for C99 math extensions for cmath. |
35 |
]) |