1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
#!/bin/sh
#
# Simple configure script
#
# Defaults
APXS=/usr/sbin/apxs
test -x $APXS || unset APXS
ME=`basename $0`
DIR=`dirname $0`
if [ $DIR = '.' ]; then
DIR=`pwd`
fi
usage() {
echo "usage: $ME [--apxs=/path/to/apxs] [--apachever=<1|2|2.2>] [--debug]"
}
die() {
echo $*
exit 2
}
# Retrograde option handling to allow for primitive getopts
ac_prev=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
case $ac_option in
--apxs=*)
APXS=$ac_optarg ;;
--apxs)
ac_prev=APXS ;;
--apachever=*)
VERSION=$ac_optarg ;;
--debug)
# DEBUG="-g"
DEBUG="-g -O0 -Wall -ansi -pedantic -Wno-implicit-function-declaration -Wno-long-long"
;;
--debug-verbose)
echo "--debug-verbose is no longer supported - use a 'TKTAuthDebug 2' directive in your config instead"
DEBUG="-g"
;;
-h | --help)
usage; exit 0 ;;
*)
usage; exit 1 ;;
esac
done
# Sanity checks
test "$ac_prev" = "APXS" && die "Error: option '--apxs' requires an argument"
test -n "$APXS" || die "Error: cannot locate apxs (use --apxs=/path/to/apxs)"
test -x $APXS || die "Error: missing apxs '$APXS' (use --apxs=/path/to/apxs)"
# Get Apache version
if [ -z "$VERSION" ]; then
HTTPD=`$APXS -q SBINDIR`/`$APXS -q TARGET`
test -x $HTTPD || die "Error: cannot determine apache version (use --apachever=<1|2|2.2>)"
VERSION=`$HTTPD -v | head -1 | sed -e 's/.*Apache\///' -e 's/^\([0-9]\.[0-9]\+\).*/\1/'`
fi
# Standardise
test $VERSION = '2.0' && VERSION=2
test $VERSION = '20' && VERSION=2
test $VERSION = '22' && VERSION=2.2
if [ $VERSION != '1' -a $VERSION != '2' -a $VERSION != '2.2' ]; then
die "Error: apache version '$VERSION' not supported"
fi
# Generate Makedefs
DIV="#-------------------------------------------------------------------------"
WARNING="# Generated by $ME, do not edit!"
test -f Makedefs && rm -f Makedefs
test -f Makedefs && die "Error deleting Makedefs"
echo $DIV >> Makedefs
echo $WARNING >> Makedefs
echo >> Makedefs
echo "VERSION = $VERSION" >> Makedefs
echo "APXS = $APXS" >> Makedefs
test -n "$DEBUG" && echo "CFLAGS += $DEBUG" >> Makedefs
if [ "$VERSION" = "1" ]; then
echo "CFLAGS += -DAPACHE13" >> Makedefs
echo "TARGET = mod_auth_tkt.so" >> Makedefs
else
if [ $VERSION = "2.2" ]; then
echo "CFLAGS += -DAPACHE22" >> Makedefs
fi
echo "TARGET = mod_auth_tkt.la" >> Makedefs
fi
echo "BASEDIR = $DIR" >> Makedefs
if [ -d /usr/share/man ]; then
echo "MANPATH = /usr/share/man" >> Makedefs
else
echo "MANPATH = /usr/man" >> Makedefs
fi
MAT_VERSION=`cat VERSION`
echo "MAT_VERSION = $MAT_VERSION" >> Makedefs
echo >> Makedefs
echo $WARNING >> Makedefs
echo $DIV >> Makedefs
# Finish with a 'make clean'
make -s clean
|