I don't have the full configure logs at hand. The build was with the Sun Studio suite 12.6, and it builds successfully on Solaris 11.3, and fails linking on 11.4.
Failure was:
CCLD temacs
Undefined first referenced
symbol in file
cos floatfns.o
exp floatfns.o
log floatfns.o
pow xfns.o
sin floatfns.o
tan floatfns.o
acos floatfns.o
asin floatfns.o
atan floatfns.o
ceil floatfns.o
fmod floatfns.o
powf pdumper.o
atan2 floatfns.o
floor xterm.o
ilogb floatfns.o
log10 xdisp.o
lround hbfont.o
scalbn floatfns.o
ld: fatal: symbol referencing errors
In 11.4, sqrt is defined in libc.so as an absolute symbol, so the test for if -lm is necessary succeeds without it. I haven't disassembled the new libc, but I suspect that you're right and they have a sqrt that is fast enough either depends on a sqrt instruction or is otherwise "simple" for some value of simple.
Was able to reproduce the build failure with SS12.4 on 11.4 as well.
This is the actual patch we're using:
--- emacs-27.2.orig/configure.ac
+++ emacs-27.2/configure.ac
@@ -1634,14 +1634,14 @@ AC_DEFUN([AC_TYPE_SIZE_T])
# Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them.
AC_DEFUN([AC_TYPE_UID_T])
-# sqrt and other floating-point functions such as fmod and frexp
+# atan and other floating-point functions such as fmod and frexp
# are found in -lm on many systems.
OLD_LIBS=$LIBS
-AC_SEARCH_LIBS([sqrt], [m])
+AC_SEARCH_LIBS([atan], [m])
if test "X$LIBS" = "X$OLD_LIBS"; then
LIB_MATH=
else
- LIB_MATH=$ac_cv_search_sqrt
+ LIB_MATH=$ac_cv_search_atan
fi
LIBS=$OLD_LIBS
Reading elsethread, I totally understand Eli Zaretskii's concern about this being fragile, but as near as I can tell this is still the unfortunate state of the art in figuring out if libm is needed using autoconf, although testing with trig functions does seem to be the mode these days.