53:704368f1bb23 | 54:2b8f40c58944 |
---|---|
1 #!/bin/sh | 1 #!/bin/sh |
2 | |
3 failed() | |
4 { | |
5 $@ | |
6 if [ $? -ne 0 ]; then | |
7 return 0 | |
8 else | |
9 return 1 | |
10 fi | |
11 } | |
12 | |
2 | 13 |
3 # create temporary directory | 14 # create temporary directory |
4 TEMP_DIR=".tmp-`uname -n`" | 15 TEMP_DIR=".tmp-`uname -n`" |
5 rm -Rf "$TEMP_DIR" | 16 rm -Rf "$TEMP_DIR" |
6 if ! mkdir -p "$TEMP_DIR"; then | 17 if failed mkdir -p "$TEMP_DIR"; then |
7 echo "Cannot create tmp dir $TEMP_DIR" | 18 echo "Cannot create tmp dir $TEMP_DIR" |
8 echo "Abort" | 19 echo "Abort" |
9 exit 1 | 20 exit 1 |
10 fi | 21 fi |
11 touch "$TEMP_DIR/options" | 22 touch "$TEMP_DIR/options" |
26 INFODIR= | 37 INFODIR= |
27 MANDIR= | 38 MANDIR= |
28 | 39 |
29 # custom variables | 40 # custom variables |
30 HOST=`uname -n` | 41 HOST=`uname -n` |
31 PREFIX=$(pwd)/work | 42 PREFIX=`pwd`/work |
32 INSTALL_DIR=$PREFIX | 43 INSTALL_DIR=$PREFIX |
33 | 44 |
34 # features | 45 # features |
35 FEATURE_PG=auto | 46 FEATURE_PG=auto |
36 | 47 |
189 echo "Toolchain error: $TOOLCHAIN_ERROR" | 200 echo "Toolchain error: $TOOLCHAIN_ERROR" |
190 echo "Abort." | 201 echo "Abort." |
191 abort_configure | 202 abort_configure |
192 fi | 203 fi |
193 | 204 |
205 | |
194 # | 206 # |
195 # DEPENDENCIES | 207 # DEPENDENCIES |
196 # | 208 # |
197 | 209 |
198 # create buffer for make variables required by dependencies | 210 # create buffer for make variables required by dependencies |
205 while true | 217 while true |
206 do | 218 do |
207 if [ -z "$PKG_CONFIG" ]; then | 219 if [ -z "$PKG_CONFIG" ]; then |
208 break | 220 break |
209 fi | 221 fi |
210 if ! $PKG_CONFIG libpq ; then | 222 if failed $PKG_CONFIG libpq ; then |
211 break | 223 break |
212 fi | 224 fi |
213 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libpq`" | 225 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libpq`" |
214 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libpq`" | 226 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libpq`" |
215 echo yes | 227 echo yes |
226 while true | 238 while true |
227 do | 239 do |
228 if [ -z "$PKG_CONFIG" ]; then | 240 if [ -z "$PKG_CONFIG" ]; then |
229 break | 241 break |
230 fi | 242 fi |
231 if ! $PKG_CONFIG openssl ; then | 243 if failed $PKG_CONFIG openssl ; then |
232 break | 244 break |
233 fi | 245 fi |
234 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags openssl`" | 246 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags openssl`" |
235 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs openssl`" | 247 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs openssl`" |
236 echo yes | 248 echo yes |
238 done | 250 done |
239 | 251 |
240 # dependency openssl platform="bsd" | 252 # dependency openssl platform="bsd" |
241 while true | 253 while true |
242 do | 254 do |
243 if ! isplatform "bsd"; then | 255 if failed isplatform "bsd"; then |
244 break | 256 break |
245 fi | 257 fi |
246 TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto" | 258 TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto" |
247 echo yes | 259 echo yes |
248 return 0 | 260 return 0 |
255 { | 267 { |
256 printf "checking for libxml2... " | 268 printf "checking for libxml2... " |
257 # dependency libxml2 platform="macos" | 269 # dependency libxml2 platform="macos" |
258 while true | 270 while true |
259 do | 271 do |
260 if ! isplatform "macos"; then | 272 if failed isplatform "macos"; then |
261 break | 273 break |
262 fi | 274 fi |
263 if tmp_flags=`xml2-config --cflags` ; then | 275 if tmp_flags=`xml2-config --cflags` ; then |
264 TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" | 276 TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" |
265 else | 277 else |
278 while true | 290 while true |
279 do | 291 do |
280 if [ -z "$PKG_CONFIG" ]; then | 292 if [ -z "$PKG_CONFIG" ]; then |
281 break | 293 break |
282 fi | 294 fi |
283 if ! $PKG_CONFIG libxml-2.0 ; then | 295 if failed $PKG_CONFIG libxml-2.0 ; then |
284 break | 296 break |
285 fi | 297 fi |
286 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`" | 298 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`" |
287 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libxml-2.0`" | 299 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libxml-2.0`" |
288 echo yes | 300 echo yes |
327 | 339 |
328 # Target | 340 # Target |
329 TEMP_CFLAGS= | 341 TEMP_CFLAGS= |
330 TEMP_LDFLAGS= | 342 TEMP_LDFLAGS= |
331 | 343 |
332 if ! dependency_libxml2; then | 344 if failed dependency_libxml2; then |
333 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " | 345 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " |
334 ERROR=1 | 346 ERROR=1 |
335 fi | 347 fi |
336 if ! dependency_openssl; then | 348 if failed dependency_openssl; then |
337 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " | 349 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " |
338 ERROR=1 | 350 ERROR=1 |
339 fi | 351 fi |
340 | 352 |
341 # Features | 353 # Features |
342 if [ -n "$FEATURE_PG" ]; then | 354 if [ -n "$FEATURE_PG" ]; then |
343 # check dependency | 355 # check dependency |
344 if ! dependency_libpq ; then | 356 if failed dependency_libpq ; then |
345 # "auto" features can fail and are just disabled in this case | 357 # "auto" features can fail and are just disabled in this case |
346 if [ "$FEATURE_PG" = "auto" ]; then | 358 if [ "$FEATURE_PG" = "auto" ]; then |
347 unset FEATURE_PG | 359 unset FEATURE_PG |
348 else | 360 else |
349 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq " | 361 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq " |