summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Nagy <tnagy2pow10@gmail.com>2010-08-30 15:02:26 +0200
committerStefan Metzmacher <metze@samba.org>2010-08-30 21:01:19 +0200
commit734677292fb6fb4f7cccc7ab1c6fd04ad2203aed (patch)
tree4efcf64004c7041b9846d47967e903e1433a6fa1
parenta8d8cf00eae08466ef6a232ccbb5ede9ee4d9626 (diff)
downloadsamba-734677292fb6fb4f7cccc7ab1c6fd04ad2203aed.tar.gz
samba-734677292fb6fb4f7cccc7ab1c6fd04ad2203aed.tar.bz2
samba-734677292fb6fb4f7cccc7ab1c6fd04ad2203aed.zip
Disable gccdeps if -MD is not supported
Signed-off-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--buildtools/wafsamba/wscript26
1 files changed, 23 insertions, 3 deletions
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index bad65cac24..e2b1a278dd 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -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)
@@ -160,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'