Fix compile errror on freebsd - defines have to be moved up due to
header dependencies.