Patch from Anders Vinjar for compilation on Linux.