Clang fixes

I was trying to compile this with clang on OS X and hit a few issues.

The commit messages contain more detail, but the highlights are:
- I had to pass `-I/usr/local/nagios/include` to compile because I installed from source.
- `clang` seems to need `-D_XOPEN_SOURCE=600` to give you `strdup` with `-std=c99`.
- Fix for edge case if `malloc` doesn't `calloc` by default