test/make/configure.vm

changeset 61
2c68549dabef
parent 59
410e4f942ce7
child 63
ac47c2fb2c4a
equal deleted inserted replaced
51:5c12e9e29733 61:2c68549dabef
1 #!/bin/sh 1 #!/bin/sh
2 2
3 # create temporary directory
4 TEMP_DIR=".tmp-`uname -n`"
5 rm -Rf "$TEMP_DIR"
6 if mkdir -p "$TEMP_DIR"; then
7 :
8 else
9 echo "Cannot create tmp dir $TEMP_DIR"
10 echo "Abort"
11 exit 1
12 fi
13 touch "$TEMP_DIR/options"
14 touch "$TEMP_DIR/features"
15
16 # define standard variables
17 PREFIX=/usr
18 EPREFIX=/usr
19 BINDIR=
20 SBINDIR=
21 LIBDIR=
22 LIBEXECDIR=
23 DATADIR=
24 SYSCONFDIR=
25 SHAREDSTATEDIR=
26 LOCALSTATEDIR=
27 INCLUDEDIR=
28 INFODIR=
29 MANDIR=
30
31 # custom variables
3 #foreach( $var in $vars ) 32 #foreach( $var in $vars )
4 #if( $var.exec ) 33 #if( $var.exec )
5 ${var.varName}=`${var.value}` 34 ${var.varName}=`${var.value}`
6 #else 35 #else
7 ${var.varName}=${var.value} 36 ${var.varName}=${var.value}
8 #end 37 #end
9 #end 38 #end
10 39
11 #if ( ! $project.hasVar("PREFIX") )
12 PREFIX=/usr
13 #end
14 #if ( ! $project.hasVar("EPREFIX") )
15 EPREFIX=$PREFIX
16 #end
17
18 #if ( ! $project.hasVar("BINDIR") )
19 BINDIR=
20 #end
21 #if ( ! $project.hasVar("SBINDIR") )
22 SBINDIR=
23 #end
24 #if ( ! $project.hasVar("LIBDIR") )
25 LIBDIR=
26 #end
27 #if ( ! $project.hasVar("LIBEXECDIR") )
28 LIBEXECDIR=
29 #end
30 #if ( ! $project.hasVar("DATADIR") )
31 DATADIR=
32 #end
33 #if ( ! $project.hasVar("SYSCONFDIR") )
34 SYSCONFDIR=
35 #end
36 #if ( ! $project.hasVar("SHAREDSTATEDIR") )
37 SHAREDSTATEDIR=
38 #end
39 #if ( ! $project.hasVar("LOCALSTATEDIR") )
40 LOCALSTATEDIR=
41 #end
42 #if ( ! $project.hasVar("INCLUDEDIR") )
43 INCLUDEDIR=
44 #end
45 #if ( ! $project.hasVar("INFODIR") )
46 INFODIR=
47 #end
48 #if ( ! $project.hasVar("MANDIR") )
49 MANDIR=
50 #end
51
52 OS=`uname -s`
53 OS_VERSION=`uname -r`
54
55 TEMP_DIR=".tmp-`uname -n`"
56 mkdir -p "$TEMP_DIR"
57 if [ $? -ne 0 ]; then
58 echo "Cannot create tmp dir"
59 echo "Abort"
60 fi
61 touch "$TEMP_DIR/options"
62 touch "$TEMP_DIR/features"
63
64 # features 40 # features
65 #foreach( $feature in $features ) 41 #foreach( $feature in $features )
66 #if( ${feature.isDefault()} ) 42 #if( ${feature.isDefault()} )
67 ${feature.getVarName()}=auto 43 ${feature.getVarName()}=auto
68 #end 44 #end
69 #end 45 #end
46
47 # clean abort
48 abort_configure()
49 {
50 rm -Rf "$TEMP_DIR"
51 exit 1
52 }
70 53
71 # help text 54 # help text
72 printhelp() 55 printhelp()
73 { 56 {
74 echo "Usage: $0 [OPTIONS]..." 57 echo "Usage: $0 [OPTIONS]..."
134 "--sharedstatedir="*) SHAREDSTATEDIR=${D}{ARG#--sharedstatedir=} ;; 117 "--sharedstatedir="*) SHAREDSTATEDIR=${D}{ARG#--sharedstatedir=} ;;
135 "--localstatedir="*) LOCALSTATEDIR=${D}{ARG#--localstatedir=} ;; 118 "--localstatedir="*) LOCALSTATEDIR=${D}{ARG#--localstatedir=} ;;
136 "--includedir="*) INCLUDEDIR=${D}{ARG#--includedir=} ;; 119 "--includedir="*) INCLUDEDIR=${D}{ARG#--includedir=} ;;
137 "--infodir="*) INFODIR=${D}{ARG#--infodir=} ;; 120 "--infodir="*) INFODIR=${D}{ARG#--infodir=} ;;
138 "--mandir"*) MANDIR=${D}{ARG#--mandir} ;; 121 "--mandir"*) MANDIR=${D}{ARG#--mandir} ;;
139 "--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;; 122 "--help"*) printhelp; abort_configure ;;
140 "--debug") BUILD_TYPE="debug" ;; 123 "--debug") BUILD_TYPE="debug" ;;
141 "--release") BUILD_TYPE="release" ;; 124 "--release") BUILD_TYPE="release" ;;
142 #foreach( $opt in $options ) 125 #foreach( $opt in $options )
143 "--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;; 126 "--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;;
144 #end 127 #end
145 #foreach( $feature in $features ) 128 #foreach( $feature in $features )
146 "--enable-${feature.arg}") ${feature.getVarName()}=on ;; 129 "--enable-${feature.arg}") ${feature.getVarName()}=on ;;
147 "--disable-${feature.arg}") unset ${feature.getVarName()} ;; 130 "--disable-${feature.arg}") unset ${feature.getVarName()} ;;
148 #end 131 #end
149 "-"*) echo "unknown option: $ARG"; rm -Rf "$TEMP_DIR"; exit 1 ;; 132 "-"*) echo "unknown option: $ARG"; abort_configure ;;
150 esac 133 esac
151 done 134 done
152 135
136 ## Begin unparsed content. **
137 #[[
153 # set dir variables 138 # set dir variables
154 if [ -z "$BINDIR" ]; then 139 : ${BINDIR:="$EPREFIX/bin"}
155 BINDIR=$EPREFIX/bin 140 : ${SBINDIR:="$EPREFIX/sbin"}
156 fi 141 : ${LIBDIR:="$EPREFIX/lib"}
157 if [ -z "$SBINDIR" ]; then 142 : ${LIBEXECDIR:="$EPREFIX/libexec"}
158 SBINDIR=$EPREFIX/sbin 143 : ${DATADIR:="$PREFIX/share"}
159 fi 144 : ${SYSCONFDIR:="$PREFIX/etc"}
160 if [ -z "$LIBDIR" ]; then 145 : ${SHAREDSTATEDIR:="$PREFIX/com"}
161 LIBDIR=$EPREFIX/lib 146 : ${LOCALSTATEDIR:="$PREFIX/var"}
162 fi 147 : ${INCLUDEDIR:="$PREFIX/include"}
163 if [ -z "$LIBEXEC" ]; then 148 : ${INFODIR:="$PREFIX/info"}
164 LIBEXECDIR=$EPREFIX/libexec 149 : ${MANDIR:="$PREFIX/man"}
165 fi 150
166 if [ -z "$DATADIR" ]; then 151 # Test for availability of pkg-config
167 DATADIR=$PREFIX/share 152 PKG_CONFIG=`command -v pkg-config`
168 fi 153 : ${PKG_CONFIG:="false"}
169 if [ -z "$SYSCONFDIR" ]; then
170 SYSCONFDIR=$PREFIX/etc
171 fi
172 if [ -z "$SHAREDSTATEDIR" ]; then
173 SHAREDSTATEDIR=$PREFIX/com
174 fi
175 if [ -z "$LOCALSTATEDIR" ]; then
176 LOCALSTATEDIR=$PREFIX/var
177 fi
178 if [ -z "$INCLUDEDIR" ]; then
179 INCLUDEDIR=$PREFIX/include
180 fi
181 if [ -z "$INFODIR" ]; then
182 INFODIR=$PREFIX/info
183 fi
184 if [ -z "$MANDIR" ]; then
185 MANDIR=$PREFIX/man
186 fi
187
188 which pkg-config > /dev/null
189 if [ $? -eq 0 ]; then
190 PKG_CONFIG=pkg-config
191 else
192 PKG_CONFIG=false
193 fi
194 154
195 # Simple uname based platform detection 155 # Simple uname based platform detection
196 # $PLATFORM is used for platform dependent dependency selection 156 # $PLATFORM is used for platform dependent dependency selection
157 OS=`uname -s`
158 OS_VERSION=`uname -r`
197 printf "detect platform... " 159 printf "detect platform... "
198 if [ "$OS" = "SunOS" ]; then 160 if [ "$OS" = "SunOS" ]; then
199 PLATFORM="solaris sunos unix svr4" 161 PLATFORM="solaris sunos unix svr4"
200 fi 162 fi
201 if [ "$OS" = "Linux" ]; then 163 if [ "$OS" = "Linux" ]; then
205 PLATFORM="freebsd bsd unix" 167 PLATFORM="freebsd bsd unix"
206 fi 168 fi
207 if [ "$OS" = "Darwin" ]; then 169 if [ "$OS" = "Darwin" ]; then
208 PLATFORM="macos osx bsd unix" 170 PLATFORM="macos osx bsd unix"
209 fi 171 fi
210 echo "$OS" | grep -i "MINGW" > /dev/null 172 if echo "$OS" | grep -i "MINGW" > /dev/null; then
211 if [ $? -eq 0 ]; then
212 PLATFORM="windows mingw" 173 PLATFORM="windows mingw"
213 fi 174 fi
214 175 : ${PLATFORM:="unix"}
215 if [ -z "$PLATFORM" ]; then 176
216 PLATFORM="unix" 177 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
217 fi 178 echo "$PLATFORM_NAME"
218
219 for p in $PLATFORM
220 do
221 PLATFORM_NAME=$p
222 break
223 done
224 echo $PLATFORM_NAME
225 179
226 isplatform() 180 isplatform()
227 { 181 {
228 for p in $PLATFORM 182 for p in $PLATFORM
229 do 183 do
231 return 0 185 return 0
232 fi 186 fi
233 done 187 done
234 return 1 188 return 1
235 } 189 }
236 isnotplatform() 190 notisplatform()
237 { 191 {
238 for p in $PLATFORM 192 for p in $PLATFORM
239 do 193 do
240 if [ "$p" = "$1" ]; then 194 if [ "$p" = "$1" ]; then
241 return 1 195 return 1
242 fi 196 fi
243 done 197 done
244 return 0 198 return 0
245 } 199 }
246 200 ]]#
247 # generate config.mk and config.h 201 ## End of unparsed content **
248 cat > "$TEMP_DIR/config.mk" << __EOF__ 202
249 # 203 # generate config.mk
250 # config.mk generated by configure 204 cat > "$TEMP_DIR/vars.mk" << __EOF__
251 # 205 PREFIX=$PREFIX
252 206 EPREFIX=$EPREFIX
253 # general vars 207 BINDIR=$BINDIR
208 SBINDIR=$SBINDIR
209 LIBDIR=$LIBDIR
210 LIBEXECDIR=$LIBEXECDIR
211 DATADIR=$DATADIR
212 SYSCONFDIR=$SYSCONFDIR
213 SHAREDSTATEDIR=$SHAREDSTATEDIR
214 LOCALSTATEDIR=$LOCALSTATEDIR
215 INCLUDEDIR=$INCLUDEDIR
216 INFODIR=$INFODIR
217 MANDIR=$MANDIR
254 #foreach( $var in $vars ) 218 #foreach( $var in $vars )
255 ${var.varName}=$${var.varName} 219 ${var.varName}=$${var.varName}
256 #end 220 #end
257
258 #if ( ! $project.hasVar("PREFIX") )
259 PREFIX=$PREFIX
260 #end
261 #if ( ! $project.hasVar("EPREFIX") )
262 EPREFIX=$EPREFIX
263 #end
264
265 #if ( ! $project.hasVar("BINDIR") )
266 BINDIR=$BINDIR
267 #end
268 #if ( ! $project.hasVar("SBINDIR") )
269 SBINDIR=$SBINDIR
270 #end
271 #if ( ! $project.hasVar("LIBDIR") )
272 LIBDIR=$LIBDIR
273 #end
274 #if ( ! $project.hasVar("LIBEXECDIR") )
275 LIBEXECDIR=$LIBEXECDIR
276 #end
277 #if ( ! $project.hasVar("DATADIR") )
278 DATADIR=$DATADIR
279 #end
280 #if ( ! $project.hasVar("SYSCONFDIR") )
281 SYSCONFDIR=$SYSCONFDIR
282 #end
283 #if ( ! $project.hasVar("SHAREDSTATEDIR") )
284 SHAREDSTATEDIR=$SHAREDSTATEDIR
285 #end
286 #if ( ! $project.hasVar("LOCALSTATEDIR") )
287 LOCALSTATEDIR=$LOCALSTATEDIR
288 #end
289 #if ( ! $project.hasVar("INCLUDEDIR") )
290 INCLUDEDIR=$INCLUDEDIR
291 #end
292 #if ( ! $project.hasVar("INFODIR") )
293 INFODIR=$INFODIR
294 #end
295 #if ( ! $project.hasVar("MANDIR") )
296 MANDIR=$MANDIR
297 #end
298
299 __EOF__ 221 __EOF__
300 222 cat > "$TEMP_DIR/config.mk" << __EOF__
301 echo > "$TEMP_DIR/make.mk" 223 #
302 224 # config.mk generated by configure
303 ENV_CFLAGS=$CFLAGS 225 #
304 ENV_LDFLAGS=$LDFLAGS 226 __EOF__
305 ENV_CXXFLAGS=$CXXFLAGS 227 sort -u "$TEMP_DIR/vars.mk" >> "$TEMP_DIR/config.mk"
306 228
307 # Toolchain detection 229
230 # toolchain detection
308 # this will insert make vars to config.mk 231 # this will insert make vars to config.mk
309 . make/toolchain.sh 232 . make/toolchain.sh
310 233 if [ -n "$TOOLCHAIN_ERROR" ]; then
311 # add user specified flags to config.mk 234 echo "Toolchain error: $TOOLCHAIN_ERROR"
312 echo "# project specific flags" >> "$TEMP_DIR/config.mk" 235 echo "Abort."
313 if [ -n "${ENV_CFLAGS}" ]; then 236 abort_configure
314 echo "CFLAGS += $ENV_CFLAGS" >> "$TEMP_DIR/config.mk"
315 fi
316 if [ -n "${ENV_CXXFLAGS}" ]; then
317 echo "CXXFLAGS += $ENV_CXXFLAGS" >> "$TEMP_DIR/config.mk"
318 fi
319 if [ -n "${ENV_LDFLAGS}" ]; then
320 echo "LDFLAGS += $ENV_LDFLAGS" >> "$TEMP_DIR/config.mk"
321 fi 237 fi
322 238
323 # 239 #
324 # DEPENDENCIES 240 # DEPENDENCIES
325 # 241 #
326 242
243 # create buffer for make variables required by dependencies
244 echo > "$TEMP_DIR/make.mk"
245
327 #foreach( $dependency in $namedDependencies ) 246 #foreach( $dependency in $namedDependencies )
328 dependency_${dependency.name}() 247 dependency_error_${dependency.name}()
329 { 248 {
330 printf "checking for ${dependency.name}... " 249 printf "checking for ${dependency.name}... "
331 #foreach( $sub in $dependency.getSubdependencies() ) 250 #foreach( $sub in $dependency.getSubdependencies() )
332 # dependency $sub.getFullName() 251 # dependency $sub.getFullName()
333 while true 252 while true
334 do 253 do
335 #if( $sub.platform ) 254 #if( $sub.platform )
336 if isnotplatform "${sub.platform}"; then 255 if notisplatform "${sub.platform}"; then
337 break 256 break
338 fi 257 fi
339 #end 258 #end
340 #foreach( $not in $sub.getNotList() ) 259 #foreach( $np in $sub.getNotList() )
341 if isplatform "${not}"; then 260 if isplatform "${np}"; then
342 break 261 break
343 fi 262 fi
344 #end 263 #end
345 #if( $sub.pkgconfig.size() > 0 ) 264 #if( $sub.pkgconfig.size() > 0 )
346 if [ -z "$PKG_CONFIG" ]; then 265 if [ -z "$PKG_CONFIG" ]; then
347 break 266 break
348 fi 267 fi
349 #end 268 #end
350 #foreach( $test in $sub.tests ) 269 #foreach( $test in $sub.tests )
351 $test > /dev/null 270 if $test > /dev/null ; then
352 if [ $? -ne 0 ]; then 271 :
353 break 272 else
273 break
354 fi 274 fi
355 #end 275 #end
356 #foreach( $pkg in $sub.pkgconfig ) 276 #foreach( $pkg in $sub.pkgconfig )
357 $pkg.getPkgConfigTestQuery() 277 if $pkg.getPkgConfigTestQuery() ; then
358 if [ $? -ne 0 ] ; then 278 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`"
359 break 279 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`"
360 fi 280 else
361 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags $pkg.name`" 281 break
362 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs $pkg.name`" 282 fi
363 #end 283 #end
364 #foreach( $flags in $sub.flags ) 284 #foreach( $flags in $sub.flags )
365 #if( $flags.exec ) 285 #if( $flags.exec )
366 $flags.value > /dev/null 286 if tmp_flags=`$flags.value` ; then
367 if [ $? -eq 0 ]; then 287 TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags"
368 TEMP_$flags.varName="$TEMP_$flags.varName `$flags.value`"
369 else 288 else
370 break 289 break
371 fi 290 fi
372 #else 291 #else
373 TEMP_$flags.varName="$TEMP_$flags.varName $flags.value" 292 TEMP_$flags.varName="$TEMP_$flags.varName $flags.value"
378 # Dependency: $dependency.name 297 # Dependency: $dependency.name
379 $sub.make 298 $sub.make
380 __EOF__ 299 __EOF__
381 #end 300 #end
382 echo yes 301 echo yes
383 return 0 302 return 1
384 done 303 done
385 304
386 #end 305 #end
387 echo no 306 echo no
388 return 1 307 return 0
389 } 308 }
390 #end 309 #end
391 310
392 DEPENDENCIES_FAILED= 311 DEPENDENCIES_FAILED=
393 ERROR=0 312 ERROR=0
394 #if( $dependencies.size() > 0 ) 313 #if( $dependencies.size() > 0 )
395 # general dependencies 314 # unnamed dependencies
396 TEMP_CFLAGS= 315 TEMP_CFLAGS=
397 TEMP_LDFLAGS= 316 TEMP_LDFLAGS=
398 #foreach( $dependency in $dependencies ) 317 #foreach( $dependency in $dependencies )
399 while true 318 while true
400 do 319 do
401 #if( $dependency.platform ) 320 #if( $dependency.platform )
402 if isnotplatform "${dependency.platform}"; then 321 if notisplatform "${dependency.platform}"; then
403 break 322 break
404 fi 323 fi
405 #end 324 #end
406 #foreach( $not in $dependency.getNotList() ) 325 #foreach( $np in $dependency.getNotList() )
407 if isplatform "${not}"; then 326 if isplatform "${np}"; then
408 break 327 break
409 fi 328 fi
410 #end 329 #end
411 while true 330 while true
412 do 331 do
416 break 335 break
417 fi 336 fi
418 #end 337 #end
419 #foreach( $pkg in $dependency.pkgconfig ) 338 #foreach( $pkg in $dependency.pkgconfig )
420 printf "checking for pkg-config package $pkg.name... " 339 printf "checking for pkg-config package $pkg.name... "
421 $pkg.getPkgConfigTestQuery() 340 if $pkg.getPkgConfigTestQuery() ; then
422 if [ $? -ne 0 ]; then 341 echo yes
342 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`"
343 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`"
344 else
423 echo no 345 echo no
424 ERROR=1 346 ERROR=1
425 break 347 break
426 fi 348 fi
427 echo yes
428 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags $pkg.name`"
429 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs $pkg.name`"
430 #end 349 #end
431 350
432 #foreach( $flags in $dependency.flags ) 351 #foreach( $flags in $dependency.flags )
433 #if( $flags.exec ) 352 #if( $flags.exec )
434 $flags.value > /dev/null 353 $flags.value > /dev/null
435 if [ $? -ne 0 ]; then 354 if tmp_flags=`$flags.value` ; then
436 TEMP_$flags.varName="$TEMP_$flags.varName `$flags.value`" 355 TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags"
437 else 356 else
438 ERROR=1 357 ERROR=1
439 break 358 break
440 fi 359 fi
441 #else 360 #else
445 #if ( $dependency.make.length() > 0 ) 364 #if ( $dependency.make.length() > 0 )
446 cat >> "$TEMP_DIR/make.mk" << __EOF__ 365 cat >> "$TEMP_DIR/make.mk" << __EOF__
447 $dependency.make 366 $dependency.make
448 __EOF__ 367 __EOF__
449 #end 368 #end
450
451 break 369 break
452 done 370 done
453
454 break 371 break
455 done 372 done
456 #end 373 #end
457 374
458 # add general dependency flags to config.mk 375 # add unnamed dependency flags to config.mk
459 echo >> "$TEMP_DIR/config.mk" 376 echo >> "$TEMP_DIR/config.mk"
460 if [ -n "${TEMP_CFLAGS}" ]; then 377 if [ -n "${TEMP_CFLAGS}" ]; then
461 echo "CFLAGS += $TEMP_CFLAGS" >> $TEMP_DIR/config.mk 378 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk"
462 fi
463 if [ -n "${TEMP_CXXFLAGS}" ]; then
464 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> $TEMP_DIR/config.mk
465 fi 379 fi
466 if [ -n "${TEMP_LDFLAGS}" ]; then 380 if [ -n "${TEMP_LDFLAGS}" ]; then
467 echo "LDFLAGS += $TEMP_LDFLAGS" >> $TEMP_DIR/config.mk 381 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk"
468 fi 382 fi
469 #end 383 #end
470 384
471 # 385 #
472 # OPTION VALUES 386 # OPTION VALUES
475 #foreach( $val in $opt.values ) 389 #foreach( $val in $opt.values )
476 ${val.func}() 390 ${val.func}()
477 { 391 {
478 VERR=0 392 VERR=0
479 #foreach( $dep in $val.dependencies ) 393 #foreach( $dep in $val.dependencies )
480 dependency_$dep 394 if dependency_error_$dep ; then
481 if [ $? -ne 0 ]; then
482 VERR=1 395 VERR=1
483 fi 396 fi
484 #end 397 #end
485 if [ $VERR -ne 0 ]; then 398 if [ $VERR -ne 0 ]; then
486 return 1 399 return 1
499 #end 412 #end
500 413
501 # 414 #
502 # TARGETS 415 # TARGETS
503 # 416 #
504 TEMP_CFLAGS=
505 TEMP_CXXFLAGS=
506 TEMP_LDFLAGS=
507 417
508 #foreach( $target in $targets ) 418 #foreach( $target in $targets )
509 #if ( $target.name ) 419 #if ( $target.name )
510 # Target: $target.name 420 # Target: $target.name
511 #else 421 #else
512 # Target 422 # Target
513 #end 423 #end
514 TEMP_CFLAGS= 424 TEMP_CFLAGS=
515 TEMP_LDFLAGS= 425 TEMP_LDFLAGS=
516 TEMP_CXXFLAGS=
517 426
518 #foreach( $dependency in $target.dependencies ) 427 #foreach( $dependency in $target.dependencies )
519 dependency_$dependency 428 if dependency_error_$dependency; then
520 if [ $? -ne 0 ]; then
521 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " 429 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
522 ERROR=1 430 ERROR=1
523 fi 431 fi
524 #end 432 #end
525 433
526 # Features 434 # Features
527 #foreach( $feature in $target.features ) 435 #foreach( $feature in $target.features )
528 if [ -n "$${feature.getVarName()}" ]; then 436 if [ -n "$${feature.getVarName()}" ]; then
529 #foreach( $dependency in $feature.dependencies ) 437 #foreach( $dependency in $feature.dependencies )
530 # check dependency 438 # check dependency
531 dependency_$dependency 439 if dependency_error_$dependency ; then
532 if [ $? -ne 0 ]; then
533 # "auto" features can fail and are just disabled in this case 440 # "auto" features can fail and are just disabled in this case
534 if [ "$${feature.getVarName()}" != "auto" ]; then 441 if [ "$${feature.getVarName()}" = "auto" ]; then
442 unset ${feature.getVarName()}
443 else
535 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " 444 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
536 ERROR=1 445 ERROR=1
537 else
538 unset ${feature.getVarName()}
539 fi 446 fi
540 fi 447 fi
541 #end 448 #end
542 fi 449 fi
543 #end 450 #end
545 #foreach( $opt in $target.options ) 452 #foreach( $opt in $target.options )
546 # Option: --${opt.argument} 453 # Option: --${opt.argument}
547 if [ -z ${D}${opt.getVarName()} ]; then 454 if [ -z ${D}${opt.getVarName()} ]; then
548 SAVED_ERROR="$ERROR" 455 SAVED_ERROR="$ERROR"
549 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" 456 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
550 ERROR=0 457 ERROR=1
551 while true 458 while true
552 do 459 do
553 #foreach( $optdef in $opt.defaults ) 460 #foreach( $optdef in $opt.defaults )
554 #if( $optdef.platform ) 461 #if( $optdef.platform )
555 if isplatform "$optdef.platform"; then 462 if isplatform "$optdef.platform"; then
556 #end 463 #end
557 $optdef.func 464 if $optdef.func ; then
558 if [ $? -eq 0 ]; then
559 echo " ${opt.argument}: ${optdef.valueName}" >> "$TEMP_DIR/options" 465 echo " ${opt.argument}: ${optdef.valueName}" >> "$TEMP_DIR/options"
560 ERROR=0 466 ERROR=0
561 break 467 break
562 fi 468 fi
563 #if( $optdef.platform ) 469 #if( $optdef.platform )
575 if false; then 481 if false; then
576 false 482 false
577 #foreach( $optval in $opt.values ) 483 #foreach( $optval in $opt.values )
578 elif [ "${D}${opt.getVarName()}" = "${optval.value}" ]; then 484 elif [ "${D}${opt.getVarName()}" = "${optval.value}" ]; then
579 echo " ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options 485 echo " ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options
580 $optval.func 486 if $optval.func ; then
581 if [ $? -ne 0 ]; then 487 :
488 else
582 ERROR=1 489 ERROR=1
583 fi 490 fi
584 #end 491 #end
585 fi 492 fi
586 fi 493 fi
588 495
589 echo >> "$TEMP_DIR/config.mk" 496 echo >> "$TEMP_DIR/config.mk"
590 if [ -n "${TEMP_CFLAGS}" ]; then 497 if [ -n "${TEMP_CFLAGS}" ]; then
591 echo "${target.getCFlags()} += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk" 498 echo "${target.getCFlags()} += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk"
592 fi 499 fi
593 if [ -n "${TEMP_CXXFLAGS}" ]; then
594 echo "${target.getCXXFlags()} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk"
595 fi
596 if [ "$BUILD_TYPE" = "debug" ]; then 500 if [ "$BUILD_TYPE" = "debug" ]; then
597 echo '${target.getCFlags()} += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" 501 echo '${target.getCFlags()} += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk"
598 echo '${target.getCXXFlags()} += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk"
599 fi 502 fi
600 if [ "$BUILD_TYPE" = "release" ]; then 503 if [ "$BUILD_TYPE" = "release" ]; then
601 echo '${target.getCFlags()} += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" 504 echo '${target.getCFlags()} += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk"
602 echo '${target.getCXXFlags()} += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk"
603 fi 505 fi
604 if [ -n "${TEMP_LDFLAGS}" ]; then 506 if [ -n "${TEMP_LDFLAGS}" ]; then
605 echo "${target.getLDFlags()} += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" 507 echo "${target.getLDFlags()} += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk"
606 fi 508 fi
607 509
608 #end 510 #end
609 if [ $ERROR -ne 0 ]; then 511 if [ $ERROR -ne 0 ]; then
610 echo 512 echo
611 echo "Error: Unresolved dependencies" 513 echo "Error: Unresolved dependencies"
612 echo "$DEPENDENCIES_FAILED" 514 echo "$DEPENDENCIES_FAILED"
613 rm -Rf "$TEMP_DIR" 515 abort_configure
614 exit 1
615 fi 516 fi
616 517
617 echo "configure finished" 518 echo "configure finished"
618 echo 519 echo
619 echo "Build Config:" 520 echo "Build Config:"

mercurial