Debian Codegraph @

configure

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