s3-waf: make pieces of the source3 waf wscript depends on toplevel_build
authorAndrew Tridgell <tridge@samba.org>
Mon, 21 Feb 2011 01:14:38 +0000 (12:14 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 22 Feb 2011 01:51:09 +0000 (02:51 +0100)
this will allow the toplevel build to use source3/wscript for
configure options

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source3/wscript

index 9e5a8dec41134debe64c40d5de7cd62c0d1d04df..7567ea4c503f09def6c549c9e50ec16b7480791c 100644 (file)
@@ -9,21 +9,23 @@ VERSION=None
 import sys, os
 from optparse import SUPPRESS_HELP
 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
-import wafsamba, Options
+sys.path.insert(0, "source3")
+import wafsamba, Options, Logs, Utils
 import build.charset
 import samba_utils, samba_version
 import samba3
 
 def set_options(opt):
-    opt.BUILTIN_DEFAULT('NONE')
-    opt.PRIVATE_EXTENSION_DEFAULT('s3')
-    opt.RECURSE('../lib/replace')
-    opt.RECURSE('build')
-    opt.RECURSE('selftest')
-    opt.RECURSE('../lib/nss_wrapper')
-    opt.RECURSE('../lib/socket_wrapper')
-    opt.RECURSE('../lib/tevent')
-    opt.RECURSE('../lib/tdb')
+    if not os.getenv('TOPLEVEL_BUILD'):
+        opt.BUILTIN_DEFAULT('NONE')
+        opt.PRIVATE_EXTENSION_DEFAULT('s3')
+        opt.RECURSE('../lib/replace')
+        opt.RECURSE('build')
+        opt.RECURSE('selftest')
+        opt.RECURSE('../lib/nss_wrapper')
+        opt.RECURSE('../lib/socket_wrapper')
+        opt.RECURSE('../lib/tevent')
+        opt.RECURSE('../lib/tdb')
 
     opt.add_option('--with-static-modules',
                    help=("Comma-separated list of names of modules to statically link in"),
@@ -61,40 +63,41 @@ def set_options(opt):
 def configure(conf):
     from samba_utils import TO_LIST
 
-    version = samba_version.load_version(env=conf.env)
-
-    conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
-    conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
-    conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
+    if not conf.env.toplevel_build:
+        version = samba_version.load_version(env=conf.env)
+        conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
+        conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
+        conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
 
     if Options.options.developer:
         conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
-        conf.env['developer'] = True
+        conf.env.developer = True
 
     if Options.options.with_swat:
         conf.env['build_swat'] = True
 
-    conf.RECURSE('../lib/replace')
-    conf.RECURSE('build')
-    conf.RECURSE('../lib/tdb')
-    conf.RECURSE('../lib/talloc')
-    conf.RECURSE('../lib/tevent')
-    conf.RECURSE('../lib/popt')
-    conf.RECURSE('../lib/nss_wrapper')
-    conf.RECURSE('../lib/socket_wrapper')
-    conf.RECURSE('../lib/zlib')
-    conf.RECURSE('../libcli/smbreadline')
-    conf.RECURSE('../lib/util')
-
-    conf.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace''')
-    if not conf.env.USING_SYSTEM_TDB:
-        conf.ADD_EXTRA_INCLUDES('#lib/tdb/include')
-    if not conf.env.USING_SYSTEM_TEVENT:
-        conf.ADD_EXTRA_INCLUDES('#lib/tevent')
-    if not conf.env.USING_SYSTEM_TALLOC:
-        conf.ADD_EXTRA_INCLUDES('#lib/talloc')
-    if not conf.env.USING_SYSTEM_POPT:
-        conf.ADD_EXTRA_INCLUDES('#lib/popt')
+    if not conf.env.toplevel_build:
+        conf.RECURSE('../lib/replace')
+        conf.RECURSE('build')
+        conf.RECURSE('../lib/tdb')
+        conf.RECURSE('../lib/talloc')
+        conf.RECURSE('../lib/tevent')
+        conf.RECURSE('../lib/popt')
+        conf.RECURSE('../lib/nss_wrapper')
+        conf.RECURSE('../lib/socket_wrapper')
+        conf.RECURSE('../lib/zlib')
+        conf.RECURSE('../libcli/smbreadline')
+        conf.RECURSE('../lib/util')
+
+        conf.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace''')
+        if not conf.env.USING_SYSTEM_TDB:
+            conf.ADD_EXTRA_INCLUDES('#lib/tdb/include')
+        if not conf.env.USING_SYSTEM_TEVENT:
+            conf.ADD_EXTRA_INCLUDES('#lib/tevent')
+        if not conf.env.USING_SYSTEM_TALLOC:
+            conf.ADD_EXTRA_INCLUDES('#lib/talloc')
+        if not conf.env.USING_SYSTEM_POPT:
+            conf.ADD_EXTRA_INCLUDES('#lib/popt')
 
     conf.ADD_LDFLAGS("-Wl,--export-dynamic", testflags=True)