summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorbeatrice <beatrice@dangofactory.net>2026-11-22 20:03:00 +0900
committerbeatrice <beatrice@dangofactory.net>2026-11-22 20:03:00 +0900
commit2d8ae60f18b379215be576a0d533e28fa28e1bf1 (patch)
tree47cd73ec5fd53931d2dcdd634a9e7687c4449185 /configure.ac
parent77e1ce5d6dee871c49ef211222ba18ef0c486bda (diff)
downloadlibsodium-master.tar.gz
libsodium-master.zip
Release tarball libsodium.tar.gz (dist-generated files / local differences from tag)HEADlocal/libsodiummaster
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac49
1 files changed, 41 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 3baf9a96..6478af5f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,6 +278,27 @@ int main(void) { return 0; }
)
])
+AS_CASE([$host_cpu],
+ [s390x], [
+ AC_MSG_CHECKING(for clang 21 with the s390x vector facility)
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([
+#if defined(__clang__) && __clang_major__ == 21 && defined(__VX__)
+# error wrong code for widening vector multiplications
+#endif
+int main(void) { return 0; }
+ ])],
+ [AC_MSG_RESULT(no)],
+ [AC_MSG_RESULT(yes)
+ AX_CHECK_COMPILE_FLAG([-mno-vx], [
+ AC_MSG_WARN([clang 21 generates wrong vector code on s390x - vector facility disabled])
+ CFLAGS="$CFLAGS -mno-vx"
+ ], [
+ AC_MSG_ERROR([clang 21 generates wrong vector code on s390x - please use another compiler version])
+ ])
+ ])
+ ])
+
LIBTOOL_OLD_FLAGS="$LIBTOOL_EXTRA_FLAGS"
LIBTOOL_EXTRA_FLAGS="$LIBTOOL_EXTRA_FLAGS -version-info $SODIUM_LIBRARY_VERSION"
AC_ARG_ENABLE(soname-versions,
@@ -335,7 +356,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
[AC_MSG_RESULT(no)
])
-AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wextra], [CWFLAGS="$WCFLAGS -Wextra"])
+AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wextra], [CWFLAGS="$CWFLAGS -Wextra"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Warray-bounds], [CWFLAGS="$CWFLAGS -Warray-bounds"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wbad-function-cast], [CWFLAGS="$CWFLAGS -Wbad-function-cast"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wcast-qual], [CWFLAGS="$CWFLAGS -Wcast-qual"])
@@ -363,6 +384,7 @@ AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wsometimes-uninitialized], [CWFLAGS="$CWFLAGS -
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wstrict-prototypes], [CWFLAGS="$CWFLAGS -Wstrict-prototypes"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wswitch-enum], [CWFLAGS="$CWFLAGS -Wswitch-enum"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wvariable-decl], [CWFLAGS="$CWFLAGS -Wvariable-decl"])
+AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wvla], [CWFLAGS="$CWFLAGS -Wvla"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wwrite-strings], [CWFLAGS="$CWFLAGS -Wwrite-strings"])
AS_IF([test "x$EMSCRIPTEN" = "x"], [
@@ -741,7 +763,7 @@ AS_IF([test "$enable_asm" != "no"],[
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
]], [[
#if defined(__amd64) || defined(__amd64__) || defined(__x86_64__)
-# if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(_WIN32) || defined(_WIN64)
+# if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(_WIN32) || defined(_WIN64) || defined(__midipix__)
# error Windows x86_64 calling conventions are not supported yet
# endif
/* neat */
@@ -841,6 +863,21 @@ __asm__ __volatile__ ("xchgl %%ebx, %k1; cpuid; xchgl %%ebx, %k1" :
])
AC_SUBST(HAVE_CPUID_V)
+AS_CASE([$host_cpu], [i?86|amd64|x86_64], [
+ AS_IF([test "$enable_asm" != "no"],[
+ AC_MSG_CHECKING(whether XGETBV can be used with inline assembly)
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
+unsigned int xcr0;
+__asm__ __volatile__(".byte 0x0f, 0x01, 0xd0" :
+ "=a" (xcr0) :
+ "c" ((unsigned int) 0U) : "%edx");
+ ]])],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_XGETBV_ASM], [1], [XGETBV can be used with inline assembly])],
+ [AC_MSG_RESULT(no)])
+ ])
+])
+
asm_hide_symbol="unsupported"
AS_IF([test "$enable_asm" != "no"],[
AC_MSG_CHECKING(if the .private_extern asm directive is supported)
@@ -939,9 +976,7 @@ AS_IF([test "x$EMSCRIPTEN" = "x"],[
AC_MSG_CHECKING(for getrandom with a standard API)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
+#include <unistd.h>
#ifdef HAVE_SYS_RANDOM_H
# include <sys/random.h>
#endif
@@ -959,9 +994,7 @@ if (&getrandom != NULL) {
AC_MSG_CHECKING(for getentropy with a standard API)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
+#include <unistd.h>
#ifdef HAVE_SYS_RANDOM_H
# include <sys/random.h>
#endif