Compile and run on FreeBSD (tested on 9.1)
merged