@@ -7859,17 +7859,21 @@ PY_STDLIB_MOD_SIMPLE([unicodedata])
7859
7859
#
7860
7860
# Example for MD5:
7861
7861
#
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).
7868
7872
#
7869
7873
# LIBHACL_FLAG_I: '-I' flags passed to $(CC) for HACL* and HACL*-based modules
7870
7874
# 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
7873
7877
LIBHACL_FLAG_I='-I$(srcdir)/Modules/_hacl -I$(srcdir)/Modules/_hacl/include'
7874
7878
LIBHACL_FLAG_D='-D_BSD_SOURCE -D_DEFAULT_SOURCE'
7875
7879
case "$ac_sys_system" in
@@ -7887,7 +7891,8 @@ AC_SUBST([LIBHACL_LDFLAGS])
7887
7891
# The SIMD files use aligned_alloc, which is not available on older versions of
7888
7892
# Android.
7889
7893
# 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
7891
7896
dnl This can be extended here to detect e.g. Power8, which HACL* should also support.
7892
7897
AX_CHECK_COMPILE_FLAG ( [ -msse -msse2 -msse3 -msse4.1 -msse4.2] ,[
7893
7898
[ LIBHACL_SIMD128_FLAGS="-msse -msse2 -msse3 -msse4.1 -msse4.2"]
@@ -7918,7 +7923,8 @@ AC_SUBST([LIBHACL_BLAKE2_SIMD128_OBJS])
7918
7923
# Although AVX support is not guaranteed on Android
7919
7924
# (https://developer.android.com/ndk/guides/abis#86-64), this is safe because we do a
7920
7925
# 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
7922
7928
AX_CHECK_COMPILE_FLAG ( [ -mavx2] ,[
7923
7929
[ LIBHACL_SIMD256_FLAGS="-mavx2"]
7924
7930
AC_DEFINE ( [ HACL_CAN_COMPILE_SIMD256] , [ 1] , [ HACL* library can compile SIMD256 implementations] )
0 commit comments