gentoo-ebuilds/media-radio/tlf/files/tlf-1.4.1-pi.patch
Thomas Beierlein ae348f36a8
media-radio/tlf: provide fallback definitions for M_PI and M_PI_2
C Standard does not guarantee the presence of both definitions in every
circumstance.

Closes: https://bugs.gentoo.org/907442
Signed-off-by: Thomas Beierlein <tomjbe@gentoo.org>
2023-07-04 19:35:30 +02:00

47 lines
986 B
Diff

# As C standards does not define M_PI or M_PI_2 provide a fallback
# bug 907442
diff --git a/src/muf.c b/src/muf.c
index 6671651..1f880fd 100644
--- a/src/muf.c
+++ b/src/muf.c
@@ -32,6 +32,10 @@
#include "tlf_panel.h"
#include "ui_utils.h"
+#ifndef M_PI_2
+ # define M_PI_2 1.57079632679489661923 /* pi/2 */
+#endif
+
// message splitters:
// line[0] - original line, content can be modified in-place
diff --git a/src/qrb.h b/src/qrb.h
index 89d3f30..0120de0 100644
--- a/src/qrb.h
+++ b/src/qrb.h
@@ -21,6 +21,10 @@
#ifndef QRB_H
#define QRB_H
+#ifndef M_PI
+ # define M_PI 3.14159265358979323846 /* pi */
+#endif
+
#define ARC_IN_KM 111.2
#define RADIAN (180.0 / M_PI)
diff --git a/src/sunup.c b/src/sunup.c
index b1186dd..7412c06 100644
--- a/src/sunup.c
+++ b/src/sunup.c
@@ -23,6 +23,10 @@
#include "get_time.h"
+#ifndef M_PI
+ # define M_PI 3.14159265358979323846 /* pi */
+#endif
+
#define RADIAN (180.0 / M_PI)