[Mesa-dev] [PATCH mesa] scons: split out check_header() helper

Eric Engestrom eric.engestrom at imgtec.com
Mon Jul 10 14:40:44 UTC 2017


Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
---
 scons/gallium.py | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/scons/gallium.py b/scons/gallium.py
index 61643a6d4f..c8e47a39db 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -145,6 +145,17 @@ def check_cc(env, cc, expr, cpp_opt = '-E'):
     sys.stdout.write(' %s\n' % ['no', 'yes'][int(bool(result))])
     return result
 
+def check_header(env, header):
+    '''Check if the header exist'''
+
+    conf = SCons.Script.Configure(env)
+    have_header = False
+
+    if conf.CheckHeader(header):
+        have_header = True
+
+    env = conf.Finish()
+    return have_header
 
 def check_prog(env, prog):
     """Check whether this program exists."""
@@ -325,10 +336,8 @@ def generate(env):
                 'GLX_INDIRECT_RENDERING',
             ]
 
-        conf = SCons.Script.Configure(env)
-        if conf.CheckHeader('xlocale.h'):
+        if check_header(env, 'xlocale.h'):
             cppdefines += ['HAVE_XLOCALE_H']
-        env = conf.Finish()
 
     if platform == 'windows':
         cppdefines += [
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list