0

I'm attempting to check for the existence of a library from inside my SConscript file, as follows:

# Not sure if this bit is relevant:
Import('env')
env = env.Clone()

# This is what I'm trying to do:
conf = env.Configure()
if conf.CheckLib('gcrypt'):
    pass # actually something more interesting

...but it's not working. All I'm getting is an opaque error from scons, as follows:

scons: ***
File "/home/src/foo/bar/SConscript", line 49, in <module>

...where line 49 is the conf = env.Configure() line.

This is on Mac OS X, where I don't expect to find the library mentioned. How do I detect this in my SConscript file?

Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380

1 Answers1

0

I tested this and it worked just fine. Maybe its a problem with how you're creating or passing the env. Here is my sample code in case it helps:

SConstruct

env = Environment()
env.SConscript('SConscript', exports='env', duplicate=0)

SConscript

Import('env')

env = env.Clone()

conf = env.Configure()
if conf.CheckLib('gcrypt'):
  pass

And here is the result:

$ scons
scons: Reading SConscript files ...
Checking for C library gcrypt... no
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.
Brady
  • 10,207
  • 2
  • 20
  • 59