diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-07-25 19:23:29 +0200 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-07-26 14:11:34 +0200 |
commit | 42bd480ccbe3cf252bbf33e0f7a5e5eacc75a5ce (patch) | |
tree | 251fbaa88931cacbfc88c51cfc329829b33bb3f1 /t | |
parent | 2bb312c8afbb7eb15bd794c638d72b4dd15dc4eb (diff) | |
download | automake-42bd480ccbe3cf252bbf33e0f7a5e5eacc75a5ce.tar.gz |
test init: refactor: new function 'require_tool'
* t/ax/test-init.sh (require_tool): Here.
Use it in the loop in the prerequisites in $required.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 't')
-rw-r--r-- | t/ax/test-init.sh | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/t/ax/test-init.sh b/t/ax/test-init.sh index 95a42e009..d6fc8a6b6 100644 --- a/t/ax/test-init.sh +++ b/t/ax/test-init.sh @@ -635,15 +635,12 @@ require_compiler_ () ## required by them. ## ## ----------------------------------------------------------- ## -# Look for (and maybe set up) required tools and/or system features; skip -# the current test if they are not found. -for tool in : $required -do - # Check that each required tool is present. - case $tool in - :) ;; +require_tool () +{ + am_tool=$1 + case $1 in cc|c++|fortran|fortran77) - require_compiler_ $tool;; + require_compiler_ $1;; xsi-lib-shell) if test x"$am_test_prefer_config_shell" = x"yes"; then require_xsi "$SHELL" @@ -862,16 +859,23 @@ do ;; *) # Generic case: the tool must support --version. - echo "$me: running $tool --version" - # It is not likely but possible that $tool is a special builtin, - # in which case the shell is allowed to exit after an error. So - # we need the subshell here. Also, some tools, like Sun cscope, + echo "$me: running $1 --version" + # It is not likely but possible that the required tool is a special + # builtin, in which case the shell is allowed to exit after an error. + # So we need the subshell here. Also, some tools, like Sun cscope, # can be interactive without redirection. - ($tool --version) </dev/null \ - || skip_all_ "required program '$tool' not available" + ($1 --version) </dev/null \ + || skip_all_ "required program '$1' not available" ;; esac +} + +# Look for (and maybe set up) required tools and/or system features; skip +# the current test if they are not found. +for am_tool in $required; do + require_tool $am_tool done +unset am_tool # We might need extra macros, e.g., from Libtool or Gettext. case " $required " in *\ libtool*) . ./t/libtool-macros.dir/get.sh;; esac |