autogen.sh: Remove bashism / non-portable stuff.

This commit is contained in:
Jan Holesovsky 2010-12-01 19:03:56 +01:00
parent 6637546a37
commit 5da12b112f

View file

@ -15,7 +15,19 @@ requote()
set -- "${@//\'/$q\'$q}" # quote inner instances of '
set -- "${@/#/$q}" # add ' to start of each param
set -- "${@/%/$q}" # add ' to end of each param
echo "$*"
echo "$*" # ' in a comment to stop confusing vim
}
distro()
{
name=''
while test "$#" -gt 0 ; do
case "$1" in
--with-distro=*) name=${1#--with-distro=} ;;
esac
shift
done
echo $name
}
old_args=""
@ -34,16 +46,16 @@ if test "z`uname -s`" != "zDarwin" ; then
fi
conf_args=$(requote "$@")
distro_name=$(requote "$@" | sed -n -e "s/.*'--with-distro=\([^']*\)'.*/\1/p")
distro_name=$(distro "$@")
if test "z${distro_name}" != "z" ; then
cumul=""
if test -f "./distro-configs/${distro_name}.conf" ; then
IFS=$'\n'
IFS="$(printf '\n')"
for opt in $(cat distro-configs/${distro_name}.conf) ; do cumul="$cumul $opt" ; done ;
unset IFS
conf_args=$(requote "$@" | sed -e "s/'--with-distro=[^']*'/$cumul/")
else
echo "Warning: there is no pre-set configuration for ${distro_config}, ignoring --with-distro=${distro_config}"
echo "Warning: there is no pre-set configuration for ${distro_name}, ignoring --with-distro=${distro_name}"
fi
fi