From 14008703f623d68960fad5e8113c245f0b80a74a Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 1 Mar 2021 21:46:58 +0300 Subject: [PATCH] wscript: fix tgmath check for old toolchails like GCW0 --- wscript | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/wscript b/wscript index 3a0fd4a8..6334ac70 100644 --- a/wscript +++ b/wscript @@ -212,17 +212,6 @@ def configure(conf): conf.env.append_unique('CXXFLAGS', cxxflags) conf.env.append_unique('LINKFLAGS', linkflags) - # check if we can use C99 tgmath - if conf.check_cc(header_name='tgmath.h', mandatory=False): - if conf.env.COMPILER_CC == 'msvc': - conf.define('_CRT_SILENCE_NONCONFORMING_TGMATH_H', 1) - tgmath_usable = conf.check_cc(fragment='''#include - int main(void){ return (int)sin(2.0f); }''', - msg='Checking if tgmath.h is usable', mandatory=False) - conf.define_cond('HAVE_TGMATH_H', tgmath_usable) - else: - conf.undefine('HAVE_TGMATH_H') - # check if we can use C99 stdint if conf.check_cc(header_name='stdint.h', mandatory=False): # use system @@ -267,6 +256,18 @@ def configure(conf): # conf.multicheck(*a, run_all_tests = True, mandatory = True) + # check if we can use C99 tgmath + if conf.check_cc(header_name='tgmath.h', mandatory=False): + if conf.env.COMPILER_CC == 'msvc': + conf.define('_CRT_SILENCE_NONCONFORMING_TGMATH_H', 1) + tgmath_usable = conf.check_cc(fragment='''#include + const float val = 2; + int main(void){ return (int)(-asin(val)); }''', + msg='Checking if tgmath.h is usable', mandatory=False, use='M') + conf.define_cond('HAVE_TGMATH_H', tgmath_usable) + else: + conf.undefine('HAVE_TGMATH_H') + # indicate if we are packaging for Linux/BSD if not conf.options.WIN_INSTALL and conf.env.DEST_OS not in ['win32', 'darwin', 'android']: conf.env.LIBDIR = conf.env.BINDIR = '${PREFIX}/lib/xash3d'