https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112963
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Iain Sandoe from comment #6) > I cannot peak for the others, but Darwin does not need '-lm' because it is > part of libc [libSystem] (adding -lm actually symlinks to libSystem and > alters the effective library order on the link line so I'd prefer to avoid > it, if possible). We managed to make this work for libgfortran, I need to > check how. libgfortran seems to use the LT_LIB_M macro for that (but I believe that is just a newer name for AC_CHECK_LIBM). libgfortran has if test "$build" != "$host"; then LIBGFOR_IS_NATIVE=false GCC_NO_EXECUTABLES else LIBGFOR_IS_NATIVE=true fi and later uses LT_LIB_M, while libquadmath has GCC_NO_EXECUTABLES unconditionally. libstdc++-v3 uses something like libgfortran with extra condition for some Darwin crosses.