1.1 --- a/configure Sat Jun 04 19:17:26 2011 +0200
1.2 +++ b/configure Wed Jun 08 15:47:03 2011 +0200
1.3 @@ -127,75 +127,94 @@
1.4 prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*)
1.5 eval ${item%%=*}=\"${item#*=}\"
1.6 ;;
1.7 - *) do_error "has_or_abort: incorrect parameters: '$@'";;
1.8 + *) do_error "check_for: incorrect parameters: '$@'";;
1.9 esac
1.10 done
1.11
1.12 + case "${prog}:${inc}:${lib}" in
1.13 + ?*:?*:|?*::?*|:?*:?*|?*:?*:?*)
1.14 + if [ -n "${var}" ]; then
1.15 + do_error "check_for: the use of var is not compatible with passing several of [prog|inc|lib] at once"
1.16 + fi
1.17 + ;;
1.18 + ::) do_error "check_for: [prog|inc|lib] is mandatory";;
1.19 + esac
1.20 +
1.21 if [ -n "${kconfig}" ]; then
1.22 add_to_kconfig_list "${kconfig}"
1.23 fi
1.24
1.25 - case "${prog}:${inc}:${lib}" in
1.26 - ?*::)
1.27 - for item in ${prog}; do
1.28 - printf "Checking for '${item}'... "
1.29 - if [ -n "${var}" ]; then
1.30 - eval val="\${${var}}"
1.31 - if [ -n "${val}" ]; then
1.32 - printf "${val} (cached)\n"
1.33 - add_to_var_list "${var}"
1.34 - return 0
1.35 - fi
1.36 + if [ -n "${prog}" ]; then
1.37 + for item in ${prog}; do
1.38 + printf "Checking for '${item}'... "
1.39 + if [ -n "${var}" ]; then
1.40 + eval val="\${${var}}"
1.41 + if [ -n "${val}" ]; then
1.42 + printf "${val} (cached)\n"
1.43 + add_to_var_list "${var}"
1.44 + return 0
1.45 fi
1.46 - where="$( which "${item}" 2>/dev/null )"
1.47 - if [ -z "${where}" ]; then
1.48 + fi
1.49 + where="$( which "${item}" 2>/dev/null )"
1.50 + if [ -z "${where}" ]; then
1.51 + printf "no\n"
1.52 + continue
1.53 + elif [ -n "${ver}" ]; then
1.54 + str=$( LC_ALL=C "${where}" --version 2>&1 \
1.55 + |grep -E "${ver}" \
1.56 + |head -n 1
1.57 + )
1.58 + if [ -z "${str}" ]; then
1.59 printf "no\n"
1.60 + unset where
1.61 continue
1.62 - elif [ -n "${ver}" ]; then
1.63 - str=$( LC_ALL=C "${where}" --version 2>&1 \
1.64 - |grep -E "${ver}" \
1.65 - |head -n 1
1.66 - )
1.67 - if [ -z "${str}" ]; then
1.68 - printf "no\n"
1.69 - unset where
1.70 - continue
1.71 - fi
1.72 fi
1.73 - status="${where}"
1.74 - break
1.75 - done
1.76 - ;;
1.77 - :?*:)
1.78 - for item in ${inc}; do
1.79 - printf "Checking for '${item}'... "
1.80 - if printf "#include \"${item}\"" |gcc -x c -c - -o /dev/null >/dev/null 2>&1; then
1.81 - where="${item}"
1.82 - status=yes
1.83 - break;
1.84 - fi
1.85 - printf "no\n"
1.86 - done
1.87 - ;;
1.88 - ::?*)
1.89 - for item in ${lib}; do
1.90 - printf "Checking for '${item}'... "
1.91 - where="$( gcc -print-file-name="${item}" )"
1.92 - if [ "${where}" != "${item}" ]; then
1.93 - where="$( readlink "${where}" )"
1.94 - status=yes
1.95 - break;
1.96 - fi
1.97 - printf "no\n"
1.98 - done
1.99 - ;;
1.100 - esac
1.101 -
1.102 - if [ -z "${status}" ]; then
1.103 - return 1
1.104 + fi
1.105 + status="${where}"
1.106 + break
1.107 + done
1.108 + if [ -z "${status}" ]; then
1.109 + return 1
1.110 + fi
1.111 + printf "${status}\n"
1.112 + unset status
1.113 fi
1.114
1.115 - printf "${status}"
1.116 + if [ -n "${inc}" ]; then
1.117 + for item in ${inc}; do
1.118 + printf "Checking for '${item}'... "
1.119 + if printf "#include \"${item}\"" |gcc -x c -c - -o /dev/null >/dev/null 2>&1; then
1.120 + where="${item}"
1.121 + status=yes
1.122 + break;
1.123 + fi
1.124 + printf "no\n"
1.125 + done
1.126 + if [ -z "${status}" ]; then
1.127 + return 1
1.128 + fi
1.129 + printf "${status}\n"
1.130 + unset status
1.131 + fi
1.132 +
1.133 + if [ -n "${lib}" ]; then
1.134 + for item in ${lib}; do
1.135 + printf "Checking for '${item}'... "
1.136 + where="$( gcc -print-file-name="${item}" )"
1.137 + if [ "${where}" != "${item}" ]; then
1.138 + where="$( readlink "${where}" )"
1.139 + status=yes
1.140 + break;
1.141 + fi
1.142 + printf "no\n"
1.143 + done
1.144 + if [ -z "${status}" ]; then
1.145 + return 1
1.146 + fi
1.147 + printf "${status}\n"
1.148 + unset status
1.149 + fi
1.150 +
1.151 if [ -n "${var}" ]; then
1.152 eval ${var}='"'"${where}"'"'
1.153 add_to_var_list "${var}"
1.154 @@ -203,7 +222,6 @@
1.155 if [ -n "${kconfig}" ]; then
1.156 eval ${kconfig}=y
1.157 fi
1.158 - printf "\n"
1.159 }
1.160
1.161 # This function checks for a tool, and aborts if not found