diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-01-20 16:29:06 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-01-21 00:30:01 +0000 |
commit | f2151025401d345a9ce1c2ee0860dc69d1c6d9c0 (patch) | |
tree | 3f5cccafa6dfe085315a722d871c35e3179c8ab4 | |
parent | 5f70fd602d8de4efa4a5a662cafe28a772bdd674 (diff) |
Handle CFLAGS disabling SSE 4.2.
When checking whether nmmintrin.h works, add -msse4.2 at the *beginning*
of CFLAGS, so that user (or Gentoo build process) settings with
-mno-sse4.2 override it.
Bug: 10792
Change-Id: I1b77c2a092360a86bc7012d29642ff3303b60812
Reviewed-on: https://code.wireshark.org/review/6696
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | configure.ac | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index bbc02208a9..fccd9b0fbd 100644 --- a/configure.ac +++ b/configure.ac @@ -1080,8 +1080,30 @@ CFLAGS_before_simd="$CFLAGS" AC_WIRESHARK_COMPILER_FLAGS_CHECK(-msse4.2, C) if test "x$CFLAGS" != "x$CFLAGS_before_simd" then - AC_MSG_CHECKING([whether there is nmmintrin.h header]) + # + # Restore CFLAGS. We only want to apply -msse4.2 to + # wsutil/ws_mempbrk_sse42.c, as the SSE4.2 code there + # is run only if the hardware supports it, but other + # code would do no such checks. + # + CFLAGS="$CFLAGS_before_simd" + + # + # Make sure we have the necessary header for the SSE4.2 intrinsics + # and that we can use it. + # + AC_MSG_CHECKING([whether there is nmmintrin.h header and we can use it]) + # + # Add the SSE4.2 flags to the beginning of CFLAGS, in case the + # user explicitly specified -mno-sse4.2 (or in case Gentoo's build + # tools did so); if they did so, we only want this to work if + # we can use the #pragma to override that for ws_mempbrk_sse42.c, + # and putting it at the beginning means that the CFLAGS setting + # in the environment will come later and override it. + # + saved_CFLAGS="$CFLAGS" + CFLAGS="-msse4.2 $CFLAGS" AC_TRY_COMPILE( [#include <nmmintrin.h>], [return 0;], @@ -1096,9 +1118,7 @@ then AC_MSG_RESULT([no]) ] ) - - # Restore CFLAGS - CFLAGS="$CFLAGS_before_simd" + CFLAGS="$saved_CFLAGS" else have_sse42=no fi |