-
savoirfairelinux authoredsavoirfairelinux authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
configure 3.91 KiB
#!/bin/sh
#
# configure script v 1.0
# (c) 2004 Savoir-faire Linux inc.
#
# History:
# 2004-12-21 Jerome Oufella (Original release)
#
# This is the installation prefix.
PREFIX=/usr/local
# Define QTDIR if your env doesn't.
#QTDIR=/usr/lib/qt3
# Define this directory to look for CC++2/CCRTP
CCPPDIR=
CCRTPDIR=
# Define this directory to look for oSIP
OSIPDIR=
# Define this directory to look for eXoSIP
EXOSIPDIR=
################################################################################
################################################################################
# You shouldnt have to change this, those are the classic install directories.
CLASSIC_DIRS=/usr:/usr/local:/opt
# Display general usage informations.
usage () {
echo "Usage: $0 [options]"
echo "Options:
-prefix DIR Set install prefix
-oss Enable OSS support
-alsa Enable ALSA support [Not supported yet]
-macosx Enable MacOSX audio support [Not supported yet]"
}
# Check if $1 is contained in $PATH-style $2. Optionally $3 is "-p" to print
# the matching directory.
is_in_path () {
local file
local path
local d
file=$1
path=$2
if [ x"$file" = x"" ]
then
return 1 # bad file name
fi
if [ x"$path" = x"" ]
then
return 1 # bad path list
fi
for d in `echo $path | sed -e 's/:/ /g'`
do
if [ -e $d/$file ]
then
if [ x"$3" = x"-p" ]
then
echo "$d"
fi
return 0 # ok
fi
done
return 1 # not found
}
# Parse arguments
while [ $# -gt 0 ]
do
case "$1" in
-prefix)
PREFIX=$2
shift 2
;;
-oss)
DEFVARS="-DOSS ${DEFVARS}"
shift
;;
-alsa)
DEFVARS="-DALSA ${DEFVARS}"
shift
;;
-help|--help|-h)
usage
exit 1
;;
*)
usage
echo
echo "Fatal: Unknown option \"$1\"."
exit 1
;;
esac
done
# Check PREFIX
if [ x"$PREFIX" != x"" ]
then
if [ ! -d $PREFIX ]
then
usage
echo "Fatal: Cannot find "$PREFIX" directory."
exit 1
fi
else
usage
exit 1
fi
DEFVARS="-DPREFIX=\\\"$PREFIX\\\" -DPROGSHAREDIR=\\\"$PREFIX/share/sflphone\\\" $DEFVARS"
# Check for QT
if [ x"$QTDIR" = x"" ] # Is QTDIR defined ?
then
echo 'Fatal: $QTDIR does not exist. Edit this script to define manually or'
echo " set your QTDIR environment variable to the right location."
exit 1
fi
# Check for cc++2
dir=`is_in_path bin/ccgnu2-config ${CLASSIC_DIRS}:$CCPPDIR -p`
if [ x"dir" = x"" ]
then
echo "I couldn't find bin/ccgnu2-config in the standard dirs. Please edit"
echo "this script and set CCPPDIR."
exit 1
else
echo "Found cc++2."
CCPPDIR=${dir}
fi
# Check for ccRTP (include/ccrtp/rtp.h)
dir=`is_in_path include/ccrtp/rtp.h ${CLASSIC_DIRS}:$CCDIR -p`
if [ x"dir" = x"" ]
then
echo "I couldn't find ccrtp/rtp.h in the standard dirs. Please edit"
echo "this script and set CCRTPDIR."
exit 1
else
echo "Found ccRTP."
CCRTPDIR=${dir}
fi
# Check for oSIP (include/osip2/osip.h)
dir=`is_in_path include/osip2/osip.h ${CLASSIC_DIRS}:$OSIPDIR -p`
if [ x"dir" = x"" ]
then
echo "I couldn't find osip2/osip.h in the standard dirs.Please edit"
echo "this script and set OSIPDIR."
exit 1
else
echo "Found oSIP."
OSIPDIR=${dir}
fi
# Check for eXoSIP (include/eXosip/eXosip.h)
dir=`is_in_path include/eXosip/eXosip.h ${CLASSIC_DIRS}:$EXOSIPDIR -p`
if [ x"dir" = x"" ]
then
echo "I couldn't find exosip/exosip.h in the standard dirs. Please "
echo "edit this script and set EXOSIPDIR."
exit 1
else
echo "Found eXoSIP."
EXOSIPDIR=${dir}
fi
echo "Config OK :"
echo " PREFIX is \"$PREFIX\",
QT in $QTDIR,
CC++2 in $CCPPDIR,
CCRTP in $CCRTPDIR,
OSIP in $OSIPDIR,
EXOSIP in $EXOSIPDIR,
Defining $DEFVARS."
cat > configure.conf << EOF
# This file is automagically generated by configure.sh.
# It is included by the Makefile at compile time.
#
PREFIX=$PREFIX
QTDIR=$QTDIR
CCPPDIR=$CCPPDIR
CCRTPDIR=$CCRTPDIR
OSIPDIR=$OSIPDIR
EXOSIPDIR=$EXOSIPDIR
DEFVARS=${DEFVARS=-DOSS}
#
# End.
EOF
echo "Generated configure.conf, you can now type 'make' to compile sflphone."
exit 0
# EOF