@@ -7859,17 +7859,21 @@ PY_STDLIB_MOD_SIMPLE([unicodedata])
78597859#
78607860# Example for MD5:
78617861#
7862- # 1. Compile Modules/_hacl/Hacl_Hash_MD5.c into Modules/_hacl/Hacl_Hash_MD5.o.
7863- # 2. Create Modules/_hacl/libHacl_Hash_MD5$EXT where $EXT is the extension
7864- # for a static (resp. shared) library depending on whether we are on WASI.
7865- # 3. Compile Modules/md5module.c into Modules/md5module.o.
7866- # 4. Link Modules/md5module.o with Modules/_hacl/libHacl_Hash_MD5$EXT
7867- # and get Modules/_md5$(EXT_SUFFIX).
7862+ # * Compile Modules/_hacl/Hacl_Hash_MD5.c into Modules/_hacl/Hacl_Hash_MD5.o.
7863+ # * Decide whether the object files are to be passed to the linker (emulate
7864+ # a shared library without having to install it) or if we need to create
7865+ # a static library for WASI. The following summarizes the values taken by
7866+ # the MODULE_<NAME>_LDFLAGS variable depending on the linkage type:
7867+ # - shared: MODULE__MD5_LDFLAGS is set to LIBHACL_MD5_OBJS
7868+ # - static: MODULE__MD5_LDFLAGS is set to Modules/_hacl/libHacl_Hash_MD5.a
7869+ # * Compile Modules/md5module.c into Modules/md5module.o.
7870+ # * Link Modules/md5module.o using $(MODULE__MD5_LDFLAGS)
7871+ # and get Modules/_md5$(EXT_SUFFIX).
78687872#
78697873# LIBHACL_FLAG_I: '-I' flags passed to $(CC) for HACL* and HACL*-based modules
78707874# LIBHACL_FLAG_D: '-D' flags passed to $(CC) for HACL* and HACL*-based modules
7871- # LIBHACL_CFLAGS: flags passed $(CC) for HACL* and HACL*-based modules
7872- # LIBHACL_LDFLAGS: flags passed $(LDSHARED) for HACL* and HACL*-based modules
7875+ # LIBHACL_CFLAGS: compiler flags passed for HACL* and HACL*-based modules
7876+ # LIBHACL_LDFLAGS: linker flags passed for HACL* and HACL*-based modules
78737877LIBHACL_FLAG_I='-I$(srcdir)/Modules/_hacl -I$(srcdir)/Modules/_hacl/include'
78747878LIBHACL_FLAG_D='-D_BSD_SOURCE -D_DEFAULT_SOURCE'
78757879case "$ac_sys_system" in
@@ -7887,7 +7891,8 @@ AC_SUBST([LIBHACL_LDFLAGS])
78877891# The SIMD files use aligned_alloc, which is not available on older versions of
78887892# Android.
78897893# The *mmintrin.h headers are x86-family-specific, so can't be used on WASI.
7890- if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || test "$ANDROID_API_LEVEL" -ge 28; then
7894+ if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || \
7895+ test -n "$ANDROID_API_LEVEL" -a "$ANDROID_API_LEVEL" -ge 28; then
78917896 dnl This can be extended here to detect e.g. Power8, which HACL* should also support.
78927897 AX_CHECK_COMPILE_FLAG ( [ -msse -msse2 -msse3 -msse4.1 -msse4.2] ,[
78937898 [ LIBHACL_SIMD128_FLAGS="-msse -msse2 -msse3 -msse4.1 -msse4.2"]
@@ -7918,7 +7923,8 @@ AC_SUBST([LIBHACL_BLAKE2_SIMD128_OBJS])
79187923# Although AVX support is not guaranteed on Android
79197924# (https://developer.android.com/ndk/guides/abis#86-64), this is safe because we do a
79207925# runtime CPUID check.
7921- if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || test "$ANDROID_API_LEVEL" -ge 28; then
7926+ if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || \
7927+ test -n "$ANDROID_API_LEVEL" -a "$ANDROID_API_LEVEL" -ge 28; then
79227928 AX_CHECK_COMPILE_FLAG ( [ -mavx2] ,[
79237929 [ LIBHACL_SIMD256_FLAGS="-mavx2"]
79247930 AC_DEFINE ( [ HACL_CAN_COMPILE_SIMD256] , [ 1] , [ HACL* library can compile SIMD256 implementations] )
0 commit comments