Incorporate bitcoind upstream fixes for OS X

Ran into some issues while compiling under OS X 10.9 and found these fixes in the bitcoind repo.