local64.h: make <asm/local64.h> mandatory
[linux-2.6-microblaze.git] / scripts / clang-version.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 #
4 # clang-version clang-command
5 #
6 # Print the compiler version of `clang-command' in a 5 or 6-digit form
7 # such as `50001' for clang-5.0.1 etc.
8
9 compiler="$*"
10
11 if ! ( $compiler --version | grep -q clang) ; then
12         echo 0
13         exit 1
14 fi
15
16 MAJOR=$(echo __clang_major__ | $compiler -E -x c - | tail -n 1)
17 MINOR=$(echo __clang_minor__ | $compiler -E -x c - | tail -n 1)
18 PATCHLEVEL=$(echo __clang_patchlevel__ | $compiler -E -x c - | tail -n 1)
19 printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL