It derives the --cpu arg from CHOST which is normally i686 on even the newest x86 platforms. This disables sha1_sse2 on Pentium4 even though it supports SSE2.
There is somewhat of a quandary in fixing this, unfortunately. The configure.py script can autodetect the processor that it is currently running on (via Python's platform module). However in some cases this has unfavorable behavior (particularly note the special case in the ebuild for sparc, as Gentoo/sparc is a 32-bit userspace so 64-bit builds there are never good; I think PPC may have similar problems but am not sure). On the other hand, for x86 in particular this may make a big difference, not only for enabling SSE2 code but also in terms of general code scheduling. Digging through other ebuilds, I found the get-flag ebuild command. It looks like this might have the desired effect - if the user has set -march/-mcpu, use that as the target processor, otherwise use CHOST as before. I've created an updated version of the 1.8.7 ebuild which attempts this. Only tested on x86-64 but it seems to behave properly. I somewhat expect that there are at least a few cases this will do the wrong thing, though.
Created attachment 204260 [details] botan 1.8.7-r1 ebuild
I have -march=native, so it fails for me with: * Building for CPU native * Disabling modules: proc_walk,unix_procs,cpu_counter Unknown or unidentifiable processor "native" * * ERROR: dev-libs/botan-1.8.7-r1 failed. * Call stack: * ebuild.sh, line 49: Called src_configure * environment, line 2587: Called die * The specific snippet of code: * ./configure.py --prefix="${D}/usr" --libdir=/$(get_libdir) --docdir=/share/doc/ --cc=gcc --os=linux --cpu=${arch} --with-endian="$(tc-endian)" --with-tr1=system $(use_with bzip2) $(use_with gmp gnump) $(use_with ssl openssl) $(use_with zlib) --disable-modules=${disable_modules} || die "configure.py failed" * The die message: * configure.py failed * * If you need support, post the topmost build error, and the call stack if relevant. * A complete build log is located at '/var/tmp/portage/dev-libs/botan-1.8.7-r1/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/dev-libs/botan-1.8.7-r1/temp/environment'. *
Not going to fix this in 1.8. It would require too many invasive changes to the build system. Mainline sources (to be released as 1.9.4, probably sometime early next year) adds build options --enable-{sse2,ssse3,altivec} which can be used with portages use_enable to turn on SIMD code based on use flags rather than guessing based on the argument to --cpu.