[PATCH] configure.ac: fix HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS on x32 targets
Jussi Kivilinna
jussi.kivilinna at iki.fi
Mon Feb 2 19:21:56 CET 2026
* configure.ac (gcry_cv_compiler_defines__x86_64__): New.
(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS): Enable if __x86_64__ macro is
defined by compiler and size of long is 4 (x32) or 8 (amd64).
--
Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
configure.ac | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index be6b29b4..d94319cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1829,6 +1829,25 @@ if test $amd64_as_feature_detection = yes; then
fi
+#
+# Check whether compiler defines __x86_64__ macro (amd64 or x32)
+#
+AC_CACHE_CHECK([whether compiler defines __x86_64__ macro],
+ [gcry_cv_compiler_defines__x86_64__],
+ [if test "$mpi_cpu_arch" != "x86" ||
+ test "$try_asm_modules" != "yes" ; then
+ gcry_cv_compiler_defines__x86_64__="n/a"
+ else
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
+ #ifndef __x86_64__
+ # error "Architecture is not x86_64"
+ #endif
+ ]])],
+ [gcry_cv_compiler_defines__x86_64__=yes],
+ [gcry_cv_compiler_defines__x86_64__=no])
+ fi])
+
+
#
# Check whether GCC assembler supports features needed for our i386/amd64
# implementations
@@ -1859,7 +1878,9 @@ if test $amd64_as_feature_detection = yes; then
[gcry_cv_gcc_x86_platform_as_ok=yes])
fi])
if test "$gcry_cv_gcc_x86_platform_as_ok" = "yes" &&
- test "$ac_cv_sizeof_unsigned_long" = "8"; then
+ test "$gcry_cv_compiler_defines__x86_64__" = "yes" &&
+ (test "$ac_cv_sizeof_unsigned_long" = "4" ||
+ test "$ac_cv_sizeof_unsigned_long" = "8"); then
AC_DEFINE(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS,1,
[Defined if underlying assembler is compatible with amd64 assembly implementations])
fi
--
2.51.0
More information about the Gcrypt-devel
mailing list