[Mesa-dev] [PATCH v1 3/5] autotools: compilation flags for sse

Sergii Romantsov sergii.romantsov at gmail.com
Fri Oct 26 10:05:26 UTC 2018


While building of 32bit Mesa gcc doesn't specifies __SSE__ by default.
So it has to be done manually by flag '-msee'.
Added support of such specification to build-system.

CC: Dylan Baker <dylan at pnwbakers.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108560
Signed-off-by: Sergii Romantsov <sergii.romantsov at globallogic.com>
---
 configure.ac | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/configure.ac b/configure.ac
index ab9bdce..f88ac87 100644
--- a/configure.ac
+++ b/configure.ac
@@ -421,13 +421,27 @@ dnl
 dnl Optional flags, check for compiler support
 dnl
 SSE41_CFLAGS="-msse4.1"
+dnl
+dnl x86_64 enables -msse by default, on x86 it required to be enabled manually
+dnl
+SSE_CFLAGS=
+SSE_CXXFLAGS=
+
 dnl Code compiled by GCC with -msse* assumes a 16 byte aligned
 dnl stack, but on x86-32 such alignment is not guaranteed.
 case "$target_cpu" in
 i?86)
     SSE41_CFLAGS="$SSE41_CFLAGS -mstackrealign"
+    AX_CHECK_COMPILE_FLAG([-msse],            [SSE_CFLAGS="-msse -mstackrealign"])
+    AC_LANG_PUSH([C++])
+    AX_CHECK_COMPILE_FLAG([-msse],            [SSE_CXXFLAGS="-msse -mstackrealign"])
+    AC_LANG_POP([C++])
     ;;
 esac
+AC_SUBST([SSE_CFLAGS], $SSE_CFLAGS)
+AC_SUBST([SSE_CXXFLAGS], $SSE_CXXFLAGS)
+AM_CONDITIONAL([SSE_CFLAGS], [test -n x$SSE_CFLAGS])
+
 save_CFLAGS="$CFLAGS"
 CFLAGS="$SSE41_CFLAGS $CFLAGS"
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
-- 
2.7.4



More information about the mesa-dev mailing list