summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac271
1 files changed, 169 insertions, 102 deletions
diff --git a/configure.ac b/configure.ac
index c3ab96f3..1d5027ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -575,10 +575,6 @@ AC_ARG_ENABLE(padlock-support,
[Disable support for the PadLock Engine of VIA processors]),
padlocksupport=$enableval,padlocksupport=yes)
AC_MSG_RESULT($padlocksupport)
-if test x"$padlocksupport" = xyes ; then
- AC_DEFINE(ENABLE_PADLOCK_SUPPORT, 1,
- [Enable support for the PadLock engine.])
-fi
# Implementation of the --disable-aesni-support switch.
AC_MSG_CHECKING([whether AESNI support is requested])
@@ -603,10 +599,6 @@ AC_ARG_ENABLE(drng-support,
[Disable support for the Intel DRNG (RDRAND instruction)]),
drngsupport=$enableval,drngsupport=yes)
AC_MSG_RESULT($drngsupport)
-if test x"$drngsupport" = xyes ; then
- AC_DEFINE(ENABLE_DRNG_SUPPORT, 1,
- [Enable support for Intel DRNG (RDRAND instruction).])
-fi
# Implementation of the --disable-avx-support switch.
AC_MSG_CHECKING([whether AVX support is requested])
@@ -995,19 +987,121 @@ fi
#
+# Check whether GCC assembler supports features needed for our ARM
+# implementations. This needs to be done before setting up the
+# assembler stuff.
+#
+AC_CACHE_CHECK([whether GCC assembler is compatible for ARM assembly implementations],
+ [gcry_cv_gcc_arm_platform_as_ok],
+ [gcry_cv_gcc_arm_platform_as_ok=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [[__asm__(
+ /* Test if assembler supports UAL syntax. */
+ ".syntax unified\n\t"
+ ".arm\n\t" /* our assembly code is in ARM mode */
+ /* Following causes error if assembler ignored '.syntax unified'. */
+ "asmfunc:\n\t"
+ "add %r0, %r0, %r4, ror #12;\n\t"
+
+ /* Test if '.type' and '.size' are supported. */
+ ".size asmfunc,.-asmfunc;\n\t"
+ ".type asmfunc,%function;\n\t"
+ );]])],
+ [gcry_cv_gcc_arm_platform_as_ok=yes])])
+if test "$gcry_cv_gcc_arm_platform_as_ok" = "yes" ; then
+ AC_DEFINE(HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS,1,
+ [Defined if underlying assembler is compatible with ARM assembly implementations])
+fi
+
+
+#
+# Check whether underscores in symbols are required. This needs to be
+# done before setting up the assembler stuff.
+#
+GNUPG_SYS_SYMBOL_UNDERSCORE()
+
+
+#################################
+#### ####
+#### Setup assembler stuff. ####
+#### Define mpi_cpu_arch. ####
+#### ####
+#################################
+AC_ARG_ENABLE(mpi-path,
+ AC_HELP_STRING([--enable-mpi-path=EXTRA_PATH],
+ [prepend EXTRA_PATH to list of CPU specific optimizations]),
+ mpi_extra_path="$enableval",mpi_extra_path="")
+AC_MSG_CHECKING(architecture and mpi assembler functions)
+if test -f $srcdir/mpi/config.links ; then
+ . $srcdir/mpi/config.links
+ AC_CONFIG_LINKS("$mpi_ln_list")
+ ac_cv_mpi_sflags="$mpi_sflags"
+ AC_MSG_RESULT($mpi_cpu_arch)
+else
+ AC_MSG_RESULT(failed)
+ AC_MSG_ERROR([mpi/config.links missing!])
+fi
+MPI_SFLAGS="$ac_cv_mpi_sflags"
+AC_SUBST(MPI_SFLAGS)
+
+AM_CONDITIONAL(MPI_MOD_ASM_MPIH_ADD1, test "$mpi_mod_asm_mpih_add1" = yes)
+AM_CONDITIONAL(MPI_MOD_ASM_MPIH_SUB1, test "$mpi_mod_asm_mpih_sub1" = yes)
+AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL1, test "$mpi_mod_asm_mpih_mul1" = yes)
+AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL2, test "$mpi_mod_asm_mpih_mul2" = yes)
+AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL3, test "$mpi_mod_asm_mpih_mul3" = yes)
+AM_CONDITIONAL(MPI_MOD_ASM_MPIH_LSHIFT, test "$mpi_mod_asm_mpih_lshift" = yes)
+AM_CONDITIONAL(MPI_MOD_ASM_MPIH_RSHIFT, test "$mpi_mod_asm_mpih_rshift" = yes)
+AM_CONDITIONAL(MPI_MOD_ASM_UDIV, test "$mpi_mod_asm_udiv" = yes)
+AM_CONDITIONAL(MPI_MOD_ASM_UDIV_QRNND, test "$mpi_mod_asm_udiv_qrnnd" = yes)
+AM_CONDITIONAL(MPI_MOD_C_MPIH_ADD1, test "$mpi_mod_c_mpih_add1" = yes)
+AM_CONDITIONAL(MPI_MOD_C_MPIH_SUB1, test "$mpi_mod_c_mpih_sub1" = yes)
+AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL1, test "$mpi_mod_c_mpih_mul1" = yes)
+AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL2, test "$mpi_mod_c_mpih_mul2" = yes)
+AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL3, test "$mpi_mod_c_mpih_mul3" = yes)
+AM_CONDITIONAL(MPI_MOD_C_MPIH_LSHIFT, test "$mpi_mod_c_mpih_lshift" = yes)
+AM_CONDITIONAL(MPI_MOD_C_MPIH_RSHIFT, test "$mpi_mod_c_mpih_rshift" = yes)
+AM_CONDITIONAL(MPI_MOD_C_UDIV, test "$mpi_mod_c_udiv" = yes)
+AM_CONDITIONAL(MPI_MOD_C_UDIV_QRNND, test "$mpi_mod_c_udiv_qrnnd" = yes)
+
+# Reset non applicable feature flags.
+if test "$mpi_cpu_arch" != "x86" ; then
+ aesnisupport="n/a"
+ pclmulsupport="n/a"
+ avxsupport="n/a"
+ avx2support="n/a"
+ padlocksupport="n/a"
+ drngsupport="n/a"
+fi
+
+if test "$mpi_cpu_arch" != "arm" ; then
+ neonsupport="n/a"
+fi
+
+
+#############################################
+#### ####
+#### Platform specific compiler checks. ####
+#### ####
+#############################################
+
+#
# Check whether GCC inline assembler supports SSSE3 instructions
# This is required for the AES-NI instructions.
#
AC_CACHE_CHECK([whether GCC inline assembler supports SSSE3 instructions],
[gcry_cv_gcc_inline_asm_ssse3],
- [gcry_cv_gcc_inline_asm_ssse3=no
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [if test "$mpi_cpu_arch" != "x86" ; then
+ gcry_cv_gcc_inline_asm_ssse3="n/a"
+ else
+ gcry_cv_gcc_inline_asm_ssse3=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[[static unsigned char be_mask[16] __attribute__ ((aligned (16))) =
{ 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
void a(void) {
__asm__("pshufb %[mask], %%xmm2\n\t"::[mask]"m"(*be_mask):);
}]])],
- [gcry_cv_gcc_inline_asm_ssse3=yes])])
+ [gcry_cv_gcc_inline_asm_ssse3=yes])
+ fi])
if test "$gcry_cv_gcc_inline_asm_ssse3" = "yes" ; then
AC_DEFINE(HAVE_GCC_INLINE_ASM_SSSE3,1,
[Defined if inline assembler supports SSSE3 instructions])
@@ -1019,12 +1113,16 @@ fi
#
AC_CACHE_CHECK([whether GCC inline assembler supports PCLMUL instructions],
[gcry_cv_gcc_inline_asm_pclmul],
- [gcry_cv_gcc_inline_asm_pclmul=no
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [if test "$mpi_cpu_arch" != "x86" ; then
+ gcry_cv_gcc_inline_asm_pclmul="n/a"
+ else
+ gcry_cv_gcc_inline_asm_pclmul=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[[void a(void) {
__asm__("pclmulqdq \$0, %%xmm1, %%xmm3\n\t":::"cc");
}]])],
- [gcry_cv_gcc_inline_asm_pclmul=yes])])
+ [gcry_cv_gcc_inline_asm_pclmul=yes])
+ fi])
if test "$gcry_cv_gcc_inline_asm_pclmul" = "yes" ; then
AC_DEFINE(HAVE_GCC_INLINE_ASM_PCLMUL,1,
[Defined if inline assembler supports PCLMUL instructions])
@@ -1036,12 +1134,16 @@ fi
#
AC_CACHE_CHECK([whether GCC inline assembler supports AVX instructions],
[gcry_cv_gcc_inline_asm_avx],
- [gcry_cv_gcc_inline_asm_avx=no
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [if test "$mpi_cpu_arch" != "x86" ; then
+ gcry_cv_gcc_inline_asm_avx="n/a"
+ else
+ gcry_cv_gcc_inline_asm_avx=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[[void a(void) {
__asm__("xgetbv; vaesdeclast (%[mem]),%%xmm0,%%xmm7\n\t"::[mem]"r"(0):);
}]])],
- [gcry_cv_gcc_inline_asm_avx=yes])])
+ [gcry_cv_gcc_inline_asm_avx=yes])
+ fi])
if test "$gcry_cv_gcc_inline_asm_avx" = "yes" ; then
AC_DEFINE(HAVE_GCC_INLINE_ASM_AVX,1,
[Defined if inline assembler supports AVX instructions])
@@ -1053,12 +1155,16 @@ fi
#
AC_CACHE_CHECK([whether GCC inline assembler supports AVX2 instructions],
[gcry_cv_gcc_inline_asm_avx2],
- [gcry_cv_gcc_inline_asm_avx2=no
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [if test "$mpi_cpu_arch" != "x86" ; then
+ gcry_cv_gcc_inline_asm_avx2="n/a"
+ else
+ gcry_cv_gcc_inline_asm_avx2=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[[void a(void) {
__asm__("xgetbv; vpbroadcastb %%xmm7,%%ymm1\n\t":::"cc");
}]])],
- [gcry_cv_gcc_inline_asm_avx2=yes])])
+ [gcry_cv_gcc_inline_asm_avx2=yes])
+ fi])
if test "$gcry_cv_gcc_inline_asm_avx2" = "yes" ; then
AC_DEFINE(HAVE_GCC_INLINE_ASM_AVX2,1,
[Defined if inline assembler supports AVX2 instructions])
@@ -1070,12 +1176,16 @@ fi
#
AC_CACHE_CHECK([whether GCC inline assembler supports BMI2 instructions],
[gcry_cv_gcc_inline_asm_bmi2],
- [gcry_cv_gcc_inline_asm_bmi2=no
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [if test "$mpi_cpu_arch" != "x86" ; then
+ gcry_cv_gcc_inline_asm_bmi2="n/a"
+ else
+ gcry_cv_gcc_inline_asm_bmi2=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[[void a(void) {
__asm__("rorxl \$23, %%eax, %%edx\\n\\t":::"memory");
}]])],
- [gcry_cv_gcc_inline_asm_bmi2=yes])])
+ [gcry_cv_gcc_inline_asm_bmi2=yes])
+ fi])
if test "$gcry_cv_gcc_inline_asm_bmi2" = "yes" ; then
AC_DEFINE(HAVE_GCC_INLINE_ASM_BMI2,1,
[Defined if inline assembler supports BMI2 instructions])
@@ -1120,8 +1230,11 @@ fi
if test $amd64_as_feature_detection = yes; then
AC_CACHE_CHECK([whether GCC assembler is compatible for amd64 assembly implementations],
[gcry_cv_gcc_amd64_platform_as_ok],
- [gcry_cv_gcc_amd64_platform_as_ok=no
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [if test "$mpi_cpu_arch" != "x86" ; then
+ gcry_cv_gcc_amd64_platform_as_ok="n/a"
+ else
+ gcry_cv_gcc_amd64_platform_as_ok=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[[__asm__(
/* Test if '.type' and '.size' are supported. */
/* These work only on ELF targets. */
@@ -1137,7 +1250,8 @@ if test $amd64_as_feature_detection = yes; then
* to be disable on this machine. */
"xorl \$(123456789/12345678), %ebp;\n\t"
);]])],
- [gcry_cv_gcc_amd64_platform_as_ok=yes])])
+ [gcry_cv_gcc_amd64_platform_as_ok=yes])
+ fi])
if test "$gcry_cv_gcc_amd64_platform_as_ok" = "yes" ; then
AC_DEFINE(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS,1,
[Defined if underlying assembler is compatible with amd64 assembly implementations])
@@ -1151,8 +1265,11 @@ fi
#
AC_CACHE_CHECK([whether GCC assembler is compatible for Intel syntax assembly implementations],
[gcry_cv_gcc_platform_as_ok_for_intel_syntax],
- [gcry_cv_gcc_platform_as_ok_for_intel_syntax=no
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [if test "$mpi_cpu_arch" != "x86" ; then
+ gcry_cv_gcc_platform_as_ok_for_intel_syntax="n/a"
+ else
+ gcry_cv_gcc_platform_as_ok_for_intel_syntax=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[[__asm__(
".intel_syntax noprefix\n\t"
"pxor xmm1, xmm7;\n\t"
@@ -1172,7 +1289,8 @@ AC_CACHE_CHECK([whether GCC assembler is compatible for Intel syntax assembly im
"add VAL_A, VAL_B;\n\t"
"add VAL_B, 0b10101;\n\t"
);]])],
- [gcry_cv_gcc_platform_as_ok_for_intel_syntax=yes])])
+ [gcry_cv_gcc_platform_as_ok_for_intel_syntax=yes])
+ fi])
if test "$gcry_cv_gcc_platform_as_ok_for_intel_syntax" = "yes" ; then
AC_DEFINE(HAVE_INTEL_SYNTAX_PLATFORM_AS,1,
[Defined if underlying assembler is compatible with Intel syntax assembly implementations])
@@ -1184,7 +1302,10 @@ fi
#
AC_CACHE_CHECK([whether compiler is configured for ARMv6 or newer architecture],
[gcry_cv_cc_arm_arch_is_v6],
- [AC_EGREP_CPP(yes,
+ [if test "$mpi_cpu_arch" != "arm" ; then
+ gcry_cv_cc_arm_arch_is_v6="n/a"
+ else
+ AC_EGREP_CPP(yes,
[#if defined(__arm__) && \
((defined(__ARM_ARCH) && __ARM_ARCH >= 6) \
|| defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
@@ -1195,7 +1316,8 @@ AC_CACHE_CHECK([whether compiler is configured for ARMv6 or newer architecture],
|| defined(__ARM_ARCH_7EM__))
yes
#endif
- ], gcry_cv_cc_arm_arch_is_v6=yes, gcry_cv_cc_arm_arch_is_v6=no)])
+ ], gcry_cv_cc_arm_arch_is_v6=yes, gcry_cv_cc_arm_arch_is_v6=no)
+ fi])
if test "$gcry_cv_cc_arm_arch_is_v6" = "yes" ; then
AC_DEFINE(HAVE_ARM_ARCH_V6,1,
[Defined if ARM architecture is v6 or newer])
@@ -1207,8 +1329,11 @@ fi
#
AC_CACHE_CHECK([whether GCC inline assembler supports NEON instructions],
[gcry_cv_gcc_inline_asm_neon],
- [gcry_cv_gcc_inline_asm_neon=no
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [if test "$mpi_cpu_arch" != "arm" ; then
+ gcry_cv_gcc_inline_asm_neon="n/a"
+ else
+ gcry_cv_gcc_inline_asm_neon=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[[__asm__(
".syntax unified\n\t"
".thumb\n\t"
@@ -1219,40 +1344,14 @@ AC_CACHE_CHECK([whether GCC inline assembler supports NEON instructions],
"vadd.s64 %d3, %d2, %d3;\n\t"
);
]])],
- [gcry_cv_gcc_inline_asm_neon=yes])])
+ [gcry_cv_gcc_inline_asm_neon=yes])
+ fi])
if test "$gcry_cv_gcc_inline_asm_neon" = "yes" ; then
AC_DEFINE(HAVE_GCC_INLINE_ASM_NEON,1,
[Defined if inline assembler supports NEON instructions])
fi
-#
-# Check whether GCC assembler supports features needed for our ARM
-# implementations
-#
-AC_CACHE_CHECK([whether GCC assembler is compatible for ARM assembly implementations],
- [gcry_cv_gcc_arm_platform_as_ok],
- [gcry_cv_gcc_arm_platform_as_ok=no
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
- [[__asm__(
- /* Test if assembler supports UAL syntax. */
- ".syntax unified\n\t"
- ".arm\n\t" /* our assembly code is in ARM mode */
- /* Following causes error if assembler ignored '.syntax unified'. */
- "asmfunc:\n\t"
- "add %r0, %r0, %r4, ror #12;\n\t"
-
- /* Test if '.type' and '.size' are supported. */
- ".size asmfunc,.-asmfunc;\n\t"
- ".type asmfunc,%function;\n\t"
- );]])],
- [gcry_cv_gcc_arm_platform_as_ok=yes])])
-if test "$gcry_cv_gcc_arm_platform_as_ok" = "yes" ; then
- AC_DEFINE(HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS,1,
- [Defined if underlying assembler is compatible with ARM assembly implementations])
-fi
-
-
#######################################
#### Checks for library functions. ####
#######################################
@@ -1368,48 +1467,8 @@ fi
#
-# Setup assembler stuff.
-#
-# Note that config.links also defines mpi_cpu_arch, which is required
-# later on.
+# Other defines
#
-GNUPG_SYS_SYMBOL_UNDERSCORE()
-AC_ARG_ENABLE(mpi-path,
- AC_HELP_STRING([--enable-mpi-path=EXTRA_PATH],
- [prepend EXTRA_PATH to list of CPU specific optimizations]),
- mpi_extra_path="$enableval",mpi_extra_path="")
-AC_MSG_CHECKING(for mpi assembler functions)
-if test -f $srcdir/mpi/config.links ; then
- . $srcdir/mpi/config.links
- AC_CONFIG_LINKS("$mpi_ln_list")
- ac_cv_mpi_sflags="$mpi_sflags"
- AC_MSG_RESULT(done)
-else
- AC_MSG_RESULT(failed)
- AC_MSG_ERROR([mpi/config.links missing!])
-fi
-MPI_SFLAGS="$ac_cv_mpi_sflags"
-AC_SUBST(MPI_SFLAGS)
-
-AM_CONDITIONAL(MPI_MOD_ASM_MPIH_ADD1, test "$mpi_mod_asm_mpih_add1" = yes)
-AM_CONDITIONAL(MPI_MOD_ASM_MPIH_SUB1, test "$mpi_mod_asm_mpih_sub1" = yes)
-AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL1, test "$mpi_mod_asm_mpih_mul1" = yes)
-AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL2, test "$mpi_mod_asm_mpih_mul2" = yes)
-AM_CONDITIONAL(MPI_MOD_ASM_MPIH_MUL3, test "$mpi_mod_asm_mpih_mul3" = yes)
-AM_CONDITIONAL(MPI_MOD_ASM_MPIH_LSHIFT, test "$mpi_mod_asm_mpih_lshift" = yes)
-AM_CONDITIONAL(MPI_MOD_ASM_MPIH_RSHIFT, test "$mpi_mod_asm_mpih_rshift" = yes)
-AM_CONDITIONAL(MPI_MOD_ASM_UDIV, test "$mpi_mod_asm_udiv" = yes)
-AM_CONDITIONAL(MPI_MOD_ASM_UDIV_QRNND, test "$mpi_mod_asm_udiv_qrnnd" = yes)
-AM_CONDITIONAL(MPI_MOD_C_MPIH_ADD1, test "$mpi_mod_c_mpih_add1" = yes)
-AM_CONDITIONAL(MPI_MOD_C_MPIH_SUB1, test "$mpi_mod_c_mpih_sub1" = yes)
-AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL1, test "$mpi_mod_c_mpih_mul1" = yes)
-AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL2, test "$mpi_mod_c_mpih_mul2" = yes)
-AM_CONDITIONAL(MPI_MOD_C_MPIH_MUL3, test "$mpi_mod_c_mpih_mul3" = yes)
-AM_CONDITIONAL(MPI_MOD_C_MPIH_LSHIFT, test "$mpi_mod_c_mpih_lshift" = yes)
-AM_CONDITIONAL(MPI_MOD_C_MPIH_RSHIFT, test "$mpi_mod_c_mpih_rshift" = yes)
-AM_CONDITIONAL(MPI_MOD_C_UDIV, test "$mpi_mod_c_udiv" = yes)
-AM_CONDITIONAL(MPI_MOD_C_UDIV_QRNND, test "$mpi_mod_c_udiv_qrnnd" = yes)
-
if test mym4_isgit = "yes"; then
AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
[Defined if this is not a regular release])
@@ -1538,6 +1597,14 @@ if test x"$neonsupport" = xyes ; then
AC_DEFINE(ENABLE_NEON_SUPPORT,1,
[Enable support for ARM NEON instructions.])
fi
+if test x"$padlocksupport" = xyes ; then
+ AC_DEFINE(ENABLE_PADLOCK_SUPPORT, 1,
+ [Enable support for the PadLock engine.])
+fi
+if test x"$drngsupport" = xyes ; then
+ AC_DEFINE(ENABLE_DRNG_SUPPORT, 1,
+ [Enable support for Intel DRNG (RDRAND instruction).])
+fi
# Define conditional sources and config.h symbols depending on the