File: compilertest.py

package info (click to toggle)
fsplib 0.14-5.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 236 kB
  • sloc: ansic: 1,581; python: 117; makefile: 11; sh: 8
file content (28 lines) | stat: -rw-r--r-- 635 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#
# Scons compiler tester
#
# Version 1.2
# 08-Sep-2014
#

def checkForCCOption(conf,option):
   """Checks if CC compiler supports given command line option.

   Adds option to CCFLAGS option is supported by compiler.

   """
   conf.Message("Checking whether %s supports %s... " % (conf.env['CC'],option))
   lastCFLAGS=conf.env['CCFLAGS']
   conf.env.Append(CCFLAGS = option)
   rc = conf.TryCompile("""
void dummy(void);
void dummy(void) {}
""",'.c')
   if not rc:
       try:
          lastCFLAGS.remove(option)
       except ValueError:
          pass
       conf.env.Replace(CCFLAGS = lastCFLAGS)
   conf.Result(rc)
   return rc