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 9compiler="$*" 10 11if ! ( $compiler --version | grep -q clang) ; then 12 echo 0 13 exit 1 14fi 15 16MAJOR=$(echo __clang_major__ | $compiler -E -x c - | tail -n 1) 17MINOR=$(echo __clang_minor__ | $compiler -E -x c - | tail -n 1) 18PATCHLEVEL=$(echo __clang_patchlevel__ | $compiler -E -x c - | tail -n 1) 19printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL 20