|
| 1 | +#!/bin/sh |
| 2 | +# |
| 3 | +# configure script v 1.0 |
| 4 | +# (c) 2004 Savoir-faire Linux inc. |
| 5 | +# |
| 6 | +# History: |
| 7 | +# 2004-12-21 Jerome Oufella (Original release) |
| 8 | +# |
| 9 | + |
| 10 | +# This is the installation prefix. |
| 11 | +PREFIX=/usr/local |
| 12 | + |
| 13 | +# Define QTDIR if your env doesn't. |
| 14 | +#QTDIR=/usr/lib/qt3 |
| 15 | + |
| 16 | +# Define this directory to look for CC++2/CCRTP |
| 17 | +CCPPDIR= |
| 18 | +CCRTPDIR= |
| 19 | + |
| 20 | +# Define this directory to look for oSIP |
| 21 | +OSIPDIR= |
| 22 | + |
| 23 | +# Define this directory to look for eXoSIP |
| 24 | +EXOSIPDIR= |
| 25 | + |
| 26 | +################################################################################ |
| 27 | +################################################################################ |
| 28 | + |
| 29 | +# You shouldnt have to change this, those are the classic install directories. |
| 30 | +CLASSIC_DIRS=/usr:/usr/local:/opt |
| 31 | + |
| 32 | +# Display general usage informations. |
| 33 | +usage () { |
| 34 | + echo "Usage: $0 [options]" |
| 35 | + echo "Options: |
| 36 | + -prefix DIR Set install prefix |
| 37 | + -oss Enable OSS support |
| 38 | + -alsa Enable ALSA support [Not supported yet] |
| 39 | + -macosx Enable MacOSX audio support [Not supported yet]" |
| 40 | +} |
| 41 | + |
| 42 | +# Check if $1 is contained in $PATH-style $2. Optionally $3 is "-p" to print |
| 43 | +# the matching directory. |
| 44 | +is_in_path () { |
| 45 | + local file |
| 46 | + local path |
| 47 | + local d |
| 48 | + |
| 49 | + file=$1 |
| 50 | + path=$2 |
| 51 | + |
| 52 | + if [ x"$file" = x"" ] |
| 53 | + then |
| 54 | + return 1 # bad file name |
| 55 | + fi |
| 56 | + |
| 57 | + if [ x"$path" = x"" ] |
| 58 | + then |
| 59 | + return 1 # bad path list |
| 60 | + fi |
| 61 | + |
| 62 | + for d in `echo $path | sed -e 's/:/ /g'` |
| 63 | + do |
| 64 | + if [ -e $d/$file ] |
| 65 | + then |
| 66 | + if [ x"$3" = x"-p" ] |
| 67 | + then |
| 68 | + echo "$d" |
| 69 | + fi |
| 70 | + return 0 # ok |
| 71 | + fi |
| 72 | + done |
| 73 | + |
| 74 | + return 1 # not found |
| 75 | +} |
| 76 | + |
| 77 | +# Parse arguments |
| 78 | +while [ $# -gt 0 ] |
| 79 | +do |
| 80 | + case "$1" in |
| 81 | + -prefix) |
| 82 | + PREFIX=$2 |
| 83 | + shift 2 |
| 84 | + ;; |
| 85 | + -oss) |
| 86 | + DEFVARS="-DOSS ${DEFVARS}" |
| 87 | + shift |
| 88 | + ;; |
| 89 | + -alsa) |
| 90 | + DEFVARS="-DALSA ${DEFVARS}" |
| 91 | + shift |
| 92 | + ;; |
| 93 | + -help|--help|-h) |
| 94 | + usage |
| 95 | + exit 1 |
| 96 | + ;; |
| 97 | + |
| 98 | + *) |
| 99 | + usage |
| 100 | + echo |
| 101 | + echo "Fatal: Unknown option \"$1\"." |
| 102 | + exit 1 |
| 103 | + ;; |
| 104 | + esac |
| 105 | +done |
| 106 | + |
| 107 | +# Check PREFIX |
| 108 | +if [ x"$PREFIX" != x"" ] |
| 109 | +then |
| 110 | + if [ ! -d $PREFIX ] |
| 111 | + then |
| 112 | + usage |
| 113 | + echo "Fatal: Cannot find "$PREFIX" directory." |
| 114 | + exit 1 |
| 115 | + fi |
| 116 | +else |
| 117 | + usage |
| 118 | + exit 1 |
| 119 | +fi |
| 120 | +DEFVARS="-DPREFIX=\\\"$PREFIX\\\" -DPROGSHAREDIR=\\\"$PREFIX/share/sflphone\\\" $DEFVARS" |
| 121 | + |
| 122 | +# Check for QT |
| 123 | +if [ x"$QTDIR" = x"" ] # Is QTDIR defined ? |
| 124 | +then |
| 125 | + echo 'Fatal: $QTDIR does not exist. Edit this script to define manually or' |
| 126 | + echo " set your QTDIR environment variable to the right location." |
| 127 | + exit 1 |
| 128 | +fi |
| 129 | + |
| 130 | +# Check for cc++2 |
| 131 | +dir=`is_in_path bin/ccgnu2-config ${CLASSIC_DIRS}:$CCPPDIR -p` |
| 132 | +if [ x"dir" = x"" ] |
| 133 | +then |
| 134 | + echo "I couldn't find bin/ccgnu2-config in the standard dirs. Please edit" |
| 135 | + echo "this script and set CCPPDIR." |
| 136 | + exit 1 |
| 137 | +else |
| 138 | + echo "Found cc++2." |
| 139 | + CCPPDIR=${dir} |
| 140 | +fi |
| 141 | + |
| 142 | +# Check for ccRTP (include/ccrtp/rtp.h) |
| 143 | +dir=`is_in_path include/ccrtp/rtp.h ${CLASSIC_DIRS}:$CCDIR -p` |
| 144 | +if [ x"dir" = x"" ] |
| 145 | +then |
| 146 | + echo "I couldn't find ccrtp/rtp.h in the standard dirs. Please edit" |
| 147 | + echo "this script and set CCRTPDIR." |
| 148 | + exit 1 |
| 149 | +else |
| 150 | + echo "Found ccRTP." |
| 151 | + CCRTPDIR=${dir} |
| 152 | +fi |
| 153 | + |
| 154 | +# Check for oSIP (include/osip2/osip.h) |
| 155 | +dir=`is_in_path include/osip2/osip.h ${CLASSIC_DIRS}:$OSIPDIR -p` |
| 156 | +if [ x"dir" = x"" ] |
| 157 | +then |
| 158 | + echo "I couldn't find osip2/osip.h in the standard dirs.Please edit" |
| 159 | + echo "this script and set OSIPDIR." |
| 160 | + exit 1 |
| 161 | +else |
| 162 | + echo "Found oSIP." |
| 163 | + OSIPDIR=${dir} |
| 164 | +fi |
| 165 | + |
| 166 | +# Check for eXoSIP (include/eXosip/eXosip.h) |
| 167 | +dir=`is_in_path include/eXosip/eXosip.h ${CLASSIC_DIRS}:$EXOSIPDIR -p` |
| 168 | +if [ x"dir" = x"" ] |
| 169 | +then |
| 170 | + echo "I couldn't find exosip/exosip.h in the standard dirs. Please " |
| 171 | + echo "edit this script and set EXOSIPDIR." |
| 172 | + exit 1 |
| 173 | +else |
| 174 | + echo "Found eXoSIP." |
| 175 | + EXOSIPDIR=${dir} |
| 176 | +fi |
| 177 | + |
| 178 | + |
| 179 | +echo "Config OK :" |
| 180 | +echo " PREFIX is \"$PREFIX\", |
| 181 | + QT in $QTDIR, |
| 182 | + CC++2 in $CCPPDIR, |
| 183 | + CCRTP in $CCRTPDIR, |
| 184 | + OSIP in $OSIPDIR, |
| 185 | + EXOSIP in $EXOSIPDIR, |
| 186 | + Defining $DEFVARS." |
| 187 | + |
| 188 | +cat > configure.conf << EOF |
| 189 | +# This file is automagically generated by configure.sh. |
| 190 | +# It is included by the Makefile at compile time. |
| 191 | +# |
| 192 | +PREFIX=$PREFIX |
| 193 | +QTDIR=$QTDIR |
| 194 | +CCPPDIR=$CCPPDIR |
| 195 | +CCRTPDIR=$CCRTPDIR |
| 196 | +OSIPDIR=$OSIPDIR |
| 197 | +EXOSIPDIR=$EXOSIPDIR |
| 198 | +DEFVARS=${DEFVARS=-DOSS} |
| 199 | +# |
| 200 | +# End. |
| 201 | +EOF |
| 202 | + |
| 203 | +echo "Generated configure.conf, you can now type 'make' to compile sflphone." |
| 204 | +exit 0 |
| 205 | + |
| 206 | +# EOF |
0 commit comments