configure: add some autoconf emulation.
This commit is contained in:
parent
0d40ca5b6b
commit
1c599fd7f6
|
@ -9,9 +9,9 @@ begin
|
||||||
|
|
||||||
begin_options
|
begin_options
|
||||||
|
|
||||||
ask "Install prefix?" prefix /usr/local
|
ask "Install prefix" prefix /usr/local
|
||||||
ask "Require LASH?" USE_LASH yes
|
ask "Require LASH" USE_LASH yes
|
||||||
ask "Build for debugging?" USE_DEBUG no
|
ask "Build for debugging" USE_DEBUG no
|
||||||
|
|
||||||
begin_tests
|
begin_tests
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,48 @@ fatal ()
|
||||||
exit 255
|
exit 255
|
||||||
}
|
}
|
||||||
|
|
||||||
[ $# -gt 0 ] && fatal "This is not an autoconf script. Run it without any options and you will be prompted."
|
UPDATE=no
|
||||||
|
HELP=no
|
||||||
|
|
||||||
|
split ()
|
||||||
|
{
|
||||||
|
while [ $# -gt 0 ]
|
||||||
|
do
|
||||||
|
echo $1
|
||||||
|
shift 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# -gt 0 ]
|
||||||
|
then
|
||||||
|
case "$1" in
|
||||||
|
--update)
|
||||||
|
UPDATE=yes
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--help)
|
||||||
|
HELP=yes
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# fatal "This is not an autoconf script. Run it without any options and you will be prompted."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ $# -gt 0 ]
|
||||||
|
then
|
||||||
|
echo "## options" > make.conf
|
||||||
|
|
||||||
|
split "$@" | sed '
|
||||||
|
s/--\(enable\|disable\)-\([^ =]\+\)/--\1-\U\2/g;
|
||||||
|
s/--enable-\([^ =]\+\)=\(.*\)/USE_\1=\2/g;
|
||||||
|
s/--enable-\([^ =]\+\)/USE_\1=yes/g;
|
||||||
|
s/--disable-\([^ =]\+\)/USE_\1=no/g;
|
||||||
|
s/--\([^ =]\+\)/\1/g;
|
||||||
|
' | sed -n '/^[^ =]\+=./p' >> make.conf
|
||||||
|
UPDATE=yes;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
ask ()
|
ask ()
|
||||||
{
|
{
|
||||||
|
@ -23,9 +64,37 @@ ask ()
|
||||||
D="`eval echo \\$$2`"
|
D="`eval echo \\$$2`"
|
||||||
D=${D:-$3}
|
D=${D:-$3}
|
||||||
|
|
||||||
echo -n "$BLACK$BOLD::$SGR0 $1 [$BOLD${D}$SGR0] "
|
if [ $HELP = yes ]
|
||||||
|
then
|
||||||
|
echo -en "\t"
|
||||||
|
|
||||||
|
if [ "$D" = yes ] || [ "$D" = no ]
|
||||||
|
then
|
||||||
|
if [ "$D" = yes ]
|
||||||
|
then
|
||||||
|
echo -n "$2" | sed s/^USE_/--enable-/ | tr '[[:upper:]]' '[[:lower:]]'
|
||||||
|
else
|
||||||
|
echo -n "$2" | sed s/^USE_/--disable-/ | tr '[[:upper:]]' '[[:lower:]]'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -n "--$2" | tr '[[:upper:]]' '[[:lower:]]'
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\t$1"
|
||||||
|
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "$BLACK$BOLD::$SGR0 ${1}? [$BOLD${D}$SGR0] "
|
||||||
|
|
||||||
|
if [ $UPDATE = yes ]
|
||||||
|
then
|
||||||
|
A="$D"
|
||||||
|
echo
|
||||||
|
else
|
||||||
read A
|
read A
|
||||||
A=${A:-$D}
|
A=${A:-$D}
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$3" = yes ] || [ "$3" = no ]
|
if [ "$3" = yes ] || [ "$3" = no ]
|
||||||
then
|
then
|
||||||
|
@ -101,15 +170,34 @@ begin_options ()
|
||||||
# get the old values
|
# get the old values
|
||||||
extract_options
|
extract_options
|
||||||
|
|
||||||
|
if [ $HELP = yes ]
|
||||||
|
then
|
||||||
|
echo "****"
|
||||||
|
echo "This is not an autoconf script! Run without any arguments and you will be prompted."
|
||||||
|
echo "Alternatively, you may use the following autoconf style arguments for"
|
||||||
|
echo "non-interactive configuration."
|
||||||
|
echo "****"
|
||||||
|
echo
|
||||||
|
echo " Available options:"
|
||||||
|
echo
|
||||||
|
else
|
||||||
echo > make.conf
|
echo > make.conf
|
||||||
append "# This file was automatically generated on `date`. Any changes may be lost!"
|
append "# This file was automatically generated on `date`. Any changes may be lost!"
|
||||||
append "## options"
|
append "## options"
|
||||||
|
|
||||||
|
if [ $UPDATE = yes ]
|
||||||
|
then
|
||||||
|
echo "--- Updating configuration ---"
|
||||||
|
else
|
||||||
echo "--- Configuration required ---"
|
echo "--- Configuration required ---"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
begin_tests ()
|
begin_tests ()
|
||||||
{
|
{
|
||||||
|
[ $HELP = yes ] && exit 0
|
||||||
|
|
||||||
append "## libs"
|
append "## libs"
|
||||||
extract_options
|
extract_options
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue