diff --git a/configure.ac b/configure.ac index d1f796d3..56d0e318 100644 --- a/configure.ac +++ b/configure.ac @@ -154,6 +154,7 @@ dnl Checks for typedefs, structures, and compiler characteristics. AC_C_BIGENDIAN AC_MSG_CHECKING(for 128-bit arithmetic) +have_ti_mode=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ @@ -163,9 +164,11 @@ uint128_t x; return sizeof(x) / CHAR_BIT != 16U ]])], [AC_MSG_RESULT(yes) - AC_DEFINE([HAVE_TI_MODE], [1], [gcc TI mode is available])], + AC_DEFINE([HAVE_TI_MODE], [1], [gcc TI mode is available]) + have_ti_mode=yes], [AC_MSG_RESULT(no)]) -AC_SUBST(HAVE_TI_MODE) +AM_CONDITIONAL([HAVE_TI_MODE], [test x$have_ti_mode = xyes]) +AC_SUBST([HAVE_TI_MODE]) dnl Checks for functions and headers diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index 41353fb8..08eea70f 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -17,12 +17,6 @@ libsodium_la_SOURCES = \ crypto_generichash/blake2/ref/blake2b-ref.c \ crypto_generichash/blake2/ref/blake2s-ref.c \ crypto_generichash/blake2/ref/generichash_blake2b.c \ - crypto_scalarmult/curve25519/donna_c64/api.h \ - crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c \ - crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c \ - crypto_scalarmult/curve25519/ref/api.h \ - crypto_scalarmult/curve25519/ref/base_curve25519_ref.c \ - crypto_scalarmult/curve25519/ref/smult_curve25519_ref.c \ crypto_hashblocks/sha256/ref/blocks_sha256.c \ crypto_hashblocks/sha256/ref/api.h \ crypto_hashblocks/sha512/ref/blocks_sha512.c \ @@ -152,6 +146,18 @@ libsodium_la_SOURCES = \ sodium/utils.c \ sodium/version.c +if HAVE_TI_MODE +libsodium_la_SOURCES += \ + crypto_scalarmult/curve25519/donna_c64/api.h \ + crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c \ + crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c +else +libsodium_la_SOURCES += \ + crypto_scalarmult/curve25519/ref/api.h \ + crypto_scalarmult/curve25519/ref/base_curve25519_ref.c \ + crypto_scalarmult/curve25519/ref/smult_curve25519_ref.c +endif + libsodium_la_LDFLAGS = \ $(AM_LDFLAGS) \ -export-dynamic \