-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure
executable file
·147 lines (120 loc) · 2.97 KB
/
configure
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
# ******************** variables ****************
CFG_ARGS="$0 $1 $2 $3 $4 $5 $6 $7 $8 $9"
ARG_BEQUIET=0
ARG_PREFIX=""
ARG_CFGMAKE="$PWD/config.make"
ARG_WITH_DEBUG=1
ARG_WITH_STRIP=1
ARG_WITH_APXS=1
ARG_APXS="NOTSET"
# ******************** usage ********************
function usage() {
cat <<_ACEOF
\`configure' configures mod_swift.
Usage: $0 [OPTION]...
Configuration:
-h, --help display this help and exit
-q, --quiet, --silent do not print \`checking...' messages
Installation directories:
--prefix=PREFIX install files in PREFIX [/usr/local]
--enable-debug turn on debugging and compile time warnings
--enable-strip turn on stripping of debug symbols
--with-apxs=PATH location of apxs [which apxs]
_ACEOF
exit 0;
}
# ******************** running ********************
function cfgwrite() {
echo "$1" >> $ARG_CFGMAKE
}
function genConfigMake() {
if [[ $ARG_BEQUIET != 1 ]]; then
echo "creating: $ARG_CFGMAKE"
fi
echo "# mod_swift configuration" > $ARG_CFGMAKE
cfgwrite "# created by: '$CFG_ARGS'"
cfgwrite ""
cfgwrite "# Note: you can override any option as a 'make' parameter, eg:"
cfgwrite "# make debug=yes"
cfgwrite ""
if [[ $ARG_WITH_DEBUG = 1 ]]; then
cfgwrite "# configured to produce debugging code";
cfgwrite "debug:=yes"
else
cfgwrite "# configured to produce non-debugging code";
cfgwrite "debug:=no"
fi
cfgwrite ""
if [[ $ARG_WITH_STRIP = 1 ]]; then
cfgwrite "# configured to produce stripped code";
cfgwrite "strip:=yes"
else
cfgwrite "# configured not to strip code";
cfgwrite "strip:=no"
fi
cfgwrite ""
cfgwrite "# enforce shared libraries";
cfgwrite "shared:=yes"
cfgwrite ""
if [ -n "$ARG_APXS" ]; then
cfgwrite "APXS:=${ARG_APXS}"
cfgwrite ""
fi
if [ -n "$ARG_PREFIX" ]; then
cfgwrite "prefix:=${ARG_PREFIX}"
cfgwrite ""
fi
}
function runIt() {
if [[ "$ARG_APXS" = "NOTSET" ]]; then
ARG_APXS="`which apxs`";
fi
if [ -z "$ARG_PREFIX" ]; then
ARG_PREFIX=/usr/local
fi
genConfigMake;
}
# ******************** options ********************
function extractFuncValue() {
VALUE="`echo "$1" | sed "s/[^=]*=//g"`"
}
function processOption() {
case "x$1" in
"x--help"|"x-h")
usage;
;;
"x--quiet"|"x--silent"|"x-q") ARG_BEQUIET=1; ;;
x--prefix=*)
extractFuncValue $1;
ARG_PREFIX="$VALUE";
;;
x--with-apxs=*)
extractFuncValue $1;
ARG_APXS="$VALUE";
;;
"x--with-apxs")
ARG_APXS="`which apxs`";
;;
"x--without-apxs")
ARG_APXS="";
;;
"x--enable-debug")
ARG_WITH_DEBUG=1
;;
"x--disable-debug")
ARG_WITH_DEBUG=0
;;
"x--enable-strip")
ARG_WITH_STRIP=1
;;
"x--disable-strip")
ARG_WITH_STRIP=0
;;
*) echo "error: cannot process argument: $1"; exit 1; ;;
esac
}
for i in $@; do
processOption $i;
done
runIt