Allow fully qulified file name in tools to check for.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Sep 23 07:15:06 2008 +0000 (2008-09-23)
changeset 87076a65d37807f
parent 869 23c6c9ea90be
child 871 907d4ad06c0f
Allow fully qulified file name in tools to check for.
Simplify checking for bash.

/trunk/configure | 30 13 17 0 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
configure
     1.1 --- a/configure	Tue Sep 23 05:20:08 2008 +0000
     1.2 +++ b/configure	Tue Sep 23 07:15:06 2008 +0000
     1.3 @@ -10,9 +10,10 @@
     1.4  #  - makeinfo for building docs, even if discarded later on
     1.5  #  - others obvious... :-/
     1.6  TOOLS_TO_CHECK='
     1.7 -make/^GNU
     1.8 +/bin/bash/^GNU bash, version 3\.
     1.9 +make/^GNU Make
    1.10  gcc
    1.11 -awk/^GNU
    1.12 +awk/^GNU Awk
    1.13  sed
    1.14  bison
    1.15  flex
    1.16 @@ -46,12 +47,12 @@
    1.17  
    1.18  # A small function to test for existence of various tools
    1.19  # Usage: has_or_abort foobar
    1.20 -#          -> foobar must exist in PATH
    1.21 +#          -> foobar must exist in PATH or be an exiting fully qualified file name
    1.22  # Usage: has_or_abort foobar/string
    1.23 -#          -> foobar must exist in PATH, and $(foobar --version) must contain 'string'
    1.24 +#          -> foobar must exist in PATH or be an existing FQFN, and $(foobar --version) must contain 'string'
    1.25  has_or_abort() {
    1.26 -    tool=$(echo "${1}/" |cut -d / -f 1)
    1.27 -    regexp=$(echo "${1}/" |cut -d / -f 2)
    1.28 +    tool="${1%/*}"
    1.29 +    regexp="${1##*/}"
    1.30      printf "Checking for '${tool}'... "
    1.31      where=$(which "${tool}" 2>/dev/null || true)
    1.32      if [ -z "${where}" ]; then
    1.33 @@ -249,18 +250,13 @@
    1.34  [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc/ct-ng-${VERSION}"
    1.35  [ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man/man1"
    1.36  
    1.37 -# Check bash is present, and at least version 3.0
    1.38 -printf "Checking '/bin/bash' is at least bash-3.0... "
    1.39 -[ -x /bin/bash ] || do_error "bash 3.0 or above was not found in '/bin/bash'"
    1.40 -bash_version=$(/bin/bash -c 'echo ${BASH_VERSION}')
    1.41 -bash_major=$(/bin/bash -c 'echo ${BASH_VERSINFO[0]}')
    1.42 -[ ${bash_major} -ge 3 ] || do_error "bash 3.0 or above is needed ('/bin/bash' is '${bash_version}')"
    1.43 -echo "${bash_version}"
    1.44 -
    1.45  # Check the existence of absolutely required tools
    1.46 -for tool in ${TOOLS_TO_CHECK}; do
    1.47 -    has_or_abort "${tool}"
    1.48 -done
    1.49 +{ IFS='
    1.50 +';
    1.51 +  for tool in ${TOOLS_TO_CHECK}; do
    1.52 +      has_or_abort "${tool}"
    1.53 +  done;
    1.54 +}
    1.55  
    1.56  # It's safer to change all ',' to spaces rather than setting IFS
    1.57  CONTRIB_list=$(echo "${CONTRIB_list}" |sed -r -e 's/,+/ /g;')