Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nanopb/nanopb.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2022-11-25 11:54:39 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2022-11-25 11:54:39 +0300
commit9a8776022f9c874c3736a46ac700645dc9cacf9b (patch)
tree33605a05cdb73923bc2c5c42e29a4abcf6a1a985 /tests
parentdd4079930b76fb26dcbb49141a105d78ac9da95c (diff)
Automatically add -lm to test builds on platforms that have libm (#792)
Most tests don't need it, but on FreeBSD isnan() comes from libm.
Diffstat (limited to 'tests')
-rw-r--r--tests/SConstruct6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/SConstruct b/tests/SConstruct
index d2af0d7..135c8f9 100644
--- a/tests/SConstruct
+++ b/tests/SConstruct
@@ -76,7 +76,7 @@ env.Append(PROTOCPATH = '#../generator')
if not env.GetOption('clean'):
def check_ccflags(context, flags, linkflags = ''):
'''Check if given CCFLAGS are supported'''
- context.Message('Checking support for CCFLAGS="%s"... ' % flags)
+ context.Message('Checking support for CCFLAGS="%s" LINKFLAGS="%s"... ' % (flags, linkflags))
oldflags = context.env['CCFLAGS']
oldlinkflags = context.env['LINKFLAGS']
context.env.Append(CCFLAGS = flags)
@@ -122,6 +122,10 @@ if not env.GetOption('clean'):
if stdlib: conf.env.Append(CPPDEFINES = {'HAVE_STDLIB_H': 1})
if limits: conf.env.Append(CPPDEFINES = {'HAVE_LIMITS_H': 1})
+ # Some platforms need libm for isnan()
+ if conf.CheckCCFLAGS('', linkflags = '-lm'):
+ conf.env.Append(LINKFLAGS = '-lm')
+
# Check protoc version
conf.env['PROTOC_VERSION'] = conf.CheckProtocVersion()