From 305f9110e1d63bfa33064d5c92490c442b27c8bf Mon Sep 17 00:00:00 2001
From: lemmi <lemmi@nerd2nerd.org>
Date: Sat, 25 Dec 2021 18:20:21 +0100
Subject: [PATCH] define target_clones attribute only for glibc

---
 src/common/darktable.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/common/darktable.h b/src/common/darktable.h
index b841bf2bc..1b9b01d4e 100644
--- a/src/common/darktable.h
+++ b/src/common/darktable.h
@@ -127,14 +127,15 @@ typedef unsigned int u_int;
 /* Create cloned functions for various CPU SSE generations */
 /* See for instructions https://hannes.hauswedell.net/post/2017/12/09/fmv/ */
 /* TL;DR : use only on SIMD functions containing low-level paralellized/vectorized loops */
-#if __has_attribute(target_clones) && !defined(_WIN32) && !defined(NATIVE_ARCH)
+#if __has_attribute(target_clones) && !defined(_WIN32) && !defined(NATIVE_ARCH) && defined(__GLIBC__)
 # if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
 #define __DT_CLONE_TARGETS__ __attribute__((target_clones("default", "sse2", "sse3", "sse4.1", "sse4.2", "popcnt", "avx", "avx2", "avx512f", "fma4")))
 # elif defined(__PPC64__)
 /* __PPC64__ is the only macro tested for in is_supported_platform.h, other macros would fail there anyway. */
 #define __DT_CLONE_TARGETS__ __attribute__((target_clones("default","cpu=power9")))
 # endif
-#else
+#endif
+#ifndef __DT_CLONE_TARGETS__
 #define __DT_CLONE_TARGETS__
 #endif
 
-- 
2.34.1

