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, CFLAGS 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. --- ChangeLog | 18 ++++++++++++++++ tests/defs | 67 +++++++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 69 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index e741c88..74ee549 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,23 @@ 2011-10-21 Stefano Lattarini <stefano.lattar...@gmail.com> + test defs: allow compilers to be auto-selected on user's request + 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. Add a minor sanity + check since we are at it. + (c++): Likewise, but for CXX, CFLAGS 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. + +2011-10-21 Stefano Lattarini <stefano.lattar...@gmail.com> + test defs: substitute compilers and flags found at configure time * tests/Makefile.am (do_subst): Also substitute CC, CXX, F77, FC, CPPFLAGS, CFLAGS, CXXFLAGS, FCFLAGS and FFLAGS. diff --git a/tests/defs b/tests/defs index 1005c20..f73c4e5 100644 --- a/tests/defs +++ b/tests/defs @@ -556,6 +556,55 @@ 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";; + *) 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. ## @@ -576,22 +625,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.2.3