make/configure.vm

changeset 753
24dc84788dee
child 796
fec90b848f4b
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/configure.vm	Thu Oct 12 00:00:35 2023 +0200
     1.3 @@ -0,0 +1,640 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +# create temporary directory
     1.7 +TEMP_DIR=".tmp-`uname -n`"
     1.8 +rm -Rf "$TEMP_DIR"
     1.9 +if mkdir -p "$TEMP_DIR"; then
    1.10 +    :
    1.11 +else
    1.12 +    echo "Cannot create tmp dir $TEMP_DIR"
    1.13 +    echo "Abort"
    1.14 +    exit 1
    1.15 +fi
    1.16 +touch "$TEMP_DIR/options"
    1.17 +touch "$TEMP_DIR/features"
    1.18 +
    1.19 +# define standard variables
    1.20 +# also define standard prefix (this is where we will search for config.site)
    1.21 +prefix=/usr
    1.22 +exec_prefix=
    1.23 +bindir=
    1.24 +sbindir=
    1.25 +libdir=
    1.26 +libexecdir=
    1.27 +datarootdir=
    1.28 +datadir=
    1.29 +sysconfdir=
    1.30 +sharedstatedir=
    1.31 +localstatedir=
    1.32 +runstatedir=
    1.33 +includedir=
    1.34 +infodir=
    1.35 +localedir=
    1.36 +mandir=
    1.37 +
    1.38 +# custom variables
    1.39 +#foreach( $var in $vars )
    1.40 +#if( $var.exec )
    1.41 +${var.varName}=`${var.value}`
    1.42 +#else
    1.43 +${var.varName}="${var.value}"
    1.44 +#end
    1.45 +#end
    1.46 +
    1.47 +# features
    1.48 +#foreach( $feature in $features )
    1.49 +#if( ${feature.auto} )
    1.50 +${feature.varName}=auto
    1.51 +#end
    1.52 +#end
    1.53 +
    1.54 +# clean abort
    1.55 +abort_configure()
    1.56 +{
    1.57 +    rm -Rf "$TEMP_DIR"
    1.58 +    exit 1
    1.59 +}
    1.60 +
    1.61 +# help text
    1.62 +printhelp()
    1.63 +{
    1.64 +    echo "Usage: $0 [OPTIONS]..."
    1.65 +    cat << __EOF__
    1.66 +Installation directories:
    1.67 +  --prefix=PREFIX         path prefix for architecture-independent files
    1.68 +                          [/usr]
    1.69 +  --exec-prefix=EPREFIX   path prefix for architecture-dependent files
    1.70 +                          [PREFIX]
    1.71 +
    1.72 +  --bindir=DIR            user executables [EPREFIX/bin]
    1.73 +  --sbindir=DIR           system admin executables [EPREFIX/sbin]
    1.74 +  --libexecdir=DIR        program executables [EPREFIX/libexec]
    1.75 +  --sysconfdir=DIR        system configuration files [PREFIX/etc]
    1.76 +  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
    1.77 +  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
    1.78 +  --runstatedir=DIR       run-time variable data [LOCALSTATEDIR/run]
    1.79 +  --libdir=DIR            object code libraries [EPREFIX/lib]
    1.80 +  --includedir=DIR        C header files [PREFIX/include]
    1.81 +  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
    1.82 +  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
    1.83 +  --infodir=DIR           info documentation [DATAROOTDIR/info]
    1.84 +  --mandir=DIR            man documentation [DATAROOTDIR/man]
    1.85 +  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
    1.86 +
    1.87 +#if( $options.size() > 0 )
    1.88 +Options:
    1.89 +  --debug                 add extra compile flags for debug builds
    1.90 +  --release               add extra compile flags for release builds
    1.91 +#foreach( $opt in $options )
    1.92 +  --${opt.argument}=${opt.valuesString}
    1.93 +#end
    1.94 +
    1.95 +#end
    1.96 +#if( $features.size() > 0 )
    1.97 +Optional Features:
    1.98 +#foreach( $feature in $features )
    1.99 +#if( $feature.auto )
   1.100 +  --disable-${feature.arg}
   1.101 +#else
   1.102 +  --enable-${feature.arg}
   1.103 +#end
   1.104 +#end
   1.105 +
   1.106 +#end
   1.107 +__EOF__
   1.108 +}
   1.109 +
   1.110 +#
   1.111 +# parse arguments
   1.112 +#
   1.113 +BUILD_TYPE="default"
   1.114 +#set( $D = '$' )
   1.115 +for ARG in "$@"
   1.116 +do
   1.117 +    case "$ARG" in
   1.118 +        "--prefix="*)         prefix=${D}{ARG#--prefix=} ;;
   1.119 +        "--exec-prefix="*)    exec_prefix=${D}{ARG#--exec-prefix=} ;;
   1.120 +        "--bindir="*)         bindir=${D}{ARG#----bindir=} ;;
   1.121 +        "--sbindir="*)        sbindir=${D}{ARG#--sbindir=} ;;
   1.122 +        "--libdir="*)         libdir=${D}{ARG#--libdir=} ;;
   1.123 +        "--libexecdir="*)     libexecdir=${D}{ARG#--libexecdir=} ;;
   1.124 +        "--datarootdir="*)    datarootdir=${D}{ARG#--datarootdir=} ;;
   1.125 +        "--datadir="*)        datadir=${D}{ARG#--datadir=} ;;
   1.126 +        "--sysconfdir="*)     sysconfdir=${D}{ARG#--sysconfdir=} ;;
   1.127 +        "--sharedstatedir="*) sharedstatedir=${D}{ARG#--sharedstatedir=} ;;
   1.128 +        "--localstatedir="*)  localstatedir=${D}{ARG#--localstatedir=} ;;
   1.129 +        "--includedir="*)     includedir=${D}{ARG#--includedir=} ;;
   1.130 +        "--infodir="*)        infodir=${D}{ARG#--infodir=} ;;
   1.131 +        "--mandir"*)          mandir=${D}{ARG#--mandir} ;;
   1.132 +        "--localedir"*)       localedir=${D}{ARG#--localedir} ;;
   1.133 +        "--help"*) printhelp; abort_configure ;;
   1.134 +        "--debug")           BUILD_TYPE="debug" ;;
   1.135 +        "--release")         BUILD_TYPE="release" ;;
   1.136 +    #foreach( $opt in $options )
   1.137 +        "--${opt.argument}="*) ${opt.varName}=${D}{ARG#--${opt.argument}=} ;;
   1.138 +    #end
   1.139 +    #foreach( $feature in $features )
   1.140 +        "--enable-${feature.arg}") ${feature.varName}=on ;;
   1.141 +        "--disable-${feature.arg}") unset ${feature.varName} ;;
   1.142 +    #end
   1.143 +        "-"*) echo "unknown option: $ARG"; abort_configure ;;
   1.144 +    esac
   1.145 +done
   1.146 +
   1.147 +## Begin unparsed content. **
   1.148 +#[[
   1.149 +
   1.150 +# set defaults for dir variables
   1.151 +: ${exec_prefix:="$prefix"}
   1.152 +: ${bindir:='${exec_prefix}/bin'}
   1.153 +: ${sbindir:='${exec_prefix}/sbin'}
   1.154 +: ${libdir:='${exec_prefix}/lib'}
   1.155 +: ${libexecdir:='${exec_prefix}/libexec'}
   1.156 +: ${datarootdir:='${prefix}/share'}
   1.157 +: ${datadir:='${datarootdir}'}
   1.158 +: ${sysconfdir:='${prefix}/etc'}
   1.159 +: ${sharedstatedir:='${prefix}/com'}
   1.160 +: ${localstatedir:='${prefix}/var'}
   1.161 +: ${runstatedir:='${localstatedir}/run'}
   1.162 +: ${includedir:='${prefix}/include'}
   1.163 +: ${infodir:='${datarootdir}/info'}
   1.164 +: ${mandir:='${datarootdir}/man'}
   1.165 +: ${localedir:='${datarootdir}/locale'}
   1.166 +
   1.167 +# check if a config.site exists and load it
   1.168 +if [ -n "$CONFIG_SITE" ]; then
   1.169 +    # CONFIG_SITE may contain space separated file names
   1.170 +    for cs in $CONFIG_SITE; do
   1.171 +        printf "loading defaults from $cs... "
   1.172 +        . "$cs"
   1.173 +        echo ok
   1.174 +    done
   1.175 +elif [ -f "$prefix/share/config.site" ]; then
   1.176 +    printf "loading site defaults... "
   1.177 +    . "$prefix/share/config.site"
   1.178 +    echo ok
   1.179 +elif [ -f "$prefix/etc/config.site" ]; then
   1.180 +    printf "loading site defaults... "
   1.181 +    . "$prefix/etc/config.site"
   1.182 +    echo ok
   1.183 +fi
   1.184 +
   1.185 +# Test for availability of pkg-config
   1.186 +PKG_CONFIG=`command -v pkg-config`
   1.187 +: ${PKG_CONFIG:="false"}
   1.188 +
   1.189 +# Simple uname based platform detection
   1.190 +# $PLATFORM is used for platform dependent dependency selection
   1.191 +OS=`uname -s`
   1.192 +OS_VERSION=`uname -r`
   1.193 +printf "detect platform... "
   1.194 +if [ "$OS" = "SunOS" ]; then
   1.195 +    PLATFORM="solaris sunos unix svr4"
   1.196 +fi
   1.197 +if [ "$OS" = "Linux" ]; then
   1.198 +    PLATFORM="linux unix"
   1.199 +fi
   1.200 +if [ "$OS" = "FreeBSD" ]; then
   1.201 +    PLATFORM="freebsd bsd unix"
   1.202 +fi
   1.203 +if [ "$OS" = "Darwin" ]; then
   1.204 +    PLATFORM="macos osx bsd unix"
   1.205 +fi
   1.206 +if echo "$OS" | grep -i "MINGW" > /dev/null; then
   1.207 +    PLATFORM="windows mingw"
   1.208 +fi
   1.209 +: ${PLATFORM:="unix"}
   1.210 +
   1.211 +PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
   1.212 +echo "$PLATFORM_NAME"
   1.213 +
   1.214 +isplatform()
   1.215 +{
   1.216 +    for p in $PLATFORM
   1.217 +    do
   1.218 +        if [ "$p" = "$1" ]; then
   1.219 +            return 0
   1.220 +        fi
   1.221 +    done
   1.222 +    return 1
   1.223 +}
   1.224 +notisplatform()
   1.225 +{
   1.226 +    for p in $PLATFORM
   1.227 +    do
   1.228 +        if [ "$p" = "$1" ]; then
   1.229 +            return 1
   1.230 +        fi
   1.231 +    done
   1.232 +    return 0
   1.233 +}
   1.234 +]]#
   1.235 +## End of unparsed content **
   1.236 +
   1.237 +# generate vars.mk
   1.238 +cat > "$TEMP_DIR/vars.mk" << __EOF__
   1.239 +prefix="$prefix"
   1.240 +exec_prefix="$exec_prefix"
   1.241 +bindir="$bindir"
   1.242 +sbindir="$sbindir"
   1.243 +libdir="$libdir"
   1.244 +libexecdir="$libexecdir"
   1.245 +datarootdir="$datarootdir"
   1.246 +datadir="$datadir"
   1.247 +sysconfdir="$sysconfdir"
   1.248 +sharedstatedir="$sharedstatedir"
   1.249 +localstatedir="$localstatedir"
   1.250 +runstatedir="$runstatedir"
   1.251 +includedir="$includedir"
   1.252 +infodir="$infodir"
   1.253 +mandir="$mandir"
   1.254 +localedir="$localedir"
   1.255 +#foreach( $var in $vars )
   1.256 +${var.varName}="${D}${var.varName}"
   1.257 +#end
   1.258 +__EOF__
   1.259 +
   1.260 +# toolchain detection utilities
   1.261 +. make/toolchain.sh
   1.262 +
   1.263 +#
   1.264 +# DEPENDENCIES
   1.265 +#
   1.266 +
   1.267 +# check languages
   1.268 +lang_c=
   1.269 +lang_cpp=
   1.270 +#foreach( $lang in $languages )
   1.271 +if detect_${lang}_compiler ; then
   1.272 +    lang_${lang}=1
   1.273 +fi
   1.274 +#end
   1.275 +
   1.276 +# create buffer for make variables required by dependencies
   1.277 +echo > "$TEMP_DIR/make.mk"
   1.278 +
   1.279 +test_pkg_config()
   1.280 +{
   1.281 +    if "$PKG_CONFIG" --exists "$1" ; then :
   1.282 +    else return 1 ; fi
   1.283 +    if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then :
   1.284 +    else return 1 ; fi
   1.285 +    if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then :
   1.286 +    else return 1 ; fi
   1.287 +    if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then :
   1.288 +    else return 1 ; fi
   1.289 +    return 0
   1.290 +}
   1.291 +
   1.292 +#foreach( $dependency in $namedDependencies )
   1.293 +dependency_error_${dependency.id}()
   1.294 +{
   1.295 +    printf "checking for ${dependency.name}... "
   1.296 +    #foreach( $sub in $dependency.subdependencies )
   1.297 +    # dependency $sub.fullName
   1.298 +    while true
   1.299 +    do
   1.300 +        #if( $sub.platform )
   1.301 +        if notisplatform "${sub.platform}"; then
   1.302 +            break
   1.303 +        fi
   1.304 +        #end
   1.305 +        #foreach( $np in $sub.notList )
   1.306 +        if isplatform "${np}"; then
   1.307 +            break
   1.308 +        fi
   1.309 +        #end
   1.310 +        #foreach( $lang in $sub.lang )
   1.311 +        if [ -z "$lang_${lang}" ] ; then
   1.312 +            break
   1.313 +        fi
   1.314 +        #end
   1.315 +        #if( $sub.pkgconfig.size() > 0 )
   1.316 +        if [ -z "$PKG_CONFIG" ]; then
   1.317 +            break
   1.318 +        fi
   1.319 +        #end
   1.320 +        #foreach( $test in $sub.tests )
   1.321 +        if $test > /dev/null ; then
   1.322 +            :
   1.323 +        else
   1.324 +            break
   1.325 +        fi
   1.326 +        #end
   1.327 +        #foreach( $pkg in $sub.pkgconfig )
   1.328 +        if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then
   1.329 +            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`"
   1.330 +            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`"
   1.331 +        else
   1.332 +            break
   1.333 +        fi
   1.334 +        #end
   1.335 +        #foreach( $flags in $sub.flags )
   1.336 +        #if( $flags.exec )
   1.337 +        if tmp_flags=`$flags.value` ; then
   1.338 +            TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags"
   1.339 +        else
   1.340 +            break
   1.341 +        fi
   1.342 +        #else
   1.343 +        TEMP_$flags.varName="$TEMP_$flags.varName $flags.value"
   1.344 +        #end
   1.345 +        #end
   1.346 +        #if ( $sub.make.length() > 0 )
   1.347 +        cat >> $TEMP_DIR/make.mk << __EOF__
   1.348 +# Dependency: $dependency.name
   1.349 +$sub.make
   1.350 +__EOF__
   1.351 +        #end
   1.352 +        echo yes
   1.353 +        return 1
   1.354 +    done
   1.355 +
   1.356 +    #end
   1.357 +    echo no
   1.358 +    return 0
   1.359 +}
   1.360 +#end
   1.361 +
   1.362 +
   1.363 +
   1.364 +
   1.365 +# start collecting dependency information
   1.366 +echo > "$TEMP_DIR/flags.mk"
   1.367 +
   1.368 +DEPENDENCIES_FAILED=
   1.369 +ERROR=0
   1.370 +#if( $dependencies.size() > 0 )
   1.371 +# unnamed dependencies
   1.372 +TEMP_CFLAGS=
   1.373 +TEMP_CXXFLAGS=
   1.374 +TEMP_LDFLAGS=
   1.375 +#foreach( $dependency in $dependencies )
   1.376 +while true
   1.377 +do
   1.378 +    #if( $dependency.platform )
   1.379 +    if notisplatform "${dependency.platform}"; then
   1.380 +        break
   1.381 +    fi
   1.382 +    #end
   1.383 +    #foreach( $np in $dependency.notList )
   1.384 +    if isplatform "${np}"; then
   1.385 +        break
   1.386 +    fi
   1.387 +    #end
   1.388 +    while true
   1.389 +    do
   1.390 +        #foreach( $lang in $dependency.lang )
   1.391 +        if [ -z "$lang_${lang}" ] ; then
   1.392 +            ERROR=1
   1.393 +            break
   1.394 +        fi
   1.395 +        #end
   1.396 +        #if( $dependency.pkgconfig.size() > 0 )
   1.397 +        if [ -z "$PKG_CONFIG" ]; then
   1.398 +            ERROR=1
   1.399 +            break
   1.400 +        fi
   1.401 +        #end
   1.402 +        #foreach( $pkg in $dependency.pkgconfig )
   1.403 +        printf "checking for pkg-config package $pkg.name... "
   1.404 +        if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then
   1.405 +            echo yes
   1.406 +            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`"
   1.407 +            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`"
   1.408 +        else
   1.409 +            echo no
   1.410 +            ERROR=1
   1.411 +            break
   1.412 +        fi
   1.413 +        #end
   1.414 +
   1.415 +        #foreach( $flags in $dependency.flags )
   1.416 +        #if( $flags.exec )
   1.417 +        $flags.value > /dev/null
   1.418 +        if tmp_flags=`$flags.value` ; then
   1.419 +            TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags"
   1.420 +        else
   1.421 +            ERROR=1
   1.422 +            break
   1.423 +        fi
   1.424 +        #else
   1.425 +        TEMP_$flags.varName="$TEMP_$flags.varName $flags.value"
   1.426 +        #end
   1.427 +        #end
   1.428 +        #if ( $dependency.make.length() > 0 )
   1.429 +        cat >> "$TEMP_DIR/make.mk" << __EOF__
   1.430 +$dependency.make
   1.431 +__EOF__
   1.432 +        #end
   1.433 +        break
   1.434 +    done
   1.435 +    break
   1.436 +done
   1.437 +#end
   1.438 +
   1.439 +# add general dependency flags to flags.mk
   1.440 +echo "# general flags" >> "$TEMP_DIR/flags.mk"
   1.441 +if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
   1.442 +    echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
   1.443 +fi
   1.444 +if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
   1.445 +    echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
   1.446 +fi
   1.447 +if [ -n "${TEMP_LDFLAGS}" ]; then
   1.448 +    echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
   1.449 +fi
   1.450 +#end
   1.451 +
   1.452 +#
   1.453 +# OPTION VALUES
   1.454 +#
   1.455 +#foreach( $opt in $options )
   1.456 +#foreach( $val in $opt.values )
   1.457 +${val.func}()
   1.458 +{
   1.459 +    VERR=0
   1.460 +    #foreach( $dep in $val.dependencies )
   1.461 +    if dependency_error_$dep ; then
   1.462 +        VERR=1
   1.463 +    fi
   1.464 +    #end
   1.465 +    if [ $VERR -ne 0 ]; then
   1.466 +        return 1
   1.467 +    fi
   1.468 +    #foreach( $def in $val.defines )
   1.469 +        TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}"
   1.470 +        TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}"
   1.471 +    #end
   1.472 +    #if( $val.hasMake() )
   1.473 +    cat >> "$TEMP_DIR/make.mk" << __EOF__
   1.474 +$val.make
   1.475 +__EOF__
   1.476 +    #end
   1.477 +    return 0
   1.478 +}
   1.479 +#end
   1.480 +#end
   1.481 +
   1.482 +#
   1.483 +# TARGETS
   1.484 +#
   1.485 +
   1.486 +#foreach( $target in $targets )
   1.487 +echo >> "$TEMP_DIR/flags.mk"
   1.488 +#if ( $target.name )
   1.489 +echo "configuring target: $target.name"
   1.490 +echo "# flags for target $target.name" >> "$TEMP_DIR/flags.mk"
   1.491 +#else
   1.492 +echo "configuring global target"
   1.493 +echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk"
   1.494 +#end
   1.495 +TEMP_CFLAGS=
   1.496 +TEMP_CXXFLAGS=
   1.497 +TEMP_LDFLAGS=
   1.498 +
   1.499 +#foreach( $dependency in $target.dependencies )
   1.500 +if dependency_error_$dependency; then
   1.501 +    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
   1.502 +    ERROR=1
   1.503 +fi
   1.504 +#end
   1.505 +
   1.506 +# Features
   1.507 +#foreach( $feature in $target.features )
   1.508 +if [ -n "${D}${feature.varName}" ]; then
   1.509 +#foreach( $dependency in $feature.dependencies )
   1.510 +    # check dependency
   1.511 +    if dependency_error_$dependency ; then
   1.512 +        # "auto" features can fail and are just disabled in this case
   1.513 +        if [ "${D}${feature.varName}" = "auto" ]; then
   1.514 +            DISABLE_${feature.varName}=1
   1.515 +        else
   1.516 +            DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
   1.517 +            ERROR=1
   1.518 +        fi
   1.519 +    fi
   1.520 +#end
   1.521 +    if [ -n "$DISABLE_${feature.varName}" ]; then
   1.522 +        unset ${feature.varName}
   1.523 +    fi
   1.524 +fi
   1.525 +#end
   1.526 +
   1.527 +#foreach( $opt in $target.options )
   1.528 +# Option: --${opt.argument}
   1.529 +if [ -z "${D}${opt.varName}" ]; then
   1.530 +    echo "auto-detecting option '${opt.argument}'"
   1.531 +    SAVED_ERROR="$ERROR"
   1.532 +    SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
   1.533 +    ERROR=1
   1.534 +    while true
   1.535 +    do
   1.536 +        #foreach( $optdef in $opt.defaults )
   1.537 +        #if( $optdef.platform )
   1.538 +        if isplatform "$optdef.platform"; then
   1.539 +        #end
   1.540 +        if $optdef.func ; then
   1.541 +            echo "  ${opt.argument}: ${optdef.valueName}" >> "$TEMP_DIR/options"
   1.542 +            ERROR=0
   1.543 +            break
   1.544 +        fi
   1.545 +        #if( $optdef.platform )
   1.546 +        fi
   1.547 +        #end
   1.548 +        #end
   1.549 +        break
   1.550 +    done
   1.551 +    if [ $ERROR -ne 0 ]; then
   1.552 +        SAVED_ERROR=1
   1.553 +        SAVED_DEPENDENCIES_FAILED="option '${opt.argument}' $SAVED_DEPENDENCIES_FAILED"
   1.554 +    fi
   1.555 +    ERROR="$SAVED_ERROR"
   1.556 +    DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
   1.557 +else
   1.558 +    echo "checking option ${opt.argument} = ${D}${opt.varName}"
   1.559 +    if false; then
   1.560 +        false
   1.561 +    #foreach( $optval in $opt.values )
   1.562 +    elif [ "${D}${opt.varName}" = "${optval.value}" ]; then
   1.563 +        echo "  ${opt.argument}: ${D}${opt.varName}" >> $TEMP_DIR/options
   1.564 +        if $optval.func ; then
   1.565 +            :
   1.566 +        else
   1.567 +            ERROR=1
   1.568 +            DEPENDENCIES_FAILED="option '${opt.argument}' $DEPENDENCIES_FAILED"
   1.569 +        fi
   1.570 +    #end
   1.571 +    fi
   1.572 +fi
   1.573 +#end
   1.574 +
   1.575 +if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
   1.576 +    echo "${target.cFlags}  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
   1.577 +fi
   1.578 +if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
   1.579 +    echo "${target.cxxFlags}  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
   1.580 +fi
   1.581 +if [ "$BUILD_TYPE" = "debug" ]; then
   1.582 +    if [ -n "$lang_c" ]; then
   1.583 +        echo '${target.cFlags} += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
   1.584 +    fi
   1.585 +    if [ -n "$lang_cpp" ]; then
   1.586 +        echo '${target.cxxFlags} += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
   1.587 +    fi
   1.588 +fi
   1.589 +if [ "$BUILD_TYPE" = "release" ]; then
   1.590 +    if [ -n "$lang_c" ]; then
   1.591 +        echo '${target.cFlags} += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
   1.592 +    fi
   1.593 +    if [ -n "$lang_cpp" ]; then
   1.594 +        echo '${target.cxxFlags} += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
   1.595 +    fi
   1.596 +fi
   1.597 +if [ -n "${TEMP_LDFLAGS}" ]; then
   1.598 +    echo "${target.ldFlags} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
   1.599 +fi
   1.600 +
   1.601 +#end
   1.602 +
   1.603 +# final result
   1.604 +if [ $ERROR -ne 0 ]; then
   1.605 +    echo
   1.606 +    echo "Error: Unresolved dependencies"
   1.607 +    echo "$DEPENDENCIES_FAILED"
   1.608 +    abort_configure
   1.609 +fi
   1.610 +
   1.611 +echo "configure finished"
   1.612 +echo
   1.613 +echo "Build Config:"
   1.614 +echo "  PREFIX:      $prefix"
   1.615 +echo "  TOOLCHAIN:   $TOOLCHAIN_NAME"
   1.616 +#if ( $options.size() > 0 )
   1.617 +echo "Options:"
   1.618 +cat "$TEMP_DIR/options"
   1.619 +#end
   1.620 +#if ( $features.size() > 0 )
   1.621 +echo "Features:"
   1.622 +#foreach( $feature in $features )
   1.623 +if [ -n "${D}${feature.varName}" ]; then
   1.624 +echo "  $feature.name: on"
   1.625 +else
   1.626 +echo "  $feature.name: off"
   1.627 +fi
   1.628 +#end
   1.629 +#end
   1.630 +echo
   1.631 +
   1.632 +# generate the config.mk file
   1.633 +cat > "$TEMP_DIR/config.mk" << __EOF__
   1.634 +#
   1.635 +# config.mk generated by configure
   1.636 +#
   1.637 +
   1.638 +__EOF__
   1.639 +write_toolchain_defaults "$TEMP_DIR/toolchain.mk"
   1.640 +cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
   1.641 +rm -Rf "$TEMP_DIR"
   1.642 +
   1.643 +

mercurial