build: more complete implementation of waf configure -C
authorAndrew Tridgell <tridge@samba.org>
Sun, 21 Mar 2010 20:48:10 +0000 (07:48 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:26:59 +0000 (20:26 +1000)
this is a closer emulation of the autoconf behaviour

buildtools/wafsamba/samba_autoconf.py
lib/replace/wscript

index fc8027c5f237727c00075a6871c447c8b24be79c..7e910ad8a4d615819262053afcb89e01c72b982a 100644 (file)
@@ -1,6 +1,6 @@
 # a waf tool to add autoconf-like macros to the configure section
 
-import Build, os, Options
+import Build, os, Options, preproc
 import string
 from Configure import conf
 from samba_utils import *
@@ -429,13 +429,22 @@ def CHECK_CC_ENV(conf):
             # make for nicer logs if just a single command
             conf.env.CC = conf.env.CC[0]
 
-@conf
-def ENABLE_CONFIGURE_CACHE(conf):
-    '''enable cache of configure results'''
-    if os.environ.get('WAFCACHE'):
-        # already setup
-        return
-    cache_path = os.path.join(conf.blddir, '.confcache')
-    mkdir_p(cache_path)
-    Options.cache_global = os.environ['WAFCACHE'] = cache_path
 
+@conf
+def SETUP_CONFIGURE_CACHE(conf, enable):
+    '''enable/disable cache of configure results'''
+    if enable:
+        # when -C is chosen, we will use a private cache and will
+        # not look into system includes. This roughtly matches what
+        # autoconf does with -C
+        cache_path = os.path.join(conf.blddir, '.confcache')
+        mkdir_p(cache_path)
+        Options.cache_global = os.environ['WAFCACHE'] = cache_path
+    else:
+        # when -C is not chosen we will not cache configure checks
+        # We set the recursion limit low to prevent waf from spending
+        # a lot of time on the signatures of the files.
+        Options.cache_global = os.environ['WAFCACHE'] = ''
+        preproc.recursion_limit = 1
+    # in either case we don't need to scan system includes
+    preproc.go_absolute = False
index dc00790436d1e7a92b3b85cd5e12cffcbe2dd5a4..73a89f00609cb5d825583359dd79521aedb8ef56 100644 (file)
@@ -53,14 +53,7 @@ def configure(conf):
     if Options.options.timestamp_dependencies:
         conf.ENABLE_TIMESTAMP_DEPENDENCIES()
 
-    if Options.options.enable_configure_cache:
-        conf.ENABLE_CONFIGURE_CACHE()
-    else:
-        # during the configure checks we want the waf dependency checker
-        # to go into system includes. This ensures that if you add/remove
-        # a system library, that 'waf configure' will detect that, and
-        # it won't be fooled by the waf cache
-        preproc.go_absolute = True
+    conf.SETUP_CONFIGURE_CACHE(Options.options.enable_configure_cache)
 
     # load our local waf extensions
     conf.check_tool('wafsamba', tooldir=conf.srcdir + "/buildtools/wafsamba")