Changeset - r3305:7abe03ef7533
[Not reviewed]
master
0 1 0
truelight - 19 years ago 2006-03-23 15:34:47
truelight@openttd.org
(svn r4064) -Fix: fixes for configure to accept spaces in params. This are mostly bypasses because bash really does suck in handling spaces and " stuff :(
1 file changed with 19 insertions and 16 deletions:
configure
19
16
0 comments (0 inline, 0 general)
configure
Show inline comments
 
@@ -32,85 +32,86 @@ function showhelp() {
 
	echo " sdl                Do you want SDL-support?            [yes]"
 
	echo " png                Do you want PNG-support?            [yes]"
 
	echo " cocoa              Do you want cocoa-support? (MacOSX) [no]"
 
	echo ""
 
	echo "Params used to configure external libs:"
 
	echo " --static-zlib-path Set the path to your static zlib    []"
 
	echo " --sdl-config       Where is your sdl-config            [sdl-config]"
 
	echo " --libpng-config    Where is your libpng-config         [libpng-config]"
 
	echo " "
 
}
 

	
 
function handle() {
 
	PARAM="$PARAM $1=`awk 'BEGIN { FS="="; $0="'$2'"; print $2;}'`"
 
	PARAM="$PARAM \"$1=`awk 'BEGIN { FS="="; $0="'"$2"'"; print $2;}'`\""
 
}
 

	
 
# The things you can use inside this case:
 
#  handle NAME VALUE - Sets the value to give the 'make upgradeconf'
 
#                         Value is in form: tag=REAL_VALUE
 
#  ITEM="NAME"       - Will set the value as above, only with the next param
 
#  SITEM="NAME"      - Will set the var $NAME to the next param
 
for n in "$@"
 
do
 
	case "$n" in
 
		--help | -h)
 
			showhelp
 
			exit 0
 
			;;
 

	
 
		--debug)
 
			DEBUG_SET=1
 
			ITEM="DEBUG"
 
			;;
 
		--debug=*)
 
			handle "DEBUG" $n
 
			handle "DEBUG" "$n"
 
			;;
 
		--profile)
 
			PARAM="$PARAM PROFILE=1"
 
			;;
 
		--dedicated)
 
			PARAM="$PARAM DEDICATED=1"
 
			;;
 
		--revision=*)
 
			RELEASE=`awk 'BEGIN { FS="="; $0="'$n'"; print $2;}'`
 
			RELEASE=`awk 'BEGIN { FS="="; $0="'"$n"'"; print $2;}'`
 
			;;
 
		--revision)
 
			SITEM="RELEASE"
 
			;;
 
		--target-cc=*)
 
			handle "CC_TARGET" $n
 
			handle "CC_TARGET" "$n"
 
			;;
 
		--target-cc)
 
			ITEM="CCTARGET"
 
			ITEM="CC_TARGET"
 
			;;
 
		--target-cxx=*)
 
			TARGET_CXX=`awk 'BEGIN { FS="="; $0="'$n'"; print $2;}'`
 
			echo "$n"
 
			TARGET_CXX=`awk 'BEGIN { FS="="; $0="'"$n"'"; print $2;}'`
 
			;;
 
		--target-cxx)
 
			SITEM="TARGET_CXX"
 
			;;
 
		--host-cc=*)
 
			handle CC_HOST $n
 
			handle CC_HOST "$n"
 
			;;
 
		--host-cc)
 
			ITEM="CC_HOST"
 
			;;
 
		--os=*)
 
			TARGET_OS=`awk 'BEGIN { FS="="; $0="'$n'"; print $2;}'`
 
			TARGET_OS=`awk 'BEGIN { FS="="; $0="'"$n"'"; print $2;}'`
 
			;;
 
		--os)
 
			SITEM="TARGET_OS"
 
			;;
 
		--windres=*)
 
			handle WINDRES $n
 
			handle WINDRES "$n"
 
			;;
 
		--windres)
 
			ITEM="WINDRES"
 
			;;
 
		--force-le)
 
			PARAM="$PARAM ENDIAN_FORCE=LE"
 
			;;
 
		--force-be)
 
			PARAM="$PARAM ENDIAN_FORCE=BE"
 
			;;
 

	
 
		--with-static)
 
@@ -141,60 +142,60 @@ do
 
			PARAM="$PARAM WITH_PNG=1"
 
			;;
 
		--without-png)
 
			PARAM="$PARAM WITH_PNG="
 
			;;
 
		--with-cocoa)
 
			PARAM="$PARAM WITH_COCOA=1"
 
			;;
 
		--without-cocoa)
 
			PARAM="$PARAM WITH_COCOA="
 
			;;
 
		--static-zlib-path=*)
 
			handle STATIC_ZLIB_PATH $n
 
			handle STATIC_ZLIB_PATH "$n"
 
			;;
 
		--static-zlib-path)
 
			ITEM="STATIC_ZLIB_PATH"
 
			;;
 
		--sdl-config=*)
 
			handle SDL-CONFIG $n
 
			handle SDL-CONFIG "$n"
 
			;;
 
		--sdl-config)
 
			ITEM="SDL-CONFIG"
 
			;;
 
		--libpng-config=*)
 
			handle LIBPNG-CONFIG $n
 
			handle LIBPNG-CONFIG "$n"
 
			;;
 
		--lib-png-config)
 
			ITEM="LIBPNG-CONFIG"
 
			;;
 

	
 
		--*=*)
 
			echo -n "Unknown switch "
 
			echo `awk 'BEGIN { FS="="; $0="'$n'"; print $1;}'`
 
			echo `awk 'BEGIN { FS="="; $0="'"$n"'"; print $1;}'`
 
			exit 1
 
			;;
 
		-*)
 
			echo "Unknown switch $n"
 
			exit 1
 
			;;
 

	
 
		*)
 
			if ! test -z "$ITEM"
 
			then
 
				PARAM="$PARAM $ITEM=$n"
 
				PARAM="$PARAM $ITEM=\"$n\""
 
				ITEM="";
 
			elif ! test -z "$SITEM"
 
			then
 
				export $SITEM=$n
 
				export $SITEM="$n"
 
				SITEM=""
 
			else
 
				echo "Unknown switch $n"
 
				exit 1
 
			fi
 
			;;
 
	esac
 
done
 

	
 
if ! test -z "$TARGET_OS"
 
then
 
	TARGET_OS=`echo $TARGET_OS | tr '[:lower:]' '[:upper:]'`
 
@@ -240,25 +241,27 @@ then
 
	then
 
		# Someone did --debug, without assigning a value, assume 1
 
		PARAM="$PARAM DEBUG=1"
 
	fi
 
fi
 

	
 
# First remove the Makefile.config, else you can have double entries
 
if test -e "Makefile.config"
 
then
 
	rm -f Makefile.config
 
fi
 

	
 
make upgradeconf $PARAM
 
echo "make upgradeconf $PARAM" > Makefile.run
 
. Makefile.run
 
rm -f Makefile.run
 

	
 
# Makefile.config currently doesn't support custom CXX, so, we add the line
 
#  ourself!
 

	
 
if ! test -z "$TARGET_CXX"
 
then
 
	echo "CXX=$TARGET_CXX" >> Makefile.config
 
fi
 

	
 
# Same for RELEASE (read: REVISION)
 

	
 
if ! test -z "$RELEASE"
0 comments (0 inline, 0 general)