From 149929109eab1f79c4b90aa423f6d6eb4ee0e882 Mon Sep 17 00:00:00 2001 From: Joseph Benden Date: Tue, 8 May 2018 11:49:22 -0700 Subject: [PATCH] Autoconf: Added NEON intrinsic support. (#1879, #1872) Perform NEON intrinsic support using Autoconf, instead of failing to build on older ARM processors without NEON features. Signed-off-by: Fabrice Fontaine [Retrieved from upstream: https://github.com/aircrack-ng/aircrack-ng/commit/149929109eab1f79c4b90aa423f6d6eb4ee0e882] --- build/m4/aircrack_ng_simd.m4 | 16 ++++++++++++++++ src/Makefile.am | 2 ++ 2 files changed, 18 insertions(+) diff --git a/build/m4/aircrack_ng_simd.m4 b/build/m4/aircrack_ng_simd.m4 index 9d13031e..74135f32 100644 --- a/build/m4/aircrack_ng_simd.m4 +++ b/build/m4/aircrack_ng_simd.m4 @@ -95,6 +95,21 @@ then AX_APPEND_FLAG(-mfpu=neon, [arm_neon_[]_AC_LANG_ABBREV[]flags]) AC_SUBST(arm_neon_[]_AC_LANG_ABBREV[]flags) ]) + + AS_VAR_PUSHDEF([CACHEVAR], [ax_cv_neon_[]_AC_LANG_ABBREV[]flags]) + AC_CACHE_CHECK([whether _AC_LANG compiler supports NEON instructions], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $arm_neon_[]_AC_LANG_ABBREV[]flags" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +#if !defined(__ARM_NEON) && !defined(__ARM_NEON__) && !defined(__aarch64) && !defined(__aarch64__) +#error macro not defined +#endif + ]])], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags + ]) + AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], + [NEON_FOUND=1], [NEON_FOUND=0]) + AS_VAR_POPDEF([CACHEVAR]) fi if test $IS_PPC -eq 1 @@ -185,6 +200,7 @@ fi AM_CONDITIONAL([X86], [test "$IS_X86" = 1]) AM_CONDITIONAL([ARM], [test "$IS_ARM" = 1]) AM_CONDITIONAL([PPC], [test "$IS_PPC" = 1]) +AM_CONDITIONAL([NEON], [test "$NEON_FOUND" = 1]) ]) AC_DEFUN([AIRCRACK_NG_SIMD_C], [ diff --git a/src/Makefile.am b/src/Makefile.am index 3cc8ebdc..beac9dce 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -116,9 +116,11 @@ endif pkglibexec_PROGRAMS = aircrack-ng--generic if ARM +if NEON pkglibexec_PROGRAMS += aircrack-ng--neon \ aircrack-ng--asimd endif +endif if PPC pkglibexec_PROGRAMS += aircrack-ng--altivec \