fix incompatibility with some unix systems

Tue, 13 Aug 2019 21:01:48 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 13 Aug 2019 21:01:48 +0200
changeset 9
ebdecbbb2f79
parent 8
82cd9f1d94cb
child 10
135c0599f883

fix incompatibility with some unix systems

test/configure file | annotate | diff | comparison | revisions
test/make/configure.vm file | annotate | diff | comparison | revisions
test/make/toolchain.sh file | annotate | diff | comparison | revisions
--- a/test/configure	Sat Aug 03 17:45:03 2019 +0200
+++ b/test/configure	Tue Aug 13 21:01:48 2019 +0200
@@ -104,42 +104,42 @@
 done
 
 # set dir variables
-if [ -z $BINDIR ]; then
+if [ -z "$BINDIR" ]; then
 	BINDIR=$EPREFIX/bin
 fi
-if [ -z $SBINDIR ]; then
+if [ -z "$SBINDIR" ]; then
 	SBINDIR=$EPREFIX/sbin
 fi
-if [ -z $LIBDIR ]; then
+if [ -z "$LIBDIR" ]; then
 	LIBDIR=$EPREFIX/lib
 fi
-if [ -z $LIBEXEC ]; then
+if [ -z "$LIBEXEC" ]; then
 	LIBEXECDIR=$EPREFIX/libexec
 fi
-if [ -z $DATADIR ]; then
+if [ -z "$DATADIR" ]; then
 	DATADIR=$PREFIX/share
 fi
-if [ -z $SYSCONFDIR]; then
+if [ -z "$SYSCONFDIR" ]; then
 	SYSCONFDIR=$PREFIX/etc
 fi
-if [ -z $SHAREDSTATEDIR ]; then
+if [ -z "$SHAREDSTATEDIR" ]; then
 	SHAREDSTATEDIR=$PREFIX/com
 fi
-if [ -z $LOCALSTATEDIR ]; then
+if [ -z "$LOCALSTATEDIR" ]; then
 	LOCALSTATEDIR=$PREFIX/var
 fi
-if [ -z $INCLUDEDIR ]; then
+if [ -z "$INCLUDEDIR" ]; then
 	INCLUDEDIR=$PREFIX/include
 fi
-if [ -z $INFODIR ]; then
+if [ -z "$INFODIR" ]; then
 	INFODIR=$PREFIX/info
 fi
-if [ -z $MANDIR ]; then
+if [ -z "$MANDIR" ]; then
 	MANDIR=$PREFIX/man
 fi
 
 which pkg-config > /dev/null
-if [ $? -ne 0 ]; then
+if [ $? -eq 0 ]; then
     PKG_CONFIG=pkg-config
 else
     PKG_CONFIG=false
@@ -226,13 +226,13 @@
 
 # add user specified flags to config.mk
 echo >> $TEMP_DIR/config.mk
-if [[ ! -z ${ENV_CFLAGS} ]]; then
+if [ ! -z "${ENV_CFLAGS}" ]; then
     echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${ENV_CXXFLAGS} ]]; then
+if [ ! -z "${ENV_CXXFLAGS}" ]; then
     echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${ENV_LDFLAGS} ]]; then
+if [ ! -z "${ENV_LDFLAGS}" ]; then
     echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 
@@ -246,14 +246,14 @@
     # dependency libpq 
     while true
     do
-        if [ -z "PKG_CONFIG" ]; then
+        if [ -z "$PKG_CONFIG" ]; then
         	break
         fi
-        if ! pkg-config libpq ; then
+        if ! $PKG_CONFIG libpq ; then
             break
         fi
-        CFLAGS+=" `pkg-config --cflags libpq`"
-        LDFLAGS+=" `pkg-config --libs libpq`"
+        CFLAGS+=" `$PKG_CONFIG --cflags libpq`"
+        LDFLAGS+=" `$PKG_CONFIG --libs libpq`"
 		echo yes
         return 0
     done
@@ -267,14 +267,14 @@
     # dependency openssl 
     while true
     do
-        if [ -z "PKG_CONFIG" ]; then
+        if [ -z "$PKG_CONFIG" ]; then
         	break
         fi
-        if ! pkg-config openssl ; then
+        if ! $PKG_CONFIG openssl ; then
             break
         fi
-        CFLAGS+=" `pkg-config --cflags openssl`"
-        LDFLAGS+=" `pkg-config --libs openssl`"
+        CFLAGS+=" `$PKG_CONFIG --cflags openssl`"
+        LDFLAGS+=" `$PKG_CONFIG --libs openssl`"
 		echo yes
         return 0
     done
@@ -288,14 +288,14 @@
     # dependency libxml2 
     while true
     do
-        if [ -z "PKG_CONFIG" ]; then
+        if [ -z "$PKG_CONFIG" ]; then
         	break
         fi
-        if ! pkg-config libxml-2.0 ; then
+        if ! $PKG_CONFIG libxml-2.0 ; then
             break
         fi
-        CFLAGS+=" `pkg-config --cflags libxml-2.0`"
-        LDFLAGS+=" `pkg-config --libs libxml-2.0`"
+        CFLAGS+=" `$PKG_CONFIG --cflags libxml-2.0`"
+        LDFLAGS+=" `$PKG_CONFIG --libs libxml-2.0`"
 		echo yes
         return 0
     done
@@ -323,13 +323,13 @@
 
 # add general dependency flags to config.mk
 echo >> $TEMP_DIR/config.mk
-if [[ ! -z ${CFLAGS} ]]; then
+if [ ! -z "${CFLAGS}" ]; then
     echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${CXXFLAGS} ]]; then
+if [ ! -z "${CXXFLAGS}" ]; then
     echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${LDFLAGS} ]]; then
+if [ ! -z "${LDFLAGS}" ]; then
     echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 
@@ -362,13 +362,13 @@
 
 
 echo >> $TEMP_DIR/config.mk
-if [[ ! -z ${CFLAGS} ]]; then
+if [ ! -z "${CFLAGS}" ]; then
     echo "CFLAGS  += $CFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${CXXFLAGS} ]]; then
+if [ ! -z "${CXXFLAGS}" ]; then
     echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${LDFLAGS} ]]; then
+if [ ! -z "${LDFLAGS}" ]; then
     echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 
--- a/test/make/configure.vm	Sat Aug 03 17:45:03 2019 +0200
+++ b/test/make/configure.vm	Tue Aug 13 21:01:48 2019 +0200
@@ -162,42 +162,42 @@
 done
 
 # set dir variables
-if [ -z $BINDIR ]; then
+if [ -z "$BINDIR" ]; then
 	BINDIR=$EPREFIX/bin
 fi
-if [ -z $SBINDIR ]; then
+if [ -z "$SBINDIR" ]; then
 	SBINDIR=$EPREFIX/sbin
 fi
-if [ -z $LIBDIR ]; then
+if [ -z "$LIBDIR" ]; then
 	LIBDIR=$EPREFIX/lib
 fi
-if [ -z $LIBEXEC ]; then
+if [ -z "$LIBEXEC" ]; then
 	LIBEXECDIR=$EPREFIX/libexec
 fi
-if [ -z $DATADIR ]; then
+if [ -z "$DATADIR" ]; then
 	DATADIR=$PREFIX/share
 fi
-if [ -z $SYSCONFDIR]; then
+if [ -z "$SYSCONFDIR" ]; then
 	SYSCONFDIR=$PREFIX/etc
 fi
-if [ -z $SHAREDSTATEDIR ]; then
+if [ -z "$SHAREDSTATEDIR" ]; then
 	SHAREDSTATEDIR=$PREFIX/com
 fi
-if [ -z $LOCALSTATEDIR ]; then
+if [ -z "$LOCALSTATEDIR" ]; then
 	LOCALSTATEDIR=$PREFIX/var
 fi
-if [ -z $INCLUDEDIR ]; then
+if [ -z "$INCLUDEDIR" ]; then
 	INCLUDEDIR=$PREFIX/include
 fi
-if [ -z $INFODIR ]; then
+if [ -z "$INFODIR" ]; then
 	INFODIR=$PREFIX/info
 fi
-if [ -z $MANDIR ]; then
+if [ -z "$MANDIR" ]; then
 	MANDIR=$PREFIX/man
 fi
 
 which pkg-config > /dev/null
-if [ $? -ne 0 ]; then
+if [ $? -eq 0 ]; then
     PKG_CONFIG=pkg-config
 else
     PKG_CONFIG=false
@@ -311,13 +311,13 @@
 
 # add user specified flags to config.mk
 echo >> $TEMP_DIR/config.mk
-if [[ ! -z ${ENV_CFLAGS} ]]; then
+if [ ! -z "${ENV_CFLAGS}" ]; then
     echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${ENV_CXXFLAGS} ]]; then
+if [ ! -z "${ENV_CXXFLAGS}" ]; then
     echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${ENV_LDFLAGS} ]]; then
+if [ ! -z "${ENV_LDFLAGS}" ]; then
     echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 
@@ -344,16 +344,16 @@
         fi
 		#end
         #if( $sub.pkgconfig.size() > 0 )
-        if [ -z "PKG_CONFIG" ]; then
+        if [ -z "$PKG_CONFIG" ]; then
         	break
         fi
         #end
         #foreach( $pkg in $sub.pkgconfig )
-        if ! pkg-config $pkg.getPkgConfigParam() ; then
+        if ! $PKG_CONFIG $pkg.getPkgConfigParam() ; then
             break
         fi
-        CFLAGS+=" `pkg-config --cflags $pkg.getPkgConfigParam()`"
-        LDFLAGS+=" `pkg-config --libs $pkg.getPkgConfigParam()`"
+        CFLAGS+=" `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
+        LDFLAGS+=" `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
         #end
         #foreach( $flags in $sub.flags )
         #if( $flags.exec )
@@ -411,21 +411,21 @@
     while true
     do
         #if( $dependency.pkgconfig.size() > 0 )
-        if [ -z "PKG_CONFIG" ]; then
+        if [ -z "$PKG_CONFIG" ]; then
             ERROR=1
             break
         fi
         #end
         #foreach( $pkg in $dependency.pkgconfig )
         printf "checking for pkg-config package $pkg.getPkgConfigParam()... "
-        if ! pkg-config $pkg.getPkgConfigParam() ; then
+        if ! $PKG_CONFIG $pkg.getPkgConfigParam() ; then
             echo no
             ERROR=1
             break
         fi
         echo yes
-        CFLAGS+=" `pkg-config --cflags $pkg.getPkgConfigParam()`"
-        LDFLAGS+=" `pkg-config --libs $pkg.getPkgConfigParam()`"
+        CFLAGS+=" `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
+        LDFLAGS+=" `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
         #end
         
         #foreach( $flags in $dependency.flags )
@@ -456,13 +456,13 @@
 
 # add general dependency flags to config.mk
 echo >> $TEMP_DIR/config.mk
-if [[ ! -z ${CFLAGS} ]]; then
+if [ ! -z "${CFLAGS}" ]; then
     echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${CXXFLAGS} ]]; then
+if [ ! -z "${CXXFLAGS}" ]; then
     echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${LDFLAGS} ]]; then
+if [ ! -z "${LDFLAGS}" ]; then
     echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 #end
@@ -567,13 +567,13 @@
 #end
 
 echo >> $TEMP_DIR/config.mk
-if [[ ! -z ${CFLAGS} ]]; then
+if [ ! -z "${CFLAGS}" ]; then
     echo "${target.getCFlags()}  += $CFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${CXXFLAGS} ]]; then
+if [ ! -z "${CXXFLAGS}" ]; then
     echo "${target.getCXXFlags()} += $CXXFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${LDFLAGS} ]]; then
+if [ ! -z "${LDFLAGS}" ]; then
     echo "${target.getLDFlags()} += $LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 
--- a/test/make/toolchain.sh	Sat Aug 03 17:45:03 2019 +0200
+++ b/test/make/toolchain.sh	Tue Aug 13 21:01:48 2019 +0200
@@ -69,7 +69,7 @@
 do
     check_c_compiler $COMP
     if [ $? -ne 0 ]; then
-	    if [[ ! -z $CC ]]; then
+	    if [ ! -z "$CC" ]; then
         	if [ $COMP = $CC ]; then
             	echo "$CC is not a working C Compiler"
             	TOOLCHAIN_DETECTION_ERROR="error"
@@ -159,7 +159,7 @@
 # toolchain
 __EOF__
 	echo "CC = ${TOOLCHAIN_CC}" >> $TEMP_DIR/config.mk
-	if [[ ! -z $TOOLCHAIN_CXX ]]; then
+	if [ ! -z "$TOOLCHAIN_CXX" ]; then
 		echo "CXX = ${TOOLCHAIN_CXX}" >> $TEMP_DIR/config.mk
 	fi
     echo "LD = ${TOOLCHAIN_LD}" >> $TEMP_DIR/config.mk

mercurial