summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-02-18 22:33:32 -0800
committerKaz Kylheku <kaz@kylheku.com>2025-02-18 22:33:32 -0800
commitca3098fd635c3368ad161b03e44e2e6a742b314e (patch)
tree4aace410531ecb60a7b6f956eabcc536196a5cde
parent724981f71ca154851ad8836e3284b082147db4bb (diff)
downloadtxr-ca3098fd635c3368ad161b03e44e2e6a742b314e.tar.gz
txr-ca3098fd635c3368ad161b03e44e2e6a742b314e.tar.bz2
txr-ca3098fd635c3368ad161b03e44e2e6a742b314e.zip
configure: fix bad gcc verison check.
* configure: The way the verison is represented in the output of gcc varies. A vendor build version may be indicated in parentheses, and that may precede or follow the version number by itself. I don't know all the variations. What I'm implementing here is looping over the white-space separated output of gcc --version, looking for an item of the form number.number.number where number is any decimal string from 0 to 99 with no leading zero, except for zero itself. If we find this item, we assume that is the gcc version, and break it up and process it as before, terminating the loop. We print the parsed gcc version in parentheses to help with spotting problems.
-rwxr-xr-xconfigure33
1 files changed, 24 insertions, 9 deletions
diff --git a/configure b/configure
index 4738c840..0b545d8f 100755
--- a/configure
+++ b/configure
@@ -1106,23 +1106,38 @@ if ! [ $diag_flags_given ] ; then
done
fi
-printf "Checking compiler version for various workarounds ... "
+printf "Checking gcc version for various workarounds ... "
output=$($make conftest.ccver)
set -- $output
if [ "$1" = "gcc" ] ; then
- gcc_version=$3
- save_ifs=$IFS ; IFS=. ; set -- $gcc_version ; IFS=$save_ifs
- if [ $1 -lt 4 ] || [ $1 -eq 4 -a $2 -le 3 ] ; then
- broken128=y
- fi
- [ $1 -lt 5 ] && do_nopie=
+ shift;
+
+ while [ $# -gt 0 ] ; do
+ case $1 in
+ [0-9].[0-9].[0-9] | [0-9].[0-9].[1-9][0-9] | \
+ [0-9].[1-9][0-9].[0-9] | [0-9].[1-9][0-9].[1-9][0-9] | \
+ [1-9][0-9].[0-9].[0-9] | [1-9][0-9].[0-9].[1-9][0-9] | \
+ [1-9][0-9].[1-9][0-9].[0-9] | [1-9][0-9].[1-9][0-9].[1-9][0-9] )
+ gcc_version=$1
+ save_ifs=$IFS ; IFS=. ; set -- $gcc_version ; IFS=$save_ifs
+ printf "(%s)\n" "$*"
+ if [ $1 -lt 4 ] || [ $1 -eq 4 -a $2 -le 3 ] ; then
+ broken128=y
+ fi
+ [ $1 -lt 5 ] && do_nopie=
+ break
+ ;;
+ esac
+ shift
+ done
elif [ "$1" = "clang" -o "$2" = "clang" ] ; then
+ printf "(clang)\n"
do_nopie=
+else
+ printf "(unrecognized)\n"
fi
-printf "done\n"
-
printf "Checking whether executables require an .exe suffix ... "
if ls conftest.exe > /dev/null 2>&1 ; then