From 2e49aeadc216062efd5cfd496c68610ee2a2eda2 Mon Sep 17 00:00:00 2001
From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
Date: Mon, 9 Jun 2025 17:27:23 -0700
Subject: [PATCH 3/3] Only use fpu_control.h with __GLIBC__

---
 parallel/Main.cc | 2 +-
 simp/Main.cc     | 2 +-
 utils/System.h   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/parallel/Main.cc b/parallel/Main.cc
index 00d044f..423c961 100644
--- a/parallel/Main.cc
+++ b/parallel/Main.cc
@@ -97,7 +97,7 @@ int main(int argc, char** argv)
         setUsageHelp("c USAGE: %s [options] <input-file> <result-output-file>\n\n  where input may be either in plain or gzipped DIMACS.\n");
         // printf("This is MiniSat 2.0 beta\n");
         
-#if defined(__linux__) && (defined(__i386__) || defined(__x86_64__))
+#if defined(__linux__) && defined(__GLIBC__) && (defined(__i386__) || defined(__x86_64__))
         fpu_control_t oldcw, newcw;
         _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
         printf("c WARNING: for repeatability, setting FPU to use double precision\n");
diff --git a/simp/Main.cc b/simp/Main.cc
index 8302179..336a7aa 100644
--- a/simp/Main.cc
+++ b/simp/Main.cc
@@ -122,7 +122,7 @@ int main(int argc, char** argv)
       setUsageHelp("c USAGE: %s [options] <input-file> <result-output-file>\n\n  where input may be either in plain or gzipped DIMACS.\n");
 
 
-#if defined(__linux__) && (defined(__i386__) || defined(__x86_64__))
+#if defined(__linux__) && defined(__GLIBC__) && (defined(__i386__) || defined(__x86_64__))
         fpu_control_t oldcw, newcw;
         _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
         //printf("c WARNING: for repeatability, setting FPU to use double precision\n");
diff --git a/utils/System.h b/utils/System.h
index 4e48fee..7fb9e81 100644
--- a/utils/System.h
+++ b/utils/System.h
@@ -21,7 +21,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
 #ifndef Glucose_System_h
 #define Glucose_System_h
 
-#if defined(__linux__)
+#if defined(__linux__) && defined(__GLIBC__) && (defined(__i386__) || defined(__x86_64__))
 #include <fpu_control.h>
 #endif
 
-- 
2.47.0

