fix automake to work with current automake and fix compile to work with freebsd