Fix compilation on OS X

OS X doesn't implement SOL_TCP so workaround this the same way as on
FreeBSD/Solaris.
Merge pull request #76 from sitsofe/osx

Fix compilation on OS X