Skip to contentSkip to conversation

build-sys: improve detection of the "isnan" function in uClibc

PATCH In review Carlos Santos 2 participants 2 messages Feb 8, 2017 – Feb 9, 2017 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build-sys: improve detection of the "isnan" function in uClibc

Since commit beceb14b450ded6560ed743634a5e80604a8edf3, MATH_LIBS is set to "-lm" when the isnan function is detected. In uClibc, however, isnan is a macro that calls __isnan, __isnanf, or __isnanl, depending on the size of the argument (double, float or long double).

Fixes:
http://autobuild.buildroot.net/results/2c2/2c29a78ed81ca844a87dcd076ab3e14ea080296d/
http://autobuild.buildroot.net/results/404/404b10f359b2ae8a7216729fa1bab37fed2d3d4c/

---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)
configure.ac +1 -0
index 3759921..3bb3ba8 100644
@@ -435,6 +435,7 @@ AM_CONDITIONAL([HAVE_OPENAT], [test "x$have_openat" = xyes])
 
 AC_CHECK_FUNCS([isnan], [],
 	[AC_CHECK_LIB([m], [isnan], [MATH_LIBS="-lm"])]
+	[AC_CHECK_LIB([m], [__isnan], [MATH_LIBS="-lm"])]
 )
 AC_SUBST([MATH_LIBS])
 
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 19 lines · Carlos Santos

Since commit beceb14b450ded6560ed743634a5e80604a8edf3, MATH_LIBS is set to "-lm" when the isnan function is detected. In uClibc, however, isnan is a macro that calls __isnan, __isnanf, or __isnanl, depending on the size of the argument (double, float or long double).

Fixes:
http://autobuild.buildroot.net/results/2c2/2c29a78ed81ca844a87dcd076ab3e14ea080296d/
http://autobuild.buildroot.net/results/404/404b10f359b2ae8a7216729fa1bab37fed2d3d4c/

---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)
configure.ac +0 -0
index 3759921..3bb3ba8 100644

configure.ac AM_CONDITIONAL([HAVE_OPENAT], [test "x$have_openat" = xyes]) · line 440

Quoted 6 lines
configure.ac +1 -0
@@ -435,6 +435,7 @@ AM_CONDITIONAL([HAVE_OPENAT], [test "x$have_openat" = xyes])
 
 AC_CHECK_FUNCS([isnan], [],
 	[AC_CHECK_LIB([m], [isnan], [MATH_LIBS="-lm"])]
+	[AC_CHECK_LIB([m], [__isnan], [MATH_LIBS="-lm"])]
 )
 AC_SUBST([MATH_LIBS])

Applied, thanks. (It would be possible to use AC_COMPILE_IFELSE() monster, but if AC_CHECK_LIB() is good enough than it's probably better.)

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com