blob: 33c136cb2a065a89a3fd06afffa6bc751282b10e [file] [log] [blame]
# Copyright 2010 Google Inc.
# All Rights Reserved.
# Author: (Tim Haloun)
"""Tools that we need to include with libjingle."""
import subprocess
# We need this in libjingle because main.scons depends on it and
# libjingle depends on main.scons.
def EnableFeatureWherePackagePresent(env, bit, cpp_flag, package):
"""Enable a feature if a required pkg-config package is present.
env: The current SCons environment.
bit: The name of the Bit to enable when the package is present.
cpp_flag: The CPP flag to enable when the package is present.
package: The name of the package.
if not env.Bit('host_linux'):
if _HavePackage(package):
env.Append(CPPDEFINES = [cpp_flag])
print ('Warning: Package \"%s\" not found. Feature \"%s\" will not be '
'built. To build with this feature, install the package that '
'provides the \"%s.pc\" file.') % (package, bit, package)
def _HavePackage(package):
"""Whether the given pkg-config package name is present on the build system.
package: The name of the package.
True if the package is present, else False
return['pkg-config', '--exists', package]) == 0
def generate(env): # pylint: disable-msg=C6409
def exists(env): # pylint: disable-msg=C6409,W0613
return 1