update reference configure scripts configure-evo

Sun, 17 Sep 2023 12:39:42 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 17 Sep 2023 12:39:42 +0200
branch
configure-evo
changeset 60
43d6680e6410
parent 59
410e4f942ce7
child 61
2c68549dabef
child 62
a8af19ddbfec

update reference configure scripts

src/test/resources/golden-sample/configure file | annotate | diff | comparison | revisions
src/test/resources/golden-sample/configure2 file | annotate | diff | comparison | revisions
test/configure file | annotate | diff | comparison | revisions
--- a/src/test/resources/golden-sample/configure	Sun Sep 17 12:34:45 2023 +0200
+++ b/src/test/resources/golden-sample/configure	Sun Sep 17 12:39:42 2023 +0200
@@ -1,9 +1,11 @@
 #!/bin/sh
 
 # create temporary directory
-TEMP_DIR=".tmp-$(uname -n)"
+TEMP_DIR=".tmp-`uname -n`"
 rm -Rf "$TEMP_DIR"
-if ! mkdir -p "$TEMP_DIR"; then
+if mkdir -p "$TEMP_DIR"; then
+    :
+else
     echo "Cannot create tmp dir $TEMP_DIR"
     echo "Abort"
     exit 1
@@ -27,8 +29,8 @@
 MANDIR=
 
 # custom variables
-HOST=$(uname -n)
-PREFIX=$(pwd)/work
+HOST=`uname -n`
+PREFIX=`pwd`/work
 INSTALL_DIR=$PREFIX
 
 # features
@@ -102,26 +104,26 @@
 
 
 # set dir variables
-BINDIR=${BINDIR:-"$EPREFIX/bin"}
-SBINDIR=${SBINDIR:-"$EPREFIX/sbin"}
-LIBDIR=${LIBDIR:-"$EPREFIX/lib"}
-LIBEXECDIR=${LIBEXECDIR:-"$EPREFIX/libexec"}
-DATADIR=${DATADIR:-"$PREFIX/share"}
-SYSCONFDIR=${SYSCONFDIR:-"$PREFIX/etc"}
-SHAREDSTATEDIR=${SHAREDSTATEDIR:-"$PREFIX/com"}
-LOCALSTATEDIR=${LOCALSTATEDIR:-"$PREFIX/var"}
-INCLUDEDIR=${INCLUDEDIR:-"$PREFIX/include"}
-INFODIR=${INFODIR:-"$PREFIX/info"}
-MANDIR=${MANDIR:-"$PREFIX/man"}
+: ${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=${PKG_CONFIG:-"false"}
+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)
+OS=`uname -s`
+OS_VERSION=`uname -r`
 printf "detect platform... "
 if [ "$OS" = "SunOS" ]; then
     PLATFORM="solaris sunos unix svr4"
@@ -138,9 +140,9 @@
 if echo "$OS" | grep -i "MINGW" > /dev/null; then
     PLATFORM="windows mingw"
 fi
-PLATFORM=${PLATFORM:-"unix"}
+: ${PLATFORM:="unix"}
 
-PLATFORM_NAME=$(echo "$PLATFORM" | cut -f1 -d' ' -)
+PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
 echo "$PLATFORM_NAME"
 
 isplatform()
@@ -153,6 +155,16 @@
     done
     return 1
 }
+notisplatform()
+{
+    for p in $PLATFORM
+    do
+        if [ "$p" = "$1" ]; then
+            return 1
+        fi
+    done
+    return 0
+}
 
 
 # generate config.mk
@@ -198,7 +210,7 @@
 # create buffer for make variables required by dependencies
 echo > "$TEMP_DIR/make.mk"
 
-dependency_libpq()
+dependency_error_libpq()
 {
     printf "checking for libpq... "
     # dependency libpq
@@ -207,19 +219,20 @@
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
-        if ! $PKG_CONFIG libpq ; then
+        if $PKG_CONFIG libpq ; then
+            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libpq`"
+            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libpq`"
+        else
             break
         fi
-        TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags libpq)"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs libpq)"
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
-dependency_openssl()
+dependency_error_openssl()
 {
     printf "checking for openssl... "
     # dependency openssl
@@ -228,50 +241,51 @@
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
-        if ! $PKG_CONFIG openssl ; then
+        if $PKG_CONFIG openssl ; then
+            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags openssl`"
+            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs openssl`"
+        else
             break
         fi
-        TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags openssl)"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs openssl)"
         echo yes
-        return 0
+        return 1
     done
 
     # dependency openssl platform="bsd"
     while true
     do
-        if ! isplatform "bsd"; then
+        if notisplatform "bsd"; then
             break
         fi
         TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto"
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
-dependency_libxml2()
+dependency_error_libxml2()
 {
     printf "checking for libxml2... "
     # dependency libxml2 platform="macos"
     while true
     do
-        if ! isplatform "macos"; then
+        if notisplatform "macos"; then
             break
         fi
-        if tmp_flags=$(xml2-config --cflags) ; then
+        if tmp_flags=`xml2-config --cflags` ; then
             TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags"
         else
             break
         fi
-        if tmp_flags=$(xml2-config --libs) ; then
+        if tmp_flags=`xml2-config --libs` ; then
             TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags"
         else
             break
         fi
         echo yes
-        return 0
+        return 1
     done
 
     # dependency libxml2
@@ -280,17 +294,18 @@
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
-        if ! $PKG_CONFIG libxml-2.0 ; then
+        if $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
-        TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags libxml-2.0)"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs libxml-2.0)"
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
 
 DEPENDENCIES_FAILED=
@@ -329,11 +344,11 @@
 TEMP_CFLAGS=
 TEMP_LDFLAGS=
 
-if ! dependency_libxml2; then
+if dependency_error_libxml2; then
     DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
     ERROR=1
 fi
-if ! dependency_openssl; then
+if dependency_error_openssl; then
     DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl "
     ERROR=1
 fi
@@ -341,7 +356,7 @@
 # Features
 if [ -n "$FEATURE_PG" ]; then
     # check dependency
-    if ! dependency_libpq ; then
+    if dependency_error_libpq ; then
         # "auto" features can fail and are just disabled in this case
         if [ "$FEATURE_PG" = "auto" ]; then
             unset FEATURE_PG
--- a/src/test/resources/golden-sample/configure2	Sun Sep 17 12:34:45 2023 +0200
+++ b/src/test/resources/golden-sample/configure2	Sun Sep 17 12:39:42 2023 +0200
@@ -1,9 +1,11 @@
 #!/bin/sh
 
 # create temporary directory
-TEMP_DIR=".tmp-$(uname -n)"
+TEMP_DIR=".tmp-`uname -n`"
 rm -Rf "$TEMP_DIR"
-if ! mkdir -p "$TEMP_DIR"; then
+if mkdir -p "$TEMP_DIR"; then
+    :
+else
     echo "Cannot create tmp dir $TEMP_DIR"
     echo "Abort"
     exit 1
@@ -108,26 +110,26 @@
 
 
 # set dir variables
-BINDIR=${BINDIR:-"$EPREFIX/bin"}
-SBINDIR=${SBINDIR:-"$EPREFIX/sbin"}
-LIBDIR=${LIBDIR:-"$EPREFIX/lib"}
-LIBEXECDIR=${LIBEXECDIR:-"$EPREFIX/libexec"}
-DATADIR=${DATADIR:-"$PREFIX/share"}
-SYSCONFDIR=${SYSCONFDIR:-"$PREFIX/etc"}
-SHAREDSTATEDIR=${SHAREDSTATEDIR:-"$PREFIX/com"}
-LOCALSTATEDIR=${LOCALSTATEDIR:-"$PREFIX/var"}
-INCLUDEDIR=${INCLUDEDIR:-"$PREFIX/include"}
-INFODIR=${INFODIR:-"$PREFIX/info"}
-MANDIR=${MANDIR:-"$PREFIX/man"}
+: ${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=${PKG_CONFIG:-"false"}
+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)
+OS=`uname -s`
+OS_VERSION=`uname -r`
 printf "detect platform... "
 if [ "$OS" = "SunOS" ]; then
     PLATFORM="solaris sunos unix svr4"
@@ -144,9 +146,9 @@
 if echo "$OS" | grep -i "MINGW" > /dev/null; then
     PLATFORM="windows mingw"
 fi
-PLATFORM=${PLATFORM:-"unix"}
+: ${PLATFORM:="unix"}
 
-PLATFORM_NAME=$(echo "$PLATFORM" | cut -f1 -d' ' -)
+PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
 echo "$PLATFORM_NAME"
 
 isplatform()
@@ -159,6 +161,16 @@
     done
     return 1
 }
+notisplatform()
+{
+    for p in $PLATFORM
+    do
+        if [ "$p" = "$1" ]; then
+            return 1
+        fi
+    done
+    return 0
+}
 
 
 # generate config.mk
@@ -201,55 +213,57 @@
 # create buffer for make variables required by dependencies
 echo > "$TEMP_DIR/make.mk"
 
-dependency_qt4()
+dependency_error_qt4()
 {
     printf "checking for qt4... "
     # dependency qt4
     while true
     do
-        if ! which qmake-qt4 > /dev/null ; then
+        if which qmake-qt4 > /dev/null ; then
+            :
+        else
             break
         fi
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
-dependency_curl()
+dependency_error_curl()
 {
     printf "checking for curl... "
     # dependency curl platform="windows"
     while true
     do
-        if ! isplatform "windows"; then
+        if notisplatform "windows"; then
             break
         fi
         TEMP_CFLAGS="$TEMP_CFLAGS -I/mingw/include"
         TEMP_LDFLAGS="$TEMP_LDFLAGS -lcurl"
         echo yes
-        return 0
+        return 1
     done
 
     # dependency curl platform="macos"
     while true
     do
-        if ! isplatform "macos"; then
+        if notisplatform "macos"; then
             break
         fi
-        if tmp_flags=$(curl-config --cflags) ; then
+        if tmp_flags=`curl-config --cflags` ; then
             TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags"
         else
             break
         fi
-        if tmp_flags=$(curl-config --ldflags) ; then
+        if tmp_flags=`curl-config --ldflags` ; then
             TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags"
         else
             break
         fi
         echo yes
-        return 0
+        return 1
     done
 
     # dependency curl
@@ -258,19 +272,20 @@
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
-        if ! $PKG_CONFIG libcurl ; then
+        if $PKG_CONFIG libcurl ; then
+            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libcurl`"
+            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libcurl`"
+        else
             break
         fi
-        TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags libcurl)"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs libcurl)"
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
-dependency_gtk2()
+dependency_error_gtk2()
 {
     printf "checking for gtk2... "
     # dependency gtk2
@@ -279,19 +294,20 @@
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
-        if ! $PKG_CONFIG gtk+-2.0 ; then
+        if $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
-        TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags gtk+-2.0)"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs gtk+-2.0)"
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
-dependency_sqlite()
+dependency_error_sqlite()
 {
     printf "checking for sqlite... "
     # dependency sqlite
@@ -300,25 +316,26 @@
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
-        if ! $PKG_CONFIG sqlite3 ; then
+        if $PKG_CONFIG sqlite3 ; then
+            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags sqlite3`"
+            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs sqlite3`"
+        else
             break
         fi
-        TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags sqlite3)"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs sqlite3)"
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
-dependency_test()
+dependency_error_test()
 {
     printf "checking for test... "
     # dependency test platform="bsd"
     while true
     do
-        if ! isplatform "bsd"; then
+        if notisplatform "bsd"; then
             break
         fi
         if isplatform "macos"; then
@@ -326,7 +343,7 @@
         fi
         TEMP_CFLAGS="$TEMP_CFLAGS -DBSD"
         echo yes
-        return 0
+        return 1
     done
 
     # dependency test
@@ -334,13 +351,13 @@
     do
         TEMP_CFLAGS="$TEMP_CFLAGS -DTEST"
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
-dependency_gtk3()
+dependency_error_gtk3()
 {
     printf "checking for gtk3... "
     # dependency gtk3
@@ -349,19 +366,20 @@
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
-        if ! $PKG_CONFIG gtk+-5.0 ; then
+        if $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
-        TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags gtk+-5.0)"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs gtk+-5.0)"
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
-dependency_deptest()
+dependency_error_deptest()
 {
     printf "checking for deptest... "
     # dependency deptest
@@ -369,13 +387,13 @@
     do
         TEMP_CFLAGS="$TEMP_CFLAGS -DDEPTEST"
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
-dependency_libxml2()
+dependency_error_libxml2()
 {
     printf "checking for libxml2... "
     # dependency libxml2
@@ -384,22 +402,23 @@
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
-        if ! $PKG_CONFIG --atleast-version=2.8 libxml-2.0 ; then
+        if $PKG_CONFIG --atleast-version=2.8 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
-        TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags libxml-2.0)"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs libxml-2.0)"
         cat >> $TEMP_DIR/make.mk << __EOF__
 # Dependency: libxml2
 xml = libxml2
 
 __EOF__
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
 
 DEPENDENCIES_FAILED=
@@ -437,7 +456,7 @@
 checkopt_toolkit_gtk3()
 {
     VERR=0
-    if ! dependency_gtk3 ; then
+    if dependency_error_gtk3 ; then
         VERR=1
     fi
     if [ $VERR -ne 0 ]; then
@@ -453,10 +472,10 @@
 checkopt_toolkit_cli()
 {
     VERR=0
-    if ! dependency_curl ; then
+    if dependency_error_curl ; then
         VERR=1
     fi
-    if ! dependency_test ; then
+    if dependency_error_test ; then
         VERR=1
     fi
     if [ $VERR -ne 0 ]; then
@@ -467,7 +486,7 @@
 checkopt_toolkit_gtk2()
 {
     VERR=0
-    if ! dependency_gtk2 ; then
+    if dependency_error_gtk2 ; then
         VERR=1
     fi
     if [ $VERR -ne 0 ]; then
@@ -478,7 +497,7 @@
 checkopt_toolkit_wpf()
 {
     VERR=0
-    if ! dependency_test ; then
+    if dependency_error_test ; then
         VERR=1
     fi
     if [ $VERR -ne 0 ]; then
@@ -495,15 +514,15 @@
 TEMP_CFLAGS=
 TEMP_LDFLAGS=
 
-if ! dependency_curl; then
+if dependency_error_curl; then
     DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl "
     ERROR=1
 fi
-if ! dependency_libxml2; then
+if dependency_error_libxml2; then
     DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
     ERROR=1
 fi
-if ! dependency_test; then
+if dependency_error_test; then
     DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED test "
     ERROR=1
 fi
@@ -511,7 +530,7 @@
 # Features
 if [ -n "$FEATURE_DB" ]; then
     # check dependency
-    if ! dependency_sqlite ; then
+    if dependency_error_sqlite ; then
         # "auto" features can fail and are just disabled in this case
         if [ "$FEATURE_DB" = "auto" ]; then
             unset FEATURE_DB
@@ -523,7 +542,7 @@
 fi
 if [ -n "$FEATURE_GUI" ]; then
     # check dependency
-    if ! dependency_gtk3 ; then
+    if dependency_error_gtk3 ; then
         # "auto" features can fail and are just disabled in this case
         if [ "$FEATURE_GUI" = "auto" ]; then
             unset FEATURE_GUI
@@ -570,22 +589,30 @@
         false
     elif [ "$OPT_TOOLKIT" = "gtk3" ]; then
         echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
-        if ! checkopt_toolkit_gtk3 ; then
+        if checkopt_toolkit_gtk3 ; then
+            :
+        else
             ERROR=1
         fi
     elif [ "$OPT_TOOLKIT" = "cli" ]; then
         echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
-        if ! checkopt_toolkit_cli ; then
+        if checkopt_toolkit_cli ; then
+            :
+        else
             ERROR=1
         fi
     elif [ "$OPT_TOOLKIT" = "gtk2" ]; then
         echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
-        if ! checkopt_toolkit_gtk2 ; then
+        if checkopt_toolkit_gtk2 ; then
+            :
+        else
             ERROR=1
         fi
     elif [ "$OPT_TOOLKIT" = "wpf" ]; then
         echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
-        if ! checkopt_toolkit_wpf ; then
+        if checkopt_toolkit_wpf ; then
+            :
+        else
             ERROR=1
         fi
     fi
@@ -609,7 +636,7 @@
 TEMP_CFLAGS=
 TEMP_LDFLAGS=
 
-if ! dependency_deptest; then
+if dependency_error_deptest; then
     DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED deptest "
     ERROR=1
 fi
--- a/test/configure	Sun Sep 17 12:34:45 2023 +0200
+++ b/test/configure	Sun Sep 17 12:39:42 2023 +0200
@@ -1,20 +1,11 @@
 #!/bin/sh
 
-failed()
-{
-    $@
-    if [ $? -ne 0 ]; then
-        return 0
-    else
-        return 1
-    fi
-}
-
-
 # create temporary directory
 TEMP_DIR=".tmp-`uname -n`"
 rm -Rf "$TEMP_DIR"
-if failed mkdir -p "$TEMP_DIR"; then
+if mkdir -p "$TEMP_DIR"; then
+    :
+else
     echo "Cannot create tmp dir $TEMP_DIR"
     echo "Abort"
     exit 1
@@ -113,21 +104,21 @@
 
 
 # set dir variables
-BINDIR=${BINDIR:-"$EPREFIX/bin"}
-SBINDIR=${SBINDIR:-"$EPREFIX/sbin"}
-LIBDIR=${LIBDIR:-"$EPREFIX/lib"}
-LIBEXECDIR=${LIBEXECDIR:-"$EPREFIX/libexec"}
-DATADIR=${DATADIR:-"$PREFIX/share"}
-SYSCONFDIR=${SYSCONFDIR:-"$PREFIX/etc"}
-SHAREDSTATEDIR=${SHAREDSTATEDIR:-"$PREFIX/com"}
-LOCALSTATEDIR=${LOCALSTATEDIR:-"$PREFIX/var"}
-INCLUDEDIR=${INCLUDEDIR:-"$PREFIX/include"}
-INFODIR=${INFODIR:-"$PREFIX/info"}
-MANDIR=${MANDIR:-"$PREFIX/man"}
+: ${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=${PKG_CONFIG:-"false"}
+: ${PKG_CONFIG:="false"}
 
 # Simple uname based platform detection
 # $PLATFORM is used for platform dependent dependency selection
@@ -149,7 +140,7 @@
 if echo "$OS" | grep -i "MINGW" > /dev/null; then
     PLATFORM="windows mingw"
 fi
-PLATFORM=${PLATFORM:-"unix"}
+: ${PLATFORM:="unix"}
 
 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
 echo "$PLATFORM_NAME"
@@ -164,6 +155,16 @@
     done
     return 1
 }
+notisplatform()
+{
+    for p in $PLATFORM
+    do
+        if [ "$p" = "$1" ]; then
+            return 1
+        fi
+    done
+    return 0
+}
 
 
 # generate config.mk
@@ -202,7 +203,6 @@
     abort_configure
 fi
 
-
 #
 # DEPENDENCIES
 #
@@ -210,7 +210,7 @@
 # create buffer for make variables required by dependencies
 echo > "$TEMP_DIR/make.mk"
 
-dependency_libpq()
+dependency_error_libpq()
 {
     printf "checking for libpq... "
     # dependency libpq
@@ -219,19 +219,20 @@
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
-        if failed $PKG_CONFIG libpq ; then
+        if $PKG_CONFIG libpq ; then
+            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libpq`"
+            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libpq`"
+        else
             break
         fi
-        TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libpq`"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libpq`"
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
-dependency_openssl()
+dependency_error_openssl()
 {
     printf "checking for openssl... "
     # dependency openssl
@@ -240,36 +241,37 @@
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
-        if failed $PKG_CONFIG openssl ; then
+        if $PKG_CONFIG openssl ; then
+            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags openssl`"
+            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs openssl`"
+        else
             break
         fi
-        TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags openssl`"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs openssl`"
         echo yes
-        return 0
+        return 1
     done
 
     # dependency openssl platform="bsd"
     while true
     do
-        if failed isplatform "bsd"; then
+        if notisplatform "bsd"; then
             break
         fi
         TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto"
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
-dependency_libxml2()
+dependency_error_libxml2()
 {
     printf "checking for libxml2... "
     # dependency libxml2 platform="macos"
     while true
     do
-        if failed isplatform "macos"; then
+        if notisplatform "macos"; then
             break
         fi
         if tmp_flags=`xml2-config --cflags` ; then
@@ -283,7 +285,7 @@
             break
         fi
         echo yes
-        return 0
+        return 1
     done
 
     # dependency libxml2
@@ -292,17 +294,18 @@
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
-        if failed $PKG_CONFIG libxml-2.0 ; then
+        if $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
-        TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libxml-2.0`"
         echo yes
-        return 0
+        return 1
     done
 
     echo no
-    return 1
+    return 0
 }
 
 DEPENDENCIES_FAILED=
@@ -341,11 +344,11 @@
 TEMP_CFLAGS=
 TEMP_LDFLAGS=
 
-if failed dependency_libxml2; then
+if dependency_error_libxml2; then
     DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
     ERROR=1
 fi
-if failed dependency_openssl; then
+if dependency_error_openssl; then
     DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl "
     ERROR=1
 fi
@@ -353,7 +356,7 @@
 # Features
 if [ -n "$FEATURE_PG" ]; then
     # check dependency
-    if failed dependency_libpq ; then
+    if dependency_error_libpq ; then
         # "auto" features can fail and are just disabled in this case
         if [ "$FEATURE_PG" = "auto" ]; then
             unset FEATURE_PG

mercurial