You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
```
See individual commit messages. These are improvements in preparation of
the switch to Cirrus CI. (Maybe I'll just open a PR on top of this one.)
The first commit made the difference between successful build
https://cirrus-ci.com/task/6740575057608704 and unsuccessful build
https://cirrus-ci.com/task/4909571074424832.
I've tested the second commit without cross-compilation and with
cross-compilation for android (#621 (comment))
When working on the autoconf stuff, I noticed two things that I just
want to write down here:
At some point we should update build-aux/m4/ax_prog_cc_for_build.m4.
This is outdated, and there have been a lot of fixes But the latest
version is broken, so now is probably not the time.
The latest autoconf 2.70 deprecates AC_PROG_CC_C89. It's not needed
anymore because AC_PROG_CC cares about testing for version support. This
makes autoconf 2.70 output a warning that we should probably just
ignore. We don't want to force users onto 2.70...
```
Backport of [[bitcoin-core/secp256k1#862 | secp256k1#862]]
Test Plan:
./autogen.sh
./configure
make
I didn't test valgrind from brew on OSX, I have no old enough OSX that
support valgrind.
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D9382
AC_MSG_CHECKING([for working native compiler: ${CC_FOR_BUILD}])
239
-
AC_RUN_IFELSE(
240
-
[AC_LANG_PROGRAM([], [])],
241
-
[working_native_cc=yes],
242
-
[working_native_cc=no],[:])
243
-
244
-
CFLAGS_FOR_BUILD="$CFLAGS"
245
-
246
-
# Restore the environment
247
-
cross_compiling=$save_cross_compiling
248
-
CC="$SAVE_CC"
249
-
CFLAGS="$SAVE_CFLAGS"
250
-
CPPFLAGS="$SAVE_CPPFLAGS"
251
-
LDFLAGS="$SAVE_LDFLAGS"
252
-
253
-
if test x"$working_native_cc" = x"no"; then
254
-
AC_MSG_RESULT([no])
255
-
set_precomp=no
256
-
m4_define([please_set_for_build], [Please set CC_FOR_BUILD, CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD, and/or LDFLAGS_FOR_BUILD.])
257
-
if test x"$use_ecmult_static_precomputation" = x"yes"; then
258
-
AC_MSG_ERROR([native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
259
-
else
260
-
AC_MSG_WARN([Disabling statically generated ecmult table because the native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
261
-
fi
262
-
else
263
-
AC_MSG_RESULT([yes])
264
-
set_precomp=yes
265
-
fi
266
-
else
267
-
set_precomp=no
268
-
fi
269
-
270
228
if test x"$req_asm" = x"auto"; then
271
229
SECP_64BIT_ASM_CHECK
272
230
if test x"$has_64bit_asm" = x"yes"; then
@@ -320,7 +278,7 @@ else
320
278
esac
321
279
fi
322
280
323
-
#select assembly optimization
281
+
#Select assembly optimization
324
282
use_external_asm=no
325
283
326
284
case $set_asm in
@@ -337,7 +295,12 @@ no)
337
295
;;
338
296
esac
339
297
340
-
# select wide multiplication implementation
298
+
if test x"$use_external_asm" = x"yes"; then
299
+
AC_DEFINE(USE_EXTERNAL_ASM, 1, [Define this symbol if an external (non-inline) assembly implementation is used])
300
+
fi
301
+
302
+
303
+
# Select wide multiplication implementation
341
304
case $set_widemul in
342
305
int128)
343
306
AC_DEFINE(USE_FORCE_WIDEMUL_INT128, 1, [Define this symbol to force the use of the (unsigned) __int128 based wide multiplication implementation])
@@ -352,7 +315,7 @@ auto)
352
315
;;
353
316
esac
354
317
355
-
#select bignum implementation
318
+
#Select bignum implementation
356
319
case $set_bignum in
357
320
gmp)
358
321
AC_DEFINE(HAVE_LIBGMP, 1, [Define this symbol if libgmp is installed])
@@ -370,7 +333,7 @@ no)
370
333
;;
371
334
esac
372
335
373
-
#set ecmult window size
336
+
# Set ecmult window size
374
337
if test x"$req_ecmult_window" = x"auto"; then
375
338
set_ecmult_window=15
376
339
else
@@ -392,7 +355,7 @@ case $set_ecmult_window in
392
355
;;
393
356
esac
394
357
395
-
#set ecmult gen precision
358
+
# Set ecmult gen precision
396
359
if test x"$req_ecmult_gen_precision" = x"auto"; then
397
360
set_ecmult_gen_precision=4
398
361
else
@@ -462,10 +425,93 @@ if test x"$set_bignum" = x"gmp"; then
462
425
SECP_INCLUDES="$SECP_INCLUDES $GMP_CPPFLAGS"
463
426
fi
464
427
428
+
if test x"$enable_valgrind" = x"yes"; then
429
+
SECP_INCLUDES="$SECP_INCLUDES $VALGRIND_CPPFLAGS"
430
+
fi
431
+
432
+
# Handle static precomputation (after everything which modifies CFLAGS and friends)
433
+
if test x"$use_ecmult_static_precomputation" != x"no"; then
434
+
if test x"$cross_compiling" = x"no"; then
435
+
set_precomp=yes
436
+
if test x"${CC_FOR_BUILD+x}${CFLAGS_FOR_BUILD+x}${CPPFLAGS_FOR_BUILD+x}${LDFLAGS_FOR_BUILD+x}" != x; then
437
+
AC_MSG_WARN([CC_FOR_BUILD, CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD, and/or LDFLAGS_FOR_BUILD is set but ignored because we are not cross-compiling.])
438
+
fi
439
+
# If we're not cross-compiling, simply use the same compiler for building the static precompation code.
440
+
CC_FOR_BUILD="$CC"
441
+
CFLAGS_FOR_BUILD="$CFLAGS"
442
+
CPPFLAGS_FOR_BUILD="$CPPFLAGS"
443
+
LDFLAGS_FOR_BUILD="$LDFLAGS"
444
+
else
445
+
AX_PROG_CC_FOR_BUILD
446
+
447
+
# Temporarily switch to an environment for the native compiler
AC_MSG_CHECKING([for working native compiler: ${CC_FOR_BUILD}])
470
+
AC_RUN_IFELSE(
471
+
[AC_LANG_PROGRAM([], [])],
472
+
[working_native_cc=yes],
473
+
[working_native_cc=no],[:])
474
+
475
+
CFLAGS_FOR_BUILD="$CFLAGS"
476
+
477
+
# Restore the environment
478
+
cross_compiling=$save_cross_compiling
479
+
CC="$SAVE_CC"
480
+
CFLAGS="$SAVE_CFLAGS"
481
+
CPPFLAGS="$SAVE_CPPFLAGS"
482
+
LDFLAGS="$SAVE_LDFLAGS"
483
+
484
+
if test x"$working_native_cc" = x"no"; then
485
+
AC_MSG_RESULT([no])
486
+
set_precomp=no
487
+
m4_define([please_set_for_build], [Please set CC_FOR_BUILD, CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD, and/or LDFLAGS_FOR_BUILD.])
488
+
if test x"$use_ecmult_static_precomputation" = x"yes"; then
489
+
AC_MSG_ERROR([native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
490
+
else
491
+
AC_MSG_WARN([Disabling statically generated ecmult table because the native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
492
+
fi
493
+
else
494
+
AC_MSG_RESULT([yes])
495
+
set_precomp=yes
496
+
fi
497
+
fi
498
+
499
+
AC_SUBST(CC_FOR_BUILD)
500
+
AC_SUBST(CFLAGS_FOR_BUILD)
501
+
AC_SUBST(CPPFLAGS_FOR_BUILD)
502
+
AC_SUBST(LDFLAGS_FOR_BUILD)
503
+
else
504
+
set_precomp=no
505
+
fi
506
+
465
507
if test x"$set_precomp" = x"yes"; then
466
508
AC_DEFINE(USE_ECMULT_STATIC_PRECOMPUTATION, 1, [Define this symbol to use a statically generated ecmult table])
467
509
fi
468
510
511
+
###
512
+
### Handle module options
513
+
###
514
+
469
515
if test x"$enable_module_ecdh" = x"yes"; then
470
516
AC_DEFINE(ENABLE_MODULE_ECDH, 1, [Define this symbol to enable the ECDH module])
471
517
fi
@@ -493,14 +539,14 @@ if test x"$enable_module_extrakeys" = x"yes"; then
493
539
AC_DEFINE(ENABLE_MODULE_EXTRAKEYS, 1, [Define this symbol to enable the extrakeys module])
494
540
fi
495
541
496
-
if test x"$use_external_asm" = x"yes"; then
497
-
AC_DEFINE(USE_EXTERNAL_ASM, 1, [Define this symbol if an external (non-inline) assembly implementation is used])
498
-
fi
499
-
500
542
if test x"$use_external_default_callbacks" = x"yes"; then
501
543
AC_DEFINE(USE_EXTERNAL_DEFAULT_CALLBACKS, 1, [Define this symbol if an external implementation of the default callbacks is used])
0 commit comments