src/test/resources/golden-sample/configure2

branch
configure-evo
changeset 52
afcb57893858
parent 51
5c12e9e29733
child 60
43d6680e6410
equal deleted inserted replaced
51:5c12e9e29733 52:afcb57893858
1 #!/bin/sh 1 #!/bin/sh
2 2
3 3 # create temporary directory
4 TEMP_DIR=".tmp-$(uname -n)"
5 rm -Rf "$TEMP_DIR"
6 if ! mkdir -p "$TEMP_DIR"; then
7 echo "Cannot create tmp dir $TEMP_DIR"
8 echo "Abort"
9 exit 1
10 fi
11 touch "$TEMP_DIR/options"
12 touch "$TEMP_DIR/features"
13
14 # define standard variables
4 PREFIX=/usr 15 PREFIX=/usr
5 EPREFIX=$PREFIX 16 EPREFIX=/usr
6
7 BINDIR= 17 BINDIR=
8 SBINDIR= 18 SBINDIR=
9 LIBDIR= 19 LIBDIR=
10 LIBEXECDIR= 20 LIBEXECDIR=
11 DATADIR= 21 DATADIR=
14 LOCALSTATEDIR= 24 LOCALSTATEDIR=
15 INCLUDEDIR= 25 INCLUDEDIR=
16 INFODIR= 26 INFODIR=
17 MANDIR= 27 MANDIR=
18 28
19 OS=`uname -s` 29 # custom variables
20 OS_VERSION=`uname -r`
21
22 TEMP_DIR=".tmp-`uname -n`"
23 mkdir -p "$TEMP_DIR"
24 if [ $? -ne 0 ]; then
25 echo "Cannot create tmp dir"
26 echo "Abort"
27 fi
28 touch "$TEMP_DIR/options"
29 touch "$TEMP_DIR/features"
30 30
31 # features 31 # features
32 FEATURE_DB=auto 32 FEATURE_DB=auto
33
34 # clean abort
35 abort_configure()
36 {
37 rm -Rf "$TEMP_DIR"
38 exit 1
39 }
33 40
34 # help text 41 # help text
35 printhelp() 42 printhelp()
36 { 43 {
37 echo "Usage: $0 [OPTIONS]..." 44 echo "Usage: $0 [OPTIONS]..."
85 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;; 92 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;;
86 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;; 93 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;;
87 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;; 94 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;;
88 "--infodir="*) INFODIR=${ARG#--infodir=} ;; 95 "--infodir="*) INFODIR=${ARG#--infodir=} ;;
89 "--mandir"*) MANDIR=${ARG#--mandir} ;; 96 "--mandir"*) MANDIR=${ARG#--mandir} ;;
90 "--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;; 97 "--help"*) printhelp; abort_configure ;;
91 "--debug") BUILD_TYPE="debug" ;; 98 "--debug") BUILD_TYPE="debug" ;;
92 "--release") BUILD_TYPE="release" ;; 99 "--release") BUILD_TYPE="release" ;;
93 "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;; 100 "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;;
94 "--enable-db") FEATURE_DB=on ;; 101 "--enable-db") FEATURE_DB=on ;;
95 "--disable-db") unset FEATURE_DB ;; 102 "--disable-db") unset FEATURE_DB ;;
96 "--enable-gui") FEATURE_GUI=on ;; 103 "--enable-gui") FEATURE_GUI=on ;;
97 "--disable-gui") unset FEATURE_GUI ;; 104 "--disable-gui") unset FEATURE_GUI ;;
98 "-"*) echo "unknown option: $ARG"; rm -Rf "$TEMP_DIR"; exit 1 ;; 105 "-"*) echo "unknown option: $ARG"; abort_configure ;;
99 esac 106 esac
100 done 107 done
101 108
109
102 # set dir variables 110 # set dir variables
103 if [ -z "$BINDIR" ]; then 111 BINDIR=${BINDIR:-"$EPREFIX/bin"}
104 BINDIR=$EPREFIX/bin 112 SBINDIR=${SBINDIR:-"$EPREFIX/sbin"}
105 fi 113 LIBDIR=${LIBDIR:-"$EPREFIX/lib"}
106 if [ -z "$SBINDIR" ]; then 114 LIBEXECDIR=${LIBEXECDIR:-"$EPREFIX/libexec"}
107 SBINDIR=$EPREFIX/sbin 115 DATADIR=${DATADIR:-"$PREFIX/share"}
108 fi 116 SYSCONFDIR=${SYSCONFDIR:-"$PREFIX/etc"}
109 if [ -z "$LIBDIR" ]; then 117 SHAREDSTATEDIR=${SHAREDSTATEDIR:-"$PREFIX/com"}
110 LIBDIR=$EPREFIX/lib 118 LOCALSTATEDIR=${LOCALSTATEDIR:-"$PREFIX/var"}
111 fi 119 INCLUDEDIR=${INCLUDEDIR:-"$PREFIX/include"}
112 if [ -z "$LIBEXEC" ]; then 120 INFODIR=${INFODIR:-"$PREFIX/info"}
113 LIBEXECDIR=$EPREFIX/libexec 121 MANDIR=${MANDIR:-"$PREFIX/man"}
114 fi 122
115 if [ -z "$DATADIR" ]; then 123 # Test for availability of pkg-config
116 DATADIR=$PREFIX/share 124 PKG_CONFIG=$(command -v pkg-config)
117 fi 125 PKG_CONFIG=${PKG_CONFIG:-"false"}
118 if [ -z "$SYSCONFDIR" ]; then
119 SYSCONFDIR=$PREFIX/etc
120 fi
121 if [ -z "$SHAREDSTATEDIR" ]; then
122 SHAREDSTATEDIR=$PREFIX/com
123 fi
124 if [ -z "$LOCALSTATEDIR" ]; then
125 LOCALSTATEDIR=$PREFIX/var
126 fi
127 if [ -z "$INCLUDEDIR" ]; then
128 INCLUDEDIR=$PREFIX/include
129 fi
130 if [ -z "$INFODIR" ]; then
131 INFODIR=$PREFIX/info
132 fi
133 if [ -z "$MANDIR" ]; then
134 MANDIR=$PREFIX/man
135 fi
136
137 which pkg-config > /dev/null
138 if [ $? -eq 0 ]; then
139 PKG_CONFIG=pkg-config
140 else
141 PKG_CONFIG=false
142 fi
143 126
144 # Simple uname based platform detection 127 # Simple uname based platform detection
145 # $PLATFORM is used for platform dependent dependency selection 128 # $PLATFORM is used for platform dependent dependency selection
129 OS=$(uname -s)
130 OS_VERSION=$(uname -r)
146 printf "detect platform... " 131 printf "detect platform... "
147 if [ "$OS" = "SunOS" ]; then 132 if [ "$OS" = "SunOS" ]; then
148 PLATFORM="solaris sunos unix svr4" 133 PLATFORM="solaris sunos unix svr4"
149 fi 134 fi
150 if [ "$OS" = "Linux" ]; then 135 if [ "$OS" = "Linux" ]; then
154 PLATFORM="freebsd bsd unix" 139 PLATFORM="freebsd bsd unix"
155 fi 140 fi
156 if [ "$OS" = "Darwin" ]; then 141 if [ "$OS" = "Darwin" ]; then
157 PLATFORM="macos osx bsd unix" 142 PLATFORM="macos osx bsd unix"
158 fi 143 fi
159 echo "$OS" | grep -i "MINGW" > /dev/null 144 if echo "$OS" | grep -i "MINGW" > /dev/null; then
160 if [ $? -eq 0 ]; then
161 PLATFORM="windows mingw" 145 PLATFORM="windows mingw"
162 fi 146 fi
163 147 PLATFORM=${PLATFORM:-"unix"}
164 if [ -z "$PLATFORM" ]; then 148
165 PLATFORM="unix" 149 PLATFORM_NAME=$(echo "$PLATFORM" | cut -f1 -d' ' -)
166 fi 150 echo "$PLATFORM_NAME"
167
168 for p in $PLATFORM
169 do
170 PLATFORM_NAME=$p
171 break
172 done
173 echo $PLATFORM_NAME
174 151
175 isplatform() 152 isplatform()
176 { 153 {
177 for p in $PLATFORM 154 for p in $PLATFORM
178 do 155 do
180 return 0 157 return 0
181 fi 158 fi
182 done 159 done
183 return 1 160 return 1
184 } 161 }
185 isnotplatform() 162
186 { 163
187 for p in $PLATFORM 164 # generate config.mk
188 do 165 cat > "$TEMP_DIR/vars.mk" << __EOF__
189 if [ "$p" = "$1" ]; then
190 return 1
191 fi
192 done
193 return 0
194 }
195
196 # generate config.mk and config.h
197 cat > "$TEMP_DIR/config.mk" << __EOF__
198 #
199 # config.mk generated by configure
200 #
201
202 # general vars
203
204 PREFIX=$PREFIX 166 PREFIX=$PREFIX
205 EPREFIX=$EPREFIX 167 EPREFIX=$EPREFIX
206
207 BINDIR=$BINDIR 168 BINDIR=$BINDIR
208 SBINDIR=$SBINDIR 169 SBINDIR=$SBINDIR
209 LIBDIR=$LIBDIR 170 LIBDIR=$LIBDIR
210 LIBEXECDIR=$LIBEXECDIR 171 LIBEXECDIR=$LIBEXECDIR
211 DATADIR=$DATADIR 172 DATADIR=$DATADIR
213 SHAREDSTATEDIR=$SHAREDSTATEDIR 174 SHAREDSTATEDIR=$SHAREDSTATEDIR
214 LOCALSTATEDIR=$LOCALSTATEDIR 175 LOCALSTATEDIR=$LOCALSTATEDIR
215 INCLUDEDIR=$INCLUDEDIR 176 INCLUDEDIR=$INCLUDEDIR
216 INFODIR=$INFODIR 177 INFODIR=$INFODIR
217 MANDIR=$MANDIR 178 MANDIR=$MANDIR
218
219 __EOF__ 179 __EOF__
220 180 cat > "$TEMP_DIR/config.mk" << __EOF__
221 echo > "$TEMP_DIR/make.mk" 181 #
222 182 # config.mk generated by configure
223 ENV_CFLAGS=$CFLAGS 183 #
224 ENV_LDFLAGS=$LDFLAGS 184 __EOF__
225 ENV_CXXFLAGS=$CXXFLAGS 185 sort -u "$TEMP_DIR/vars.mk" >> "$TEMP_DIR/config.mk"
226 186
227 # Toolchain detection 187
188 # toolchain detection
228 # this will insert make vars to config.mk 189 # this will insert make vars to config.mk
229 . make/toolchain.sh 190 . make/toolchain.sh
230 191 if [ -n "$TOOLCHAIN_ERROR" ]; then
231 # add user specified flags to config.mk 192 echo "Toolchain error: $TOOLCHAIN_ERROR"
232 echo "# project specific flags" >> "$TEMP_DIR/config.mk" 193 echo "Abort."
233 if [ -n "${ENV_CFLAGS}" ]; then 194 abort_configure
234 echo "CFLAGS += $ENV_CFLAGS" >> "$TEMP_DIR/config.mk"
235 fi
236 if [ -n "${ENV_CXXFLAGS}" ]; then
237 echo "CXXFLAGS += $ENV_CXXFLAGS" >> "$TEMP_DIR/config.mk"
238 fi
239 if [ -n "${ENV_LDFLAGS}" ]; then
240 echo "LDFLAGS += $ENV_LDFLAGS" >> "$TEMP_DIR/config.mk"
241 fi 195 fi
242 196
243 # 197 #
244 # DEPENDENCIES 198 # DEPENDENCIES
245 # 199 #
200
201 # create buffer for make variables required by dependencies
202 echo > "$TEMP_DIR/make.mk"
246 203
247 dependency_qt4() 204 dependency_qt4()
248 { 205 {
249 printf "checking for qt4... " 206 printf "checking for qt4... "
250 # dependency qt4 207 # dependency qt4
251 while true 208 while true
252 do 209 do
253 which qmake-qt4 > /dev/null 210 if ! which qmake-qt4 > /dev/null ; then
254 if [ $? -ne 0 ]; then 211 break
255 break
256 fi 212 fi
257 echo yes 213 echo yes
258 return 0 214 return 0
259 done 215 done
260 216
265 { 221 {
266 printf "checking for curl... " 222 printf "checking for curl... "
267 # dependency curl platform="windows" 223 # dependency curl platform="windows"
268 while true 224 while true
269 do 225 do
270 if isnotplatform "windows"; then 226 if ! isplatform "windows"; then
271 break 227 break
272 fi 228 fi
273 TEMP_CFLAGS="$TEMP_CFLAGS -I/mingw/include" 229 TEMP_CFLAGS="$TEMP_CFLAGS -I/mingw/include"
274 TEMP_LDFLAGS="$TEMP_LDFLAGS -lcurl" 230 TEMP_LDFLAGS="$TEMP_LDFLAGS -lcurl"
275 echo yes 231 echo yes
277 done 233 done
278 234
279 # dependency curl platform="macos" 235 # dependency curl platform="macos"
280 while true 236 while true
281 do 237 do
282 if isnotplatform "macos"; then 238 if ! isplatform "macos"; then
283 break 239 break
284 fi 240 fi
285 curl-config --cflags > /dev/null 241 if tmp_flags=$(curl-config --cflags) ; then
286 if [ $? -eq 0 ]; then 242 TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags"
287 TEMP_CFLAGS="$TEMP_CFLAGS `curl-config --cflags`"
288 else 243 else
289 break 244 break
290 fi 245 fi
291 curl-config --ldflags > /dev/null 246 if tmp_flags=$(curl-config --ldflags) ; then
292 if [ $? -eq 0 ]; then 247 TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags"
293 TEMP_LDFLAGS="$TEMP_LDFLAGS `curl-config --ldflags`"
294 else 248 else
295 break 249 break
296 fi 250 fi
297 echo yes 251 echo yes
298 return 0 252 return 0
302 while true 256 while true
303 do 257 do
304 if [ -z "$PKG_CONFIG" ]; then 258 if [ -z "$PKG_CONFIG" ]; then
305 break 259 break
306 fi 260 fi
307 $PKG_CONFIG libcurl 261 if ! $PKG_CONFIG libcurl ; then
308 if [ $? -ne 0 ] ; then 262 break
309 break 263 fi
310 fi 264 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags libcurl)"
311 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libcurl`" 265 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs libcurl)"
312 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libcurl`"
313 echo yes 266 echo yes
314 return 0 267 return 0
315 done 268 done
316 269
317 echo no 270 echo no
324 while true 277 while true
325 do 278 do
326 if [ -z "$PKG_CONFIG" ]; then 279 if [ -z "$PKG_CONFIG" ]; then
327 break 280 break
328 fi 281 fi
329 $PKG_CONFIG gtk+-2.0 282 if ! $PKG_CONFIG gtk+-2.0 ; then
330 if [ $? -ne 0 ] ; then 283 break
331 break 284 fi
332 fi 285 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags gtk+-2.0)"
333 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags gtk+-2.0`" 286 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs gtk+-2.0)"
334 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs gtk+-2.0`"
335 echo yes 287 echo yes
336 return 0 288 return 0
337 done 289 done
338 290
339 echo no 291 echo no
346 while true 298 while true
347 do 299 do
348 if [ -z "$PKG_CONFIG" ]; then 300 if [ -z "$PKG_CONFIG" ]; then
349 break 301 break
350 fi 302 fi
351 $PKG_CONFIG sqlite3 303 if ! $PKG_CONFIG sqlite3 ; then
352 if [ $? -ne 0 ] ; then 304 break
353 break 305 fi
354 fi 306 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags sqlite3)"
355 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags sqlite3`" 307 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs sqlite3)"
356 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs sqlite3`"
357 echo yes 308 echo yes
358 return 0 309 return 0
359 done 310 done
360 311
361 echo no 312 echo no
365 { 316 {
366 printf "checking for test... " 317 printf "checking for test... "
367 # dependency test platform="bsd" 318 # dependency test platform="bsd"
368 while true 319 while true
369 do 320 do
370 if isnotplatform "bsd"; then 321 if ! isplatform "bsd"; then
371 break 322 break
372 fi 323 fi
373 if isplatform "macos"; then 324 if isplatform "macos"; then
374 break 325 break
375 fi 326 fi
396 while true 347 while true
397 do 348 do
398 if [ -z "$PKG_CONFIG" ]; then 349 if [ -z "$PKG_CONFIG" ]; then
399 break 350 break
400 fi 351 fi
401 $PKG_CONFIG gtk+-5.0 352 if ! $PKG_CONFIG gtk+-5.0 ; then
402 if [ $? -ne 0 ] ; then 353 break
403 break 354 fi
404 fi 355 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags gtk+-5.0)"
405 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags gtk+-5.0`" 356 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs gtk+-5.0)"
406 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs gtk+-5.0`"
407 echo yes 357 echo yes
408 return 0 358 return 0
409 done 359 done
410 360
411 echo no 361 echo no
432 while true 382 while true
433 do 383 do
434 if [ -z "$PKG_CONFIG" ]; then 384 if [ -z "$PKG_CONFIG" ]; then
435 break 385 break
436 fi 386 fi
437 $PKG_CONFIG --atleast-version=2.8 libxml-2.0 387 if ! $PKG_CONFIG --atleast-version=2.8 libxml-2.0 ; then
438 if [ $? -ne 0 ] ; then 388 break
439 break 389 fi
440 fi 390 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags libxml-2.0)"
441 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libxml-2.0`" 391 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs libxml-2.0)"
442 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libxml-2.0`"
443 cat >> $TEMP_DIR/make.mk << __EOF__ 392 cat >> $TEMP_DIR/make.mk << __EOF__
444 # Dependency: libxml2 393 # Dependency: libxml2
445 xml = libxml2 394 xml = libxml2
446 395
447 __EOF__ 396 __EOF__
453 return 1 402 return 1
454 } 403 }
455 404
456 DEPENDENCIES_FAILED= 405 DEPENDENCIES_FAILED=
457 ERROR=0 406 ERROR=0
458 # general dependencies 407 # unnamed dependencies
459 TEMP_CFLAGS= 408 TEMP_CFLAGS=
460 TEMP_LDFLAGS= 409 TEMP_LDFLAGS=
461 while true 410 while true
462 do 411 do
463 while true 412 while true
466 cat >> "$TEMP_DIR/make.mk" << __EOF__ 415 cat >> "$TEMP_DIR/make.mk" << __EOF__
467 MVAR = 123 416 MVAR = 123
468 MVAR += 123 417 MVAR += 123
469 418
470 __EOF__ 419 __EOF__
471
472 break 420 break
473 done 421 done
474
475 break 422 break
476 done 423 done
477 424
478 # add general dependency flags to config.mk 425 # add unnamed dependency flags to config.mk
479 echo >> "$TEMP_DIR/config.mk" 426 echo >> "$TEMP_DIR/config.mk"
480 if [ -n "${TEMP_CFLAGS}" ]; then 427 if [ -n "${TEMP_CFLAGS}" ]; then
481 echo "CFLAGS += $TEMP_CFLAGS" >> $TEMP_DIR/config.mk 428 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk"
482 fi
483 if [ -n "${TEMP_CXXFLAGS}" ]; then
484 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> $TEMP_DIR/config.mk
485 fi 429 fi
486 if [ -n "${TEMP_LDFLAGS}" ]; then 430 if [ -n "${TEMP_LDFLAGS}" ]; then
487 echo "LDFLAGS += $TEMP_LDFLAGS" >> $TEMP_DIR/config.mk 431 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk"
488 fi 432 fi
489 433
490 # 434 #
491 # OPTION VALUES 435 # OPTION VALUES
492 # 436 #
493 checkopt_toolkit_gtk3() 437 checkopt_toolkit_gtk3()
494 { 438 {
495 VERR=0 439 VERR=0
496 dependency_gtk3 440 if ! dependency_gtk3 ; then
497 if [ $? -ne 0 ]; then
498 VERR=1 441 VERR=1
499 fi 442 fi
500 if [ $VERR -ne 0 ]; then 443 if [ $VERR -ne 0 ]; then
501 return 1 444 return 1
502 fi 445 fi
508 return 0 451 return 0
509 } 452 }
510 checkopt_toolkit_cli() 453 checkopt_toolkit_cli()
511 { 454 {
512 VERR=0 455 VERR=0
513 dependency_curl 456 if ! dependency_curl ; then
514 if [ $? -ne 0 ]; then
515 VERR=1 457 VERR=1
516 fi 458 fi
517 dependency_test 459 if ! dependency_test ; then
518 if [ $? -ne 0 ]; then
519 VERR=1 460 VERR=1
520 fi 461 fi
521 if [ $VERR -ne 0 ]; then 462 if [ $VERR -ne 0 ]; then
522 return 1 463 return 1
523 fi 464 fi
524 return 0 465 return 0
525 } 466 }
526 checkopt_toolkit_gtk2() 467 checkopt_toolkit_gtk2()
527 { 468 {
528 VERR=0 469 VERR=0
529 dependency_gtk2 470 if ! dependency_gtk2 ; then
530 if [ $? -ne 0 ]; then
531 VERR=1 471 VERR=1
532 fi 472 fi
533 if [ $VERR -ne 0 ]; then 473 if [ $VERR -ne 0 ]; then
534 return 1 474 return 1
535 fi 475 fi
536 return 0 476 return 0
537 } 477 }
538 checkopt_toolkit_wpf() 478 checkopt_toolkit_wpf()
539 { 479 {
540 VERR=0 480 VERR=0
541 dependency_test 481 if ! dependency_test ; then
542 if [ $? -ne 0 ]; then
543 VERR=1 482 VERR=1
544 fi 483 fi
545 if [ $VERR -ne 0 ]; then 484 if [ $VERR -ne 0 ]; then
546 return 1 485 return 1
547 fi 486 fi
549 } 488 }
550 489
551 # 490 #
552 # TARGETS 491 # TARGETS
553 # 492 #
554 TEMP_CFLAGS=
555 TEMP_CXXFLAGS=
556 TEMP_LDFLAGS=
557 493
558 # Target: dav 494 # Target: dav
559 TEMP_CFLAGS= 495 TEMP_CFLAGS=
560 TEMP_LDFLAGS= 496 TEMP_LDFLAGS=
561 TEMP_CXXFLAGS= 497
562 498 if ! dependency_curl; then
563 dependency_curl
564 if [ $? -ne 0 ]; then
565 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl " 499 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl "
566 ERROR=1 500 ERROR=1
567 fi 501 fi
568 dependency_libxml2 502 if ! dependency_libxml2; then
569 if [ $? -ne 0 ]; then
570 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " 503 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
571 ERROR=1 504 ERROR=1
572 fi 505 fi
573 dependency_test 506 if ! dependency_test; then
574 if [ $? -ne 0 ]; then
575 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED test " 507 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED test "
576 ERROR=1 508 ERROR=1
577 fi 509 fi
578 510
579 # Features 511 # Features
580 if [ -n "$FEATURE_DB" ]; then 512 if [ -n "$FEATURE_DB" ]; then
581 # check dependency 513 # check dependency
582 dependency_sqlite 514 if ! dependency_sqlite ; then
583 if [ $? -ne 0 ]; then
584 # "auto" features can fail and are just disabled in this case 515 # "auto" features can fail and are just disabled in this case
585 if [ "$FEATURE_DB" != "auto" ]; then 516 if [ "$FEATURE_DB" = "auto" ]; then
517 unset FEATURE_DB
518 else
586 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sqlite " 519 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sqlite "
587 ERROR=1 520 ERROR=1
588 else
589 unset FEATURE_DB
590 fi 521 fi
591 fi 522 fi
592 fi 523 fi
593 if [ -n "$FEATURE_GUI" ]; then 524 if [ -n "$FEATURE_GUI" ]; then
594 # check dependency 525 # check dependency
595 dependency_gtk3 526 if ! dependency_gtk3 ; then
596 if [ $? -ne 0 ]; then
597 # "auto" features can fail and are just disabled in this case 527 # "auto" features can fail and are just disabled in this case
598 if [ "$FEATURE_GUI" != "auto" ]; then 528 if [ "$FEATURE_GUI" = "auto" ]; then
529 unset FEATURE_GUI
530 else
599 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED gtk3 " 531 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED gtk3 "
600 ERROR=1 532 ERROR=1
601 else
602 unset FEATURE_GUI
603 fi 533 fi
604 fi 534 fi
605 fi 535 fi
606 536
607 # Option: --toolkit 537 # Option: --toolkit
608 if [ -z $OPT_TOOLKIT ]; then 538 if [ -z $OPT_TOOLKIT ]; then
609 SAVED_ERROR="$ERROR" 539 SAVED_ERROR="$ERROR"
610 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" 540 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
611 ERROR=0 541 ERROR=1
612 while true 542 while true
613 do 543 do
614 if isplatform "windows"; then 544 if isplatform "windows"; then
615 checkopt_toolkit_wpf 545 if checkopt_toolkit_wpf ; then
616 if [ $? -eq 0 ]; then
617 echo " toolkit: wpf" >> "$TEMP_DIR/options" 546 echo " toolkit: wpf" >> "$TEMP_DIR/options"
618 ERROR=0 547 ERROR=0
619 break 548 break
620 fi 549 fi
621 fi 550 fi
622 checkopt_toolkit_gtk3 551 if checkopt_toolkit_gtk3 ; then
623 if [ $? -eq 0 ]; then
624 echo " toolkit: gtk3" >> "$TEMP_DIR/options" 552 echo " toolkit: gtk3" >> "$TEMP_DIR/options"
625 ERROR=0 553 ERROR=0
626 break 554 break
627 fi 555 fi
628 checkopt_toolkit_gtk2 556 if checkopt_toolkit_gtk2 ; then
629 if [ $? -eq 0 ]; then
630 echo " toolkit: gtk2" >> "$TEMP_DIR/options" 557 echo " toolkit: gtk2" >> "$TEMP_DIR/options"
631 ERROR=0 558 ERROR=0
632 break 559 break
633 fi 560 fi
634 break 561 break
641 else 568 else
642 if false; then 569 if false; then
643 false 570 false
644 elif [ "$OPT_TOOLKIT" = "gtk3" ]; then 571 elif [ "$OPT_TOOLKIT" = "gtk3" ]; then
645 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 572 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
646 checkopt_toolkit_gtk3 573 if ! checkopt_toolkit_gtk3 ; then
647 if [ $? -ne 0 ]; then
648 ERROR=1 574 ERROR=1
649 fi 575 fi
650 elif [ "$OPT_TOOLKIT" = "cli" ]; then 576 elif [ "$OPT_TOOLKIT" = "cli" ]; then
651 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 577 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
652 checkopt_toolkit_cli 578 if ! checkopt_toolkit_cli ; then
653 if [ $? -ne 0 ]; then
654 ERROR=1 579 ERROR=1
655 fi 580 fi
656 elif [ "$OPT_TOOLKIT" = "gtk2" ]; then 581 elif [ "$OPT_TOOLKIT" = "gtk2" ]; then
657 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 582 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
658 checkopt_toolkit_gtk2 583 if ! checkopt_toolkit_gtk2 ; then
659 if [ $? -ne 0 ]; then
660 ERROR=1 584 ERROR=1
661 fi 585 fi
662 elif [ "$OPT_TOOLKIT" = "wpf" ]; then 586 elif [ "$OPT_TOOLKIT" = "wpf" ]; then
663 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options 587 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
664 checkopt_toolkit_wpf 588 if ! checkopt_toolkit_wpf ; then
665 if [ $? -ne 0 ]; then
666 ERROR=1 589 ERROR=1
667 fi 590 fi
668 fi 591 fi
669 fi 592 fi
670 593
671 echo >> "$TEMP_DIR/config.mk" 594 echo >> "$TEMP_DIR/config.mk"
672 if [ -n "${TEMP_CFLAGS}" ]; then 595 if [ -n "${TEMP_CFLAGS}" ]; then
673 echo "DAV_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" 596 echo "DAV_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk"
674 fi 597 fi
675 if [ -n "${TEMP_CXXFLAGS}" ]; then
676 echo "DAV_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk"
677 fi
678 if [ "$BUILD_TYPE" = "debug" ]; then 598 if [ "$BUILD_TYPE" = "debug" ]; then
679 echo 'DAV_CFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" 599 echo 'DAV_CFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk"
680 echo 'DAV_CXXFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk"
681 fi 600 fi
682 if [ "$BUILD_TYPE" = "release" ]; then 601 if [ "$BUILD_TYPE" = "release" ]; then
683 echo 'DAV_CFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" 602 echo 'DAV_CFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk"
684 echo 'DAV_CXXFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk"
685 fi 603 fi
686 if [ -n "${TEMP_LDFLAGS}" ]; then 604 if [ -n "${TEMP_LDFLAGS}" ]; then
687 echo "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" 605 echo "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk"
688 fi 606 fi
689 607
690 # Target 608 # Target
691 TEMP_CFLAGS= 609 TEMP_CFLAGS=
692 TEMP_LDFLAGS= 610 TEMP_LDFLAGS=
693 TEMP_CXXFLAGS= 611
694 612 if ! dependency_deptest; then
695 dependency_deptest
696 if [ $? -ne 0 ]; then
697 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED deptest " 613 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED deptest "
698 ERROR=1 614 ERROR=1
699 fi 615 fi
700 616
701 # Features 617 # Features
703 619
704 echo >> "$TEMP_DIR/config.mk" 620 echo >> "$TEMP_DIR/config.mk"
705 if [ -n "${TEMP_CFLAGS}" ]; then 621 if [ -n "${TEMP_CFLAGS}" ]; then
706 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" 622 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk"
707 fi 623 fi
708 if [ -n "${TEMP_CXXFLAGS}" ]; then
709 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk"
710 fi
711 if [ "$BUILD_TYPE" = "debug" ]; then 624 if [ "$BUILD_TYPE" = "debug" ]; then
712 echo 'CFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" 625 echo 'CFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk"
713 echo 'CXXFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk"
714 fi 626 fi
715 if [ "$BUILD_TYPE" = "release" ]; then 627 if [ "$BUILD_TYPE" = "release" ]; then
716 echo 'CFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" 628 echo 'CFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk"
717 echo 'CXXFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk"
718 fi 629 fi
719 if [ -n "${TEMP_LDFLAGS}" ]; then 630 if [ -n "${TEMP_LDFLAGS}" ]; then
720 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" 631 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk"
721 fi 632 fi
722 633
723 if [ $ERROR -ne 0 ]; then 634 if [ $ERROR -ne 0 ]; then
724 echo 635 echo
725 echo "Error: Unresolved dependencies" 636 echo "Error: Unresolved dependencies"
726 echo "$DEPENDENCIES_FAILED" 637 echo "$DEPENDENCIES_FAILED"
727 rm -Rf "$TEMP_DIR" 638 abort_configure
728 exit 1
729 fi 639 fi
730 640
731 echo "configure finished" 641 echo "configure finished"
732 echo 642 echo
733 echo "Build Config:" 643 echo "Build Config:"

mercurial