summaryrefslogtreecommitdiff
path: root/m4/ax_gcc_archflag.m4
diff options
context:
space:
mode:
authorAlexey Kopytov <akopytov@gmail.com>2017-01-06 19:57:45 +0300
committerAlexey Kopytov <akopytov@gmail.com>2017-01-06 20:04:07 +0300
commit67395762a22cfb27bfdde5884938a0720722ab23 (patch)
treefd0a1c3afabf43de0271ffc06960c8dde4c6c4a8 /m4/ax_gcc_archflag.m4
parent4903696caa6862e9108f0b061dc1a0fba1145f4d (diff)
downloadautoconf-archive-67395762a22cfb27bfdde5884938a0720722ab23.tar.gz
Add code to detect ThunderX to AX_GCC_ARCHFLAG.
Update AX_GCC_ARCHFLAG to detect ThunderX (an AArch64 CPU by Cavium) and set -march/-mcpu accordingly depending on the CPU generation and compiler support.
Diffstat (limited to 'm4/ax_gcc_archflag.m4')
-rw-r--r--m4/ax_gcc_archflag.m418
1 files changed, 17 insertions, 1 deletions
diff --git a/m4/ax_gcc_archflag.m4 b/m4/ax_gcc_archflag.m4
index 0d0bf43..6a5e5e3 100644
--- a/m4/ax_gcc_archflag.m4
+++ b/m4/ax_gcc_archflag.m4
@@ -37,6 +37,7 @@
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2008 Matteo Frigo
# Copyright (c) 2014 Tsukasa Oi
+# Copyright (c) 2017 Alexey Kopytov
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@@ -64,7 +65,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 17
+#serial 18
AC_DEFUN([AX_GCC_ARCHFLAG],
[AC_REQUIRE([AC_PROG_CC])
@@ -201,6 +202,21 @@ case $host_cpu in
esac
ax_gcc_arch="$ax_gcc_arch powerpc"
;;
+ aarch64)
+ cpuimpl=`grep 'CPU implementer' /proc/cpuinfo 2> /dev/null | cut -d: -f2 | tr -d " " | head -n 1`
+ cpuarch=`grep 'CPU architecture' /proc/cpuinfo 2> /dev/null | cut -d: -f2 | tr -d " " | head -n 1`
+ cpuvar=`grep 'CPU variant' /proc/cpuinfo 2> /dev/null | cut -d: -f2 | tr -d " " | head -n 1`
+ case $cpuimpl in
+ 0x43) case $cpuarch in
+ 8) case $cpuvar in
+ 0x0) ax_gcc_arch="thunderx armv8-a native" ;;
+ 0x1) ax_gcc_arch="thunderx+lse armv8.1-a armv8-a+lse armv8-a native" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
esac
fi # not cross-compiling
fi # guess arch