From 44a0b58e307adff82a7051ea4b11742d4ce85dfe Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Sat, 24 Oct 2009 12:38:52 +0100 Subject: [PATCH 1/2] Add an autoconf check that M_PI is defined by math.h If we can't get math.h to define this, configure fails with an error Signed-off-by: Jon TURNEY --- configure.ac | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index a4d9d94..00a109d 100644 --- a/configure.ac +++ b/configure.ac @@ -142,6 +142,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 +AC_MSG_ERROR([Can't work out how to make define M_PI]) +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.7.0.4