non/configure

120 lines
2.5 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
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 ()
{
2008-05-18 02:15:39 +02:00
echo "$BOLD${GREEN}ok${SGR0}."
2008-05-16 21:12:52 +02:00
}
failed ()
{
2008-05-18 02:15:39 +02:00
echo "$BOLD${RED}failed!${SGR0}"
rm -f make.conf
2008-05-16 21:12:52 +02:00
}
2008-05-18 02:15:39 +02:00
[ $# -gt 0 ] && fatal "This is not an autoconf script. Run it without any options and you will be prompted."
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`
2008-05-18 02:15:39 +02:00
if ! ( [ $FLTK_VERSION_MAJOR -ge 1 ] && [ $FLTK_VERSION_MINOR -ge 1 ] && [ $FLTK_VERSION_PATCH -ge 7 ] )
2008-05-16 21:12:52 +02:00
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-18 02:15:39 +02:00
echo "FLTK_CFLAGS=`fltk-config --cflags`" >> make.conf
check_command ()
{
echo -n "Checking for ${BOLD}$1${SGR0}..."
if ! [ -x "`which $2`" ]
then
failed
fatal "Command $1 not found."
else
ok
fi
}
check_command FLUID fluid
2008-05-16 21:12:52 +02:00
#
check ()
{
echo -n "Checking for $BOLD$1$SGR0..."
2008-05-18 02:15:39 +02:00
if ! pkg-config --exists $3
then
failed
fatal "Required package $1 doesn't appear to be installed."
elif ! pkg-config --atleast-version $2 $3
2008-05-16 21:12:52 +02:00
then
failed
2008-05-18 02:15:39 +02:00
fatal "The installed version of $1 (`pkg-config --mod-version $3`) is too old."
2008-05-16 21:12:52 +02:00
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."