forked from osmocom/wireshark
Rewrite check for ws_mempbrk_sse42.c compilation
- check only for -msse4.2 - check if there's nmmintrin.h header - don't check if current CPU support -msse4.2 (fix cross compilation) Change-Id: Iba8d291fdf5602937ab540a69b7608a81427ad25 Reviewed-on: https://code.wireshark.org/review/2189 Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
91f58d6714
commit
6664030571
33
configure.ac
33
configure.ac
|
@ -60,12 +60,6 @@ AC_PROG_CPP
|
|||
AC_PROG_MKDIR_P
|
||||
AC_WIRESHARK_CLANG_CHECK
|
||||
|
||||
# Find supported SIMD extensions by requesting cpuid. When an SIMD
|
||||
# extension is found, the -m"simdextensionname" is added to SIMD_FLAGS
|
||||
# (only if compilator support it) (ie : if "sse2" is available "-msse2" is
|
||||
# added to SIMD_FLAGS)
|
||||
AX_EXT
|
||||
|
||||
dnl Work around libtool bug (fixed in the version 1.5a?)
|
||||
AC_DEFUN([AC_PROVIDE_AC_LIBTOOL_DLOPEN], )
|
||||
AC_LIBTOOL_DLOPEN
|
||||
|
@ -976,6 +970,33 @@ fi
|
|||
AC_SUBST(PIE_CFLAGS)
|
||||
AC_SUBST(PIE_LDFLAGS)
|
||||
|
||||
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])
|
||||
|
||||
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])
|
||||
AC_MSG_RESULT([yes])
|
||||
],
|
||||
[
|
||||
have_sse42=no
|
||||
AC_MSG_RESULT([no])
|
||||
]
|
||||
)
|
||||
|
||||
dnl build libwsutil_sse42 only if there is SSE4.2
|
||||
AM_CONDITIONAL(SSE42_SUPPORTED, test "x$have_sse42" = "xno")
|
||||
|
||||
# Restore CFLAGS
|
||||
CFLAGS="$CFLAGS_before_simd"
|
||||
fi
|
||||
|
||||
#
|
||||
# If we're running GCC or clang define _U_ to be "__attribute__((unused))"
|
||||
# so we can use _U_ to flag unused function parameters and not get warnings
|
||||
|
|
|
@ -52,9 +52,9 @@ if NEED_STRPTIME_LO
|
|||
wsutil_optional_objects += @STRPTIME_LO@
|
||||
endif
|
||||
|
||||
## if SSE42_SUPPORTED
|
||||
if SSE42_SUPPORTED
|
||||
wsutil_optional_objects += libwsutil_sse42.la
|
||||
## endif
|
||||
endif
|
||||
|
||||
include ../Makefile.am.inc
|
||||
|
||||
|
@ -83,7 +83,7 @@ libwsutil_la_SOURCES = \
|
|||
libwsutil_sse42_la_SOURCES = \
|
||||
ws_mempbrk_sse42.c
|
||||
|
||||
libwsutil_sse42_la_CFLAGS = $(AM_CFLAGS) $(SIMD_FLAGS)
|
||||
libwsutil_sse42_la_CFLAGS = $(AM_CFLAGS) -msse4.2
|
||||
|
||||
EXTRA_libwsutil_la_SOURCES= \
|
||||
inet_aton.c \
|
||||
|
|
Loading…
Reference in New Issue