added better gentoo/funtoo support

should fix #6236