| |
1 #!/bin/sh |
| |
2 |
| |
3 #set( $D = '$' ) |
| |
4 #[[ |
| |
5 # some utility functions |
| |
6 isplatform() |
| |
7 { |
| |
8 for p in $PLATFORM |
| |
9 do |
| |
10 if [ "$p" = "$1" ]; then |
| |
11 return 0 |
| |
12 fi |
| |
13 done |
| |
14 return 1 |
| |
15 } |
| |
16 notisplatform() |
| |
17 { |
| |
18 for p in $PLATFORM |
| |
19 do |
| |
20 if [ "$p" = "$1" ]; then |
| |
21 return 1 |
| |
22 fi |
| |
23 done |
| |
24 return 0 |
| |
25 } |
| |
26 istoolchain() |
| |
27 { |
| |
28 for t in $TOOLCHAIN |
| |
29 do |
| |
30 if [ "$t" = "$1" ]; then |
| |
31 return 0 |
| |
32 fi |
| |
33 done |
| |
34 return 1 |
| |
35 } |
| |
36 notistoolchain() |
| |
37 { |
| |
38 for t in $TOOLCHAIN |
| |
39 do |
| |
40 if [ "$t" = "$1" ]; then |
| |
41 return 1 |
| |
42 fi |
| |
43 done |
| |
44 return 0 |
| |
45 } |
| |
46 |
| |
47 # clean abort |
| |
48 abort_configure() |
| |
49 { |
| |
50 rm -Rf "$TEMP_DIR" |
| |
51 exit 1 |
| |
52 } |
| |
53 |
| |
54 # Test for availability of pkg-config |
| |
55 PKG_CONFIG=`command -v pkg-config` |
| |
56 : ${PKG_CONFIG:="false"} |
| |
57 |
| |
58 # Simple uname based platform detection |
| |
59 # $PLATFORM is used for platform dependent dependency selection |
| |
60 OS=`uname -s` |
| |
61 OS_VERSION=`uname -r` |
| |
62 printf "detect platform... " |
| |
63 if [ "$OS" = "SunOS" ]; then |
| |
64 PLATFORM="solaris sunos unix svr4" |
| |
65 elif [ "$OS" = "Linux" ]; then |
| |
66 PLATFORM="linux unix" |
| |
67 elif [ "$OS" = "FreeBSD" ]; then |
| |
68 PLATFORM="freebsd bsd unix" |
| |
69 elif [ "$OS" = "OpenBSD" ]; then |
| |
70 PLATFORM="openbsd bsd unix" |
| |
71 elif [ "$OS" = "NetBSD" ]; then |
| |
72 PLATFORM="netbsd bsd unix" |
| |
73 elif [ "$OS" = "Darwin" ]; then |
| |
74 PLATFORM="macos osx bsd unix" |
| |
75 elif echo "$OS" | grep -i "MINGW" > /dev/null; then |
| |
76 PLATFORM="windows mingw" |
| |
77 fi |
| |
78 : ${PLATFORM:="unix"} |
| |
79 |
| |
80 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` |
| |
81 echo "$PLATFORM_NAME" |
| |
82 ]]# |
| |
83 |
| |
84 # help text |
| |
85 printhelp() |
| |
86 { |
| |
87 echo "Usage: $0 [OPTIONS]..." |
| |
88 cat << __EOF__ |
| |
89 Installation directories: |
| |
90 --prefix=PREFIX path prefix for architecture-independent files |
| |
91 [${D}prefix] |
| |
92 --exec-prefix=EPREFIX path prefix for architecture-dependent files |
| |
93 [PREFIX] |
| |
94 |
| |
95 --bindir=DIR user executables [EPREFIX/bin] |
| |
96 --sbindir=DIR system admin executables [EPREFIX/sbin] |
| |
97 --libexecdir=DIR program executables [EPREFIX/libexec] |
| |
98 --sysconfdir=DIR system configuration files [PREFIX/etc] |
| |
99 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
| |
100 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
| |
101 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] |
| |
102 --libdir=DIR object code libraries [EPREFIX/lib] |
| |
103 --includedir=DIR C header files [PREFIX/include] |
| |
104 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
| |
105 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
| |
106 --infodir=DIR info documentation [DATAROOTDIR/info] |
| |
107 --mandir=DIR man documentation [DATAROOTDIR/man] |
| |
108 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
| |
109 |
| |
110 #if( $options.size() > 0 ) |
| |
111 Options: |
| |
112 --debug add extra compile flags for debug builds |
| |
113 --release add extra compile flags for release builds |
| |
114 #foreach( $opt in $options ) |
| |
115 --${opt.argument}=${opt.valuesString} |
| |
116 #end |
| |
117 |
| |
118 #end |
| |
119 #if( $features.size() > 0 ) |
| |
120 Optional Features: |
| |
121 #foreach( $feature in $features ) |
| |
122 ${feature.helpText} |
| |
123 #end |
| |
124 |
| |
125 #end |
| |
126 __EOF__ |
| |
127 } |
| |
128 |
| |
129 # create temporary directory |
| |
130 TEMP_DIR=".tmp-`uname -n`" |
| |
131 rm -Rf "$TEMP_DIR" |
| |
132 if mkdir -p "$TEMP_DIR"; then |
| |
133 : |
| |
134 else |
| |
135 echo "Cannot create tmp dir $TEMP_DIR" |
| |
136 echo "Abort" |
| |
137 exit 1 |
| |
138 fi |
| |
139 touch "$TEMP_DIR/options" |
| |
140 touch "$TEMP_DIR/features" |
| |
141 |
| |
142 # define standard variables |
| |
143 # also define standard prefix (this is where we will search for config.site) |
| |
144 prefix=/usr |
| |
145 exec_prefix= |
| |
146 bindir= |
| |
147 sbindir= |
| |
148 libdir= |
| |
149 libexecdir= |
| |
150 datarootdir= |
| |
151 datadir= |
| |
152 sysconfdir= |
| |
153 sharedstatedir= |
| |
154 localstatedir= |
| |
155 runstatedir= |
| |
156 includedir= |
| |
157 infodir= |
| |
158 localedir= |
| |
159 mandir= |
| |
160 |
| |
161 # custom variables |
| |
162 #foreach( $cfg in $config ) |
| |
163 if true \ |
| |
164 #if( $cfg.platform ) |
| |
165 && isplatform "${cfg.platform}" \ |
| |
166 #end |
| |
167 #foreach( $np in $cfg.notList ) |
| |
168 && notisplatform "${np}" \ |
| |
169 #end |
| |
170 ; then |
| |
171 #foreach( $var in $cfg.vars ) |
| |
172 #if( $var.exec ) |
| |
173 ${var.varName}=`${var.value}` |
| |
174 #else |
| |
175 ${var.varName}="${var.value}" |
| |
176 #end |
| |
177 #end |
| |
178 fi |
| |
179 #end |
| |
180 |
| |
181 # features |
| |
182 #foreach( $feature in $features ) |
| |
183 #if( ${feature.auto} ) |
| |
184 ${feature.varName}=auto |
| |
185 #end |
| |
186 #end |
| |
187 |
| |
188 # |
| |
189 # parse arguments |
| |
190 # |
| |
191 BUILD_TYPE="default" |
| |
192 for ARG in "$@" |
| |
193 do |
| |
194 case "$ARG" in |
| |
195 "--prefix="*) prefix=${D}{ARG#--prefix=} ;; |
| |
196 "--exec-prefix="*) exec_prefix=${D}{ARG#--exec-prefix=} ;; |
| |
197 "--bindir="*) bindir=${D}{ARG#----bindir=} ;; |
| |
198 "--sbindir="*) sbindir=${D}{ARG#--sbindir=} ;; |
| |
199 "--libdir="*) libdir=${D}{ARG#--libdir=} ;; |
| |
200 "--libexecdir="*) libexecdir=${D}{ARG#--libexecdir=} ;; |
| |
201 "--datarootdir="*) datarootdir=${D}{ARG#--datarootdir=} ;; |
| |
202 "--datadir="*) datadir=${D}{ARG#--datadir=} ;; |
| |
203 "--sysconfdir="*) sysconfdir=${D}{ARG#--sysconfdir=} ;; |
| |
204 "--sharedstatedir="*) sharedstatedir=${D}{ARG#--sharedstatedir=} ;; |
| |
205 "--localstatedir="*) localstatedir=${D}{ARG#--localstatedir=} ;; |
| |
206 "--includedir="*) includedir=${D}{ARG#--includedir=} ;; |
| |
207 "--infodir="*) infodir=${D}{ARG#--infodir=} ;; |
| |
208 "--mandir"*) mandir=${D}{ARG#--mandir} ;; |
| |
209 "--localedir"*) localedir=${D}{ARG#--localedir} ;; |
| |
210 "--help"*) printhelp; abort_configure ;; |
| |
211 "--debug") BUILD_TYPE="debug" ;; |
| |
212 "--release") BUILD_TYPE="release" ;; |
| |
213 #foreach( $opt in $options ) |
| |
214 "--${opt.argument}="*) ${opt.varName}=${D}{ARG#--${opt.argument}=} ;; |
| |
215 #end |
| |
216 #foreach( $feature in $features ) |
| |
217 "--enable-${feature.arg}") ${feature.varName}=on ;; |
| |
218 "--disable-${feature.arg}") unset ${feature.varName} ;; |
| |
219 #end |
| |
220 "-"*) echo "unknown option: $ARG"; abort_configure ;; |
| |
221 esac |
| |
222 done |
| |
223 |
| |
224 ## Begin unparsed content. ** |
| |
225 #[[ |
| |
226 |
| |
227 # set defaults for dir variables |
| |
228 : ${exec_prefix:="$prefix"} |
| |
229 : ${bindir:='${exec_prefix}/bin'} |
| |
230 : ${sbindir:='${exec_prefix}/sbin'} |
| |
231 : ${libdir:='${exec_prefix}/lib'} |
| |
232 : ${libexecdir:='${exec_prefix}/libexec'} |
| |
233 : ${datarootdir:='${prefix}/share'} |
| |
234 : ${datadir:='${datarootdir}'} |
| |
235 : ${sysconfdir:='${prefix}/etc'} |
| |
236 : ${sharedstatedir:='${prefix}/com'} |
| |
237 : ${localstatedir:='${prefix}/var'} |
| |
238 : ${runstatedir:='${localstatedir}/run'} |
| |
239 : ${includedir:='${prefix}/include'} |
| |
240 : ${infodir:='${datarootdir}/info'} |
| |
241 : ${mandir:='${datarootdir}/man'} |
| |
242 : ${localedir:='${datarootdir}/locale'} |
| |
243 |
| |
244 # check if a config.site exists and load it |
| |
245 if [ -n "$CONFIG_SITE" ]; then |
| |
246 # CONFIG_SITE may contain space separated file names |
| |
247 for cs in $CONFIG_SITE; do |
| |
248 printf "loading defaults from $cs... " |
| |
249 . "$cs" |
| |
250 echo ok |
| |
251 done |
| |
252 elif [ -f "$prefix/share/config.site" ]; then |
| |
253 printf "loading site defaults... " |
| |
254 . "$prefix/share/config.site" |
| |
255 echo ok |
| |
256 elif [ -f "$prefix/etc/config.site" ]; then |
| |
257 printf "loading site defaults... " |
| |
258 . "$prefix/etc/config.site" |
| |
259 echo ok |
| |
260 fi |
| |
261 ]]# |
| |
262 ## End of unparsed content ** |
| |
263 |
| |
264 # generate vars.mk |
| |
265 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
| |
266 prefix=$prefix |
| |
267 exec_prefix=$exec_prefix |
| |
268 bindir=$bindir |
| |
269 sbindir=$sbindir |
| |
270 libdir=$libdir |
| |
271 libexecdir=$libexecdir |
| |
272 datarootdir=$datarootdir |
| |
273 datadir=$datadir |
| |
274 sysconfdir=$sysconfdir |
| |
275 sharedstatedir=$sharedstatedir |
| |
276 localstatedir=$localstatedir |
| |
277 runstatedir=$runstatedir |
| |
278 includedir=$includedir |
| |
279 infodir=$infodir |
| |
280 mandir=$mandir |
| |
281 localedir=$localedir |
| |
282 #foreach( $var in $vars ) |
| |
283 ${var.varName}=${D}${var.varName} |
| |
284 #end |
| |
285 __EOF__ |
| |
286 |
| |
287 # toolchain detection utilities |
| |
288 . make/toolchain.sh |
| |
289 |
| |
290 # |
| |
291 # DEPENDENCIES |
| |
292 # |
| |
293 |
| |
294 # check languages |
| |
295 lang_c= |
| |
296 lang_cpp= |
| |
297 #foreach( $lang in $languages ) |
| |
298 if detect_${lang}_compiler ; then |
| |
299 lang_${lang}=1 |
| |
300 fi |
| |
301 #end |
| |
302 |
| |
303 # create buffer for make variables required by dependencies |
| |
304 echo > "$TEMP_DIR/make.mk" |
| |
305 |
| |
306 test_pkg_config() |
| |
307 { |
| |
308 if "$PKG_CONFIG" --exists "$1" ; then : |
| |
309 else return 1 ; fi |
| |
310 if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : |
| |
311 else return 1 ; fi |
| |
312 if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then : |
| |
313 else return 1 ; fi |
| |
314 if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then : |
| |
315 else return 1 ; fi |
| |
316 return 0 |
| |
317 } |
| |
318 |
| |
319 print_check_msg() |
| |
320 { |
| |
321 if [ -z "$1" ]; then |
| |
322 shift |
| |
323 printf "$@" |
| |
324 fi |
| |
325 } |
| |
326 |
| |
327 #foreach( $dependency in $namedDependencies ) |
| |
328 dependency_error_${dependency.id}() |
| |
329 { |
| |
330 print_check_msg "${D}dep_checked_${dependency.id}" "checking for ${dependency.name}... " |
| |
331 #foreach( $sub in $dependency.subdependencies ) |
| |
332 # dependency $sub.fullName |
| |
333 while true |
| |
334 do |
| |
335 #if( $sub.platform ) |
| |
336 if notisplatform "${sub.platform}"; then |
| |
337 break |
| |
338 fi |
| |
339 #end |
| |
340 #if( $sub.toolchain ) |
| |
341 if notistoolchain "${sub.toolchain}"; then |
| |
342 break |
| |
343 fi |
| |
344 #end |
| |
345 #foreach( $np in $sub.notList ) |
| |
346 if isplatform "${np}" || istoolchain "${np}"; then |
| |
347 break |
| |
348 fi |
| |
349 #end |
| |
350 #foreach( $lang in $sub.lang ) |
| |
351 if [ -z "$lang_${lang}" ] ; then |
| |
352 break |
| |
353 fi |
| |
354 #end |
| |
355 #if( $sub.pkgconfig.size() > 0 ) |
| |
356 if [ -z "$PKG_CONFIG" ]; then |
| |
357 break |
| |
358 fi |
| |
359 #end |
| |
360 #foreach( $test in $sub.tests ) |
| |
361 if $test > /dev/null ; then |
| |
362 : |
| |
363 else |
| |
364 break |
| |
365 fi |
| |
366 #end |
| |
367 #foreach( $pkg in $sub.pkgconfig ) |
| |
368 if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then |
| |
369 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`" |
| |
370 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`" |
| |
371 else |
| |
372 break |
| |
373 fi |
| |
374 #end |
| |
375 #foreach( $flags in $sub.flags ) |
| |
376 #if( $flags.exec ) |
| |
377 if tmp_flags=`$flags.value` ; then |
| |
378 TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags" |
| |
379 else |
| |
380 break |
| |
381 fi |
| |
382 #else |
| |
383 TEMP_$flags.varName="$TEMP_$flags.varName $flags.value" |
| |
384 #end |
| |
385 #end |
| |
386 #if ( $sub.make.length() > 0 ) |
| |
387 cat >> $TEMP_DIR/make.mk << __EOF__ |
| |
388 # Dependency: $dependency.name |
| |
389 $sub.make |
| |
390 __EOF__ |
| |
391 #end |
| |
392 print_check_msg "${D}dep_checked_${dependency.id}" "yes\n" |
| |
393 dep_checked_${dependency.id}=1 |
| |
394 return 1 |
| |
395 done |
| |
396 |
| |
397 #end |
| |
398 print_check_msg "${D}dep_checked_${dependency.id}" "no\n" |
| |
399 dep_checked_${dependency.id}=1 |
| |
400 return 0 |
| |
401 } |
| |
402 #end |
| |
403 |
| |
404 # start collecting dependency information |
| |
405 echo > "$TEMP_DIR/flags.mk" |
| |
406 |
| |
407 DEPENDENCIES_FAILED= |
| |
408 ERROR=0 |
| |
409 #if( $dependencies.size() > 0 ) |
| |
410 # unnamed dependencies |
| |
411 TEMP_CFLAGS= |
| |
412 TEMP_CXXFLAGS= |
| |
413 TEMP_LDFLAGS= |
| |
414 #foreach( $dependency in $dependencies ) |
| |
415 while true |
| |
416 do |
| |
417 #if( $dependency.platform ) |
| |
418 if notisplatform "${dependency.platform}"; then |
| |
419 break |
| |
420 fi |
| |
421 #end |
| |
422 #if( $dependency.toolchain ) |
| |
423 if notistoolchain "${dependency.toolchain}"; then |
| |
424 break |
| |
425 fi |
| |
426 #end |
| |
427 #foreach( $np in $dependency.notList ) |
| |
428 if isplatform "${np}" || istoolchain "${np}"; then |
| |
429 break |
| |
430 fi |
| |
431 #end |
| |
432 while true |
| |
433 do |
| |
434 #foreach( $lang in $dependency.lang ) |
| |
435 if [ -z "$lang_${lang}" ] ; then |
| |
436 ERROR=1 |
| |
437 break |
| |
438 fi |
| |
439 #end |
| |
440 #if( $dependency.pkgconfig.size() > 0 ) |
| |
441 if [ -z "$PKG_CONFIG" ]; then |
| |
442 ERROR=1 |
| |
443 break |
| |
444 fi |
| |
445 #end |
| |
446 #foreach( $pkg in $dependency.pkgconfig ) |
| |
447 print_check_msg "${D}dep_pkgconfig_checked_${pkg.id}" "checking for pkg-config package $pkg.name... " |
| |
448 if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then |
| |
449 print_check_msg "${D}dep_pkgconfig_checked_${pkg.id}" "yes\n" |
| |
450 dep_pkgconfig_checked_${pkg.id}=1 |
| |
451 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`" |
| |
452 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`" |
| |
453 else |
| |
454 print_check_msg "${D}dep_pkgconfig_checked_${pkg.id}" "no\n" |
| |
455 dep_pkgconfig_checked_${pkg.id}=1 |
| |
456 ERROR=1 |
| |
457 break |
| |
458 fi |
| |
459 #end |
| |
460 |
| |
461 #foreach( $flags in $dependency.flags ) |
| |
462 #if( $flags.exec ) |
| |
463 $flags.value > /dev/null |
| |
464 if tmp_flags=`$flags.value` ; then |
| |
465 TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags" |
| |
466 else |
| |
467 ERROR=1 |
| |
468 break |
| |
469 fi |
| |
470 #else |
| |
471 TEMP_$flags.varName="$TEMP_$flags.varName $flags.value" |
| |
472 #end |
| |
473 #end |
| |
474 #if ( $dependency.make.length() > 0 ) |
| |
475 cat >> "$TEMP_DIR/make.mk" << __EOF__ |
| |
476 $dependency.make |
| |
477 __EOF__ |
| |
478 #end |
| |
479 break |
| |
480 done |
| |
481 break |
| |
482 done |
| |
483 #end |
| |
484 |
| |
485 # add general dependency flags to flags.mk |
| |
486 echo "# general flags" >> "$TEMP_DIR/flags.mk" |
| |
487 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
| |
488 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
| |
489 fi |
| |
490 if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
| |
491 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
| |
492 fi |
| |
493 if [ -n "${TEMP_LDFLAGS}" ]; then |
| |
494 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
| |
495 fi |
| |
496 #end |
| |
497 |
| |
498 # |
| |
499 # OPTION VALUES |
| |
500 # |
| |
501 #foreach( $opt in $options ) |
| |
502 #foreach( $val in $opt.values ) |
| |
503 ${val.func}() |
| |
504 { |
| |
505 VERR=0 |
| |
506 #foreach( $dep in $val.dependencies ) |
| |
507 if dependency_error_$dep ; then |
| |
508 VERR=1 |
| |
509 fi |
| |
510 #end |
| |
511 if [ $VERR -ne 0 ]; then |
| |
512 return 1 |
| |
513 fi |
| |
514 #foreach( $def in $val.defines ) |
| |
515 TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" |
| |
516 TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" |
| |
517 #end |
| |
518 #if( $val.hasMake() ) |
| |
519 cat >> "$TEMP_DIR/make.mk" << __EOF__ |
| |
520 $val.make |
| |
521 __EOF__ |
| |
522 #end |
| |
523 return 0 |
| |
524 } |
| |
525 #end |
| |
526 #end |
| |
527 |
| |
528 # |
| |
529 # TARGETS |
| |
530 # |
| |
531 |
| |
532 #foreach( $target in $targets ) |
| |
533 echo >> "$TEMP_DIR/flags.mk" |
| |
534 #if ( $target.name ) |
| |
535 echo "configuring target: $target.name" |
| |
536 echo "# flags for target $target.name" >> "$TEMP_DIR/flags.mk" |
| |
537 #else |
| |
538 echo "configuring global target" |
| |
539 echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk" |
| |
540 #end |
| |
541 TEMP_CFLAGS= |
| |
542 TEMP_CXXFLAGS= |
| |
543 TEMP_LDFLAGS= |
| |
544 |
| |
545 #foreach( $dependency in $target.dependencies ) |
| |
546 if dependency_error_$dependency; then |
| |
547 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |
| |
548 ERROR=1 |
| |
549 fi |
| |
550 #end |
| |
551 |
| |
552 # Features |
| |
553 #foreach( $feature in $target.features ) |
| |
554 if [ -n "${D}${feature.varName}" ]; then |
| |
555 #foreach( $dependency in $feature.dependencies ) |
| |
556 # check dependency |
| |
557 if dependency_error_$dependency ; then |
| |
558 # "auto" features can fail and are just disabled in this case |
| |
559 if [ "${D}${feature.varName}" = "auto" ]; then |
| |
560 DISABLE_${feature.varName}=1 |
| |
561 else |
| |
562 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " |
| |
563 ERROR=1 |
| |
564 fi |
| |
565 fi |
| |
566 #end |
| |
567 if [ -n "$DISABLE_${feature.varName}" ]; then |
| |
568 unset ${feature.varName} |
| |
569 fi |
| |
570 fi |
| |
571 #end |
| |
572 |
| |
573 #foreach( $opt in $target.options ) |
| |
574 # Option: --${opt.argument} |
| |
575 if [ -z "${D}${opt.varName}" ]; then |
| |
576 echo "auto-detecting option '${opt.argument}'" |
| |
577 SAVED_ERROR="$ERROR" |
| |
578 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" |
| |
579 ERROR=1 |
| |
580 while true |
| |
581 do |
| |
582 #foreach( $optdef in $opt.defaults ) |
| |
583 #if( $optdef.platform ) |
| |
584 if isplatform "$optdef.platform"; then |
| |
585 #end |
| |
586 if $optdef.func ; then |
| |
587 echo " ${opt.argument}: ${optdef.valueName}" >> "$TEMP_DIR/options" |
| |
588 ERROR=0 |
| |
589 break |
| |
590 fi |
| |
591 #if( $optdef.platform ) |
| |
592 fi |
| |
593 #end |
| |
594 #end |
| |
595 break |
| |
596 done |
| |
597 if [ $ERROR -ne 0 ]; then |
| |
598 SAVED_ERROR=1 |
| |
599 SAVED_DEPENDENCIES_FAILED="option '${opt.argument}' $SAVED_DEPENDENCIES_FAILED" |
| |
600 fi |
| |
601 ERROR="$SAVED_ERROR" |
| |
602 DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" |
| |
603 else |
| |
604 echo "checking option ${opt.argument} = ${D}${opt.varName}" |
| |
605 if false; then |
| |
606 false |
| |
607 #foreach( $optval in $opt.values ) |
| |
608 elif [ "${D}${opt.varName}" = "${optval.value}" ]; then |
| |
609 echo " ${opt.argument}: ${D}${opt.varName}" >> $TEMP_DIR/options |
| |
610 if $optval.func ; then |
| |
611 : |
| |
612 else |
| |
613 ERROR=1 |
| |
614 DEPENDENCIES_FAILED="option '${opt.argument}' $DEPENDENCIES_FAILED" |
| |
615 fi |
| |
616 #end |
| |
617 fi |
| |
618 fi |
| |
619 #end |
| |
620 |
| |
621 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
| |
622 echo "${target.cFlags} += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
| |
623 fi |
| |
624 if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
| |
625 echo "${target.cxxFlags} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
| |
626 fi |
| |
627 if [ "$BUILD_TYPE" = "debug" ]; then |
| |
628 if [ -n "$lang_c" ]; then |
| |
629 echo '${target.cFlags} += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
| |
630 fi |
| |
631 if [ -n "$lang_cpp" ]; then |
| |
632 echo '${target.cxxFlags} += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
| |
633 fi |
| |
634 fi |
| |
635 if [ "$BUILD_TYPE" = "release" ]; then |
| |
636 if [ -n "$lang_c" ]; then |
| |
637 echo '${target.cFlags} += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
| |
638 fi |
| |
639 if [ -n "$lang_cpp" ]; then |
| |
640 echo '${target.cxxFlags} += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
| |
641 fi |
| |
642 fi |
| |
643 if [ -n "${TEMP_LDFLAGS}" ]; then |
| |
644 echo "${target.ldFlags} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
| |
645 fi |
| |
646 |
| |
647 #end |
| |
648 |
| |
649 # final result |
| |
650 if [ $ERROR -ne 0 ]; then |
| |
651 echo |
| |
652 echo "Error: Unresolved dependencies" |
| |
653 echo "$DEPENDENCIES_FAILED" |
| |
654 abort_configure |
| |
655 fi |
| |
656 |
| |
657 echo "configure finished" |
| |
658 echo |
| |
659 echo "Build Config:" |
| |
660 echo " PREFIX: $prefix" |
| |
661 echo " TOOLCHAIN: $TOOLCHAIN_NAME" |
| |
662 #if ( $options.size() > 0 ) |
| |
663 echo "Options:" |
| |
664 cat "$TEMP_DIR/options" |
| |
665 #end |
| |
666 #if ( $features.size() > 0 ) |
| |
667 echo "Features:" |
| |
668 #foreach( $feature in $features ) |
| |
669 if [ -n "${D}${feature.varName}" ]; then |
| |
670 echo " $feature.name: on" |
| |
671 else |
| |
672 echo " $feature.name: off" |
| |
673 fi |
| |
674 #end |
| |
675 #end |
| |
676 echo |
| |
677 |
| |
678 # generate the config.mk file |
| |
679 cat > "$TEMP_DIR/config.mk" << __EOF__ |
| |
680 # |
| |
681 # config.mk generated by configure |
| |
682 # |
| |
683 |
| |
684 __EOF__ |
| |
685 write_toolchain_defaults "$TEMP_DIR/toolchain.mk" |
| |
686 cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk |
| |
687 rm -Rf "$TEMP_DIR" |