test/make/configure.vm

branch
configure-evo
changeset 54
2b8f40c58944
parent 53
704368f1bb23
child 56
d9e8fdfc08f6
--- a/test/make/configure.vm	Fri Sep 15 11:33:35 2023 +0200
+++ b/test/make/configure.vm	Fri Sep 15 14:06:50 2023 +0200
@@ -1,9 +1,21 @@
 #!/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 ! mkdir -p "$TEMP_DIR"; then
+if failed mkdir -p "$TEMP_DIR"; then
     echo "Cannot create tmp dir $TEMP_DIR"
     echo "Abort"
     exit 1
@@ -240,7 +252,7 @@
     while true
     do
         #if( $sub.platform )
-        if ! isplatform "${sub.platform}"; then
+        if failed isplatform "${sub.platform}"; then
             break
         fi
         #end
@@ -255,12 +267,12 @@
         fi
         #end
         #foreach( $test in $sub.tests )
-        if ! $test > /dev/null ; then
+        if failed $test > /dev/null ; then
             break
         fi
         #end
         #foreach( $pkg in $sub.pkgconfig )
-        if ! $pkg.getPkgConfigTestQuery() ; then
+        if failed $pkg.getPkgConfigTestQuery() ; then
             break
         fi
         TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`"
@@ -303,7 +315,7 @@
 while true
 do
     #if( $dependency.platform )
-    if ! isplatform "${dependency.platform}"; then
+    if failed isplatform "${dependency.platform}"; then
         break
     fi
     #end
@@ -322,7 +334,7 @@
         #end
         #foreach( $pkg in $dependency.pkgconfig )
         printf "checking for pkg-config package $pkg.name... "
-        if ! $pkg.getPkgConfigTestQuery() ; then
+        if failed $pkg.getPkgConfigTestQuery() ; then
             echo no
             ERROR=1
             break
@@ -375,7 +387,7 @@
 {
     VERR=0
     #foreach( $dep in $val.dependencies )
-    if ! dependency_$dep ; then
+    if failed dependency_$dep ; then
         VERR=1
     fi
     #end
@@ -409,7 +421,7 @@
 TEMP_LDFLAGS=
 
 #foreach( $dependency in $target.dependencies )
-if ! dependency_$dependency; then
+if failed dependency_$dependency; then
     DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
     ERROR=1
 fi
@@ -420,7 +432,7 @@
 if [ -n "$${feature.getVarName()}" ]; then
 #foreach( $dependency in $feature.dependencies )
     # check dependency
-    if ! dependency_$dependency ; then
+    if failed dependency_$dependency ; then
         # "auto" features can fail and are just disabled in this case
         if [ "$${feature.getVarName()}" = "auto" ]; then
             unset ${feature.getVarName()}
@@ -467,7 +479,7 @@
     #foreach( $optval in $opt.values )
     elif [ "${D}${opt.getVarName()}" = "${optval.value}" ]; then
         echo "  ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options
-        if ! $optval.func ; then
+        if failed $optval.func ; then
             ERROR=1
         fi
     #end

mercurial