summaryrefslogtreecommitdiffstats
path: root/pkgs/development/libraries/spandsp/Check-for-feenableexcept-explicitly.patch
blob: a336732b9000dfbca5b6ffb39543e0461a11e14d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
From c0caa79a2aa6ac5b358f30719ff80ee2c6db51f7 Mon Sep 17 00:00:00 2001
From: Alyssa Ross <hi@alyssa.is>
Date: Mon, 3 Nov 2025 12:06:15 +0100
Subject: [PATCH] Check for feenableexcept() explicitly

musl provides <fenv.h>, but not the non-standard feenableexcept()
function, so using feenableexcept() whenever <fenv.h> was present
caused build failures on musl.  Instead, explicitly check for the
non-standard function we want to use.
---
 configure.ac         | 2 +-
 tests/v17_tests.c    | 6 +++---
 tests/v27ter_tests.c | 6 +++---
 tests/v29_tests.c    | 6 +++---
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index fa87245..a8864d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -186,6 +186,7 @@ AC_CHECK_FUNCS([strstr])
 AC_CHECK_FUNCS([strtol])
 AC_CHECK_FUNCS([gettimeofday])
 AC_CHECK_FUNCS([drand48])
+AC_CHECK_FUNCS([feenableexcept])
 
 AC_HEADER_SYS_WAIT
 
@@ -209,7 +210,6 @@ AC_CHECK_HEADERS([sys/select.h])
 AC_CHECK_HEADERS([sys/ioctl.h])
 AC_CHECK_HEADERS([sys/fcntl.h])
 AC_CHECK_HEADERS([sndfile.h])
-AC_CHECK_HEADERS([fenv.h])
 AC_CHECK_HEADERS([fftw3.h], , [AC_CHECK_HEADERS([fftw.h])])
 AC_CHECK_HEADERS([pcap.h])
 AC_CHECK_HEADERS([pthread.h])
diff --git a/tests/v17_tests.c b/tests/v17_tests.c
index 17c7fcb..411396c 100644
--- a/tests/v17_tests.c
+++ b/tests/v17_tests.c
@@ -59,7 +59,7 @@ display of modem status is maintained.
 #include <string.h>
 #include <sndfile.h>
 #include <signal.h>
-#if defined(HAVE_FENV_H)
+#if defined(HAVE_FEENABLEEXCEPT)
 #define __USE_GNU
 #include <fenv.h>
 #endif
@@ -263,7 +263,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
 }
 /*- End of function --------------------------------------------------------*/
 
-#if defined(HAVE_FENV_H)
+#if defined(HAVE_FEENABLEEXCEPT)
 static void sigfpe_handler(int sig_num, siginfo_t *info, void *data)
 {
     switch (sig_num)
@@ -425,7 +425,7 @@ int main(int argc, char *argv[])
     inhandle = NULL;
     outhandle = NULL;
 
-#if defined(HAVE_FENV_H)
+#if defined(HAVE_FEENABLEEXCEPT)
     fpe_trap_setup();
 #endif
 
diff --git a/tests/v27ter_tests.c b/tests/v27ter_tests.c
index 14b06f8..f0559a4 100644
--- a/tests/v27ter_tests.c
+++ b/tests/v27ter_tests.c
@@ -58,7 +58,7 @@ display of modem status is maintained.
 #include <string.h>
 #include <sndfile.h>
 #include <signal.h>
-#if defined(HAVE_FENV_H)
+#if defined(HAVE_FEENABLEEXCEPT)
 #define __USE_GNU
 #include <fenv.h>
 #endif
@@ -286,7 +286,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
 }
 /*- End of function --------------------------------------------------------*/
 
-#if defined(HAVE_FENV_H)
+#if defined(HAVE_FEENABLEEXCEPT)
 static void sigfpe_handler(int sig_num, siginfo_t *info, void *data)
 {
     switch (sig_num)
@@ -440,7 +440,7 @@ int main(int argc, char *argv[])
     inhandle = NULL;
     outhandle = NULL;
 
-#if defined(HAVE_FENV_H)
+#if defined(HAVE_FEENABLEEXCEPT)
     fpe_trap_setup();
 #endif
 
diff --git a/tests/v29_tests.c b/tests/v29_tests.c
index 390663f..7a43797 100644
--- a/tests/v29_tests.c
+++ b/tests/v29_tests.c
@@ -58,7 +58,7 @@ display of modem status is maintained.
 #include <string.h>
 #include <sndfile.h>
 #include <signal.h>
-#if defined(HAVE_FENV_H)
+#if defined(HAVE_FEENABLEEXCEPT)
 #define __USE_GNU
 #include <fenv.h>
 #endif
@@ -257,7 +257,7 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
 }
 /*- End of function --------------------------------------------------------*/
 
-#if defined(HAVE_FENV_H)
+#if defined(HAVE_FEENABLEEXCEPT)
 static void sigfpe_handler(int sig_num, siginfo_t *info, void *data)
 {
     switch (sig_num)
@@ -410,7 +410,7 @@ int main(int argc, char *argv[])
     inhandle = NULL;
     outhandle = NULL;
 
-#if defined(HAVE_FENV_H)
+#if defined(HAVE_FEENABLEEXCEPT)
     fpe_trap_setup();
 #endif
 
-- 
2.51.0