1.1 --- a/configure Tue Sep 23 07:15:06 2008 +0000
1.2 +++ b/configure Fri Sep 26 11:31:23 2008 +0000
1.3 @@ -9,21 +9,45 @@
1.4 # - awk must be GNU awk
1.5 # - makeinfo for building docs, even if discarded later on
1.6 # - others obvious... :-/
1.7 +#
1.8 +# Format of a pattern to check for, one per line:
1.9 +# pattern := tool_test OR pattern|tool_test
1.10 +# tool_test := tool/regexp
1.11 +# tool := name of the tool OR absolute pathname to the tool
1.12 +# regexp := valid grep(1) extended regular expression OR empty
1.13 +#
1.14 +# In case a pattern list is given (eg foo|bar|buz), then tests are performed
1.15 +# from left to right, stopping at the first matching test (like the shell
1.16 +# would parse 'foo || bar || buz' ).
1.17 +#
1.18 +# Examples:
1.19 +# /bin/bash/^GNU bash, version 3\.
1.20 +# will ensure that /bin/bash exists, and that $(/bin/bash --version)
1.21 +# matches the regexp '^GNU bash, version 3\.'
1.22 +# autoconf/(GNU Autoconf)|autoconf2.50/
1.23 +# will ensure that:
1.24 +# - 'autoconf' is to be found in the PATH, and that $(autoconf
1.25 +# --version) matches the regexp '(GNU Autoconf)' (which btw is
1.26 +# the signature of autoconf >= 2.50),
1.27 +# OR that:
1.28 +# - 'autoconf2.50' is to be found in the PATH
1.29 +#
1.30 TOOLS_TO_CHECK='
1.31 /bin/bash/^GNU bash, version 3\.
1.32 make/^GNU Make
1.33 -gcc
1.34 +gcc/
1.35 awk/^GNU Awk
1.36 -sed
1.37 -bison
1.38 -flex
1.39 -makeinfo
1.40 -automake
1.41 -libtool
1.42 -patch
1.43 -tar
1.44 -gzip
1.45 -bzip2
1.46 +sed/
1.47 +bison/
1.48 +flex/
1.49 +makeinfo/
1.50 +autoconf/(GNU Autoconf)|autoconf-2.50/|autoconf2.50/
1.51 +automake/
1.52 +libtool/
1.53 +patch/
1.54 +tar/
1.55 +gzip/
1.56 +bzip2/
1.57 '
1.58
1.59 PREFIX_DEFAULT=/usr/local
1.60 @@ -46,30 +70,33 @@
1.61 }
1.62
1.63 # A small function to test for existence of various tools
1.64 -# Usage: has_or_abort foobar
1.65 -# -> foobar must exist in PATH or be an exiting fully qualified file name
1.66 -# Usage: has_or_abort foobar/string
1.67 -# -> foobar must exist in PATH or be an existing FQFN, and $(foobar --version) must contain 'string'
1.68 +# Usage: has_or_abort test_pattern (see top of file, TOOLS_TO_CHECK, for
1.69 +# complete pattern format)
1.70 has_or_abort() {
1.71 - tool="${1%/*}"
1.72 - regexp="${1##*/}"
1.73 - printf "Checking for '${tool}'... "
1.74 - where=$(which "${tool}" 2>/dev/null || true)
1.75 - if [ -z "${where}" ]; then
1.76 - printf "not found!"
1.77 - [ ${FORCE} -eq 0 ] && do_error " Bailing out..."
1.78 - echo
1.79 - else
1.80 - printf "${where}"
1.81 - if [ -n "${regexp}" ]; then
1.82 - str=$(${tool} --version 2>&1 |egrep "${regexp}" |head -n 1)
1.83 - if [ -z "${str}" ]; then
1.84 - printf " failed: '${tool} --version' does not match regexp '${regexp}'."
1.85 - [ ${FORCE} -eq 0 ] && do_error " Bailing out..."
1.86 - fi
1.87 - fi
1.88 - echo
1.89 - fi
1.90 + { IFS="|"; for item in ${1}; do
1.91 + tool="${item%/*}"
1.92 + regexp="${item##*/}"
1.93 + printf "Checking for '${tool}'... "
1.94 + where=$(which "${tool}" 2>/dev/null || true)
1.95 + if [ -z "${where}" ]; then
1.96 + echo "not found"
1.97 + where=
1.98 + continue
1.99 + else
1.100 + if [ -n "${regexp}" ]; then
1.101 + str=$(${tool} --version 2>&1 |grep -E "${regexp}" |head -n 1)
1.102 + if [ -z "${str}" ]; then
1.103 + echo "wrong version string"
1.104 + where=""
1.105 + continue
1.106 + fi
1.107 + fi
1.108 + echo "${where}"
1.109 + return 0
1.110 + fi
1.111 + done;
1.112 + }
1.113 + [ ${FORCE} -eq 0 ] && do_error "Bailing out..."
1.114 return 0
1.115 }
1.116