mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 10:05:05 -07:00
Try to enable specific cflags before testing each intructions set
This commit is contained in:
parent
c3195da04d
commit
84d92fc1bf
40
configure.ac
40
configure.ac
@ -181,7 +181,7 @@ LIBTOOL_EXTRA_FLAGS="$LIBTOOL_EXTRA_FLAGS -version-info $SODIUM_LIBRARY_VERSION"
|
|||||||
AC_ARG_ENABLE(soname-versions,
|
AC_ARG_ENABLE(soname-versions,
|
||||||
[AC_HELP_STRING([--enable-soname-versions], [enable soname versions (must be disabled for Android) (default: enabled)])],
|
[AC_HELP_STRING([--enable-soname-versions], [enable soname versions (must be disabled for Android) (default: enabled)])],
|
||||||
[
|
[
|
||||||
AS_IF([test "x$enableval" = "xno"], [
|
AS_IF([test "x$enableval" = "xno"], [
|
||||||
LIBTOOL_EXTRA_FLAGS="$LIBTOOL_OLD_FLAGS -avoid-version"
|
LIBTOOL_EXTRA_FLAGS="$LIBTOOL_OLD_FLAGS -avoid-version"
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
@ -263,19 +263,21 @@ dnl Checks for headers
|
|||||||
AS_IF([test "x$EMSCRIPTEN" = "x"],[
|
AS_IF([test "x$EMSCRIPTEN" = "x"],[
|
||||||
|
|
||||||
AC_MSG_CHECKING(for MMX instructions set)
|
AC_MSG_CHECKING(for MMX instructions set)
|
||||||
|
oldcflags="$CFLAGS"
|
||||||
|
AX_CHECK_COMPILE_FLAG([-mmmx], [CFLAGS="$CFLAGS -mmmx"])
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
#pragma GCC target("mmx")
|
#pragma GCC target("mmx")
|
||||||
#ifndef __MMX__
|
|
||||||
# define __MMX__
|
|
||||||
#endif
|
|
||||||
#include <mmintrin.h>
|
#include <mmintrin.h>
|
||||||
]], [[ __m64 x = _mm_setzero_si64(); ]])],
|
]], [[ __m64 x = _mm_setzero_si64(); ]])],
|
||||||
[AC_MSG_RESULT(yes)
|
[AC_MSG_RESULT(yes)
|
||||||
AC_DEFINE([HAVE_MMINTRIN_H], [1], [mmx is available])
|
AC_DEFINE([HAVE_MMINTRIN_H], [1], [mmx is available])
|
||||||
AX_CHECK_COMPILE_FLAG([-mmmx], [CFLAGS_MMX="-mmmx"])],
|
AX_CHECK_COMPILE_FLAG([-mmmx], [CFLAGS_MMX="-mmmx"])],
|
||||||
[AC_MSG_RESULT(no)])
|
[AC_MSG_RESULT(no)])
|
||||||
|
CFLAGS="$oldcflags"
|
||||||
|
|
||||||
AC_MSG_CHECKING(for SSE2 instructions set)
|
AC_MSG_CHECKING(for SSE2 instructions set)
|
||||||
|
oldcflags="$CFLAGS"
|
||||||
|
AX_CHECK_COMPILE_FLAG([-msse2], [CFLAGS="$CFLAGS -msse2"])
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
#pragma GCC target("sse2")
|
#pragma GCC target("sse2")
|
||||||
#ifndef __SSE2__
|
#ifndef __SSE2__
|
||||||
@ -287,13 +289,13 @@ AS_IF([test "x$EMSCRIPTEN" = "x"],[
|
|||||||
AC_DEFINE([HAVE_EMMINTRIN_H], [1], [sse2 is available])
|
AC_DEFINE([HAVE_EMMINTRIN_H], [1], [sse2 is available])
|
||||||
AX_CHECK_COMPILE_FLAG([-msse2], [CFLAGS_SSE2="-msse2"])],
|
AX_CHECK_COMPILE_FLAG([-msse2], [CFLAGS_SSE2="-msse2"])],
|
||||||
[AC_MSG_RESULT(no)])
|
[AC_MSG_RESULT(no)])
|
||||||
|
CFLAGS="$oldcflags"
|
||||||
|
|
||||||
|
oldcflags="$CFLAGS"
|
||||||
|
AX_CHECK_COMPILE_FLAG([-msse3], [CFLAGS="$CFLAGS -msse3"])
|
||||||
AC_MSG_CHECKING(for SSE3 instructions set)
|
AC_MSG_CHECKING(for SSE3 instructions set)
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
#pragma GCC target("sse3")
|
#pragma GCC target("sse3")
|
||||||
#ifndef __SSE3__
|
|
||||||
# define __SSE3__
|
|
||||||
#endif
|
|
||||||
#include <pmmintrin.h>
|
#include <pmmintrin.h>
|
||||||
]], [[ __m128 x = _mm_addsub_ps(_mm_cvtpd_ps(_mm_setzero_pd()),
|
]], [[ __m128 x = _mm_addsub_ps(_mm_cvtpd_ps(_mm_setzero_pd()),
|
||||||
_mm_cvtpd_ps(_mm_setzero_pd())); ]])],
|
_mm_cvtpd_ps(_mm_setzero_pd())); ]])],
|
||||||
@ -301,43 +303,41 @@ AS_IF([test "x$EMSCRIPTEN" = "x"],[
|
|||||||
AC_DEFINE([HAVE_PMMINTRIN_H], [1], [sse3 is available])
|
AC_DEFINE([HAVE_PMMINTRIN_H], [1], [sse3 is available])
|
||||||
AX_CHECK_COMPILE_FLAG([-msse3], [CFLAGS_SSE3="-msse3"])],
|
AX_CHECK_COMPILE_FLAG([-msse3], [CFLAGS_SSE3="-msse3"])],
|
||||||
[AC_MSG_RESULT(no)])
|
[AC_MSG_RESULT(no)])
|
||||||
|
CFLAGS="$oldcflags"
|
||||||
|
|
||||||
|
oldcflags="$CFLAGS"
|
||||||
|
AX_CHECK_COMPILE_FLAG([-mssse3], [CFLAGS="$CFLAGS -mssse3"])
|
||||||
AC_MSG_CHECKING(for SSSE3 instructions set)
|
AC_MSG_CHECKING(for SSSE3 instructions set)
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
#pragma GCC target("ssse3")
|
#pragma GCC target("ssse3")
|
||||||
#ifndef __SSSE3__
|
|
||||||
# define __SSSE3__
|
|
||||||
#endif
|
|
||||||
#include <tmmintrin.h>
|
#include <tmmintrin.h>
|
||||||
]], [[ __m64 x = _mm_abs_pi32(_m_from_int(0)); ]])],
|
]], [[ __m64 x = _mm_abs_pi32(_m_from_int(0)); ]])],
|
||||||
[AC_MSG_RESULT(yes)
|
[AC_MSG_RESULT(yes)
|
||||||
AC_DEFINE([HAVE_TMMINTRIN_H], [1], [ssse3 is available])
|
AC_DEFINE([HAVE_TMMINTRIN_H], [1], [ssse3 is available])
|
||||||
AX_CHECK_COMPILE_FLAG([-mssse3], [CFLAGS_SSSE3="-mssse3"])],
|
AX_CHECK_COMPILE_FLAG([-mssse3], [CFLAGS_SSSE3="-mssse3"])],
|
||||||
[AC_MSG_RESULT(no)])
|
[AC_MSG_RESULT(no)])
|
||||||
|
CFLAGS="$oldcflags"
|
||||||
|
|
||||||
|
oldcflags="$CFLAGS"
|
||||||
|
AX_CHECK_COMPILE_FLAG([-msse4.1], [CFLAGS="$CFLAGS -msse4.1"])
|
||||||
AC_MSG_CHECKING(for SSE4.1 instructions set)
|
AC_MSG_CHECKING(for SSE4.1 instructions set)
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
#pragma GCC target("sse4.1")
|
#pragma GCC target("sse4.1")
|
||||||
#ifndef __SSE4_1__
|
|
||||||
# define __SSE4_1__
|
|
||||||
#endif
|
|
||||||
#include <smmintrin.h>
|
#include <smmintrin.h>
|
||||||
]], [[ __m128i x = _mm_minpos_epu16(_mm_setzero_si128()); ]])],
|
]], [[ __m128i x = _mm_minpos_epu16(_mm_setzero_si128()); ]])],
|
||||||
[AC_MSG_RESULT(yes)
|
[AC_MSG_RESULT(yes)
|
||||||
AC_DEFINE([HAVE_SMMINTRIN_H], [1], [sse4.1 is available])
|
AC_DEFINE([HAVE_SMMINTRIN_H], [1], [sse4.1 is available])
|
||||||
AX_CHECK_COMPILE_FLAG([-msse4.1], [CFLAGS_SSE4_1="-msse4.1"])],
|
AX_CHECK_COMPILE_FLAG([-msse4.1], [CFLAGS_SSE4_1="-msse4.1"])],
|
||||||
[AC_MSG_RESULT(no)])
|
[AC_MSG_RESULT(no)])
|
||||||
|
CFLAGS="$oldcflags"
|
||||||
|
|
||||||
|
oldcflags="$CFLAGS"
|
||||||
|
AX_CHECK_COMPILE_FLAG([-maes], [CFLAGS="$CFLAGS -maes"])
|
||||||
|
AX_CHECK_COMPILE_FLAG([-mpclmul], [CFLAGS="$CFLAGS -mpclmul"])
|
||||||
AC_MSG_CHECKING(for AESNI instructions set and PCLMULQDQ)
|
AC_MSG_CHECKING(for AESNI instructions set and PCLMULQDQ)
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
#pragma GCC target("aes")
|
#pragma GCC target("aes")
|
||||||
#pragma GCC target("pclmul")
|
#pragma GCC target("pclmul")
|
||||||
#ifndef __AES__
|
|
||||||
# define __AES__
|
|
||||||
#endif
|
|
||||||
#ifndef __PCLMUL__
|
|
||||||
# define __PCLMUL__
|
|
||||||
#endif
|
|
||||||
#include <wmmintrin.h>
|
#include <wmmintrin.h>
|
||||||
]], [[ __m128i x = _mm_aesimc_si128(_mm_setzero_si128());
|
]], [[ __m128i x = _mm_aesimc_si128(_mm_setzero_si128());
|
||||||
__m128i y = _mm_clmulepi64_si128(_mm_setzero_si128(), _mm_setzero_si128(), 0);]])],
|
__m128i y = _mm_clmulepi64_si128(_mm_setzero_si128(), _mm_setzero_si128(), 0);]])],
|
||||||
@ -347,6 +347,8 @@ AS_IF([test "x$EMSCRIPTEN" = "x"],[
|
|||||||
AX_CHECK_COMPILE_FLAG([-mpclmul], [CFLAGS_PCLMUL="-mpclmul"])
|
AX_CHECK_COMPILE_FLAG([-mpclmul], [CFLAGS_PCLMUL="-mpclmul"])
|
||||||
],
|
],
|
||||||
[AC_MSG_RESULT(no)])
|
[AC_MSG_RESULT(no)])
|
||||||
|
CFLAGS="$oldcflags"
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_SUBST(CFLAGS_MMX)
|
AC_SUBST(CFLAGS_MMX)
|
||||||
|
Loading…
Reference in New Issue
Block a user