File: configure

package info (click to toggle)
libapache2-mod-auth-pubtkt 0.7-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 284 kB
  • sloc: ansic: 993; perl: 245; php: 198; sh: 109; makefile: 29
file content (126 lines) | stat: -rwxr-xr-x 3,138 bytes parent folder | download | duplicates (2)
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
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/sh
#
# Simple configure script for mod_auth_pubtkt
#

# 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.3|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 -Wall -ansi -Wno-implicit-function-declaration -Wno-long-long" 
			;;
		-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.3|2|2.2>)"
	VERSION=`$HTTPD -v | head -1 | sed -e 's/.*Apache\///' -e 's/^\([0-9]\.[0-9]*\).*/\1/'`
fi
# Standardise
test $VERSION = '1'   && VERSION=1.3
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.3' -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.3" ]; then
  echo "CFLAGS += -DAPACHE13" >> Makedefs
  echo "TARGET = mod_auth_pubtkt.so" >> Makedefs
else
  if [ $VERSION = "2.2" ]; then
    echo "CFLAGS += -DAPACHE22" >> Makedefs
  elif [ $VERSION = "2.4" ]; then
	echo "CFLAGS += -DAPACHE24" >> Makedefs
  fi
  echo "TARGET = mod_auth_pubtkt.la" >> Makedefs
fi
echo "BASEDIR = $DIR" >> Makedefs

# proper handling of Universal Binaries under Mac OS X
HTTPD="`${APXS} -q SBINDIR`/`${APXS} -q TARGET`"
if test -x /usr/bin/lipo; then
	ARCHITECTURES=`/usr/bin/lipo -info $HTTPD | sed -e 's/.*://'`
	for ARCH in $ARCHITECTURES; do
		echo "CFLAGS += -arch ${ARCH}" >> Makedefs
		echo "LDFLAGS += -arch ${ARCH}" >> Makedefs
	done
fi

if [ -d /usr/share/man ]; then
  echo "MANPATH = /usr/share/man" >> Makedefs
else
  echo "MANPATH = /usr/man" >> Makedefs
fi

echo >> Makedefs
echo $WARNING >> Makedefs
echo $DIV >> Makedefs

# Finish with a 'make clean'
make -s clean