You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-office/libreoffice/files/libreoffice-check-for-avx.p...

59 lines
1.9 KiB

diff --git a/configure.in b/configure.in
index 65813cb..bfa612c 100755
--- a/configure.in
+++ b/configure.in
@@ -1984,6 +1984,41 @@ if test "$GCC" = "yes"; then
fi
AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
+dnl Check for AVX
+dnl ===================================================================
+AS_IF([test "x$AVX_CFLAGS" = "x"], [
+ AS_IF([test "x$SUNCC" = "xyes" && test "x$AMD64_ABI" = "xno"], [
+ AVX_CFLAGS="-xarch=avx"
+ ])
+], [
+ AVX_CFLAGS="-mavx -Winline"
+])
+
+have_avx_intrinsics=no
+AC_MSG_CHECKING(whether to use AVX intrinsics)
+avx_save_CFLAGS=$CFLAGS
+CFLAGS="$AVX_CFLAGS $CFLAGS"
+AC_COMPILE_IFELSE([
+#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))
+# if !defined(__amd64__) && !defined(__x86_64__)
+# error "Need GCC >= 4.5 for AVX intrinsics on x86"
+# endif
+#endif
+#include <immintrin.h>
+int main () {
+ __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
+ c = _mm256_permute2f128_si256 (a, b, 0);
+ return 0;
+}], have_avx_intrinsics=yes)
+CFLAGS=$avx_save_CFLAGS
+AC_MSG_RESULT([$have_avx_intrinsics])
+AS_IF([test "x$have_avx_intrinsics" = "xyes"], [
+ HAVE_GCC_AVX=TRUE
+], [
+ HAVE_GCC_AVX=FALSE
+])
+AC_SUBST(HAVE_GCC_AVX)
+
dnl ===================================================================
dnl Set the ENABLE_PCH variable. (Activate --enable-pch)
dnl ===================================================================
diff --git a/set_soenv.in b/set_soenv.in
index 4c047b6..a2b1b43 100755
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1841,6 +1841,7 @@ ToFile( "JAVAHOME", $JAVAHOME, "e" );
ToFile( "CC", $CC, "e" );
ToFile( "HAVE_GCC_VISIBILITY_FEATURE",
"@HAVE_GCC_VISIBILITY_FEATURE@", "e" );
+ToFile( "HAVE_GCC_AVX", "@HAVE_GCC_AVX@", "e" );
ToFile( "HAVE_GCC_VISIBILITY_BROKEN",
"@HAVE_GCC_VISIBILITY_BROKEN@", "e" );
ToFile( "HAVE_LD_HASH_STYLE","@HAVE_LD_HASH_STYLE@","e" );