Portability fixes.
SunOS needs -lm.  Doesn't fix the build, but gets us further.