Skip to content

Commit 0cf96a2

Browse files
magnumripperclaudioandre-br
authored andcommitted
Autoconf: Add -maes -mpclmul if supported by compiler
This is for x86 AES-NI, intrinsics version. Closes openwall#5593
1 parent 3f5e62d commit 0cf96a2

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

src/configure

+54
Original file line numberDiff line numberDiff line change
@@ -11790,6 +11790,60 @@ if test $simd != yes; then
1179011790
fi
1179111791
fi
1179211792

11793+
if test "x$simd" != xno; then
11794+
CFLAGS_EX=""
11795+
if test 1 -gt 0; then :
11796+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -maes -mpclmul" >&5
11797+
$as_echo_n "checking if $CC supports -maes -mpclmul... " >&6; }
11798+
fi
11799+
ac_ext=c
11800+
ac_cpp='$CPP $CPPFLAGS'
11801+
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
11802+
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
11803+
ac_compiler_gnu=$ac_cv_c_compiler_gnu
11804+
11805+
ac_saved_cflags="$CFLAGS"
11806+
CFLAGS="-Werror -maes -mpclmul"
11807+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11808+
/* end confdefs.h. */
11809+
11810+
int
11811+
main ()
11812+
{
11813+
11814+
;
11815+
return 0;
11816+
}
11817+
_ACEOF
11818+
if ac_fn_c_try_compile "$LINENO"; then :
11819+
if test "1" -gt 0; then :
11820+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
11821+
$as_echo "yes" >&6; }
11822+
fi
11823+
CFLAGS_EX="$CFLAGS_EX -maes -mpclmul"
11824+
11825+
else
11826+
if test 1 -gt 0; then :
11827+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
11828+
$as_echo "no" >&6; }
11829+
fi
11830+
if test "1" = 2; then :
11831+
as_fn_error $? "Not supported by compiler" "$LINENO" 5
11832+
fi
11833+
11834+
fi
11835+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
11836+
CFLAGS="$ac_saved_cflags"
11837+
ac_ext=c
11838+
ac_cpp='$CPP $CPPFLAGS'
11839+
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
11840+
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
11841+
ac_compiler_gnu=$ac_cv_c_compiler_gnu
11842+
11843+
11844+
CPU_BEST_FLAGS="$CPU_BEST_FLAGS $CFLAGS_EX"
11845+
fi
11846+
1179311847
CC="$CC_BACKUP"
1179411848
CFLAGS="$CFLAGS_BACKUP"
1179511849

src/m4/jtr_x86_logic.m4

+7
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,13 @@ if test $simd != yes; then
491491
fi
492492
fi
493493
494+
if test "x$simd" != xno; then
495+
CFLAGS_EX=""
496+
dnl Add -maes -mpclmul if supported
497+
JTR_FLAG_CHECK([-maes -mpclmul], 1)
498+
CPU_BEST_FLAGS="$CPU_BEST_FLAGS $CFLAGS_EX"
499+
fi
500+
494501
CC="$CC_BACKUP"
495502
CFLAGS="$CFLAGS_BACKUP"
496503

0 commit comments

Comments
 (0)