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
3c15130 Improve CC_FOR_BUILD detection (Tim Ruffing)
47802a4 Restructure and tidy configure.ac (Tim Ruffing)
252c19d Ask brew for valgrind include path (Tim Ruffing)
Pull request description:
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](https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html). This is outdated, and [there have been a lot of fixes](autoconf-archive/autoconf-archive#207) But the latest version is [broken](https://lists.gnu.org/archive/html/autoconf-archive-maintainers/2020-06/msg00002.html), 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...
ACKs for top commit:
sipa:
utACK 3c15130
jonasnick:
utACK 3c15130 makes sense (with my very basic understanding of autoconf)
Tree-SHA512: 595b9de316374c2213f1340cddaa22eb3190b01fa99aa6ae26e77804df41e7ecf96a09e03c28e8f8b9fd04e211e4ee2f78f1e5a7995143c84f99d2e16d4f0260
AC_MSG_CHECKING([for working native compiler: ${CC_FOR_BUILD}])
224
-
AC_RUN_IFELSE(
225
-
[AC_LANG_PROGRAM([], [])],
226
-
[working_native_cc=yes],
227
-
[working_native_cc=no],[:])
228
-
229
-
CFLAGS_FOR_BUILD="$CFLAGS"
230
-
231
-
# Restore the environment
232
-
cross_compiling=$save_cross_compiling
233
-
CC="$SAVE_CC"
234
-
CFLAGS="$SAVE_CFLAGS"
235
-
CPPFLAGS="$SAVE_CPPFLAGS"
236
-
LDFLAGS="$SAVE_LDFLAGS"
237
-
238
-
if test x"$working_native_cc" = x"no"; then
239
-
AC_MSG_RESULT([no])
240
-
set_precomp=no
241
-
m4_define([please_set_for_build], [Please set CC_FOR_BUILD, CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD, and/or LDFLAGS_FOR_BUILD.])
242
-
if test x"$use_ecmult_static_precomputation" = x"yes"; then
243
-
AC_MSG_ERROR([native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
244
-
else
245
-
AC_MSG_WARN([Disabling statically generated ecmult table because the native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
246
-
fi
247
-
else
248
-
AC_MSG_RESULT([yes])
249
-
set_precomp=yes
250
-
fi
251
-
else
252
-
set_precomp=no
253
-
fi
254
-
255
213
if test x"$req_asm" = x"auto"; then
256
214
SECP_64BIT_ASM_CHECK
257
215
if test x"$has_64bit_asm" = x"yes"; then
@@ -305,7 +263,7 @@ else
305
263
esac
306
264
fi
307
265
308
-
#select assembly optimization
266
+
#Select assembly optimization
309
267
use_external_asm=no
310
268
311
269
case $set_asm in
@@ -322,7 +280,12 @@ no)
322
280
;;
323
281
esac
324
282
325
-
# select wide multiplication implementation
283
+
if test x"$use_external_asm" = x"yes"; then
284
+
AC_DEFINE(USE_EXTERNAL_ASM, 1, [Define this symbol if an external (non-inline) assembly implementation is used])
285
+
fi
286
+
287
+
288
+
# Select wide multiplication implementation
326
289
case $set_widemul in
327
290
int128)
328
291
AC_DEFINE(USE_FORCE_WIDEMUL_INT128, 1, [Define this symbol to force the use of the (unsigned) __int128 based wide multiplication implementation])
@@ -337,7 +300,7 @@ auto)
337
300
;;
338
301
esac
339
302
340
-
#select bignum implementation
303
+
#Select bignum implementation
341
304
case $set_bignum in
342
305
gmp)
343
306
AC_DEFINE(HAVE_LIBGMP, 1, [Define this symbol if libgmp is installed])
@@ -355,7 +318,7 @@ no)
355
318
;;
356
319
esac
357
320
358
-
#set ecmult window size
321
+
# Set ecmult window size
359
322
if test x"$req_ecmult_window" = x"auto"; then
360
323
set_ecmult_window=15
361
324
else
@@ -377,7 +340,7 @@ case $set_ecmult_window in
377
340
;;
378
341
esac
379
342
380
-
#set ecmult gen precision
343
+
# Set ecmult gen precision
381
344
if test x"$req_ecmult_gen_precision" = x"auto"; then
382
345
set_ecmult_gen_precision=4
383
346
else
@@ -424,10 +387,93 @@ if test x"$set_bignum" = x"gmp"; then
424
387
SECP_INCLUDES="$SECP_INCLUDES $GMP_CPPFLAGS"
425
388
fi
426
389
390
+
if test x"$enable_valgrind" = x"yes"; then
391
+
SECP_INCLUDES="$SECP_INCLUDES $VALGRIND_CPPFLAGS"
392
+
fi
393
+
394
+
# Handle static precomputation (after everything which modifies CFLAGS and friends)
395
+
if test x"$use_ecmult_static_precomputation" != x"no"; then
396
+
if test x"$cross_compiling" = x"no"; then
397
+
set_precomp=yes
398
+
if test x"${CC_FOR_BUILD+x}${CFLAGS_FOR_BUILD+x}${CPPFLAGS_FOR_BUILD+x}${LDFLAGS_FOR_BUILD+x}" != x; then
399
+
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.])
400
+
fi
401
+
# If we're not cross-compiling, simply use the same compiler for building the static precompation code.
402
+
CC_FOR_BUILD="$CC"
403
+
CFLAGS_FOR_BUILD="$CFLAGS"
404
+
CPPFLAGS_FOR_BUILD="$CPPFLAGS"
405
+
LDFLAGS_FOR_BUILD="$LDFLAGS"
406
+
else
407
+
AX_PROG_CC_FOR_BUILD
408
+
409
+
# Temporarily switch to an environment for the native compiler
AC_MSG_CHECKING([for working native compiler: ${CC_FOR_BUILD}])
432
+
AC_RUN_IFELSE(
433
+
[AC_LANG_PROGRAM([], [])],
434
+
[working_native_cc=yes],
435
+
[working_native_cc=no],[:])
436
+
437
+
CFLAGS_FOR_BUILD="$CFLAGS"
438
+
439
+
# Restore the environment
440
+
cross_compiling=$save_cross_compiling
441
+
CC="$SAVE_CC"
442
+
CFLAGS="$SAVE_CFLAGS"
443
+
CPPFLAGS="$SAVE_CPPFLAGS"
444
+
LDFLAGS="$SAVE_LDFLAGS"
445
+
446
+
if test x"$working_native_cc" = x"no"; then
447
+
AC_MSG_RESULT([no])
448
+
set_precomp=no
449
+
m4_define([please_set_for_build], [Please set CC_FOR_BUILD, CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD, and/or LDFLAGS_FOR_BUILD.])
450
+
if test x"$use_ecmult_static_precomputation" = x"yes"; then
451
+
AC_MSG_ERROR([native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
452
+
else
453
+
AC_MSG_WARN([Disabling statically generated ecmult table because the native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
454
+
fi
455
+
else
456
+
AC_MSG_RESULT([yes])
457
+
set_precomp=yes
458
+
fi
459
+
fi
460
+
461
+
AC_SUBST(CC_FOR_BUILD)
462
+
AC_SUBST(CFLAGS_FOR_BUILD)
463
+
AC_SUBST(CPPFLAGS_FOR_BUILD)
464
+
AC_SUBST(LDFLAGS_FOR_BUILD)
465
+
else
466
+
set_precomp=no
467
+
fi
468
+
427
469
if test x"$set_precomp" = x"yes"; then
428
470
AC_DEFINE(USE_ECMULT_STATIC_PRECOMPUTATION, 1, [Define this symbol to use a statically generated ecmult table])
429
471
fi
430
472
473
+
###
474
+
### Handle module options
475
+
###
476
+
431
477
if test x"$enable_module_ecdh" = x"yes"; then
432
478
AC_DEFINE(ENABLE_MODULE_ECDH, 1, [Define this symbol to enable the ECDH module])
433
479
fi
@@ -447,14 +493,14 @@ if test x"$enable_module_extrakeys" = x"yes"; then
447
493
AC_DEFINE(ENABLE_MODULE_EXTRAKEYS, 1, [Define this symbol to enable the extrakeys module])
448
494
fi
449
495
450
-
if test x"$use_external_asm" = x"yes"; then
451
-
AC_DEFINE(USE_EXTERNAL_ASM, 1, [Define this symbol if an external (non-inline) assembly implementation is used])
452
-
fi
453
-
454
496
if test x"$use_external_default_callbacks" = x"yes"; then
455
497
AC_DEFINE(USE_EXTERNAL_DEFAULT_CALLBACKS, 1, [Define this symbol if an external implementation of the default callbacks is used])
0 commit comments