1 # Copyright
(C
) 2005 Free Software Foundation
, Inc.
3 # This
program is free software
; you can redistribute it and
/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation
; either version
2 of the License
, or
6 #
(at your option
) any later version.
8 # This
program is distributed in the hope that it will be useful
,
9 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License
for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this
program; if not
, write to the Free Software
15 # Foundation
, Inc.
, 51 Franklin Street
, Fifth Floor
, Boston
, MA
02110-1301, USA.
17 # Run the LANGUAGE compiler with GCC_OPTIONS and inspect the compiler
,
18 # assembler and linker output
(from gcc
-v
) to make sure that they
19 # match the patterns COMPILER_PATTERN
, AS_PATTERN and LD_PATTERN
,
22 proc check_for_options
{language gcc_options compiler_pattern as_pattern ld_pattern
} {
23 set filename test
-[pid
]
24 set fd
[open $filename.c w
]
25 puts $fd
"int main (void) \{ return 0; \}"
27 remote_download host $filename.c
29 set test
"compiler driver $gcc_options option(s)"
30 set gcc_options
"\{additional_flags=$gcc_options -v\}"
33 "c" { set compiler cc1 }
34 default
{ error
"unknown language" }
36 set gcc_output
[gcc_target_compile $filename.c $filename.x executable $gcc_options
]
37 remote_file build
delete $filename.c $filename.x $filename.gcno
39 if {![regexp
-- "/$compiler -quiet.*$compiler_pattern" $gcc_output]} {
40 fail
"$test (compiler options)"
43 if {![regexp
-- " *as .*$as_pattern" $gcc_output]} {
44 fail
"$test (assembler options)"
47 if {![regexp
-- "/collect2 .*$ld_pattern" $gcc_output]} {
48 fail
"$test (linker options)"
54 check_for_options c
{--coverage
} {-fprofile
-arcs
-ftest
-coverage
} {} {-lgcov
}