From c922a4f8903c70c75d23734efe3fa0f93a6dead4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Wed, 2 Apr 2025 16:39:03 +0200
Subject: [PATCH] ppc64: Use assembly files only if __VSX__ is defined.

---
 ChangeLog    |  4 ++++
 configure.ac | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 6ddde442..4470c32f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2025-04-02  Niels Möller  <nisse@lysator.liu.se>
 
+	Cherry-picked from branch nettle-3.10-fixes:
+	* configure.ac: For ppc64, check if __VSX__ is defined, and
+	disable use of assembly if it isn't.
+
 	* .gitlab-ci.yml: Fix native/fat to actually run make
 	check-fat-override. Add an EXTRA_CHECK_TARGET variable also for
 	the .cross-build template, use it for check-fat-override where
diff --git a/configure.ac b/configure.ac
index 3d41974b..53e9013c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -367,6 +367,16 @@ case "$host_cpu" in
       ]], [[]])], [], [
 	ELFV2_ABI=yes
       ])
+      if test "$enable_assembler" = yes ; then
+	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if defined(__VSX__)
+#error VSX available
+#endif
+      ]], [[]])], [
+	  AC_MSG_WARN([VSX instructions (Power7 or later) not available, disabling use of assembly.])
+	  enable_assembler=no
+      ], [])
+      fi
     fi
     ;;
   aarch64*)
-- 
GitLab