Re: [PATCH] tests: try both 'gcc' and 'cc' for the C compiler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Thu, Nov 14, 2019 at 07:06:34PM +0000, Ed Maste wrote:
> From: Ed Maste <emaste@xxxxxxxxxxx>
> 
> FreeBSD does not have a 'gcc' in the PATH by default.
> 
> Signed-off-by: Ed Maste <emaste@xxxxxxxxxxx>

Hmm.  Linux systems will typically have a link from cc to gcc, so it
might be simpler to just change the default to 'cc' in all cases.

> ---
>  tests/run_tests.sh | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/run_tests.sh b/tests/run_tests.sh
> index 081f1ee..00bd1b3 100755
> --- a/tests/run_tests.sh
> +++ b/tests/run_tests.sh
> @@ -4,7 +4,15 @@ SRCDIR=`dirname "$0"`
>  . "$SRCDIR/testutils.sh"
>  
>  if [ -z "$CC" ]; then
> -    CC=gcc
> +    for cc in gcc cc; do
> +        if which $cc 2>/dev/null; then
> +            CC=$cc
> +            break
> +        fi
> +    done
> +    if [ -z "$CC" ]; then
> +        FAIL "C compiler gcc/cc not found - set CC appropriately"
> +    fi
>  fi
>  
>  # stat differs between platforms

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux