build: use CPP and CC values when calling pidl
authorMatthieu Patou <mat@matws.net>
Thu, 9 Dec 2010 23:36:24 +0000 (02:36 +0300)
committerMatthieu Patou <mat@matws.net>
Thu, 9 Dec 2010 23:39:42 +0000 (02:39 +0300)
buildtools/wafsamba/samba_autoconf.py
buildtools/wafsamba/samba_pidl.py

index b6d0b358d6bf81b2b04bb866e24805005ac25d6a..1babe7b62d2cc7335b587ac38c086635f9dba617 100644 (file)
@@ -447,11 +447,20 @@ def CHECK_LDFLAGS(conf, ldflags):
                       msg="Checking linker accepts %s" % ldflags)
 
 
+@conf
+def CONFIG_GET(conf, option):
+    '''return True if a configuration option was found'''
+    if (option in conf.env):
+        return conf.env[option]
+    else:
+        return None
+
 @conf
 def CONFIG_SET(conf, option):
     '''return True if a configuration option was found'''
     return (option in conf.env) and (conf.env[option] != ())
 Build.BuildContext.CONFIG_SET = CONFIG_SET
+Build.BuildContext.CONFIG_GET = CONFIG_GET
 
 
 def library_flags(conf, libs):
index 902d4c6e012acb1ebf9dcfd553b58fd4af94b621..6476211eea3546953c7fc2d8769f6860768058de 100644 (file)
@@ -58,7 +58,16 @@ def SAMBA_PIDL(bld, pname, source,
         pidl_src_nodes = bld.pidl_files_cache
 
     # the cd .. is needed because pidl currently is sensitive to the directory it is run in
-    t = bld(rule='cd .. && ${PERL} "${PIDL}" --quiet ${OPTIONS} --outputdir ${OUTPUTDIR} -- "${SRC[0].abspath(env)}"',
+    cpp = ""
+    cc = ""
+    if bld.CONFIG_SET("CPP"):
+        cpp = "CPP=%s" % bld.CONFIG_GET("CPP")
+    if bld.CONFIG_SET("CC"):
+        if isinstance(bld.CONFIG_GET("CC"), list):
+            cc = "CC=%s" % bld.CONFIG_GET("CC")[0]
+        else:
+            cc = "CC=%s" % bld.CONFIG_GET("CC")
+    t = bld(rule='cd .. && %s %s ${PERL} "${PIDL}" --quiet ${OPTIONS} --outputdir ${OUTPUTDIR} -- "${SRC[0].abspath(env)}"' % (cpp, cc),
             ext_out    = '.c',
             before     = 'cc',
             on_results = True,