configure: give check_for() the ability to test several item types at once

Currently, check_for() can only test one of prog, inc or lib at once. This patch
removes this limitation.

Signed-off-by: "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
This commit is contained in:
Benoît THÉBAUDEAU" 2011-06-08 15:47:03 +02:00
parent fa8cf23b2e
commit c890ff476c

42
configure vendored
View File

@ -127,16 +127,24 @@ check_for() {
prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*) prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*)
eval ${item%%=*}=\"${item#*=}\" eval ${item%%=*}=\"${item#*=}\"
;; ;;
*) do_error "has_or_abort: incorrect parameters: '$@'";; *) do_error "check_for: incorrect parameters: '$@'";;
esac esac
done done
case "${prog}:${inc}:${lib}" in
?*:?*:|?*::?*|:?*:?*|?*:?*:?*)
if [ -n "${var}" ]; then
do_error "check_for: the use of var is not compatible with passing several of [prog|inc|lib] at once"
fi
;;
::) do_error "check_for: [prog|inc|lib] is mandatory";;
esac
if [ -n "${kconfig}" ]; then if [ -n "${kconfig}" ]; then
add_to_kconfig_list "${kconfig}" add_to_kconfig_list "${kconfig}"
fi fi
case "${prog}:${inc}:${lib}" in if [ -n "${prog}" ]; then
?*::)
for item in ${prog}; do for item in ${prog}; do
printf "Checking for '${item}'... " printf "Checking for '${item}'... "
if [ -n "${var}" ]; then if [ -n "${var}" ]; then
@ -165,8 +173,14 @@ check_for() {
status="${where}" status="${where}"
break break
done done
;; if [ -z "${status}" ]; then
:?*:) return 1
fi
printf "${status}\n"
unset status
fi
if [ -n "${inc}" ]; then
for item in ${inc}; do for item in ${inc}; do
printf "Checking for '${item}'... " printf "Checking for '${item}'... "
if printf "#include \"${item}\"" |gcc -x c -c - -o /dev/null >/dev/null 2>&1; then if printf "#include \"${item}\"" |gcc -x c -c - -o /dev/null >/dev/null 2>&1; then
@ -176,8 +190,14 @@ check_for() {
fi fi
printf "no\n" printf "no\n"
done done
;; if [ -z "${status}" ]; then
::?*) return 1
fi
printf "${status}\n"
unset status
fi
if [ -n "${lib}" ]; then
for item in ${lib}; do for item in ${lib}; do
printf "Checking for '${item}'... " printf "Checking for '${item}'... "
where="$( gcc -print-file-name="${item}" )" where="$( gcc -print-file-name="${item}" )"
@ -188,14 +208,13 @@ check_for() {
fi fi
printf "no\n" printf "no\n"
done done
;;
esac
if [ -z "${status}" ]; then if [ -z "${status}" ]; then
return 1 return 1
fi fi
printf "${status}\n"
unset status
fi
printf "${status}"
if [ -n "${var}" ]; then if [ -n "${var}" ]; then
eval ${var}='"'"${where}"'"' eval ${var}='"'"${where}"'"'
add_to_var_list "${var}" add_to_var_list "${var}"
@ -203,7 +222,6 @@ check_for() {
if [ -n "${kconfig}" ]; then if [ -n "${kconfig}" ]; then
eval ${kconfig}=y eval ${kconfig}=y
fi fi
printf "\n"
} }
# This function checks for a tool, and aborts if not found # This function checks for a tool, and aborts if not found