1 mike 1.1 #!/bin/bash
2
3 ##==============================================================================
4 ##
5 ## Current directory should be the Pegasus root directory.
6 ##
7 ##==============================================================================
8
9 if [ ! -d "src/Pegasus" ]; then
10 echo "$0: must be invoked from the root of the Pegasus distribution"
11 exit 1
12 fi
13
14 ##==============================================================================
15 ##
16 ## Options defaults.
17 ##
18 ##==============================================================================
19
20 platform=
21 prefix=/usr/local
22 mike 1.1 bindir=
23 sbindir=
24 libdir=
25 includedir=
26 datadir=
27 enable_debug=
28 enable_binary_repository=
29 disable_oop=
30 disable_prov_userctxt=
31 disable_privileged_tests=
32 disable_trace=
33
34 if [ -f "config.local" ]; then
35 source config.local
36 fi
37
38 ##==============================================================================
39 ##
40 ## Collect options.
41 ##
42 ##==============================================================================
43 mike 1.1
44 for opt
45 do
46
47 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
48
49 case $opt in
50
51 --help | --h | -h | -help)
52 help=1
53 ;;
54
55 --platform=*)
56 platform=$optarg
57 ;;
58
59 --prefix=*)
60 prefix=$optarg
61 ;;
62
63 --bindir=*)
64 mike 1.1 bindir=$optarg
65 ;;
66
67 --sbindir=*)
68 sbindir=$optarg
69 ;;
70
71 --libdir=*)
72 libdir=$optarg
73 ;;
74
75 --includedir=*)
76 includedir=$optarg
77 ;;
78
79 --datadir=*)
80 datadir=$optarg
81 ;;
82
83 --enable-debug)
84 enable_debug=1
85 mike 1.1 ;;
86
87 --enable-binary-repository)
88 enable_binary_repository=1
89 ;;
90
91 --disable-oop)
92 disable_oop=1
93 ;;
94
95 --disable-prov-userctxt)
96 disable_prov_userctxt=1
97 ;;
98
99 --disable-privileged-tests)
100 disable_privileged_tests=1
101 ;;
102
103 --disable-trace)
104 disable_trace=1
105 ;;
106 mike 1.1
107 *)
108 echo "$0: unknown option: $opt"
109 exit 1
110 ;;
111
112 esac
113
114 done
115
116 ##==============================================================================
117 ##
118 ## Help
119 ##
120 ##==============================================================================
121
122 if [ "$help" = "1" ]; then
123 cat config.help
124 exit
125 fi
126
127 mike 1.1 ##==============================================================================
128 ##
129 ## Guess the platform
130 ##
131 ##==============================================================================
132
133 if [ -z "$platform" ]; then
134
135 machine=`(uname -m) 2>/dev/null` || machine=unknown
136 system=`(uname -s) 2>/dev/null` || system=unknown
137 release=`(uname -r) 2>/dev/null` || release=unknown
138 version=`(uname -v) 2>/dev/null` || version=unknown
139
140 case "$machine:$system:$release:$version" in
141
142 i*86:Linux:*:*)
143 export platform=LINUX_IX86_GNU
144 ;;
145
146 x86_64:Linux:*:*)
147 export platform=LINUX_X86_64_GNU
148 mike 1.1 ;;
149
150 *)
151 echo "$0: Failed to guess platform: "
152 echo " machine=$machine "
153 echo " system=$system "
154 echo " release=$release "
155 echo " version=$version "
156 echo
157 exit 1
158 ;;
159
160 esac
161 else
162 platform=$platform
163 fi
164
165 ##==============================================================================
166 ##
167 ## Check platform:
168 ##
169 mike 1.1 ##==============================================================================
170
171 case "$platform" in
172
173 LINUX_IX86_GNU)
174 ;;
175
176 LINUX_X86_64_GNU)
177 ;;
178
179 *)
180 echo "$0: Unrecognized platform: $platform"
181 exit 1
182 ;;
183
184 esac
185
186 ##==============================================================================
187 ##
188 ## Deduce locations.
189 ##
190 mike 1.1 ##==============================================================================
191
192 if [ -z "$bindir" ]; then
193 bindir=$prefix/bin
194 fi
195
196 if [ -z "$sbindir" ]; then
197 sbindir=$prefix/sbin
198 fi
199
200 if [ -z "$libdir" ]; then
201 libdir=$prefix/lib
202 fi
203
204 if [ -z "$includedir" ]; then
205 includedir=$prefix/include
206 fi
207
208 if [ -z "$datadir" ]; then
209 datadir=$prefix/share
210 fi
211 mike 1.1
212 ##==============================================================================
213 ##
214 ## Create config.options
215 ##
216 ##==============================================================================
217
218 rm -f config.options
219
220 echo "platform=$platform" >> config.options
221 echo "prefix=$prefix" >> config.options
222 echo "bindir=$bindir" >> config.options
223 echo "sbindir=$sbindir" >> config.options
224 echo "libdir=$libdir" >> config.options
225 echo "includedir=$includedir" >> config.options
226 echo "datadir=$datadir" >> config.options
227 echo "enable_debug=$enable_debug" >> config.options
228 echo "enable_binary_repository=$enable_binary_repository" >> config.options
229 echo "disable_oop=$disable_oop" >> config.options
230 echo "disable_prov_userctxt=$disable_prov_userctxt" >> config.options
231 echo "disable_privileged_tests=$disable_privileged_tests" >> config.options
232 mike 1.1 echo "disable_trace=$disable_trace" >> config.options
233
234 echo "export PEGASUS_PLATFORM=$platform" >> config.options
235 echo "export PEGASUS_ROOT=`pwd`" >> config.options
236 echo "export PEGASUS_HOME=`pwd`/build/$platform" >> config.options
237
238 if [ "$enable_debug" = "1" ]; then
239 echo "export PEGASUS_DEBUG=1" >> config.options
240 fi
241
242 if [ "$enable_binary_repository" = "1" ]; then
243 echo "export PEGASUS_REPOSITORY_MODE=BIN" >> config.options
244 fi
245
246 if [ "$disable_oop" = "1" ]; then
247 echo "export PEGASUS_DEFAULT_ENABLE_OOP=false" >> config.options
248 fi
249
250 if [ "$disable_prov_userctxt" = "1" ]; then
251 echo "export PEGASUS_DISABLE_PROV_USERCTXT=1" >> config.options
252 fi
253 mike 1.1
254 if [ "$disable_privileged_tests" = "1" ]; then
255 echo "export PEGASUS_DISABLE_PRIVILEGED_TESTS=1" >> config.options
256 fi
257
258 if [ "$disable_trace" = "1" ]; then
259 echo "export PEGASUS_REMOVE_TRACE=1" >> config.options
260 fi
261
262 echo "Created config.options"
263 echo "Configured for $platform"
264 echo
|