Fix autoconf build on FreeBSD: detect gmake, and put -D*_SOURCE under linux.