From cdae493f96150808007883a7fb0b582d46af4a1a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 2 Apr 2008 21:28:15 +0000 Subject: FS#8842 by Thomas Martitz, thanks! git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16935 a1c6a512-1295-4272-9138-f99709370657 --- tools/configure | 161 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 114 insertions(+), 47 deletions(-) (limited to 'tools/configure') diff --git a/tools/configure b/tools/configure index d81f0e2fe0..7f70c332ae 100755 --- a/tools/configure +++ b/tools/configure @@ -66,6 +66,32 @@ findtool(){ done } +# parse the argument list, returns the value after the = in case of a +# option=value type option, returns 0 in case of --ccache or --no-ccache, +# returns 1 if the searched argument type wasn't fount in the argument list +# Usage [var = ]`parse_args `, i.e. `parse_args target` + +# var definitons below are needed so that parse_args can see the arguments +arg1=$1 arg2=$2 arg3=$3 arg4=$4 arg5=$5 arg6=$6 arg7=$7 arg8=$8 arg9=$9 + +parse_args() { + ret="1" + for i in $arg1 $arg2 $arg3 $arg4 $arg5 $arg6 $arg7 $arg8 $arg9 + do + if [ "$1" = "--ccache" ]; then + if [ "$i" = "--ccache" ]; then + ret="0" + fi + elif [ "$1" = "--no-ccache" ]; then + if [ "$i" = "--no-ccache" ]; then + ret="0" + fi + elif [ "$1" = `echo $i|cut -d'=' -f1` ]; then + ret=`echo $i|cut -d'=' -f2` + fi + done + echo "$ret" +} simcc () { @@ -544,7 +570,28 @@ if test "$opt" = "--help"; then echo "Invoke this in a directory to generate a Makefile to build Rockbox" echo "Do *NOT* run this within the tools directory!" echo "" - echo "Usage: configure [--ccache][--no-ccache]" +cat <&2 + if test -f "$path/$file"; then + echo "$path/$file" + return + fi + done -if test "$1" = "--ccache"; then +if [ "1" != `parse_args --ccache` ]; then echo "Enable ccache for building" ccache="ccache" else - if test "$1" != "--no-ccache"; then + if [ "1" = `parse_args --no-ccache` ]; then ccache=`findtool ccache` if test -n "$ccache"; then echo "Found and uses ccache ($ccache)" -- cgit v1.2.3