From 9552f5d5d2320879699d1518b32cd2cc36488bff Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 20 Dec 2011 03:51:38 +0000 Subject: [PATCH] Made check for libm more compiler-agnostic --- SConstruct | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/SConstruct b/SConstruct index b671c117d..465d140f0 100644 --- a/SConstruct +++ b/SConstruct @@ -492,14 +492,10 @@ elif env['F90'] == 'ifort': env['FORTRANMODDIR'] = '${TARGET.dir}' -if env['CC'] == 'gcc': - env['WIN32'] = False - env['LIBM'] = ['m'] -elif env['CC'] == 'cl': +if env['CC'] == 'cl': env['WIN32'] = True - env['LIBM'] = [] else: - assert False + env['WIN32'] = False if env['boost_inc_dir']: env.Append(CPPPATH=env['boost_inc_dir']) @@ -519,6 +515,11 @@ env['HAS_MATH_H_ERF'] = conf.CheckDeclaration('erf', '#include ', 'C++') env['HAS_BOOST_MATH'] = conf.CheckCXXHeader('boost/math/special_functions/erf.hpp', '<>') env['HAS_SUNDIALS'] = conf.CheckLibWithHeader('sundials_cvodes', 'cvodes/cvodes.h', 'C++', 'CVodeCreate(CV_BDF, CV_NEWTON);', False) +env['NEED_LIBM'] = not conf.CheckLibWithHeader(None, 'math.h', 'C', 'double x = 2.0; sqrt(x);', False) +if env['NEED_LIBM']: + env['LIBM'] = ['m'] +else: + env['LIBM'] = [] if env['HAS_SUNDIALS'] and env['use_sundials'] != 'n': # Determine Sundials version