selftest/tests.py: Update path to waflib
[sfrench/samba-autobuild/.git] / third_party / waf / wafadmin / Tools / compiler_d.py
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # Carlos Rafael Giani, 2007 (dv)
4
5 import os, sys, imp, types
6 import Utils, Configure, Options
7
8 def detect(conf):
9         if getattr(Options.options, 'check_dmd_first', None):
10                 test_for_compiler = ['dmd', 'gdc']
11         else:
12                 test_for_compiler = ['gdc', 'dmd']
13
14         for d_compiler in test_for_compiler:
15                 try:
16                         conf.check_tool(d_compiler)
17                 except:
18                         pass
19                 else:
20                         break
21         else:
22                 conf.fatal('no suitable d compiler was found')
23
24 def set_options(opt):
25         d_compiler_opts = opt.add_option_group('D Compiler Options')
26         d_compiler_opts.add_option('--check-dmd-first', action='store_true',
27                         help='checks for the gdc compiler before dmd (default is the other way round)',
28                         dest='check_dmd_first',
29                         default=False)
30
31         for d_compiler in ['gdc', 'dmd']:
32                 opt.tool_options('%s' % d_compiler, option_group=d_compiler_opts)