static libs is usually not exclusive of shared libs, and in gentoo shared libraries are actually preferred. so i woud suggest:
-DBUILD_SHARED_LIBS=ON always, and do not use the DEAL_II_PREFER_STATIC_LIBS