[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/6] test defs: allow compilers to be auto-selected on user's req
From: |
Stefano Lattarini |
Subject: |
[PATCH 4/6] test defs: allow compilers to be auto-selected on user's request |
Date: |
Thu, 19 Jan 2012 14:55:19 +0100 |
In the recent changes, by pre-setting the required compilers for
the `configure' scripts launched by the test scripts, we have
slightly reduced the coverage of autoconf/automake code aimed at
automatically detecting said compilers. This commit restore such
coverage, by allowing the user to instruct the testsuite *not* to
preset the testsuite compiler(s).
* tests/defs (cc): If $CC is set to the special value "autodetect"
or "autodetected", don't export the configure-detected CC, CFLAGS
and CPPFLAGS variables; rather, unset them.
(c++): Likewise, but for CXX, CXXFLAGS and CPPFLAGS instead.
(fortran): Likewise, but for FC and FCFLAGS instead.
(fortran77): Likewise, but for F77 and FFLAGS instead.
(require_compiler_): New function, to reduce code duplication.
---
tests/defs | 68 +++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 52 insertions(+), 16 deletions(-)
diff --git a/tests/defs b/tests/defs
index 08ada58..86dcc69 100644
--- a/tests/defs
+++ b/tests/defs
@@ -620,6 +620,56 @@ fetch_tap_driver ()
# use the perl implementation by default for the moment.
am_tap_implementation=${am_tap_implementation-shell}
+# Usage: require_compiler_ {cc|c++|fortran|fortran77}
+require_compiler_ ()
+{
+ case $# in
+ 0) fatal_ "require_compiler_: missing argument";;
+ 1) ;;
+ *) fatal_ "require_compiler_: too many arguments";;
+ esac
+ case $1 in
+ cc)
+ am__comp_lang="C"
+ am__comp_var=CC
+ am__comp_flag_vars='CFLAGS CPPFLAGS'
+ ;;
+ c++)
+ am__comp_lang="C++"
+ am__comp_var=CXX
+ am__comp_flag_vars='CXXFLAGS CPPFLAGS'
+ ;;
+ fortran)
+ am__comp_lang="Fortran"
+ am__comp_var=FC
+ am__comp_flag_vars='FCFLAGS'
+ ;;
+ fortran77)
+ am__comp_lang="Fortran 77"
+ am__comp_var=F77
+ am__comp_flag_vars='FFLAGS'
+ ;;
+ esac
+ shift
+ eval "am__comp_prog=\${$am__comp_var}" \
+ || fatal_ "expanding \${$am__comp_var} in require_compiler_"
+ case $am__comp_prog in
+ "")
+ fatal_ "botched configuration: \$$am__comp_var is empty";;
+ false)
+ skip_all_ "no $am__comp_lang compiler available";;
+ autodetect|autodetected)
+ # Let the ./configure commands in the test script try to determine
+ # these automatically.
+ unset $am__comp_var $am__comp_flag_vars;;
+ *)
+ # Pre-set these for the ./configure commands in the test script.
+ export $am__comp_var $am__comp_flag_vars;;
+ esac
+ # Delete private variables.
+ unset am__comp_lang am__comp_prog am__comp_var am__comp_flag_vars
+}
+
## ----------------------------------------------------------- ##
## Checks for required tools, and additional setups (if any) ##
## required by them. ##
@@ -640,22 +690,8 @@ do
# Check that each required tool is present.
case $tool in
:) ;;
- cc)
- test "$CC" = false && skip_all_ "no C compiler available"
- export CC CFLAGS CPPFLAGS
- ;;
- c++)
- test "$CXX" = false && skip_all_ "no C++ compiler available"
- export CXX CXXFLAGS CPPFLAGS
- ;;
- fortran)
- test "$FC" = false && skip_all_ "no Fortran compiler available"
- export FC FCFLAGS
- ;;
- fortran77)
- test "$F77" = false && skip_all_ "no Fortran 77 compiler available"
- export F77 FFLAGS
- ;;
+ cc|c++|fortran|fortran77)
+ require_compiler_ $tool;;
xsi-shell)
require_xsi "$SHELL";;
xsi-bin-sh)
--
1.7.7.3
- [PATCH 5/6] tests: no need to unset CFLAGS in tests requiring 'gcc' anymore, (continued)
- [PATCH 5/6] tests: no need to unset CFLAGS in tests requiring 'gcc' anymore, Stefano Lattarini, 2012/01/19
- [PATCH 1/6] configure: search generic compilers for use in the tests, Stefano Lattarini, 2012/01/19
- Re: [PATCH 1/6] configure: search generic compilers for use in the tests, Peter Rosin, 2012/01/20
- Re: [PATCH 1/6] configure: search generic compilers for use in the tests, Stefano Lattarini, 2012/01/20
- Re: [PATCH 1/6] configure: search generic compilers for use in the tests, Peter Rosin, 2012/01/20
- Re: [PATCH 1/6] configure: search generic compilers for use in the tests, Stefano Lattarini, 2012/01/20
- Re: [PATCH 1/6] configure: search generic compilers for use in the tests, Peter Rosin, 2012/01/23
- Re: [PATCH 1/6] configure: search generic compilers for use in the tests, Stefano Lattarini, 2012/01/23
[PATCH 3/6] test defs: substitute compilers and flags found at configure time, Stefano Lattarini, 2012/01/19
[PATCH 6/6] readme: how to run the testsuite with cross-compilers, Stefano Lattarini, 2012/01/19
[PATCH 4/6] test defs: allow compilers to be auto-selected on user's request,
Stefano Lattarini <=
Re: [PATCH 0/6] Merge 'experimental/compilers-for-testsuite' into master, Stefano Lattarini, 2012/01/23