Added fixes for Gentoo Linux.