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
This commits simply uses CC as CC_FOR_BUILD and the same for
corresponding flags if we're not cross-compiling. This has a number of
benefits in this common case:
- It avoids strange cases where very old compilers are used (#768).
- Flags are consistently set for CC and CC_FOR_BUILD.
- ./configure is faster.
- You get compiler x consistently if you set CC=x; we got this wrong
in CI in the past.
./configure warns if a _FOR_BUILD variable is set but ignored because
we're not cross-compiling.
The change exposed that //-style comments are used in gen_context.c,
which is also fixed by this commit.
This commit also reorganizes code in configure.ac to have a cleaner
separation of sections.
AC_MSG_CHECKING([for working native compiler: ${CC_FOR_BUILD}])
420
-
AC_RUN_IFELSE(
421
-
[AC_LANG_PROGRAM([], [])],
422
-
[working_native_cc=yes],
423
-
[working_native_cc=no],[:])
424
-
425
-
CFLAGS_FOR_BUILD="$CFLAGS"
426
-
427
-
# Restore the environment
428
-
cross_compiling=$save_cross_compiling
429
-
CC="$SAVE_CC"
430
-
CFLAGS="$SAVE_CFLAGS"
431
-
CPPFLAGS="$SAVE_CPPFLAGS"
432
-
LDFLAGS="$SAVE_LDFLAGS"
433
-
434
-
if test x"$working_native_cc" = x"no"; then
435
-
AC_MSG_RESULT([no])
436
-
set_precomp=no
437
-
m4_define([please_set_for_build], [Please set CC_FOR_BUILD, CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD, and/or LDFLAGS_FOR_BUILD.])
438
-
if test x"$use_ecmult_static_precomputation" = x"yes"; then
439
-
AC_MSG_ERROR([native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
440
-
else
441
-
AC_MSG_WARN([Disabling statically generated ecmult table because the native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
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.])
442
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"
443
406
else
444
-
AC_MSG_RESULT([yes])
445
-
set_precomp=yes
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])
0 commit comments