https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112963
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- BTW, yet another option would be to just LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *) LIBM=-lm ;; esac AC_SUBST([LIBM]) i.e. copy&paste libtool AC_CHECK_LIBM without that AC_CHECK_LIB part (and without *-ncr-sysv* entry which we don't support in GCC AFAIK), so something in between using -lm unconditionally and not using it on targets which don't really need it.