# HG changeset patch # User Olaf Wintermann # Date 1694779610 -7200 # Node ID 2b8f40c5894485c6f63a8acef26cbddb0e3dbcde # Parent 704368f1bb234232f4f107f48d9d7d51a2bb8a7c make configure script svr4 compatible again diff -r 704368f1bb23 -r 2b8f40c58944 test/configure --- a/test/configure Fri Sep 15 11:33:35 2023 +0200 +++ b/test/configure Fri Sep 15 14:06:50 2023 +0200 @@ -1,9 +1,20 @@ #!/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 ! mkdir -p "$TEMP_DIR"; then +if failed mkdir -p "$TEMP_DIR"; then echo "Cannot create tmp dir $TEMP_DIR" echo "Abort" exit 1 @@ -28,7 +39,7 @@ # custom variables HOST=`uname -n` -PREFIX=$(pwd)/work +PREFIX=`pwd`/work INSTALL_DIR=$PREFIX # features @@ -191,6 +202,7 @@ abort_configure fi + # # DEPENDENCIES # @@ -207,7 +219,7 @@ if [ -z "$PKG_CONFIG" ]; then break fi - if ! $PKG_CONFIG libpq ; then + if failed $PKG_CONFIG libpq ; then break fi TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libpq`" @@ -228,7 +240,7 @@ if [ -z "$PKG_CONFIG" ]; then break fi - if ! $PKG_CONFIG openssl ; then + if failed $PKG_CONFIG openssl ; then break fi TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags openssl`" @@ -240,7 +252,7 @@ # dependency openssl platform="bsd" while true do - if ! isplatform "bsd"; then + if failed isplatform "bsd"; then break fi TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto" @@ -257,7 +269,7 @@ # dependency libxml2 platform="macos" while true do - if ! isplatform "macos"; then + if failed isplatform "macos"; then break fi if tmp_flags=`xml2-config --cflags` ; then @@ -280,7 +292,7 @@ if [ -z "$PKG_CONFIG" ]; then break fi - if ! $PKG_CONFIG libxml-2.0 ; then + if failed $PKG_CONFIG libxml-2.0 ; then break fi TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`" @@ -329,11 +341,11 @@ TEMP_CFLAGS= TEMP_LDFLAGS= -if ! dependency_libxml2; then +if failed dependency_libxml2; then DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " ERROR=1 fi -if ! dependency_openssl; then +if failed dependency_openssl; then DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " ERROR=1 fi @@ -341,7 +353,7 @@ # Features if [ -n "$FEATURE_PG" ]; then # check dependency - if ! dependency_libpq ; then + if failed dependency_libpq ; then # "auto" features can fail and are just disabled in this case if [ "$FEATURE_PG" = "auto" ]; then unset FEATURE_PG diff -r 704368f1bb23 -r 2b8f40c58944 test/make/configure.vm --- 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 diff -r 704368f1bb23 -r 2b8f40c58944 test/make/toolchain.sh --- a/test/make/toolchain.sh Fri Sep 15 11:33:35 2023 +0200 +++ b/test/make/toolchain.sh Fri Sep 15 14:06:50 2023 +0200 @@ -75,7 +75,7 @@ if [ -n "$CC" ]; then if check_c_compiler "$CC"; then TOOLCHAIN_CC=$CC - TOOLCHAIN_NAME=$("$TEMP_DIR/checkcc") + TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"` echo $CC else echo "$CC is not a working C compiler" @@ -85,12 +85,12 @@ for COMP in $C_COMPILERS do if check_c_compiler "$COMP"; then - TOOLCHAIN_NAME=$("$TEMP_DIR/checkcc") + TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"` TOOLCHAIN_CC=$COMP break fi done - echo "${TOOLCHAIN_CC-"not found"}" + echo ${TOOLCHAIN_CC:-"not found"} fi printf "detect C++ compiler... " @@ -98,7 +98,7 @@ if [ -n "$CXX" ]; then if check_cpp_compiler "$CXX"; then TOOLCHAIN_CXX=$CXX - TOOLCHAIN_NAME=$("$TEMP_DIR/checkcc") + TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"` echo $CXX else echo "$CXX is not a working C++ compiler" @@ -108,12 +108,12 @@ for COMP in $CPP_COMPILERS do if check_cpp_compiler "$COMP"; then - TOOLCHAIN_NAME=$("$TEMP_DIR/checkcc") + TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"` TOOLCHAIN_CXX=$COMP break fi done - echo "${TOOLCHAIN_CXX-"not found"}" + echo ${TOOLCHAIN_CXX:-"not found"} fi printf "detect linker... "