I don't know the build system for this program (and this is a generic bug template so I cannot tell you which program exactly is), but my tests shows that it's not respecting CFLAGS properly. Please look into it, since it's important to respect user CFLAGS. Thanks, Diego P.S.: seems to be limited to libewf subdirectory.
Its with both libewf and afflib subdirectories, but only sleuthkit 2.09 seems to suffer from this? The 3.0.x series ebuilds seemed to respect the flags, and they link to system libs (aren't shipping and building their own copies). The problem with the 2.09 is that it ships full, ancient versions of both libewf (20070512) and AFFlib (2.2.12), and the way their builds are called seems to lose environment. (Their building is called from the sleuthkit main Makefile via sh execution.) I just tried moving the sh calls from the Makefile to the ebuild, and for example that prevented mutilating, e.g., CFLAGS for the bundled afflib and libewf subdirectories. But I'd believe a better solution might be stabilizing one of the 3.0.x series and removing this old version since there are also file collision bugs for the old sleuthkit-2.09, like bug #131268 and bug #266723.
Closing as fixed since this isn't an issue in recent versions anymore.