aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-02-18 17:16:04 -0800
committerGuy Harris <guy@alum.mit.edu>2015-02-19 02:42:11 +0000
commit493ab6bcf368de4cb795cbf023dce9a0d71ab655 (patch)
treef86468c0ae7a7e5b2ac52eeaba732eae8b1013f1 /configure.ac
parente29dca79f2faccfab156871dff8b200c6768d841 (diff)
Check whether emmintrin.h can be used *without* -msse4.2.
If not, we can't use SSE 4.2, as we need to be able to include it in files that use tvb_pbrk_compile()/tvb_pbrk_exec() even if they're not compiled with -msse4.2 (most files aren't, as we need to isolate SSE 4.2 instructions to a small bit of code that uses them only if running on hardware that supports them). Change-Id: I62262a3c45fa14e200967916ac0ffc283f8e322c Reviewed-on: https://code.wireshark.org/review/7246 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac64
1 files changed, 45 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index d1ec39a17e..72b48ab08b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1131,36 +1131,62 @@ if test "x$ac_sse4_2_flag" != x; then
#
# OK, we have a compiler flag to enable SSE 4.2.
#
- # Make sure we have the necessary header for the SSE4.2 intrinsics
- # and that we can use it.
+ # Make sure we have the necessary headers for the SSE4.2 intrinsics
+ # and that we can use them.
#
- 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.
+ # First, check whether we have emmintrin.h and can use it
+ # *without* the SSE 4.2 flag.
#
- saved_CFLAGS="$CFLAGS"
- CFLAGS="$ac_sse4_2_flag $CFLAGS"
+ AC_MSG_CHECKING([whether there is emmintrin.h header and we can use it])
AC_TRY_COMPILE(
- [#include <nmmintrin.h>],
+ [#include <emmintrin.h>],
[return 0;],
[
- have_sse42=yes
- AC_DEFINE(HAVE_SSE4_2, 1, [Support SSSE4.2 (Streaming SIMD Extensions 4.2) instructions])
- CFLAGS_SSE42="$ac_sse4_2_flag"
+ emmintrin_h_works=yes
AC_MSG_RESULT([yes])
],
[
- have_sse42=no
+ emmintrin_h_works=no
AC_MSG_RESULT([no])
]
)
- CFLAGS="$saved_CFLAGS"
+
+ #
+ # OK, if that works, see whether we have nmmintrin.h and
+ # can use it *with* the SSE 4.2 flag.
+ #
+ if test "x$emmintrin_h_works" = "xyes"; then
+ #
+ # 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.
+ #
+ AC_MSG_CHECKING([whether there is nmmintrin.h header and we can use it])
+ saved_CFLAGS="$CFLAGS"
+ CFLAGS="$ac_sse4_2_flag $CFLAGS"
+ AC_TRY_COMPILE(
+ [#include <nmmintrin.h>],
+ [return 0;],
+ [
+ have_sse42=yes
+ AC_DEFINE(HAVE_SSE4_2, 1, [Support SSSE4.2 (Streaming SIMD Extensions 4.2) instructions])
+ CFLAGS_SSE42="$ac_sse4_2_flag"
+ AC_MSG_RESULT([yes])
+ ],
+ [
+ have_sse42=no
+ AC_MSG_RESULT([no])
+ ]
+ )
+ CFLAGS="$saved_CFLAGS"
+ else
+ have_sse42=no
+ fi
else
have_sse42=no
fi