Gentoo patches

These are all the Gentoo patches from capisuite-0.4.5-r8 ebuild applied to the current master. Except the ones that already were covered by capisuite development.

I do not know if these patches are necessary or break something on non-Gentoo machines.

Please let me know if I have to do more things to let this pull request being merged.
Please send questions to the reasons for the individual patches via e-mail to the Gentoo maintainer (Mr. Popov) and me.