From 3ed8fb3690dd686244f8f2f5732fc48c47b50ad9 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Sat, 24 Oct 2009 12:38:52 +0100 Subject: [PATCH 2/2] Add an autoconf check that M_PI is defined by math.h It's unclear what we should do if we can't get math.h to define this. Explicitly defining via -D on the compiler command line is probably a poor choice. If everything which needs M_PI included compiler.h, this wouldn't be a problem... Signed-off-by: Jon TURNEY --- configure.ac | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index 6f88d2e..4eaf045 100644 --- a/configure.ac +++ b/configure.ac @@ -109,6 +109,23 @@ if test "x$GXX" = xyes; then CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" fi +dnl check for M_PI +AC_MSG_CHECKING(for M_PI in math.h) +mpi=no +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [ double f = M_PI ])], + [mpi=yes]) +if test "$mpi" = no; then +SAVE_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -U__STRICT_ANSI__" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [ double f = M_PI ])], + [mpi="yes, with -U__STRICT_ANSI__"], + [CFLAGS="$SAVE_CFLAGS"]) +fi +if test "$mpi" = no; then +DEFINES="$DEFINES -DM_PI=3.14159265358979323846" +fi +AC_MSG_RESULT([$mpi]) + dnl These should be unnecessary, but let the user set them if they want AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler. Default is to use CFLAGS.]) -- 1.6.4.2