summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/ruby/ruby/0001-configure.ac-check-finite-isinf-isnan-as-macros-firs.patch
blob: 4cc1fa027f9d13a2a2916559e2dd76393dca8cbf (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
From 3a8189530312e81d6c005c396565f985a47f3383 Mon Sep 17 00:00:00 2001
From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Fri, 8 Feb 2019 07:22:55 +0000
Subject: [PATCH] configure.ac: check finite,isinf,isnan as macros first
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[ruby-core:91487] [Bug #15595]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

---
Upstream-Status: Backport [https://github.com/ruby/ruby/commit/74f94b3e6ebf15b76f3b357e754095412b006e94]
(modified so as to apply cleanly here)
Signed-off-by: André Draszik <andre.draszik@jci.com>
---
 aclocal.m4                    |  1 +
 configure.ac                  | 13 ++++---------
 tool/m4/ruby_replace_funcs.m4 | 13 +++++++++++++
 3 files changed, 18 insertions(+), 9 deletions(-)
 create mode 100644 tool/m4/ruby_replace_funcs.m4

diff --git a/aclocal.m4 b/aclocal.m4
index 18ba297b05..2a907b3467 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -13,3 +13,4 @@
 
 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
 m4_include([acinclude.m4])
+m4_include([tool/m4/ruby_replace_funcs.m4])
diff --git a/configure.ac b/configure.ac
index 8a7cee55b8..b97c5b3cc9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1189,9 +1189,6 @@ main()
 		ac_cv_func_fsync=yes
 		ac_cv_func_seekdir=yes
 		ac_cv_func_telldir=yes
-		ac_cv_func_isinf=yes
-		ac_cv_func_isnan=yes
-		ac_cv_func_finite=yes
 		ac_cv_func_lchown=yes
 		ac_cv_func_link=yes
 		ac_cv_func_readlink=yes
@@ -1239,9 +1236,6 @@ main()
 [netbsd*], [	LIBS="-lm $LIBS"
 		],
 [dragonfly*], [	LIBS="-lm $LIBS"
-		# isinf() and isnan() are macros on DragonFly.
-		ac_cv_func_isinf=yes
-		ac_cv_func_isnan=yes
 		],
 [aix*],[	LIBS="-lm $LIBS"
 		ac_cv_func_round=no
@@ -2213,11 +2207,8 @@ AC_REPLACE_FUNCS(dup2)
 AC_REPLACE_FUNCS(erf)
 AC_REPLACE_FUNCS(explicit_bzero)
 AC_REPLACE_FUNCS(ffs)
-AC_REPLACE_FUNCS(finite)
 AC_REPLACE_FUNCS(flock)
 AC_REPLACE_FUNCS(hypot)
-AC_REPLACE_FUNCS(isinf)
-AC_REPLACE_FUNCS(isnan)
 AC_REPLACE_FUNCS(lgamma_r)
 AC_REPLACE_FUNCS(memmove)
 AC_REPLACE_FUNCS(nextafter)
@@ -2229,6 +2220,10 @@ AC_REPLACE_FUNCS(strlcpy)
 AC_REPLACE_FUNCS(strstr)
 AC_REPLACE_FUNCS(tgamma)
 
+RUBY_REPLACE_FUNC([finite], [@%:@include <math.h>])
+RUBY_REPLACE_FUNC([isinf], [@%:@include <math.h>])
+RUBY_REPLACE_FUNC([isnan], [@%:@include <math.h>])
+
 # for missing/setproctitle.c
 AS_CASE(["$target_os"],
 [aix* | k*bsd*-gnu | kopensolaris*-gnu | linux* | darwin*], [AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)],
diff --git a/tool/m4/ruby_replace_funcs.m4 b/tool/m4/ruby_replace_funcs.m4
new file mode 100644
index 0000000000..d0612e29a0
--- /dev/null
+++ b/tool/m4/ruby_replace_funcs.m4
@@ -0,0 +1,13 @@
+# -*- Autoconf -*-
+dnl RUBY_REPLACE_FUNC [func] [included]
+AC_DEFUN([RUBY_REPLACE_FUNC], [dnl
+    AC_CHECK_DECL([$1],dnl
+        [AC_DEFINE(AS_TR_CPP(HAVE_[$1]))],dnl
+        [AC_REPLACE_FUNCS($1)],dnl
+        [$2])dnl
+])
+
+dnl RUBY_REPLACE_FUNCS [funcs] [included]
+AC_DEFUN([RUBY_REPLACE_FUNCS] [dnl
+    m4_map_args_w([$1], [RUBY_REPLACE_FUNC(], [), [$2]])dnl
+])
-- 
2.23.0.rc1