diff --git a/configure.ac b/configure.ac index 0f16175..b472020 100644 --- a/configure.ac +++ b/configure.ac @@ -2201,11 +2201,12 @@ AC_DEFINE_UNQUOTED(LIBGCRYPT_KDFS, "$tmp", # Note that all possible modules must also be listed in # src/Makefile.am (EXTRA_libgcrypt_la_SOURCES). # -GCRYPT_HWF_MODULES= +HAVE_X86=0 +HAVE_ARM=0 case "$mpi_cpu_arch" in x86) AC_DEFINE(HAVE_CPU_ARCH_X86, 1, [Defined for the x86 platforms]) - GCRYPT_HWF_MODULES="hwf-x86.lo" + HAVE_X86=1 ;; alpha) AC_DEFINE(HAVE_CPU_ARCH_ALPHA, 1, [Defined for Alpha platforms]) @@ -2224,10 +2225,11 @@ case "$mpi_cpu_arch" in ;; arm) AC_DEFINE(HAVE_CPU_ARCH_ARM, 1, [Defined for ARM platforms]) - GCRYPT_HWF_MODULES="hwf-arm.lo" + HAVE_ARM=1 ;; esac -AC_SUBST([GCRYPT_HWF_MODULES]) +AM_CONDITIONAL(HAVE_X86, test "$HAVE_X86" = "1") +AM_CONDITIONAL(HAVE_ARM, test "$HAVE_ARM" = "1") # diff --git a/src/Makefile.am b/src/Makefile.am index cd0d354..ddf3536 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -61,10 +61,15 @@ libgcrypt_la_SOURCES = \ stdmem.c stdmem.h secmem.c secmem.h \ mpi.h missing-string.c fips.c \ hmac256.c hmac256.h context.c context.h \ - ec-context.h - -EXTRA_libgcrypt_la_SOURCES = hwf-x86.c hwf-arm.c -gcrypt_hwf_modules = @GCRYPT_HWF_MODULES@ + ec-context.h $(GCRYPT_HWF_MODULES) +if HAVE_ARM +libgcrypt_la_SOURCES += \ + hwf-arm.c +endif +if HAVE_X86 +libgcrypt_la_SOURCES += \ + hwf-x86.c +endif if HAVE_W32_SYSTEM @@ -111,14 +116,12 @@ libgcrypt_la_LDFLAGS = $(no_undefined) $(export_symbols) $(extra_ltoptions) \ $(libgcrypt_version_script_cmd) -version-info \ @LIBGCRYPT_LT_CURRENT@:@LIBGCRYPT_LT_REVISION@:@LIBGCRYPT_LT_AGE@ libgcrypt_la_DEPENDENCIES = \ - $(gcrypt_hwf_modules) \ ../cipher/libcipher.la \ ../random/librandom.la \ ../mpi/libmpi.la \ ../compat/libcompat.la \ $(srcdir)/libgcrypt.vers $(gcrypt_deps) libgcrypt_la_LIBADD = $(gcrypt_res) \ - $(gcrypt_hwf_modules) \ ../cipher/libcipher.la \ ../random/librandom.la \ ../mpi/libmpi.la \ diff --git a/src/hwf-x86.c b/src/hwf-x86.c index 399952c..a9a4c5f 100644 --- a/src/hwf-x86.c +++ b/src/hwf-x86.c @@ -28,9 +28,7 @@ #include "g10lib.h" #include "hwf-common.h" -#if !defined (__i386__) && !defined (__x86_64__) -# error Module build for wrong CPU. -#endif +#if defined (__i386__) || defined (__x86_64__) /* We use the next macro to decide whether we can test for certain features. */ @@ -308,3 +306,15 @@ _gcry_hwf_detect_x86 (void) return 0; #endif } + + +#else +/* __i386__ and __x86_64__ not defined, likely x86-emscripten */ + +unsigned int +_gcry_hwf_detect_x86 (void) +{ + return 0; +} + +#endif