non/configure

102 lines
2.1 KiB
Plaintext
Raw Normal View History

2008-05-16 21:12:52 +02:00
#!/bin/sh
#
# Copyright (C) 2008 Jonathan Moore Liles
#
. scripts/colors
2008-05-16 22:52:10 +02:00
if [ $# -gt 0 ]
then
echo This is not an autoconf script. Run it without any options and you will be prompted.
exit 255
fi
2008-05-16 21:12:52 +02:00
fatal ()
{
echo "$BOLD$RED$*$SGR0"
exit 255
}
ask ()
{
2008-05-16 22:52:10 +02:00
echo -n "$1 [$BOLD$3$SGR0] "
2008-05-16 21:12:52 +02:00
read R
2008-05-16 23:06:15 +02:00
echo "${2}=${R:-$3}" >> make.conf
2008-05-16 21:12:52 +02:00
}
ok ()
{
echo "$BOLD${GREEN}ok$SGR0."
}
failed ()
{
echo "$BOLD${RED}failed!$SGR0"
}
2008-05-16 22:52:10 +02:00
echo "-- Configuration:"
# get the old values
if [ -f make.conf ]
then
OIFS="$IFS"
IFS=''
eval "`sed -n '/^## options/{ : i; /^## libs/{ q }; p; n; b i }' make.conf`"
IFS="$OIFS"
fi
2008-05-16 21:12:52 +02:00
echo "# This is a generated file. Any changes may be lost!" > make.conf
echo "## options" >> make.conf
ask "Install prefix?" prefix ${prefix:-/usr/local}
ask "Use LASH?" USE_LASH ${USE_LASH:-yes}
ask "Build for debugging?" MAINTAINER_MODE ${MAINTAINER_MODE:-no}
echo "## libs/flags" >> make.conf
2008-05-16 21:12:52 +02:00
# tests
echo -n "Checking for ${BOLD}FLTK${SGR0}..."
FLTK_VERSION=`fltk-config --version`
FLTK_VERSION_MAJOR=`echo $FLTK_VERSION | cut -d'.' -f1`
FLTK_VERSION_MINOR=`echo $FLTK_VERSION | cut -d'.' -f2`
FLTK_VERSION_PATCH=`echo $FLTK_VERSION | cut -d'.' -f3`
if ! ( [ $FLTK_VERSION_MAJOR -ge 1 ] && [ $FLTK_VERSION_MINOR -ge 1 ] && [ $FLTK_VERSION_PATCH -ge 8 ] )
then
failed
fatal "The installed FLTK version ($FLTK_VERSION) is too old."
else
ok
fi
2008-05-16 23:06:15 +02:00
echo "FLTK_LIBS=`fltk-config --use-images --ldflags`" >> make.conf
2008-05-16 21:12:52 +02:00
#
check ()
{
echo -n "Checking for $BOLD$1$SGR0..."
if ! pkg-config --atleast-version $2 $3
then
failed
fatal "$1 not installed or too old."
fi
ok
return 0
}
2008-05-16 23:06:15 +02:00
check JACK 0.103.0 jack && echo "JACK_LIBS=`pkg-config --libs jack`" >> make.conf
check libSNDFILE 1.0.17 sndfile && echo "SNDFILE_LIBS=`pkg-config --libs sndfile`" >> make.conf
2008-05-16 21:12:52 +02:00
2008-05-16 23:06:15 +02:00
grep -q 'USE_LASH=yes' make.conf &&
2008-05-16 21:12:52 +02:00
check LASH 0.5.4 lash-1.0 &&
2008-05-16 23:06:15 +02:00
( echo "LASH_LIBS=`pkg-config --libs lash-1.0`" >> make.conf
echo "LASH_CFLAGS=-DUSE_LASH `pkg-config --cflags lash-1.0`" >> make.conf )
2008-05-16 21:12:52 +02:00
echo "-- Configuration complete."