remove golden sample tests because they are not needed anymore

Tue, 10 Oct 2023 18:52:47 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 10 Oct 2023 18:52:47 +0200
changeset 87
60bd4f61e89f
parent 86
ad0f22720c50
child 88
0a663c3692a0

remove golden sample tests because they are not needed anymore

src/test/java/de/unixwork/uwproj/RegressionTest.java file | annotate | diff | comparison | revisions
src/test/resources/golden-sample/configure file | annotate | diff | comparison | revisions
src/test/resources/golden-sample/configure2 file | annotate | diff | comparison | revisions
--- a/src/test/java/de/unixwork/uwproj/RegressionTest.java	Fri Oct 06 20:49:15 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-package de.unixwork.uwproj;
-
-import org.junit.jupiter.api.Test;
-
-import java.io.BufferedWriter;
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStreamWriter;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Objects;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-public class RegressionTest {
-
-    private void goldenSampleTest(String xml, String gs) throws Exception {
-        final var contents = new ByteArrayOutputStream();
-        try (var out = new BufferedWriter(new OutputStreamWriter(contents))) {
-            Main.writeConfigureScript(out, "test/make/configure.vm", Main.loadProjectFile("test/make/" + xml));
-        }
-        assertEquals(
-                Files.readString(Path.of(
-                        Objects.requireNonNull(RegressionTest.class.getClassLoader().getResource("golden-sample/" + gs)).toURI()
-                )),
-                contents.toString(StandardCharsets.UTF_8)
-        );
-    }
-
-    @Test
-    void projectXmlOutput() throws Exception {
-        goldenSampleTest("project.xml", "configure");
-    }
-
-    @Test
-    void project2XmlOutput() throws Exception {
-        goldenSampleTest("project2.xml", "configure2");
-    }
-}
--- a/src/test/resources/golden-sample/configure	Fri Oct 06 20:49:15 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,492 +0,0 @@
-#!/bin/sh
-
-# create temporary directory
-TEMP_DIR=".tmp-`uname -n`"
-rm -Rf "$TEMP_DIR"
-if mkdir -p "$TEMP_DIR"; then
-    :
-else
-    echo "Cannot create tmp dir $TEMP_DIR"
-    echo "Abort"
-    exit 1
-fi
-touch "$TEMP_DIR/options"
-touch "$TEMP_DIR/features"
-
-# define standard variables
-PREFIX=/usr
-EPREFIX=
-BINDIR=
-SBINDIR=
-LIBDIR=
-LIBEXECDIR=
-DATADIR=
-SYSCONFDIR=
-SHAREDSTATEDIR=
-LOCALSTATEDIR=
-INCLUDEDIR=
-INFODIR=
-MANDIR=
-
-# custom variables
-HOST=`uname -n`
-PREFIX="`pwd`/work"
-INSTALL_DIR="$PREFIX"
-
-# features
-FEATURE_PG=auto
-
-# clean abort
-abort_configure()
-{
-    rm -Rf "$TEMP_DIR"
-    exit 1
-}
-
-# help text
-printhelp()
-{
-    echo "Usage: $0 [OPTIONS]..."
-    cat << __EOF__
-Installation directories:
-  --prefix=PREFIX         path prefix for architecture-independent files
-                          [/usr]
-  --exec-prefix=EPREFIX   path prefix for architecture-dependent files
-                          [PREFIX]
-
-  --bindir=DIR            user executables [EPREFIX/bin]
-  --sbindir=DIR           system admin executables [EPREFIX/sbin]
-  --libexecdir=DIR        program executables [EPREFIX/libexec]
-  --sysconfdir=DIR        system configuration files [PREFIX/etc]
-  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
-  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --libdir=DIR            object code libraries [EPREFIX/lib]
-  --includedir=DIR        C header files [PREFIX/include]
-  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
-  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
-  --infodir=DIR           info documentation [DATAROOTDIR/info]
-  --mandir=DIR            man documentation [DATAROOTDIR/man]
-
-Optional Features:
-  --disable-pg
-
-__EOF__
-}
-
-#
-# parse arguments
-#
-BUILD_TYPE="default"
-for ARG in "$@"
-do
-    case "$ARG" in
-        "--prefix="*)         PREFIX=${ARG#--prefix=} ;;
-        "--exec-prefix="*)    EPREFIX=${ARG#--exec-prefix=} ;;
-        "--bindir="*)         BINDIR=${ARG#----bindir=} ;;
-        "--sbindir="*)        SBINDIR=${ARG#--sbindir=} ;;
-        "--libdir="*)         LIBDIR=${ARG#--libdir=} ;;
-        "--libexecdir="*)     LIBEXECDIR=${ARG#--libexecdir=} ;;
-        "--datadir="*)        DATADIR=${ARG#--datadir=} ;;
-        "--sysconfdir="*)     SYSCONFDIR=${ARG#--sysconfdir=} ;;
-        "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;;
-        "--localstatedir="*)  LOCALSTATEDIR=${ARG#--localstatedir=} ;;
-        "--includedir="*)     INCLUDEDIR=${ARG#--includedir=} ;;
-        "--infodir="*)        INFODIR=${ARG#--infodir=} ;;
-        "--mandir"*)          MANDIR=${ARG#--mandir} ;;
-        "--help"*) printhelp; abort_configure ;;
-        "--debug")           BUILD_TYPE="debug" ;;
-        "--release")         BUILD_TYPE="release" ;;
-        "--enable-pg") FEATURE_PG=on ;;
-        "--disable-pg") unset FEATURE_PG ;;
-        "-"*) echo "unknown option: $ARG"; abort_configure ;;
-    esac
-done
-
-
-# set dir variables
-: ${EPREFIX:="$PREFIX"}
-: ${BINDIR:="$EPREFIX/bin"}
-: ${SBINDIR:="$EPREFIX/sbin"}
-: ${LIBDIR:="$EPREFIX/lib"}
-: ${LIBEXECDIR:="$EPREFIX/libexec"}
-: ${DATADIR:="$PREFIX/share"}
-: ${SYSCONFDIR:="$PREFIX/etc"}
-: ${SHAREDSTATEDIR:="$PREFIX/com"}
-: ${LOCALSTATEDIR:="$PREFIX/var"}
-: ${INCLUDEDIR:="$PREFIX/include"}
-: ${INFODIR:="$PREFIX/info"}
-: ${MANDIR:="$PREFIX/man"}
-
-# Test for availability of pkg-config
-PKG_CONFIG=`command -v pkg-config`
-: ${PKG_CONFIG:="false"}
-
-# Simple uname based platform detection
-# $PLATFORM is used for platform dependent dependency selection
-OS=`uname -s`
-OS_VERSION=`uname -r`
-printf "detect platform... "
-if [ "$OS" = "SunOS" ]; then
-    PLATFORM="solaris sunos unix svr4"
-fi
-if [ "$OS" = "Linux" ]; then
-    PLATFORM="linux unix"
-fi
-if [ "$OS" = "FreeBSD" ]; then
-    PLATFORM="freebsd bsd unix"
-fi
-if [ "$OS" = "Darwin" ]; then
-    PLATFORM="macos osx bsd unix"
-fi
-if echo "$OS" | grep -i "MINGW" > /dev/null; then
-    PLATFORM="windows mingw"
-fi
-: ${PLATFORM:="unix"}
-
-PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
-echo "$PLATFORM_NAME"
-
-isplatform()
-{
-    for p in $PLATFORM
-    do
-        if [ "$p" = "$1" ]; then
-            return 0
-        fi
-    done
-    return 1
-}
-notisplatform()
-{
-    for p in $PLATFORM
-    do
-        if [ "$p" = "$1" ]; then
-            return 1
-        fi
-    done
-    return 0
-}
-
-
-# generate vars.mk
-cat > "$TEMP_DIR/vars.mk" << __EOF__
-PREFIX="$PREFIX"
-EPREFIX="$EPREFIX"
-BINDIR="$BINDIR"
-SBINDIR="$SBINDIR"
-LIBDIR="$LIBDIR"
-LIBEXECDIR="$LIBEXECDIR"
-DATADIR="$DATADIR"
-SYSCONFDIR="$SYSCONFDIR"
-SHAREDSTATEDIR="$SHAREDSTATEDIR"
-LOCALSTATEDIR="$LOCALSTATEDIR"
-INCLUDEDIR="$INCLUDEDIR"
-INFODIR="$INFODIR"
-MANDIR="$MANDIR"
-HOST="$HOST"
-PREFIX="$PREFIX"
-INSTALL_DIR="$INSTALL_DIR"
-__EOF__
-sort -u -o "$TEMP_DIR/vars.mk" "$TEMP_DIR/vars.mk"
-
-
-# toolchain detection utilities
-. make/toolchain.sh
-
-#
-# DEPENDENCIES
-#
-
-# check languages
-lang_c=
-lang_cpp=
-if detect_cpp_compiler ; then
-    lang_cpp=1
-fi
-if detect_c_compiler ; then
-    lang_c=1
-fi
-
-# create buffer for make variables required by dependencies
-echo > "$TEMP_DIR/make.mk"
-
-test_pkg_config()
-{
-    if "$PKG_CONFIG" --exists "$1" ; then :
-    else return 1 ; fi
-    if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then :
-    else return 1 ; fi
-    if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then :
-    else return 1 ; fi
-    if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then :
-    else return 1 ; fi
-    return 0
-}
-
-dependency_error_cpp()
-{
-    printf "checking for cpp... "
-    # dependency cpp
-    while true
-    do
-        if [ -z "$lang_cpp" ] ; then
-            break
-        fi
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-dependency_error_libpq()
-{
-    printf "checking for libpq... "
-    # dependency libpq
-    while true
-    do
-        if [ -z "$PKG_CONFIG" ]; then
-            break
-        fi
-        if test_pkg_config "libpq" "" "" "" ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libpq`"
-            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libpq`"
-        else
-            break
-        fi
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-dependency_error_openssl()
-{
-    printf "checking for openssl... "
-    # dependency openssl
-    while true
-    do
-        if [ -z "$lang_c" ] ; then
-            break
-        fi
-        if [ -z "$PKG_CONFIG" ]; then
-            break
-        fi
-        if test_pkg_config "openssl" "" "" "" ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags openssl`"
-            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs openssl`"
-        else
-            break
-        fi
-        echo yes
-        return 1
-    done
-
-    # dependency openssl platform="bsd"
-    while true
-    do
-        if notisplatform "bsd"; then
-            break
-        fi
-        TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto"
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-dependency_error_libxml2()
-{
-    printf "checking for libxml2... "
-    # dependency libxml2 platform="macos"
-    while true
-    do
-        if notisplatform "macos"; then
-            break
-        fi
-        if tmp_flags=`xml2-config --cflags` ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags"
-        else
-            break
-        fi
-        if tmp_flags=`xml2-config --libs` ; then
-            TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags"
-        else
-            break
-        fi
-        echo yes
-        return 1
-    done
-
-    # dependency libxml2
-    while true
-    do
-        if [ -z "$PKG_CONFIG" ]; then
-            break
-        fi
-        if test_pkg_config "libxml-2.0" "" "" "" ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`"
-            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libxml-2.0`"
-        else
-            break
-        fi
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-
-
-
-
-# start collecting dependency information
-echo > "$TEMP_DIR/flags.mk"
-
-DEPENDENCIES_FAILED=
-ERROR=0
-# unnamed dependencies
-TEMP_CFLAGS=
-TEMP_CXXFLAGS=
-TEMP_LDFLAGS=
-while true
-do
-    while true
-    do
-        if [ -z "$lang_c" ] ; then
-            ERROR=1
-            break
-        fi
-
-        break
-    done
-    break
-done
-
-# add general dependency flags to flags.mk
-echo "# general flags" >> "$TEMP_DIR/flags.mk"
-if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
-    echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
-    echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-if [ -n "${TEMP_LDFLAGS}" ]; then
-    echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-
-#
-# OPTION VALUES
-#
-
-#
-# TARGETS
-#
-
-echo >> "$TEMP_DIR/flags.mk"
-echo "configuring global target"
-echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk"
-TEMP_CFLAGS=
-TEMP_CXXFLAGS=
-TEMP_LDFLAGS=
-
-if dependency_error_libxml2; then
-    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
-    ERROR=1
-fi
-if dependency_error_openssl; then
-    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl "
-    ERROR=1
-fi
-
-# Features
-if [ -n "$FEATURE_PG" ]; then
-    # check dependency
-    if dependency_error_libpq ; then
-        # "auto" features can fail and are just disabled in this case
-        if [ "$FEATURE_PG" = "auto" ]; then
-            DISABLE_FEATURE_PG=1
-        else
-            DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq "
-            ERROR=1
-        fi
-    fi
-    # check dependency
-    if dependency_error_cpp ; then
-        # "auto" features can fail and are just disabled in this case
-        if [ "$FEATURE_PG" = "auto" ]; then
-            DISABLE_FEATURE_PG=1
-        else
-            DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED cpp "
-            ERROR=1
-        fi
-    fi
-    if [ -n "$DISABLE_FEATURE_PG" ]; then
-        unset FEATURE_PG
-    fi
-fi
-
-
-if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
-    echo "CFLAGS  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
-    echo "CXXFLAGS  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-if [ "$BUILD_TYPE" = "debug" ]; then
-    if [ -n "$lang_c" ]; then
-        echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    fi
-    if [ -n "$lang_cpp" ]; then
-        echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    fi
-fi
-if [ "$BUILD_TYPE" = "release" ]; then
-    if [ -n "$lang_c" ]; then
-        echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    fi
-    if [ -n "$lang_cpp" ]; then
-        echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    fi
-fi
-if [ -n "${TEMP_LDFLAGS}" ]; then
-    echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-
-
-# final result
-if [ $ERROR -ne 0 ]; then
-    echo
-    echo "Error: Unresolved dependencies"
-    echo "$DEPENDENCIES_FAILED"
-    abort_configure
-fi
-
-echo "configure finished"
-echo
-echo "Build Config:"
-echo "  PREFIX:    $PREFIX"
-echo "  TOOLCHAIN: $TOOLCHAIN_NAME"
-echo "Features:"
-if [ -n "$FEATURE_PG" ]; then
-echo "  pg: on"
-else
-echo "  pg: off"
-fi
-echo
-
-# generate the config.mk file
-cat > "$TEMP_DIR/config.mk" << __EOF__
-#
-# config.mk generated by configure
-#
-
-__EOF__
-write_toolchain_defaults "$TEMP_DIR/toolchain.mk"
-cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
-rm -Rf "$TEMP_DIR"
-
-
--- a/src/test/resources/golden-sample/configure2	Fri Oct 06 20:49:15 2023 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,769 +0,0 @@
-#!/bin/sh
-
-# create temporary directory
-TEMP_DIR=".tmp-`uname -n`"
-rm -Rf "$TEMP_DIR"
-if mkdir -p "$TEMP_DIR"; then
-    :
-else
-    echo "Cannot create tmp dir $TEMP_DIR"
-    echo "Abort"
-    exit 1
-fi
-touch "$TEMP_DIR/options"
-touch "$TEMP_DIR/features"
-
-# define standard variables
-PREFIX=/usr
-EPREFIX=
-BINDIR=
-SBINDIR=
-LIBDIR=
-LIBEXECDIR=
-DATADIR=
-SYSCONFDIR=
-SHAREDSTATEDIR=
-LOCALSTATEDIR=
-INCLUDEDIR=
-INFODIR=
-MANDIR=
-
-# custom variables
-
-# features
-FEATURE_DB=auto
-
-# clean abort
-abort_configure()
-{
-    rm -Rf "$TEMP_DIR"
-    exit 1
-}
-
-# help text
-printhelp()
-{
-    echo "Usage: $0 [OPTIONS]..."
-    cat << __EOF__
-Installation directories:
-  --prefix=PREFIX         path prefix for architecture-independent files
-                          [/usr]
-  --exec-prefix=EPREFIX   path prefix for architecture-dependent files
-                          [PREFIX]
-
-  --bindir=DIR            user executables [EPREFIX/bin]
-  --sbindir=DIR           system admin executables [EPREFIX/sbin]
-  --libexecdir=DIR        program executables [EPREFIX/libexec]
-  --sysconfdir=DIR        system configuration files [PREFIX/etc]
-  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
-  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --libdir=DIR            object code libraries [EPREFIX/lib]
-  --includedir=DIR        C header files [PREFIX/include]
-  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
-  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
-  --infodir=DIR           info documentation [DATAROOTDIR/info]
-  --mandir=DIR            man documentation [DATAROOTDIR/man]
-
-Options:
-  --debug                 add extra compile flags for debug builds
-  --release               add extra compile flags for release builds
-  --toolkit=(gtk3|cli|gtk2|wpf)
-
-Optional Features:
-  --disable-db
-  --enable-gui
-
-__EOF__
-}
-
-#
-# parse arguments
-#
-BUILD_TYPE="default"
-for ARG in "$@"
-do
-    case "$ARG" in
-        "--prefix="*)         PREFIX=${ARG#--prefix=} ;;
-        "--exec-prefix="*)    EPREFIX=${ARG#--exec-prefix=} ;;
-        "--bindir="*)         BINDIR=${ARG#----bindir=} ;;
-        "--sbindir="*)        SBINDIR=${ARG#--sbindir=} ;;
-        "--libdir="*)         LIBDIR=${ARG#--libdir=} ;;
-        "--libexecdir="*)     LIBEXECDIR=${ARG#--libexecdir=} ;;
-        "--datadir="*)        DATADIR=${ARG#--datadir=} ;;
-        "--sysconfdir="*)     SYSCONFDIR=${ARG#--sysconfdir=} ;;
-        "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;;
-        "--localstatedir="*)  LOCALSTATEDIR=${ARG#--localstatedir=} ;;
-        "--includedir="*)     INCLUDEDIR=${ARG#--includedir=} ;;
-        "--infodir="*)        INFODIR=${ARG#--infodir=} ;;
-        "--mandir"*)          MANDIR=${ARG#--mandir} ;;
-        "--help"*) printhelp; abort_configure ;;
-        "--debug")           BUILD_TYPE="debug" ;;
-        "--release")         BUILD_TYPE="release" ;;
-        "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;;
-        "--enable-db") FEATURE_DB=on ;;
-        "--disable-db") unset FEATURE_DB ;;
-        "--enable-gui") FEATURE_GUI=on ;;
-        "--disable-gui") unset FEATURE_GUI ;;
-        "-"*) echo "unknown option: $ARG"; abort_configure ;;
-    esac
-done
-
-
-# set dir variables
-: ${EPREFIX:="$PREFIX"}
-: ${BINDIR:="$EPREFIX/bin"}
-: ${SBINDIR:="$EPREFIX/sbin"}
-: ${LIBDIR:="$EPREFIX/lib"}
-: ${LIBEXECDIR:="$EPREFIX/libexec"}
-: ${DATADIR:="$PREFIX/share"}
-: ${SYSCONFDIR:="$PREFIX/etc"}
-: ${SHAREDSTATEDIR:="$PREFIX/com"}
-: ${LOCALSTATEDIR:="$PREFIX/var"}
-: ${INCLUDEDIR:="$PREFIX/include"}
-: ${INFODIR:="$PREFIX/info"}
-: ${MANDIR:="$PREFIX/man"}
-
-# Test for availability of pkg-config
-PKG_CONFIG=`command -v pkg-config`
-: ${PKG_CONFIG:="false"}
-
-# Simple uname based platform detection
-# $PLATFORM is used for platform dependent dependency selection
-OS=`uname -s`
-OS_VERSION=`uname -r`
-printf "detect platform... "
-if [ "$OS" = "SunOS" ]; then
-    PLATFORM="solaris sunos unix svr4"
-fi
-if [ "$OS" = "Linux" ]; then
-    PLATFORM="linux unix"
-fi
-if [ "$OS" = "FreeBSD" ]; then
-    PLATFORM="freebsd bsd unix"
-fi
-if [ "$OS" = "Darwin" ]; then
-    PLATFORM="macos osx bsd unix"
-fi
-if echo "$OS" | grep -i "MINGW" > /dev/null; then
-    PLATFORM="windows mingw"
-fi
-: ${PLATFORM:="unix"}
-
-PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
-echo "$PLATFORM_NAME"
-
-isplatform()
-{
-    for p in $PLATFORM
-    do
-        if [ "$p" = "$1" ]; then
-            return 0
-        fi
-    done
-    return 1
-}
-notisplatform()
-{
-    for p in $PLATFORM
-    do
-        if [ "$p" = "$1" ]; then
-            return 1
-        fi
-    done
-    return 0
-}
-
-
-# generate vars.mk
-cat > "$TEMP_DIR/vars.mk" << __EOF__
-PREFIX="$PREFIX"
-EPREFIX="$EPREFIX"
-BINDIR="$BINDIR"
-SBINDIR="$SBINDIR"
-LIBDIR="$LIBDIR"
-LIBEXECDIR="$LIBEXECDIR"
-DATADIR="$DATADIR"
-SYSCONFDIR="$SYSCONFDIR"
-SHAREDSTATEDIR="$SHAREDSTATEDIR"
-LOCALSTATEDIR="$LOCALSTATEDIR"
-INCLUDEDIR="$INCLUDEDIR"
-INFODIR="$INFODIR"
-MANDIR="$MANDIR"
-__EOF__
-sort -u -o "$TEMP_DIR/vars.mk" "$TEMP_DIR/vars.mk"
-
-
-# toolchain detection utilities
-. make/toolchain.sh
-
-#
-# DEPENDENCIES
-#
-
-# check languages
-lang_c=
-lang_cpp=
-if detect_c_compiler ; then
-    lang_c=1
-fi
-
-# create buffer for make variables required by dependencies
-echo > "$TEMP_DIR/make.mk"
-
-test_pkg_config()
-{
-    if "$PKG_CONFIG" --exists "$1" ; then :
-    else return 1 ; fi
-    if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then :
-    else return 1 ; fi
-    if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then :
-    else return 1 ; fi
-    if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then :
-    else return 1 ; fi
-    return 0
-}
-
-dependency_error_qt4()
-{
-    printf "checking for qt4... "
-    # dependency qt4
-    while true
-    do
-        if which qmake-qt4 > /dev/null ; then
-            :
-        else
-            break
-        fi
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-dependency_error_curl()
-{
-    printf "checking for curl... "
-    # dependency curl platform="windows"
-    while true
-    do
-        if notisplatform "windows"; then
-            break
-        fi
-        TEMP_CFLAGS="$TEMP_CFLAGS -I/mingw/include"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS -lcurl"
-        echo yes
-        return 1
-    done
-
-    # dependency curl platform="macos"
-    while true
-    do
-        if notisplatform "macos"; then
-            break
-        fi
-        if tmp_flags=`curl-config --cflags` ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags"
-        else
-            break
-        fi
-        if tmp_flags=`curl-config --ldflags` ; then
-            TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags"
-        else
-            break
-        fi
-        echo yes
-        return 1
-    done
-
-    # dependency curl
-    while true
-    do
-        if [ -z "$PKG_CONFIG" ]; then
-            break
-        fi
-        if test_pkg_config "libcurl" "" "" "" ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libcurl`"
-            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libcurl`"
-        else
-            break
-        fi
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-dependency_error_gtk2()
-{
-    printf "checking for gtk2... "
-    # dependency gtk2
-    while true
-    do
-        if [ -z "$PKG_CONFIG" ]; then
-            break
-        fi
-        if test_pkg_config "gtk+-2.0" "" "" "" ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-2.0`"
-            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-2.0`"
-        else
-            break
-        fi
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-dependency_error_sqlite()
-{
-    printf "checking for sqlite... "
-    # dependency sqlite
-    while true
-    do
-        if [ -z "$PKG_CONFIG" ]; then
-            break
-        fi
-        if test_pkg_config "sqlite3" "" "" "" ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags sqlite3`"
-            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs sqlite3`"
-        else
-            break
-        fi
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-dependency_error_test()
-{
-    printf "checking for test... "
-    # dependency test platform="bsd"
-    while true
-    do
-        if notisplatform "bsd"; then
-            break
-        fi
-        if isplatform "macos"; then
-            break
-        fi
-        TEMP_CFLAGS="$TEMP_CFLAGS -DBSD"
-        echo yes
-        return 1
-    done
-
-    # dependency test
-    while true
-    do
-        TEMP_CFLAGS="$TEMP_CFLAGS -DTEST"
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-dependency_error_gtk3()
-{
-    printf "checking for gtk3... "
-    # dependency gtk3
-    while true
-    do
-        if [ -z "$PKG_CONFIG" ]; then
-            break
-        fi
-        if test_pkg_config "gtk+-5.0" "" "" "" ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-5.0`"
-            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-5.0`"
-        else
-            break
-        fi
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-dependency_error_deptest()
-{
-    printf "checking for deptest... "
-    # dependency deptest
-    while true
-    do
-        TEMP_CFLAGS="$TEMP_CFLAGS -DDEPTEST"
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-dependency_error_libxml2()
-{
-    printf "checking for libxml2... "
-    # dependency libxml2
-    while true
-    do
-        if [ -z "$PKG_CONFIG" ]; then
-            break
-        fi
-        if test_pkg_config "libxml-2.0" "2.8" "" "" ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`"
-            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libxml-2.0`"
-        else
-            break
-        fi
-        cat >> $TEMP_DIR/make.mk << __EOF__
-# Dependency: libxml2
-xml = libxml2
-
-__EOF__
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-
-
-
-
-# start collecting dependency information
-echo > "$TEMP_DIR/flags.mk"
-
-DEPENDENCIES_FAILED=
-ERROR=0
-# unnamed dependencies
-TEMP_CFLAGS=
-TEMP_CXXFLAGS=
-TEMP_LDFLAGS=
-while true
-do
-    while true
-    do
-        if [ -z "$lang_c" ] ; then
-            ERROR=1
-            break
-        fi
-
-        cat >> "$TEMP_DIR/make.mk" << __EOF__
-MVAR = 123
-MVAR += 123
-
-__EOF__
-        break
-    done
-    break
-done
-
-# add general dependency flags to flags.mk
-echo "# general flags" >> "$TEMP_DIR/flags.mk"
-if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
-    echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
-    echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-if [ -n "${TEMP_LDFLAGS}" ]; then
-    echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-
-#
-# OPTION VALUES
-#
-checkopt_toolkit_gtk3()
-{
-    VERR=0
-    if dependency_error_gtk3 ; then
-        VERR=1
-    fi
-    if [ $VERR -ne 0 ]; then
-        return 1
-    fi
-        TEMP_CFLAGS="$TEMP_CFLAGS -Da=b"
-        TEMP_CXXFLAGS="$TEMP_CXXFLAGS -Da=b"
-    cat >> "$TEMP_DIR/make.mk" << __EOF__
-UIOBJ += graphics_cairo.o
-
-__EOF__
-    return 0
-}
-checkopt_toolkit_cli()
-{
-    VERR=0
-    if dependency_error_curl ; then
-        VERR=1
-    fi
-    if dependency_error_test ; then
-        VERR=1
-    fi
-    if [ $VERR -ne 0 ]; then
-        return 1
-    fi
-    return 0
-}
-checkopt_toolkit_gtk2()
-{
-    VERR=0
-    if dependency_error_gtk2 ; then
-        VERR=1
-    fi
-    if [ $VERR -ne 0 ]; then
-        return 1
-    fi
-    return 0
-}
-checkopt_toolkit_wpf()
-{
-    VERR=0
-    if dependency_error_test ; then
-        VERR=1
-    fi
-    if [ $VERR -ne 0 ]; then
-        return 1
-    fi
-    return 0
-}
-
-#
-# TARGETS
-#
-
-echo >> "$TEMP_DIR/flags.mk"
-echo "configuring target: dav"
-echo "# flags for target dav" >> "$TEMP_DIR/flags.mk"
-TEMP_CFLAGS=
-TEMP_CXXFLAGS=
-TEMP_LDFLAGS=
-
-if dependency_error_curl; then
-    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl "
-    ERROR=1
-fi
-if dependency_error_libxml2; then
-    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
-    ERROR=1
-fi
-if dependency_error_test; then
-    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED test "
-    ERROR=1
-fi
-
-# Features
-if [ -n "$FEATURE_DB" ]; then
-    # check dependency
-    if dependency_error_sqlite ; then
-        # "auto" features can fail and are just disabled in this case
-        if [ "$FEATURE_DB" = "auto" ]; then
-            DISABLE_FEATURE_DB=1
-        else
-            DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sqlite "
-            ERROR=1
-        fi
-    fi
-    if [ -n "$DISABLE_FEATURE_DB" ]; then
-        unset FEATURE_DB
-    fi
-fi
-if [ -n "$FEATURE_GUI" ]; then
-    # check dependency
-    if dependency_error_gtk3 ; then
-        # "auto" features can fail and are just disabled in this case
-        if [ "$FEATURE_GUI" = "auto" ]; then
-            DISABLE_FEATURE_GUI=1
-        else
-            DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED gtk3 "
-            ERROR=1
-        fi
-    fi
-    if [ -n "$DISABLE_FEATURE_GUI" ]; then
-        unset FEATURE_GUI
-    fi
-fi
-
-# Option: --toolkit
-if [ -z "$OPT_TOOLKIT" ]; then
-    echo "auto-detecting option 'toolkit'"
-    SAVED_ERROR="$ERROR"
-    SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
-    ERROR=1
-    while true
-    do
-        if isplatform "windows"; then
-        if checkopt_toolkit_wpf ; then
-            echo "  toolkit: wpf" >> "$TEMP_DIR/options"
-            ERROR=0
-            break
-        fi
-        fi
-        if checkopt_toolkit_gtk3 ; then
-            echo "  toolkit: gtk3" >> "$TEMP_DIR/options"
-            ERROR=0
-            break
-        fi
-        if checkopt_toolkit_gtk2 ; then
-            echo "  toolkit: gtk2" >> "$TEMP_DIR/options"
-            ERROR=0
-            break
-        fi
-        break
-    done
-    if [ $ERROR -ne 0 ]; then
-        SAVED_ERROR=1
-        SAVED_DEPENDENCIES_FAILED="option 'toolkit' $SAVED_DEPENDENCIES_FAILED"
-    fi
-    ERROR="$SAVED_ERROR"
-    DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
-else
-    echo "checking option toolkit = $OPT_TOOLKIT"
-    if false; then
-        false
-    elif [ "$OPT_TOOLKIT" = "gtk3" ]; then
-        echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
-        if checkopt_toolkit_gtk3 ; then
-            :
-        else
-            ERROR=1
-            DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
-        fi
-    elif [ "$OPT_TOOLKIT" = "cli" ]; then
-        echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
-        if checkopt_toolkit_cli ; then
-            :
-        else
-            ERROR=1
-            DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
-        fi
-    elif [ "$OPT_TOOLKIT" = "gtk2" ]; then
-        echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
-        if checkopt_toolkit_gtk2 ; then
-            :
-        else
-            ERROR=1
-            DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
-        fi
-    elif [ "$OPT_TOOLKIT" = "wpf" ]; then
-        echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
-        if checkopt_toolkit_wpf ; then
-            :
-        else
-            ERROR=1
-            DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED"
-        fi
-    fi
-fi
-
-if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
-    echo "DAV_CFLAGS  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
-    echo "DAV_CXXFLAGS  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-if [ "$BUILD_TYPE" = "debug" ]; then
-    if [ -n "$lang_c" ]; then
-        echo 'DAV_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    fi
-    if [ -n "$lang_cpp" ]; then
-        echo 'DAV_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    fi
-fi
-if [ "$BUILD_TYPE" = "release" ]; then
-    if [ -n "$lang_c" ]; then
-        echo 'DAV_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    fi
-    if [ -n "$lang_cpp" ]; then
-        echo 'DAV_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    fi
-fi
-if [ -n "${TEMP_LDFLAGS}" ]; then
-    echo "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-
-echo >> "$TEMP_DIR/flags.mk"
-echo "configuring global target"
-echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk"
-TEMP_CFLAGS=
-TEMP_CXXFLAGS=
-TEMP_LDFLAGS=
-
-if dependency_error_deptest; then
-    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED deptest "
-    ERROR=1
-fi
-
-# Features
-
-
-if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
-    echo "CFLAGS  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
-    echo "CXXFLAGS  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-if [ "$BUILD_TYPE" = "debug" ]; then
-    if [ -n "$lang_c" ]; then
-        echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    fi
-    if [ -n "$lang_cpp" ]; then
-        echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    fi
-fi
-if [ "$BUILD_TYPE" = "release" ]; then
-    if [ -n "$lang_c" ]; then
-        echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    fi
-    if [ -n "$lang_cpp" ]; then
-        echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    fi
-fi
-if [ -n "${TEMP_LDFLAGS}" ]; then
-    echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-
-
-# final result
-if [ $ERROR -ne 0 ]; then
-    echo
-    echo "Error: Unresolved dependencies"
-    echo "$DEPENDENCIES_FAILED"
-    abort_configure
-fi
-
-echo "configure finished"
-echo
-echo "Build Config:"
-echo "  PREFIX:    $PREFIX"
-echo "  TOOLCHAIN: $TOOLCHAIN_NAME"
-echo "Options:"
-cat "$TEMP_DIR/options"
-echo "Features:"
-if [ -n "$FEATURE_DB" ]; then
-echo "  db: on"
-else
-echo "  db: off"
-fi
-if [ -n "$FEATURE_GUI" ]; then
-echo "  gui: on"
-else
-echo "  gui: off"
-fi
-echo
-
-# generate the config.mk file
-cat > "$TEMP_DIR/config.mk" << __EOF__
-#
-# config.mk generated by configure
-#
-
-__EOF__
-write_toolchain_defaults "$TEMP_DIR/toolchain.mk"
-cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
-rm -Rf "$TEMP_DIR"
-
-

mercurial