configure

changeset 753
24dc84788dee
child 754
4bc7d966c9db
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/configure	Thu Oct 12 00:00:35 2023 +0200
     1.3 @@ -0,0 +1,756 @@
     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 +src_dir=`pwd`
    1.40 +DOXYGEN=`command -v doxygen`
    1.41 +PANDOC=`command -v pandoc`
    1.42 +CMAKE=`command -v cmake`
    1.43 +
    1.44 +# features
    1.45 +
    1.46 +# clean abort
    1.47 +abort_configure()
    1.48 +{
    1.49 +    rm -Rf "$TEMP_DIR"
    1.50 +    exit 1
    1.51 +}
    1.52 +
    1.53 +# help text
    1.54 +printhelp()
    1.55 +{
    1.56 +    echo "Usage: $0 [OPTIONS]..."
    1.57 +    cat << __EOF__
    1.58 +Installation directories:
    1.59 +  --prefix=PREFIX         path prefix for architecture-independent files
    1.60 +                          [/usr]
    1.61 +  --exec-prefix=EPREFIX   path prefix for architecture-dependent files
    1.62 +                          [PREFIX]
    1.63 +
    1.64 +  --bindir=DIR            user executables [EPREFIX/bin]
    1.65 +  --sbindir=DIR           system admin executables [EPREFIX/sbin]
    1.66 +  --libexecdir=DIR        program executables [EPREFIX/libexec]
    1.67 +  --sysconfdir=DIR        system configuration files [PREFIX/etc]
    1.68 +  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
    1.69 +  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
    1.70 +  --runstatedir=DIR       run-time variable data [LOCALSTATEDIR/run]
    1.71 +  --libdir=DIR            object code libraries [EPREFIX/lib]
    1.72 +  --includedir=DIR        C header files [PREFIX/include]
    1.73 +  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
    1.74 +  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
    1.75 +  --infodir=DIR           info documentation [DATAROOTDIR/info]
    1.76 +  --mandir=DIR            man documentation [DATAROOTDIR/man]
    1.77 +  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
    1.78 +
    1.79 +Options:
    1.80 +  --debug                 add extra compile flags for debug builds
    1.81 +  --release               add extra compile flags for release builds
    1.82 +  --with-tests=(yes|no)
    1.83 +  --with-docs=(all|html|api|none)
    1.84 +
    1.85 +__EOF__
    1.86 +}
    1.87 +
    1.88 +#
    1.89 +# parse arguments
    1.90 +#
    1.91 +BUILD_TYPE="default"
    1.92 +for ARG in "$@"
    1.93 +do
    1.94 +    case "$ARG" in
    1.95 +        "--prefix="*)         prefix=${ARG#--prefix=} ;;
    1.96 +        "--exec-prefix="*)    exec_prefix=${ARG#--exec-prefix=} ;;
    1.97 +        "--bindir="*)         bindir=${ARG#----bindir=} ;;
    1.98 +        "--sbindir="*)        sbindir=${ARG#--sbindir=} ;;
    1.99 +        "--libdir="*)         libdir=${ARG#--libdir=} ;;
   1.100 +        "--libexecdir="*)     libexecdir=${ARG#--libexecdir=} ;;
   1.101 +        "--datarootdir="*)    datarootdir=${ARG#--datarootdir=} ;;
   1.102 +        "--datadir="*)        datadir=${ARG#--datadir=} ;;
   1.103 +        "--sysconfdir="*)     sysconfdir=${ARG#--sysconfdir=} ;;
   1.104 +        "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;;
   1.105 +        "--localstatedir="*)  localstatedir=${ARG#--localstatedir=} ;;
   1.106 +        "--includedir="*)     includedir=${ARG#--includedir=} ;;
   1.107 +        "--infodir="*)        infodir=${ARG#--infodir=} ;;
   1.108 +        "--mandir"*)          mandir=${ARG#--mandir} ;;
   1.109 +        "--localedir"*)       localedir=${ARG#--localedir} ;;
   1.110 +        "--help"*) printhelp; abort_configure ;;
   1.111 +        "--debug")           BUILD_TYPE="debug" ;;
   1.112 +        "--release")         BUILD_TYPE="release" ;;
   1.113 +        "--with-tests="*) OPT_WITH_TESTS=${ARG#--with-tests=} ;;
   1.114 +        "--with-docs="*) OPT_WITH_DOCS=${ARG#--with-docs=} ;;
   1.115 +        "-"*) echo "unknown option: $ARG"; abort_configure ;;
   1.116 +    esac
   1.117 +done
   1.118 +
   1.119 +
   1.120 +
   1.121 +# set defaults for dir variables
   1.122 +: ${exec_prefix:="$prefix"}
   1.123 +: ${bindir:='${exec_prefix}/bin'}
   1.124 +: ${sbindir:='${exec_prefix}/sbin'}
   1.125 +: ${libdir:='${exec_prefix}/lib'}
   1.126 +: ${libexecdir:='${exec_prefix}/libexec'}
   1.127 +: ${datarootdir:='${prefix}/share'}
   1.128 +: ${datadir:='${datarootdir}'}
   1.129 +: ${sysconfdir:='${prefix}/etc'}
   1.130 +: ${sharedstatedir:='${prefix}/com'}
   1.131 +: ${localstatedir:='${prefix}/var'}
   1.132 +: ${runstatedir:='${localstatedir}/run'}
   1.133 +: ${includedir:='${prefix}/include'}
   1.134 +: ${infodir:='${datarootdir}/info'}
   1.135 +: ${mandir:='${datarootdir}/man'}
   1.136 +: ${localedir:='${datarootdir}/locale'}
   1.137 +
   1.138 +# check if a config.site exists and load it
   1.139 +if [ -n "$CONFIG_SITE" ]; then
   1.140 +    # CONFIG_SITE may contain space separated file names
   1.141 +    for cs in $CONFIG_SITE; do
   1.142 +        printf "loading defaults from $cs... "
   1.143 +        . "$cs"
   1.144 +        echo ok
   1.145 +    done
   1.146 +elif [ -f "$prefix/share/config.site" ]; then
   1.147 +    printf "loading site defaults... "
   1.148 +    . "$prefix/share/config.site"
   1.149 +    echo ok
   1.150 +elif [ -f "$prefix/etc/config.site" ]; then
   1.151 +    printf "loading site defaults... "
   1.152 +    . "$prefix/etc/config.site"
   1.153 +    echo ok
   1.154 +fi
   1.155 +
   1.156 +# Test for availability of pkg-config
   1.157 +PKG_CONFIG=`command -v pkg-config`
   1.158 +: ${PKG_CONFIG:="false"}
   1.159 +
   1.160 +# Simple uname based platform detection
   1.161 +# $PLATFORM is used for platform dependent dependency selection
   1.162 +OS=`uname -s`
   1.163 +OS_VERSION=`uname -r`
   1.164 +printf "detect platform... "
   1.165 +if [ "$OS" = "SunOS" ]; then
   1.166 +    PLATFORM="solaris sunos unix svr4"
   1.167 +fi
   1.168 +if [ "$OS" = "Linux" ]; then
   1.169 +    PLATFORM="linux unix"
   1.170 +fi
   1.171 +if [ "$OS" = "FreeBSD" ]; then
   1.172 +    PLATFORM="freebsd bsd unix"
   1.173 +fi
   1.174 +if [ "$OS" = "Darwin" ]; then
   1.175 +    PLATFORM="macos osx bsd unix"
   1.176 +fi
   1.177 +if echo "$OS" | grep -i "MINGW" > /dev/null; then
   1.178 +    PLATFORM="windows mingw"
   1.179 +fi
   1.180 +: ${PLATFORM:="unix"}
   1.181 +
   1.182 +PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
   1.183 +echo "$PLATFORM_NAME"
   1.184 +
   1.185 +isplatform()
   1.186 +{
   1.187 +    for p in $PLATFORM
   1.188 +    do
   1.189 +        if [ "$p" = "$1" ]; then
   1.190 +            return 0
   1.191 +        fi
   1.192 +    done
   1.193 +    return 1
   1.194 +}
   1.195 +notisplatform()
   1.196 +{
   1.197 +    for p in $PLATFORM
   1.198 +    do
   1.199 +        if [ "$p" = "$1" ]; then
   1.200 +            return 1
   1.201 +        fi
   1.202 +    done
   1.203 +    return 0
   1.204 +}
   1.205 +
   1.206 +
   1.207 +# generate vars.mk
   1.208 +cat > "$TEMP_DIR/vars.mk" << __EOF__
   1.209 +prefix="$prefix"
   1.210 +exec_prefix="$exec_prefix"
   1.211 +bindir="$bindir"
   1.212 +sbindir="$sbindir"
   1.213 +libdir="$libdir"
   1.214 +libexecdir="$libexecdir"
   1.215 +datarootdir="$datarootdir"
   1.216 +datadir="$datadir"
   1.217 +sysconfdir="$sysconfdir"
   1.218 +sharedstatedir="$sharedstatedir"
   1.219 +localstatedir="$localstatedir"
   1.220 +runstatedir="$runstatedir"
   1.221 +includedir="$includedir"
   1.222 +infodir="$infodir"
   1.223 +mandir="$mandir"
   1.224 +localedir="$localedir"
   1.225 +src_dir="$src_dir"
   1.226 +DOXYGEN="$DOXYGEN"
   1.227 +PANDOC="$PANDOC"
   1.228 +CMAKE="$CMAKE"
   1.229 +__EOF__
   1.230 +
   1.231 +# toolchain detection utilities
   1.232 +. make/toolchain.sh
   1.233 +
   1.234 +#
   1.235 +# DEPENDENCIES
   1.236 +#
   1.237 +
   1.238 +# check languages
   1.239 +lang_c=
   1.240 +lang_cpp=
   1.241 +if detect_cpp_compiler ; then
   1.242 +    lang_cpp=1
   1.243 +fi
   1.244 +if detect_c_compiler ; then
   1.245 +    lang_c=1
   1.246 +fi
   1.247 +
   1.248 +# create buffer for make variables required by dependencies
   1.249 +echo > "$TEMP_DIR/make.mk"
   1.250 +
   1.251 +test_pkg_config()
   1.252 +{
   1.253 +    if "$PKG_CONFIG" --exists "$1" ; then :
   1.254 +    else return 1 ; fi
   1.255 +    if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then :
   1.256 +    else return 1 ; fi
   1.257 +    if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then :
   1.258 +    else return 1 ; fi
   1.259 +    if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then :
   1.260 +    else return 1 ; fi
   1.261 +    return 0
   1.262 +}
   1.263 +
   1.264 +dependency_error_pandoc()
   1.265 +{
   1.266 +    printf "checking for pandoc... "
   1.267 +    # dependency pandoc
   1.268 +    while true
   1.269 +    do
   1.270 +        if test -n "$PANDOC" > /dev/null ; then
   1.271 +            :
   1.272 +        else
   1.273 +            break
   1.274 +        fi
   1.275 +        echo yes
   1.276 +        return 1
   1.277 +    done
   1.278 +
   1.279 +    echo no
   1.280 +    return 0
   1.281 +}
   1.282 +dependency_error_cpp()
   1.283 +{
   1.284 +    printf "checking for cpp... "
   1.285 +    # dependency cpp
   1.286 +    while true
   1.287 +    do
   1.288 +        if [ -z "$lang_cpp" ] ; then
   1.289 +            break
   1.290 +        fi
   1.291 +        echo yes
   1.292 +        return 1
   1.293 +    done
   1.294 +
   1.295 +    echo no
   1.296 +    return 0
   1.297 +}
   1.298 +dependency_error_c()
   1.299 +{
   1.300 +    printf "checking for c... "
   1.301 +    # dependency c platform="mingw"
   1.302 +    while true
   1.303 +    do
   1.304 +        if notisplatform "mingw"; then
   1.305 +            break
   1.306 +        fi
   1.307 +        if [ -z "$lang_c" ] ; then
   1.308 +            break
   1.309 +        fi
   1.310 +        cat >> $TEMP_DIR/make.mk << __EOF__
   1.311 +# Dependency: c
   1.312 +AR=ar
   1.313 +ARFLAGS=r
   1.314 +STLIB_EXT=.lib
   1.315 +SHLIB_EXT=.dll
   1.316 +
   1.317 +__EOF__
   1.318 +        echo yes
   1.319 +        return 1
   1.320 +    done
   1.321 +
   1.322 +    # dependency c platform="macos"
   1.323 +    while true
   1.324 +    do
   1.325 +        if notisplatform "macos"; then
   1.326 +            break
   1.327 +        fi
   1.328 +        if [ -z "$lang_c" ] ; then
   1.329 +            break
   1.330 +        fi
   1.331 +        cat >> $TEMP_DIR/make.mk << __EOF__
   1.332 +# Dependency: c
   1.333 +AR=ar
   1.334 +ARFLAGS=r
   1.335 +STLIB_EXT=.a
   1.336 +SHLIB_EXT=.dylib
   1.337 +
   1.338 +__EOF__
   1.339 +        echo yes
   1.340 +        return 1
   1.341 +    done
   1.342 +
   1.343 +    # dependency c platform="unix"
   1.344 +    while true
   1.345 +    do
   1.346 +        if notisplatform "unix"; then
   1.347 +            break
   1.348 +        fi
   1.349 +        if [ -z "$lang_c" ] ; then
   1.350 +            break
   1.351 +        fi
   1.352 +        cat >> $TEMP_DIR/make.mk << __EOF__
   1.353 +# Dependency: c
   1.354 +AR=ar
   1.355 +ARFLAGS=r
   1.356 +STLIB_EXT=.a
   1.357 +SHLIB_EXT=.so
   1.358 +
   1.359 +__EOF__
   1.360 +        echo yes
   1.361 +        return 1
   1.362 +    done
   1.363 +
   1.364 +    echo no
   1.365 +    return 0
   1.366 +}
   1.367 +dependency_error_file_tools()
   1.368 +{
   1.369 +    printf "checking for file-tools... "
   1.370 +    # dependency file-tools
   1.371 +    while true
   1.372 +    do
   1.373 +        cat >> $TEMP_DIR/make.mk << __EOF__
   1.374 +# Dependency: file-tools
   1.375 +MKDIR=mkdir -p
   1.376 +RMDIR=rm -f -R
   1.377 +COPYFILE=cp
   1.378 +COPYALL=cp -R
   1.379 +
   1.380 +__EOF__
   1.381 +        echo yes
   1.382 +        return 1
   1.383 +    done
   1.384 +
   1.385 +    echo no
   1.386 +    return 0
   1.387 +}
   1.388 +dependency_error_cmake()
   1.389 +{
   1.390 +    printf "checking for cmake... "
   1.391 +    # dependency cmake
   1.392 +    while true
   1.393 +    do
   1.394 +        if test -n "$CMAKE" > /dev/null ; then
   1.395 +            :
   1.396 +        else
   1.397 +            break
   1.398 +        fi
   1.399 +        echo yes
   1.400 +        return 1
   1.401 +    done
   1.402 +
   1.403 +    echo no
   1.404 +    return 0
   1.405 +}
   1.406 +dependency_error_doxygen()
   1.407 +{
   1.408 +    printf "checking for doxygen... "
   1.409 +    # dependency doxygen
   1.410 +    while true
   1.411 +    do
   1.412 +        if test -n "$DOXYGEN" > /dev/null ; then
   1.413 +            :
   1.414 +        else
   1.415 +            break
   1.416 +        fi
   1.417 +        echo yes
   1.418 +        return 1
   1.419 +    done
   1.420 +
   1.421 +    echo no
   1.422 +    return 0
   1.423 +}
   1.424 +
   1.425 +
   1.426 +
   1.427 +
   1.428 +# start collecting dependency information
   1.429 +echo > "$TEMP_DIR/flags.mk"
   1.430 +
   1.431 +DEPENDENCIES_FAILED=
   1.432 +ERROR=0
   1.433 +# unnamed dependencies
   1.434 +TEMP_CFLAGS=
   1.435 +TEMP_CXXFLAGS=
   1.436 +TEMP_LDFLAGS=
   1.437 +while true
   1.438 +do
   1.439 +    while true
   1.440 +    do
   1.441 +
   1.442 +        cat >> "$TEMP_DIR/make.mk" << __EOF__
   1.443 +# library version
   1.444 +VERSION="3.0.0"
   1.445 +
   1.446 +# build directory structure !! do not change or override !!
   1.447 +BUILD_DIR=${src_dir}/build
   1.448 +DOCS_DIR=${src_dir}/build/docs
   1.449 +DIST_DIR=${src_dir}/dist
   1.450 +
   1.451 +__EOF__
   1.452 +        break
   1.453 +    done
   1.454 +    break
   1.455 +done
   1.456 +
   1.457 +# add general dependency flags to flags.mk
   1.458 +echo "# general flags" >> "$TEMP_DIR/flags.mk"
   1.459 +if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
   1.460 +    echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
   1.461 +fi
   1.462 +if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
   1.463 +    echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
   1.464 +fi
   1.465 +if [ -n "${TEMP_LDFLAGS}" ]; then
   1.466 +    echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
   1.467 +fi
   1.468 +
   1.469 +#
   1.470 +# OPTION VALUES
   1.471 +#
   1.472 +checkopt_with_tests_yes()
   1.473 +{
   1.474 +    VERR=0
   1.475 +    if dependency_error_cpp ; then
   1.476 +        VERR=1
   1.477 +    fi
   1.478 +    if dependency_error_cmake ; then
   1.479 +        VERR=1
   1.480 +    fi
   1.481 +    if [ $VERR -ne 0 ]; then
   1.482 +        return 1
   1.483 +    fi
   1.484 +    cat >> "$TEMP_DIR/make.mk" << __EOF__
   1.485 +WITH_TESTS=yes
   1.486 +
   1.487 +__EOF__
   1.488 +    return 0
   1.489 +}
   1.490 +checkopt_with_tests_no()
   1.491 +{
   1.492 +    VERR=0
   1.493 +    if [ $VERR -ne 0 ]; then
   1.494 +        return 1
   1.495 +    fi
   1.496 +    return 0
   1.497 +}
   1.498 +checkopt_with_docs_all()
   1.499 +{
   1.500 +    VERR=0
   1.501 +    if dependency_error_pandoc ; then
   1.502 +        VERR=1
   1.503 +    fi
   1.504 +    if dependency_error_doxygen ; then
   1.505 +        VERR=1
   1.506 +    fi
   1.507 +    if [ $VERR -ne 0 ]; then
   1.508 +        return 1
   1.509 +    fi
   1.510 +    cat >> "$TEMP_DIR/make.mk" << __EOF__
   1.511 +# Documentation
   1.512 +WITH_DOCS_API=yes
   1.513 +WITH_DOCS_HTML=yes
   1.514 +
   1.515 +__EOF__
   1.516 +    return 0
   1.517 +}
   1.518 +checkopt_with_docs_html()
   1.519 +{
   1.520 +    VERR=0
   1.521 +    if dependency_error_pandoc ; then
   1.522 +        VERR=1
   1.523 +    fi
   1.524 +    if [ $VERR -ne 0 ]; then
   1.525 +        return 1
   1.526 +    fi
   1.527 +    cat >> "$TEMP_DIR/make.mk" << __EOF__
   1.528 +# Documentation
   1.529 +WITH_DOCS_HTML=yes
   1.530 +
   1.531 +__EOF__
   1.532 +    return 0
   1.533 +}
   1.534 +checkopt_with_docs_api()
   1.535 +{
   1.536 +    VERR=0
   1.537 +    if dependency_error_doxygen ; then
   1.538 +        VERR=1
   1.539 +    fi
   1.540 +    if [ $VERR -ne 0 ]; then
   1.541 +        return 1
   1.542 +    fi
   1.543 +    cat >> "$TEMP_DIR/make.mk" << __EOF__
   1.544 +# Documentation
   1.545 +WITH_DOCS_API=yes
   1.546 +
   1.547 +__EOF__
   1.548 +    return 0
   1.549 +}
   1.550 +checkopt_with_docs_none()
   1.551 +{
   1.552 +    VERR=0
   1.553 +    if [ $VERR -ne 0 ]; then
   1.554 +        return 1
   1.555 +    fi
   1.556 +    return 0
   1.557 +}
   1.558 +
   1.559 +#
   1.560 +# TARGETS
   1.561 +#
   1.562 +
   1.563 +echo >> "$TEMP_DIR/flags.mk"
   1.564 +echo "configuring global target"
   1.565 +echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk"
   1.566 +TEMP_CFLAGS=
   1.567 +TEMP_CXXFLAGS=
   1.568 +TEMP_LDFLAGS=
   1.569 +
   1.570 +if dependency_error_c; then
   1.571 +    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED c "
   1.572 +    ERROR=1
   1.573 +fi
   1.574 +if dependency_error_file_tools; then
   1.575 +    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED file_tools "
   1.576 +    ERROR=1
   1.577 +fi
   1.578 +
   1.579 +# Features
   1.580 +
   1.581 +# Option: --with-tests
   1.582 +if [ -z "$OPT_WITH_TESTS" ]; then
   1.583 +    echo "auto-detecting option 'with-tests'"
   1.584 +    SAVED_ERROR="$ERROR"
   1.585 +    SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
   1.586 +    ERROR=1
   1.587 +    while true
   1.588 +    do
   1.589 +        if checkopt_with_tests_yes ; then
   1.590 +            echo "  with-tests: yes" >> "$TEMP_DIR/options"
   1.591 +            ERROR=0
   1.592 +            break
   1.593 +        fi
   1.594 +        if checkopt_with_tests_no ; then
   1.595 +            echo "  with-tests: no" >> "$TEMP_DIR/options"
   1.596 +            ERROR=0
   1.597 +            break
   1.598 +        fi
   1.599 +        break
   1.600 +    done
   1.601 +    if [ $ERROR -ne 0 ]; then
   1.602 +        SAVED_ERROR=1
   1.603 +        SAVED_DEPENDENCIES_FAILED="option 'with-tests' $SAVED_DEPENDENCIES_FAILED"
   1.604 +    fi
   1.605 +    ERROR="$SAVED_ERROR"
   1.606 +    DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
   1.607 +else
   1.608 +    echo "checking option with-tests = $OPT_WITH_TESTS"
   1.609 +    if false; then
   1.610 +        false
   1.611 +    elif [ "$OPT_WITH_TESTS" = "yes" ]; then
   1.612 +        echo "  with-tests: $OPT_WITH_TESTS" >> $TEMP_DIR/options
   1.613 +        if checkopt_with_tests_yes ; then
   1.614 +            :
   1.615 +        else
   1.616 +            ERROR=1
   1.617 +            DEPENDENCIES_FAILED="option 'with-tests' $DEPENDENCIES_FAILED"
   1.618 +        fi
   1.619 +    elif [ "$OPT_WITH_TESTS" = "no" ]; then
   1.620 +        echo "  with-tests: $OPT_WITH_TESTS" >> $TEMP_DIR/options
   1.621 +        if checkopt_with_tests_no ; then
   1.622 +            :
   1.623 +        else
   1.624 +            ERROR=1
   1.625 +            DEPENDENCIES_FAILED="option 'with-tests' $DEPENDENCIES_FAILED"
   1.626 +        fi
   1.627 +    fi
   1.628 +fi
   1.629 +# Option: --with-docs
   1.630 +if [ -z "$OPT_WITH_DOCS" ]; then
   1.631 +    echo "auto-detecting option 'with-docs'"
   1.632 +    SAVED_ERROR="$ERROR"
   1.633 +    SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
   1.634 +    ERROR=1
   1.635 +    while true
   1.636 +    do
   1.637 +        if checkopt_with_docs_all ; then
   1.638 +            echo "  with-docs: all" >> "$TEMP_DIR/options"
   1.639 +            ERROR=0
   1.640 +            break
   1.641 +        fi
   1.642 +        if checkopt_with_docs_html ; then
   1.643 +            echo "  with-docs: html" >> "$TEMP_DIR/options"
   1.644 +            ERROR=0
   1.645 +            break
   1.646 +        fi
   1.647 +        if checkopt_with_docs_api ; then
   1.648 +            echo "  with-docs: api" >> "$TEMP_DIR/options"
   1.649 +            ERROR=0
   1.650 +            break
   1.651 +        fi
   1.652 +        if checkopt_with_docs_none ; then
   1.653 +            echo "  with-docs: none" >> "$TEMP_DIR/options"
   1.654 +            ERROR=0
   1.655 +            break
   1.656 +        fi
   1.657 +        break
   1.658 +    done
   1.659 +    if [ $ERROR -ne 0 ]; then
   1.660 +        SAVED_ERROR=1
   1.661 +        SAVED_DEPENDENCIES_FAILED="option 'with-docs' $SAVED_DEPENDENCIES_FAILED"
   1.662 +    fi
   1.663 +    ERROR="$SAVED_ERROR"
   1.664 +    DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
   1.665 +else
   1.666 +    echo "checking option with-docs = $OPT_WITH_DOCS"
   1.667 +    if false; then
   1.668 +        false
   1.669 +    elif [ "$OPT_WITH_DOCS" = "all" ]; then
   1.670 +        echo "  with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options
   1.671 +        if checkopt_with_docs_all ; then
   1.672 +            :
   1.673 +        else
   1.674 +            ERROR=1
   1.675 +            DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED"
   1.676 +        fi
   1.677 +    elif [ "$OPT_WITH_DOCS" = "html" ]; then
   1.678 +        echo "  with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options
   1.679 +        if checkopt_with_docs_html ; then
   1.680 +            :
   1.681 +        else
   1.682 +            ERROR=1
   1.683 +            DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED"
   1.684 +        fi
   1.685 +    elif [ "$OPT_WITH_DOCS" = "api" ]; then
   1.686 +        echo "  with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options
   1.687 +        if checkopt_with_docs_api ; then
   1.688 +            :
   1.689 +        else
   1.690 +            ERROR=1
   1.691 +            DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED"
   1.692 +        fi
   1.693 +    elif [ "$OPT_WITH_DOCS" = "none" ]; then
   1.694 +        echo "  with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options
   1.695 +        if checkopt_with_docs_none ; then
   1.696 +            :
   1.697 +        else
   1.698 +            ERROR=1
   1.699 +            DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED"
   1.700 +        fi
   1.701 +    fi
   1.702 +fi
   1.703 +
   1.704 +if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
   1.705 +    echo "CFLAGS  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
   1.706 +fi
   1.707 +if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
   1.708 +    echo "CXXFLAGS  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
   1.709 +fi
   1.710 +if [ "$BUILD_TYPE" = "debug" ]; then
   1.711 +    if [ -n "$lang_c" ]; then
   1.712 +        echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
   1.713 +    fi
   1.714 +    if [ -n "$lang_cpp" ]; then
   1.715 +        echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
   1.716 +    fi
   1.717 +fi
   1.718 +if [ "$BUILD_TYPE" = "release" ]; then
   1.719 +    if [ -n "$lang_c" ]; then
   1.720 +        echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
   1.721 +    fi
   1.722 +    if [ -n "$lang_cpp" ]; then
   1.723 +        echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
   1.724 +    fi
   1.725 +fi
   1.726 +if [ -n "${TEMP_LDFLAGS}" ]; then
   1.727 +    echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
   1.728 +fi
   1.729 +
   1.730 +
   1.731 +# final result
   1.732 +if [ $ERROR -ne 0 ]; then
   1.733 +    echo
   1.734 +    echo "Error: Unresolved dependencies"
   1.735 +    echo "$DEPENDENCIES_FAILED"
   1.736 +    abort_configure
   1.737 +fi
   1.738 +
   1.739 +echo "configure finished"
   1.740 +echo
   1.741 +echo "Build Config:"
   1.742 +echo "  PREFIX:      $prefix"
   1.743 +echo "  TOOLCHAIN:   $TOOLCHAIN_NAME"
   1.744 +echo "Options:"
   1.745 +cat "$TEMP_DIR/options"
   1.746 +echo
   1.747 +
   1.748 +# generate the config.mk file
   1.749 +cat > "$TEMP_DIR/config.mk" << __EOF__
   1.750 +#
   1.751 +# config.mk generated by configure
   1.752 +#
   1.753 +
   1.754 +__EOF__
   1.755 +write_toolchain_defaults "$TEMP_DIR/toolchain.mk"
   1.756 +cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
   1.757 +rm -Rf "$TEMP_DIR"
   1.758 +
   1.759 +

mercurial