Disable gccdeps if -MD is not supported
[obnox/samba/samba-obnox.git] / buildtools / wafsamba / wscript
index 56f2e60a5beb4a4431625520c649806d22651ce9..e2b1a278ddebd2dbc5136246c3a262cd04cea533 100644 (file)
@@ -82,7 +82,7 @@ def set_options(opt):
                    action="store_true", dest='fatal_errors', default=False)
     gr.add_option('--enable-gccdeps',
                    help=("Enable use of gcc -MD dependency module"),
-                   action="store_true", dest='enable_gccdeps', default=False)
+                   action="store_true", dest='enable_gccdeps', default=True)
     gr.add_option('--timestamp-dependencies',
                    help=("use file timestamps instead of content for build dependencies (BROKEN)"),
                    action="store_true", dest='timestamp_dependencies', default=False)
@@ -130,6 +130,14 @@ def set_options(opt):
                   help=SUPPRESS_HELP,
                   action='store_true', dest='AUTOCONF_DISABLE_DEPENDENCY_TRACKING', default=False)
 
+    gr = opt.option_group('dist options')
+    gr.add_option('--sign-release',
+                   help='sign the release tarball created by waf dist',
+                   action='store_true', dest='SIGN_RELEASE')
+    gr.add_option('--tag',
+                   help='tag release in git at the same time',
+                   type='string', action='store', dest='TAG_RELEASE')
+
 
 @wafsamba.runonce
 def configure(conf):
@@ -152,9 +160,29 @@ def configure(conf):
     # we need git for 'waf dist'
     conf.find_program('git', var='GIT')
 
+    # older gcc versions (< 4.4) does not work with gccdeps, so we have to see if the .d file is generated
     if Options.options.enable_gccdeps:
-        # don't enable gccdeps by default as it needs a very recent version gcc
-        conf.check_tool('gccdeps', tooldir=conf.srcdir + "/buildtools/wafsamba")
+        from TaskGen import feature, after
+        @feature('testd')
+        @after('apply_core')
+        def check_d(self):
+            tsk = self.compiled_tasks[0]
+            tsk.outputs.append(tsk.outputs[0].change_ext('.d'))
+
+        import Task
+        cc = Task.TaskBase.classes['cc']
+        oldmeth = cc.run
+
+        cc.run = Task.compile_fun_noshell('cc', '${CC} ${CCFLAGS} ${CPPFLAGS} ${_CCINCFLAGS} ${_CCDEFFLAGS} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT[0].abspath(env)}')[0]
+        try:
+            try:
+                conf.check(features='cc testd', fragment='int main() {return 0;}\n', ccflags=['-MD'], mandatory=True, msg='Check for -MD')
+            except:
+                pass
+            else:
+                conf.check_tool('gccdeps', tooldir=conf.srcdir + "/buildtools/wafsamba")
+        finally:
+            cc.run = oldmeth
 
     # make the install paths available in environment
     conf.env.LIBDIR = Options.options.LIBDIR or '${PREFIX}/lib'
@@ -191,6 +219,10 @@ def configure(conf):
     conf.env.ABI_CHECK = Options.options.ABI_CHECK or Options.options.developer
     if Options.options.ABI_CHECK_DISABLE:
         conf.env.ABI_CHECK = False
+    try:
+        conf.find_program('gdb', mandatory=True)
+    except:
+        conf.env.ABI_CHECK = False
 
     conf.CHECK_COMMAND(['uname', '-a'],
                        msg='Checking build system',