removal of failed function in favor what the ancients actually did configure-evo

Sun, 17 Sep 2023 12:19:52 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 17 Sep 2023 12:19:52 +0200
branch
configure-evo
changeset 58
362998dbe619
parent 57
df03772f7429
child 59
410e4f942ce7

removal of failed function in favor what the ancients actually did

test/make/configure.vm file | annotate | diff | comparison | revisions
--- a/test/make/configure.vm	Sun Sep 17 12:15:14 2023 +0200
+++ b/test/make/configure.vm	Sun Sep 17 12:19:52 2023 +0200
@@ -1,21 +1,11 @@
 #!/bin/sh
 
-# runs a command and returns 0 if the command failed
-# same as ! cmd but compatible with svr4 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
@@ -277,16 +267,19 @@
         fi
         #end
         #foreach( $test in $sub.tests )
-        if failed $test > /dev/null ; then
+        if $test > /dev/null ; then
+            :
+        else
             break
         fi
         #end
         #foreach( $pkg in $sub.pkgconfig )
-        if failed $pkg.getPkgConfigTestQuery() ; then
+        if $pkg.getPkgConfigTestQuery() ; then
+            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`"
+            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`"
+        else
             break
         fi
-        TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`"
         #end
         #foreach( $flags in $sub.flags )
         #if( $flags.exec )
@@ -344,14 +337,15 @@
         #end
         #foreach( $pkg in $dependency.pkgconfig )
         printf "checking for pkg-config package $pkg.name... "
-        if failed $pkg.getPkgConfigTestQuery() ; then
+        if $pkg.getPkgConfigTestQuery() ; then
+            echo yes
+            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`"
+            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`"
+        else
             echo no
             ERROR=1
             break
         fi
-        echo yes
-        TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`"
         #end
 
         #foreach( $flags in $dependency.flags )
@@ -489,7 +483,9 @@
     #foreach( $optval in $opt.values )
     elif [ "${D}${opt.getVarName()}" = "${optval.value}" ]; then
         echo "  ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options
-        if failed $optval.func ; then
+        if $optval.func ; then
+            :
+        else
             ERROR=1
         fi
     #end

mercurial