#!/bin/sh # # Simple configure script # # Defaults APXS=/usr/sbin/apxs test -x $APXS || APXS=/usr/bin/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|2.4>)" 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 test $VERSION = '24' && VERSION=2.4 if [ $VERSION != '1' -a $VERSION != '2' -a $VERSION != '2.2' -a $VERSION != '2.4' ]; 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 echo "TARGET = mod_auth_tkt.la" >> Makedefs fi echo "BASEDIR = $DIR" >> Makedefs if [ "$MANPATH" != "" ]; then echo "MANPATH = $MANPATH" >> Makedefs else if [ -d /usr/share/man ]; then echo "MANPATH = /usr/share/man" >> Makedefs else echo "MANPATH = /usr/man" >> Makedefs fi 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