busybox/scripts/gcc-version.sh
Chris Renshaw 6c6470b384 gcc-version.sh: fix for "invalid number" message during Android NDK builds
A CR in the gcc output would cause the following to show throughout build:

: invalid numberbox-1.32.1/scripts/gcc-version.sh: line 12: printf: 9

Signed-off-by: Chris Renshaw <osm0sis@outlook.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-22 09:21:39 +02:00

13 lines
359 B
Bash
Executable File

#!/bin/sh
#
# gcc-version gcc-command
#
# Prints the gcc version of `gcc-command' in a canonical 4-digit form
# such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc.
#
compiler="$*"
# tr -d '\r': fix up msdos-style line endings (Cygwin et al)
MAJ_MIN=$(echo __GNUC__ __GNUC_MINOR__ | $compiler -E -xc - | tr -d '\r' | tail -n 1)
printf '%02d%02d\n' $MAJ_MIN