https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112963
--- Comment #12 from Iain Sandoe <iains at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #10) > 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 tested this patch on x86_64-darwin and powerpc64le-linux where it correctly omits the '-lm' from the libquadmath link line on Darwin, but includes it on powerpc64le-linux (where it is also currently omitted in an unpatched build). So, I can also test the patch at comment #2 or we could go with this one.