cryptlib/gccversionpatch
2020-01-22 19:05:39 +01:00

34 lines
998 B
Plaintext

--- cl-original/tools/ccopts.sh 2019-11-23 17:03:39.315504598 +0100
+++ cl-testpatch/tools/ccopts.sh 2020-01-22 18:49:01.093189548 +0100
@@ -508,10 +508,17 @@
# apparent version less than 10 we add a trailing zero to the string to make
# the checks that follow work.
-GCC_VER="$($CC -dumpversion | tr -d '.' | cut -c 1-2)"
-if [ "$GCC_VER" -lt 10 ] ; then
- GCC_VER="${GCC_VER}0" ;
-fi
+GCC_VER="$($CC -dumpversion)"
+case $GCC_VER in
+ [0-9])
+ GCC_VER="${GCC_VER}0" ;;
+
+ [0-9][0-9]*)
+ GCC_VER="$(echo $GCC_VER | tr -d '.' | cut -c 1-3)" ;;
+
+ *)
+ GCC_VER="$(echo $GCC_VER | tr -d '.' | cut -c 1-2)" ;;
+esac
# Try and determine the CPU type. This is made more complex by a pile of
# *BSE's which, along with antideluvian tools like an as that doesn't
@@ -606,7 +613,7 @@
CCARGS="$CCARGS -march=pentium" ;;
esac ;
else
- CCARGS="$CCARGS -mcpu=pentium" ;
+ CCARGS="$CCARGS -march=native" ;
fi ;
fi