Gentoo patches

Includes changes from Gentoo to make this work on more systems and fix other bugs.  Also has warning removal from my compilation attempts from Debian.

I made this off the Debian fork that also have other updates.  Striving towards a better product, right?