From 47c7f8f3bbaa86723ad11e62b248453599dc7537 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 13 Jan 2019 22:55:51 +0000 Subject: [PATCH] Update OSX clang version detection --- config.lib | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config.lib b/config.lib index 5b399d86a3..e5942d412c 100644 --- a/config.lib +++ b/config.lib @@ -1335,7 +1335,7 @@ make_compiler_cflags() { elif echo "$version_line" | grep -q "clang"; then # Enable some things only for certain clang versions # Need to try really hard to get the version line, because OSX clang likes to hide its true version - cc_version="`$1 -v 2>&1 | grep -i version | head -n 1 | sed s@[^0-9]@@g | cut -c 1-2`" + cc_version="`$1 -v 2>&1 | grep -i version | head -n 1 | sed s@[^0-9.]@@g | $awk -F . '{printf "%d%02d\n", $1, $2}'`" # aliasing rules are not held in openttd code flags="$flags -fno-strict-aliasing" @@ -1357,14 +1357,14 @@ make_compiler_cflags() { # it happens when using the FOR_ALL_WINDOWS_FROM_BACK_FROM macro flags="$flags -Wno-self-assign" - if [ "$cc_version" -lt "30" ]; then + if [ "$cc_version" -lt "300" ]; then # warning: equality comparison with extraneous parentheses flags="$flags -Wno-parentheses" # warning: operands of ? are integers of different signs: 'unsigned int' and 'int' flags="$flags -Wno-sign-compare" fi - if [ "$cc_version" -ge "30" ]; then + if [ "$cc_version" -ge "300" ]; then # warning: equality comparison with extraneous parentheses # this warning could be useful, but it warns about code in squirrel flags="$flags -Wno-parentheses-equality" @@ -1383,8 +1383,8 @@ make_compiler_cflags() { flags="$flags -Wno-unused-variable" fi - if [ "$cc_version" -lt "33" ]; then - log 1 "configure: error: clang version is too old: `$1 -v 2>&1 | head -n 1`, minumum: 3.3" + if [ "$cc_version" -lt "303" ]; then + log 1 "configure: error: clang version is too old: `$1 -v 2>&1 | grep -i version | head -n 1`, minumum: 3.3" exit 1 fi