src/test/resources/golden-sample/configure2

branch
configure-evo
changeset 60
43d6680e6410
parent 52
afcb57893858
child 63
ac47c2fb2c4a
equal deleted inserted replaced
59:410e4f942ce7 60:43d6680e6410
1 #!/bin/sh 1 #!/bin/sh
2 2
3 # create temporary directory 3 # create temporary directory
4 TEMP_DIR=".tmp-$(uname -n)" 4 TEMP_DIR=".tmp-`uname -n`"
5 rm -Rf "$TEMP_DIR" 5 rm -Rf "$TEMP_DIR"
6 if ! mkdir -p "$TEMP_DIR"; then 6 if mkdir -p "$TEMP_DIR"; then
7 :
8 else
7 echo "Cannot create tmp dir $TEMP_DIR" 9 echo "Cannot create tmp dir $TEMP_DIR"
8 echo "Abort" 10 echo "Abort"
9 exit 1 11 exit 1
10 fi 12 fi
11 touch "$TEMP_DIR/options" 13 touch "$TEMP_DIR/options"
106 esac 108 esac
107 done 109 done
108 110
109 111
110 # set dir variables 112 # set dir variables
111 BINDIR=${BINDIR:-"$EPREFIX/bin"} 113 : ${BINDIR:="$EPREFIX/bin"}
112 SBINDIR=${SBINDIR:-"$EPREFIX/sbin"} 114 : ${SBINDIR:="$EPREFIX/sbin"}
113 LIBDIR=${LIBDIR:-"$EPREFIX/lib"} 115 : ${LIBDIR:="$EPREFIX/lib"}
114 LIBEXECDIR=${LIBEXECDIR:-"$EPREFIX/libexec"} 116 : ${LIBEXECDIR:="$EPREFIX/libexec"}
115 DATADIR=${DATADIR:-"$PREFIX/share"} 117 : ${DATADIR:="$PREFIX/share"}
116 SYSCONFDIR=${SYSCONFDIR:-"$PREFIX/etc"} 118 : ${SYSCONFDIR:="$PREFIX/etc"}
117 SHAREDSTATEDIR=${SHAREDSTATEDIR:-"$PREFIX/com"} 119 : ${SHAREDSTATEDIR:="$PREFIX/com"}
118 LOCALSTATEDIR=${LOCALSTATEDIR:-"$PREFIX/var"} 120 : ${LOCALSTATEDIR:="$PREFIX/var"}
119 INCLUDEDIR=${INCLUDEDIR:-"$PREFIX/include"} 121 : ${INCLUDEDIR:="$PREFIX/include"}
120 INFODIR=${INFODIR:-"$PREFIX/info"} 122 : ${INFODIR:="$PREFIX/info"}
121 MANDIR=${MANDIR:-"$PREFIX/man"} 123 : ${MANDIR:="$PREFIX/man"}
122 124
123 # Test for availability of pkg-config 125 # Test for availability of pkg-config
124 PKG_CONFIG=$(command -v pkg-config) 126 PKG_CONFIG=`command -v pkg-config`
125 PKG_CONFIG=${PKG_CONFIG:-"false"} 127 : ${PKG_CONFIG:="false"}
126 128
127 # Simple uname based platform detection 129 # Simple uname based platform detection
128 # $PLATFORM is used for platform dependent dependency selection 130 # $PLATFORM is used for platform dependent dependency selection
129 OS=$(uname -s) 131 OS=`uname -s`
130 OS_VERSION=$(uname -r) 132 OS_VERSION=`uname -r`
131 printf "detect platform... " 133 printf "detect platform... "
132 if [ "$OS" = "SunOS" ]; then 134 if [ "$OS" = "SunOS" ]; then
133 PLATFORM="solaris sunos unix svr4" 135 PLATFORM="solaris sunos unix svr4"
134 fi 136 fi
135 if [ "$OS" = "Linux" ]; then 137 if [ "$OS" = "Linux" ]; then
142 PLATFORM="macos osx bsd unix" 144 PLATFORM="macos osx bsd unix"
143 fi 145 fi
144 if echo "$OS" | grep -i "MINGW" > /dev/null; then 146 if echo "$OS" | grep -i "MINGW" > /dev/null; then
145 PLATFORM="windows mingw" 147 PLATFORM="windows mingw"
146 fi 148 fi
147 PLATFORM=${PLATFORM:-"unix"} 149 : ${PLATFORM:="unix"}
148 150
149 PLATFORM_NAME=$(echo "$PLATFORM" | cut -f1 -d' ' -) 151 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
150 echo "$PLATFORM_NAME" 152 echo "$PLATFORM_NAME"
151 153
152 isplatform() 154 isplatform()
153 { 155 {
154 for p in $PLATFORM 156 for p in $PLATFORM
156 if [ "$p" = "$1" ]; then 158 if [ "$p" = "$1" ]; then
157 return 0 159 return 0
158 fi 160 fi
159 done 161 done
160 return 1 162 return 1
163 }
164 notisplatform()
165 {
166 for p in $PLATFORM
167 do
168 if [ "$p" = "$1" ]; then
169 return 1
170 fi
171 done
172 return 0
161 } 173 }
162 174
163 175
164 # generate config.mk 176 # generate config.mk
165 cat > "$TEMP_DIR/vars.mk" << __EOF__ 177 cat > "$TEMP_DIR/vars.mk" << __EOF__
199 # 211 #
200 212
201 # create buffer for make variables required by dependencies 213 # create buffer for make variables required by dependencies
202 echo > "$TEMP_DIR/make.mk" 214 echo > "$TEMP_DIR/make.mk"
203 215
204 dependency_qt4() 216 dependency_error_qt4()
205 { 217 {
206 printf "checking for qt4... " 218 printf "checking for qt4... "
207 # dependency qt4 219 # dependency qt4
208 while true 220 while true
209 do 221 do
210 if ! which qmake-qt4 > /dev/null ; then 222 if which qmake-qt4 > /dev/null ; then
211 break 223 :
212 fi 224 else
213 echo yes 225 break
214 return 0 226 fi
215 done 227 echo yes
216 228 return 1
217 echo no 229 done
218 return 1 230
219 } 231 echo no
220 dependency_curl() 232 return 0
233 }
234 dependency_error_curl()
221 { 235 {
222 printf "checking for curl... " 236 printf "checking for curl... "
223 # dependency curl platform="windows" 237 # dependency curl platform="windows"
224 while true 238 while true
225 do 239 do
226 if ! isplatform "windows"; then 240 if notisplatform "windows"; then
227 break 241 break
228 fi 242 fi
229 TEMP_CFLAGS="$TEMP_CFLAGS -I/mingw/include" 243 TEMP_CFLAGS="$TEMP_CFLAGS -I/mingw/include"
230 TEMP_LDFLAGS="$TEMP_LDFLAGS -lcurl" 244 TEMP_LDFLAGS="$TEMP_LDFLAGS -lcurl"
231 echo yes 245 echo yes
232 return 0 246 return 1
233 done 247 done
234 248
235 # dependency curl platform="macos" 249 # dependency curl platform="macos"
236 while true 250 while true
237 do 251 do
238 if ! isplatform "macos"; then 252 if notisplatform "macos"; then
239 break 253 break
240 fi 254 fi
241 if tmp_flags=$(curl-config --cflags) ; then 255 if tmp_flags=`curl-config --cflags` ; then
242 TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" 256 TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags"
243 else 257 else
244 break 258 break
245 fi 259 fi
246 if tmp_flags=$(curl-config --ldflags) ; then 260 if tmp_flags=`curl-config --ldflags` ; then
247 TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" 261 TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags"
248 else 262 else
249 break 263 break
250 fi 264 fi
251 echo yes 265 echo yes
252 return 0 266 return 1
253 done 267 done
254 268
255 # dependency curl 269 # dependency curl
256 while true 270 while true
257 do 271 do
258 if [ -z "$PKG_CONFIG" ]; then 272 if [ -z "$PKG_CONFIG" ]; then
259 break 273 break
260 fi 274 fi
261 if ! $PKG_CONFIG libcurl ; then 275 if $PKG_CONFIG libcurl ; then
262 break 276 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libcurl`"
263 fi 277 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libcurl`"
264 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags libcurl)" 278 else
265 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs libcurl)" 279 break
266 echo yes 280 fi
267 return 0 281 echo yes
268 done 282 return 1
269 283 done
270 echo no 284
271 return 1 285 echo no
272 } 286 return 0
273 dependency_gtk2() 287 }
288 dependency_error_gtk2()
274 { 289 {
275 printf "checking for gtk2... " 290 printf "checking for gtk2... "
276 # dependency gtk2 291 # dependency gtk2
277 while true 292 while true
278 do 293 do
279 if [ -z "$PKG_CONFIG" ]; then 294 if [ -z "$PKG_CONFIG" ]; then
280 break 295 break
281 fi 296 fi
282 if ! $PKG_CONFIG gtk+-2.0 ; then 297 if $PKG_CONFIG gtk+-2.0 ; then
283 break 298 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-2.0`"
284 fi 299 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-2.0`"
285 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags gtk+-2.0)" 300 else
286 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs gtk+-2.0)" 301 break
287 echo yes 302 fi
288 return 0 303 echo yes
289 done 304 return 1
290 305 done
291 echo no 306
292 return 1 307 echo no
293 } 308 return 0
294 dependency_sqlite() 309 }
310 dependency_error_sqlite()
295 { 311 {
296 printf "checking for sqlite... " 312 printf "checking for sqlite... "
297 # dependency sqlite 313 # dependency sqlite
298 while true 314 while true
299 do 315 do
300 if [ -z "$PKG_CONFIG" ]; then 316 if [ -z "$PKG_CONFIG" ]; then
301 break 317 break
302 fi 318 fi
303 if ! $PKG_CONFIG sqlite3 ; then 319 if $PKG_CONFIG sqlite3 ; then
304 break 320 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags sqlite3`"
305 fi 321 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs sqlite3`"
306 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags sqlite3)" 322 else
307 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs sqlite3)" 323 break
308 echo yes 324 fi
309 return 0 325 echo yes
310 done 326 return 1
311 327 done
312 echo no 328
313 return 1 329 echo no
314 } 330 return 0
315 dependency_test() 331 }
332 dependency_error_test()
316 { 333 {
317 printf "checking for test... " 334 printf "checking for test... "
318 # dependency test platform="bsd" 335 # dependency test platform="bsd"
319 while true 336 while true
320 do 337 do
321 if ! isplatform "bsd"; then 338 if notisplatform "bsd"; then
322 break 339 break
323 fi 340 fi
324 if isplatform "macos"; then 341 if isplatform "macos"; then
325 break 342 break
326 fi 343 fi
327 TEMP_CFLAGS="$TEMP_CFLAGS -DBSD" 344 TEMP_CFLAGS="$TEMP_CFLAGS -DBSD"
328 echo yes 345 echo yes
329 return 0 346 return 1
330 done 347 done
331 348
332 # dependency test 349 # dependency test
333 while true 350 while true
334 do 351 do
335 TEMP_CFLAGS="$TEMP_CFLAGS -DTEST" 352 TEMP_CFLAGS="$TEMP_CFLAGS -DTEST"
336 echo yes 353 echo yes
337 return 0 354 return 1
338 done 355 done
339 356
340 echo no 357 echo no
341 return 1 358 return 0
342 } 359 }
343 dependency_gtk3() 360 dependency_error_gtk3()
344 { 361 {
345 printf "checking for gtk3... " 362 printf "checking for gtk3... "
346 # dependency gtk3 363 # dependency gtk3
347 while true 364 while true
348 do 365 do
349 if [ -z "$PKG_CONFIG" ]; then 366 if [ -z "$PKG_CONFIG" ]; then
350 break 367 break
351 fi 368 fi
352 if ! $PKG_CONFIG gtk+-5.0 ; then 369 if $PKG_CONFIG gtk+-5.0 ; then
353 break 370 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-5.0`"
354 fi 371 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-5.0`"
355 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags gtk+-5.0)" 372 else
356 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs gtk+-5.0)" 373 break
357 echo yes 374 fi
358 return 0 375 echo yes
359 done 376 return 1
360 377 done
361 echo no 378
362 return 1 379 echo no
363 } 380 return 0
364 dependency_deptest() 381 }
382 dependency_error_deptest()
365 { 383 {
366 printf "checking for deptest... " 384 printf "checking for deptest... "
367 # dependency deptest 385 # dependency deptest
368 while true 386 while true
369 do 387 do
370 TEMP_CFLAGS="$TEMP_CFLAGS -DDEPTEST" 388 TEMP_CFLAGS="$TEMP_CFLAGS -DDEPTEST"
371 echo yes 389 echo yes
372 return 0 390 return 1
373 done 391 done
374 392
375 echo no 393 echo no
376 return 1 394 return 0
377 } 395 }
378 dependency_libxml2() 396 dependency_error_libxml2()
379 { 397 {
380 printf "checking for libxml2... " 398 printf "checking for libxml2... "
381 # dependency libxml2 399 # dependency libxml2
382 while true 400 while true
383 do 401 do
384 if [ -z "$PKG_CONFIG" ]; then 402 if [ -z "$PKG_CONFIG" ]; then
385 break 403 break
386 fi 404 fi
387 if ! $PKG_CONFIG --atleast-version=2.8 libxml-2.0 ; then 405 if $PKG_CONFIG --atleast-version=2.8 libxml-2.0 ; then
388 break 406 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`"
389 fi 407 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libxml-2.0`"
390 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags libxml-2.0)" 408 else
391 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs libxml-2.0)" 409 break
410 fi
392 cat >> $TEMP_DIR/make.mk << __EOF__ 411 cat >> $TEMP_DIR/make.mk << __EOF__
393 # Dependency: libxml2 412 # Dependency: libxml2
394 xml = libxml2 413 xml = libxml2
395 414
396 __EOF__ 415 __EOF__
397 echo yes 416 echo yes
398 return 0 417 return 1
399 done 418 done
400 419
401 echo no 420 echo no
402 return 1 421 return 0
403 } 422 }
404 423
405 DEPENDENCIES_FAILED= 424 DEPENDENCIES_FAILED=
406 ERROR=0 425 ERROR=0
407 # unnamed dependencies 426 # unnamed dependencies
435 # OPTION VALUES 454 # OPTION VALUES
436 # 455 #
437 checkopt_toolkit_gtk3() 456 checkopt_toolkit_gtk3()
438 { 457 {
439 VERR=0 458 VERR=0
440 if ! dependency_gtk3 ; then 459 if dependency_error_gtk3 ; then
441 VERR=1 460 VERR=1
442 fi 461 fi
443 if [ $VERR -ne 0 ]; then 462 if [ $VERR -ne 0 ]; then
444 return 1 463 return 1
445 fi 464 fi
451 return 0 470 return 0
452 } 471 }
453 checkopt_toolkit_cli() 472 checkopt_toolkit_cli()
454 { 473 {
455 VERR=0 474 VERR=0
456 if ! dependency_curl ; then 475 if dependency_error_curl ; then
457 VERR=1 476 VERR=1
458 fi 477 fi
459 if ! dependency_test ; then 478 if dependency_error_test ; then
460 VERR=1 479 VERR=1
461 fi 480 fi
462 if [ $VERR -ne 0 ]; then 481 if [ $VERR -ne 0 ]; then
463 return 1 482 return 1
464 fi 483 fi
465 return 0 484 return 0
466 } 485 }
467 checkopt_toolkit_gtk2() 486 checkopt_toolkit_gtk2()
468 { 487 {
469 VERR=0 488 VERR=0
470 if ! dependency_gtk2 ; then 489 if dependency_error_gtk2 ; then
471 VERR=1 490 VERR=1
472 fi 491 fi
473 if [ $VERR -ne 0 ]; then 492 if [ $VERR -ne 0 ]; then
474 return 1 493 return 1
475 fi 494 fi
476 return 0 495 return 0
477 } 496 }
478 checkopt_toolkit_wpf() 497 checkopt_toolkit_wpf()
479 { 498 {
480 VERR=0 499 VERR=0
481 if ! dependency_test ; then 500 if dependency_error_test ; then
482 VERR=1 501 VERR=1
483 fi 502 fi
484 if [ $VERR -ne 0 ]; then 503 if [ $VERR -ne 0 ]; then
485 return 1 504 return 1
486 fi 505 fi
493 512
494 # Target: dav 513 # Target: dav
495 TEMP_CFLAGS= 514 TEMP_CFLAGS=
496 TEMP_LDFLAGS= 515 TEMP_LDFLAGS=
497 516
498 if ! dependency_curl; then 517 if dependency_error_curl; then
499 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl " 518 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl "
500 ERROR=1 519 ERROR=1
501 fi 520 fi
502 if ! dependency_libxml2; then 521 if dependency_error_libxml2; then
503 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " 522 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
504 ERROR=1 523 ERROR=1
505 fi 524 fi
506 if ! dependency_test; then 525 if dependency_error_test; then
507 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED test " 526 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED test "
508 ERROR=1 527 ERROR=1
509 fi 528 fi
510 529
511 # Features 530 # Features
512 if [ -n "$FEATURE_DB" ]; then 531 if [ -n "$FEATURE_DB" ]; then
513 # check dependency 532 # check dependency
514 if ! dependency_sqlite ; then 533 if dependency_error_sqlite ; then
515 # "auto" features can fail and are just disabled in this case 534 # "auto" features can fail and are just disabled in this case
516 if [ "$FEATURE_DB" = "auto" ]; then 535 if [ "$FEATURE_DB" = "auto" ]; then
517 unset FEATURE_DB 536 unset FEATURE_DB
518 else 537 else
519 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sqlite " 538 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sqlite "
521 fi 540 fi
522 fi 541 fi
523 fi 542 fi
524 if [ -n "$FEATURE_GUI" ]; then 543 if [ -n "$FEATURE_GUI" ]; then
525 # check dependency 544 # check dependency
526 if ! dependency_gtk3 ; then 545 if dependency_error_gtk3 ; then
527 # "auto" features can fail and are just disabled in this case 546 # "auto" features can fail and are just disabled in this case
528 if [ "$FEATURE_GUI" = "auto" ]; then 547 if [ "$FEATURE_GUI" = "auto" ]; then
529 unset FEATURE_GUI 548 unset FEATURE_GUI
530 else 549 else
531 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED gtk3 " 550 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED gtk3 "
568 else 587 else
569 if false; then 588 if false; then
570 false 589 false
571 elif [ "$OPT_TOOLKIT" = "gtk3" ]; then 590 elif [ "$OPT_TOOLKIT" = "gtk3" ]; then
572 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 591 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
573 if ! checkopt_toolkit_gtk3 ; then 592 if checkopt_toolkit_gtk3 ; then
593 :
594 else
574 ERROR=1 595 ERROR=1
575 fi 596 fi
576 elif [ "$OPT_TOOLKIT" = "cli" ]; then 597 elif [ "$OPT_TOOLKIT" = "cli" ]; then
577 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 598 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
578 if ! checkopt_toolkit_cli ; then 599 if checkopt_toolkit_cli ; then
600 :
601 else
579 ERROR=1 602 ERROR=1
580 fi 603 fi
581 elif [ "$OPT_TOOLKIT" = "gtk2" ]; then 604 elif [ "$OPT_TOOLKIT" = "gtk2" ]; then
582 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 605 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
583 if ! checkopt_toolkit_gtk2 ; then 606 if checkopt_toolkit_gtk2 ; then
607 :
608 else
584 ERROR=1 609 ERROR=1
585 fi 610 fi
586 elif [ "$OPT_TOOLKIT" = "wpf" ]; then 611 elif [ "$OPT_TOOLKIT" = "wpf" ]; then
587 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 612 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
588 if ! checkopt_toolkit_wpf ; then 613 if checkopt_toolkit_wpf ; then
614 :
615 else
589 ERROR=1 616 ERROR=1
590 fi 617 fi
591 fi 618 fi
592 fi 619 fi
593 620
607 634
608 # Target 635 # Target
609 TEMP_CFLAGS= 636 TEMP_CFLAGS=
610 TEMP_LDFLAGS= 637 TEMP_LDFLAGS=
611 638
612 if ! dependency_deptest; then 639 if dependency_error_deptest; then
613 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED deptest " 640 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED deptest "
614 ERROR=1 641 ERROR=1
615 fi 642 fi
616 643
617 # Features 644 # Features

mercurial