@@ -141,15 +141,13 @@ AC_ARG_ENABLE(external_default_callbacks,
141141 [ use_external_default_callbacks=$enableval] ,
142142 [ use_external_default_callbacks=no] )
143143
144- AC_ARG_WITH ( [ field] , [ AS_HELP_STRING ( [ --with-field=64bit|32bit|auto] ,
145- [ finite field implementation to use [ default=auto] ] ) ] ,[ req_field=$withval] , [ req_field=auto] )
144+ dnl Test-only override of the (autodetected by the C code) "widemul" setting.
145+ dnl Legal values are int64 (for [u]int64_t), int128 (for [unsigned] __int128), and auto (the default).
146+ AC_ARG_WITH ( [ test-override-wide-multiply] , [ ] ,[ set_widemul=$withval] , [ set_widemul=auto] )
146147
147148AC_ARG_WITH ( [ bignum] , [ AS_HELP_STRING ( [ --with-bignum=gmp|no|auto] ,
148149[ bignum implementation to use [ default=auto] ] ) ] ,[ req_bignum=$withval] , [ req_bignum=auto] )
149150
150- AC_ARG_WITH ( [ scalar] , [ AS_HELP_STRING ( [ --with-scalar=64bit|32bit|auto] ,
151- [ scalar implementation to use [ default=auto] ] ) ] ,[ req_scalar=$withval] , [ req_scalar=auto] )
152-
153151AC_ARG_WITH ( [ asm] , [ AS_HELP_STRING ( [ --with-asm=x86_64|arm|no|auto] ,
154152[ assembly optimizations to use (experimental: arm) [ default=auto] ] ) ] ,[ req_asm=$withval] , [ req_asm=auto] )
155153
@@ -170,8 +168,6 @@ AC_ARG_WITH([ecmult-gen-precision], [AS_HELP_STRING([--with-ecmult-gen-precision
170168) ] ,
171169[ req_ecmult_gen_precision=$withval] , [ req_ecmult_gen_precision=auto] )
172170
173- AC_CHECK_TYPES ( [ __int128] )
174-
175171AC_CHECK_HEADER ( [ valgrind/memcheck.h] , [ enable_valgrind=yes] , [ enable_valgrind=no] , [ ] )
176172AM_CONDITIONAL([ VALGRIND_ENABLED] ,[ test "$enable_valgrind" = "yes"] )
177173
@@ -265,63 +261,6 @@ else
265261 esac
266262fi
267263
268- if test x"$req_field" = x"auto"; then
269- if test x"set_asm" = x"x86_64"; then
270- set_field=64bit
271- fi
272- if test x"$set_field" = x; then
273- SECP_INT128_CHECK
274- if test x"$has_int128" = x"yes"; then
275- set_field=64bit
276- fi
277- fi
278- if test x"$set_field" = x; then
279- set_field=32bit
280- fi
281- else
282- set_field=$req_field
283- case $set_field in
284- 64bit)
285- if test x"$set_asm" != x"x86_64"; then
286- SECP_INT128_CHECK
287- if test x"$has_int128" != x"yes"; then
288- AC_MSG_ERROR ( [ 64bit field explicitly requested but neither __int128 support or x86_64 assembly available] )
289- fi
290- fi
291- ;;
292- 32bit)
293- ;;
294- *)
295- AC_MSG_ERROR ( [ invalid field implementation selection] )
296- ;;
297- esac
298- fi
299-
300- if test x"$req_scalar" = x"auto"; then
301- SECP_INT128_CHECK
302- if test x"$has_int128" = x"yes"; then
303- set_scalar=64bit
304- fi
305- if test x"$set_scalar" = x; then
306- set_scalar=32bit
307- fi
308- else
309- set_scalar=$req_scalar
310- case $set_scalar in
311- 64bit)
312- SECP_INT128_CHECK
313- if test x"$has_int128" != x"yes"; then
314- AC_MSG_ERROR ( [ 64bit scalar explicitly requested but __int128 support not available] )
315- fi
316- ;;
317- 32bit)
318- ;;
319- *)
320- AC_MSG_ERROR ( [ invalid scalar implementation selected] )
321- ;;
322- esac
323- fi
324-
325264if test x"$req_bignum" = x"auto"; then
326265 SECP_GMP_CHECK
327266 if test x"$has_gmp" = x"yes"; then
@@ -365,16 +304,18 @@ no)
365304 ;;
366305esac
367306
368- # select field implementation
369- case $set_field in
370- 64bit )
371- AC_DEFINE ( USE_FIELD_5X52 , 1 , [ Define this symbol to use the FIELD_5X52 implementation] )
307+ # select wide multiplication implementation
308+ case $set_widemul in
309+ int128 )
310+ AC_DEFINE ( USE_FORCE_WIDEMUL_INT128 , 1 , [ Define this symbol to force the use of the (unsigned) __int128 based wide multiplication implementation] )
372311 ;;
373- 32bit)
374- AC_DEFINE ( USE_FIELD_10X26 , 1 , [ Define this symbol to use the FIELD_10X26 implementation] )
312+ int64)
313+ AC_DEFINE ( USE_FORCE_WIDEMUL_INT64 , 1 , [ Define this symbol to force the use of the (u)int64_t based wide multiplication implementation] )
314+ ;;
315+ auto)
375316 ;;
376317*)
377- AC_MSG_ERROR ( [ invalid field implementation] )
318+ AC_MSG_ERROR ( [ invalid wide multiplication implementation] )
378319 ;;
379320esac
380321
396337 ;;
397338esac
398339
399- # select scalar implementation
400- case $set_scalar in
401- 64bit)
402- AC_DEFINE ( USE_SCALAR_4X64 , 1 , [ Define this symbol to use the 4x64 scalar implementation] )
403- ;;
404- 32bit)
405- AC_DEFINE ( USE_SCALAR_8X32 , 1 , [ Define this symbol to use the 8x32 scalar implementation] )
406- ;;
407- *)
408- AC_MSG_ERROR ( [ invalid scalar implementation] )
409- ;;
410- esac
411-
412340# set ecmult window size
413341if test x"$req_ecmult_window" = x"auto"; then
414342 set_ecmult_window=15
@@ -553,10 +481,12 @@ echo " module recovery = $enable_module_recovery"
553481echo
554482echo " asm = $set_asm"
555483echo " bignum = $set_bignum"
556- echo " field = $set_field"
557- echo " scalar = $set_scalar"
558484echo " ecmult window size = $set_ecmult_window"
559485echo " ecmult gen prec. bits = $set_ecmult_gen_precision"
486+ dnl Hide test-only options unless they're used.
487+ if test x"$set_widemul" != xauto; then
488+ echo " wide multiplication = $set_widemul"
489+ fi
560490echo
561491echo " valgrind = $enable_valgrind"
562492echo " CC = $CC"
0 commit comments