don't use cflags/ldflags directly in the configure script - fixes #281

Sat, 02 Sep 2023 14:25:05 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 02 Sep 2023 14:25:05 +0200
changeset 30
d4c38bb71fa0
parent 29
5e958351935d
child 31
4c6060dad560

don't use cflags/ldflags directly in the configure script - fixes #281

test/make/configure.vm file | annotate | diff | comparison | revisions
--- a/test/make/configure.vm	Thu Aug 03 16:57:57 2023 +0200
+++ b/test/make/configure.vm	Sat Sep 02 14:25:05 2023 +0200
@@ -347,19 +347,19 @@
         if [ $? -ne 0 ] ; then
             break
         fi
-        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
-        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
+        TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
+        TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
         #end
         #foreach( $flags in $sub.flags )
         #if( $flags.exec )
         $flags.value > /dev/null
         if [ $? -eq 0 ]; then
-            $flags.varName="$$flags.varName `$flags.value`"
+            TEMP_$flags.varName="$TEMP_$flags.varName `$flags.value`"
         else
             break
         fi
         #else
-        $flags.varName="$$flags.varName $flags.value"    
+        TEMP_$flags.varName="$TEMP_$flags.varName $flags.value"    
         #end
         #end
         #foreach( $test in $sub.tests )
@@ -388,8 +388,8 @@
 ERROR=0
 #if( $dependencies.size() > 0 )
 # general dependencies
-CFLAGS=
-LDFLAGS=
+TEMP_CFLAGS=
+TEMP_LDFLAGS=
 #foreach( $dependency in $dependencies )
 while true
 do
@@ -420,21 +420,21 @@
             break
         fi
         echo yes
-        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
-        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
+        TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
+        TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
         #end
         
         #foreach( $flags in $dependency.flags )
         #if( $flags.exec )
         $flags.value > /dev/null
         if [ $? -ne 0 ]; then
-            $flags.varName="$$flags.varName `$flags.value`"
+            TEMP_$flags.varName="$TEMP_$flags.varName `$flags.value`"
         else
             ERROR=1
             break
         fi
         #else
-        $flags.varName="$$flags.varName $flags.value"    
+        TEMP_$flags.varName="$TEMP_$flags.varName $flags.value"    
         #end
         #end
 		#if ( $dependency.make.length() > 0 )
@@ -452,14 +452,14 @@
 
 # add general dependency flags to config.mk
 echo >> $TEMP_DIR/config.mk
-if [ ! -z "${CFLAGS}" ]; then
-    echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
+if [ ! -z "${TEMP_CFLAGS}" ]; then
+    echo "CFLAGS += $TEMP_CFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [ ! -z "${CXXFLAGS}" ]; then
-    echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
+if [ ! -z "${TEMP_CXXFLAGS}" ]; then
+    echo "CXXFLAGS += $TEMP_CXXFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [ ! -z "${LDFLAGS}" ]; then
-    echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
+if [ ! -z "${TEMP_LDFLAGS}" ]; then
+    echo "LDFLAGS += $TEMP_LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 #end
 
@@ -481,7 +481,7 @@
 		return 1
 	fi
 	#foreach( $def in $val.defines )
-		CFLAGS="$CFLAGS ${def.toFlags()}"
+		TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}"
 	#end
 	#if( $val.hasMake() )
 	cat >> $TEMP_DIR/make.mk << __EOF__
@@ -496,9 +496,9 @@
 #
 # TARGETS
 #
-CFLAGS=
-CXXFLAGS=
-LDFLAGS=
+TEMP_CFLAGS=
+TEMP_CXXFLAGS=
+TEMP_LDFLAGS=
 
 #foreach( $target in $targets )
 #if ( $target.name )
@@ -506,9 +506,9 @@
 #else
 # Target
 #end
-CFLAGS=
-LDFLAGS=
-CXXFLAGS=
+TEMP_CFLAGS=
+TEMP_LDFLAGS=
+TEMP_CXXFLAGS=
 
 #foreach( $dependency in $target.dependencies )
 dependency_$dependency
@@ -580,14 +580,14 @@
 #end
 
 echo >> $TEMP_DIR/config.mk
-if [ ! -z "${CFLAGS}" ]; then
-    echo "${target.getCFlags()}  += $CFLAGS" >> $TEMP_DIR/config.mk
+if [ ! -z "${TEMP_CFLAGS}" ]; then
+    echo "${target.getCFlags()}  += $TEMP_CFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [ ! -z "${CXXFLAGS}" ]; then
-    echo "${target.getCXXFlags()} += $CXXFLAGS" >> $TEMP_DIR/config.mk
+if [ ! -z "${TEMP_CXXFLAGS}" ]; then
+    echo "${target.getCXXFlags()} += $TEMP_CXXFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [ ! -z "${LDFLAGS}" ]; then
-    echo "${target.getLDFlags()} += $LDFLAGS" >> $TEMP_DIR/config.mk
+if [ ! -z "${TEMP_LDFLAGS}" ]; then
+    echo "${target.getLDFlags()} += $TEMP_LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 
 #end

mercurial