More libm functions (see #297)

With autoconf checking.

TODO: set _POSIX_C_SOURCE so we get more of these functions.