FreeBSD specific patches

Hi guys,

These are the patches that are automatically applied at build-time on FreeBSD that could likely be pulled upstream to you guys. Could you review them and pull them? 

A few also came from NetBSD which you can find the commits for here:

http://pkgsrc.se/files.php?messageId=20130324164748.18FD0175DD@cvs.netbsd.org