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}])
230
-
AC_RUN_IFELSE(
231
-
[AC_LANG_PROGRAM([], [])],
232
-
[working_native_cc=yes],
233
-
[working_native_cc=no],[:])
234
-
235
-
CFLAGS_FOR_BUILD="$CFLAGS"
236
-
237
-
# Restore the environment
238
-
cross_compiling=$save_cross_compiling
239
-
CC="$SAVE_CC"
240
-
CFLAGS="$SAVE_CFLAGS"
241
-
CPPFLAGS="$SAVE_CPPFLAGS"
242
-
LDFLAGS="$SAVE_LDFLAGS"
243
-
244
-
if test x"$working_native_cc" = x"no"; then
245
-
AC_MSG_RESULT([no])
246
-
set_precomp=no
247
-
m4_define([please_set_for_build], [Please set CC_FOR_BUILD, CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD, and/or LDFLAGS_FOR_BUILD.])
248
-
if test x"$use_ecmult_static_precomputation" = x"yes"; then
249
-
AC_MSG_ERROR([native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
250
-
else
251
-
AC_MSG_WARN([Disabling statically generated ecmult table because the native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
252
-
fi
253
-
else
254
-
AC_MSG_RESULT([yes])
255
-
set_precomp=yes
256
-
fi
257
-
else
258
-
set_precomp=no
259
-
fi
260
-
261
213
if test x"$req_asm" = x"auto"; then
262
214
SECP_64BIT_ASM_CHECK
263
215
if test x"$has_64bit_asm" = x"yes"; then
@@ -311,6 +263,79 @@ else
311
263
esac
312
264
fi
313
265
266
+
# This should come after all tests which modify CFLAGS and friends.
267
+
if test x"$use_ecmult_static_precomputation" != x"no"; then
268
+
if test x"$cross_compiling" = x"no"; then
269
+
set_precomp=yes
270
+
# If we're not cross-compiling, simply use the same compiler for building the static precompation code.
271
+
CC_FOR_BUILD="$CC"
272
+
CFLAGS_FOR_BUILD="$CFLAGS"
273
+
CPPFLAGS_FOR_BUILD="$CPPFLAGS"
274
+
LDFLAGS_FOR_BUILD="$LDFLAGS"
275
+
if test x"${CC_FOR_BUILD+x}${CFLAGS_FOR_BUILD+x}${CPPFLAGS_FOR_BUILD+x}${LDFLAGS_FOR_BUILD+x}" != xxxxx; then
276
+
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.])
277
+
fi
278
+
else
279
+
AX_PROG_CC_FOR_BUILD
280
+
281
+
# Temporarily switch to an environment for the native compiler
AC_MSG_CHECKING([for working native compiler: ${CC_FOR_BUILD}])
304
+
AC_RUN_IFELSE(
305
+
[AC_LANG_PROGRAM([], [])],
306
+
[working_native_cc=yes],
307
+
[working_native_cc=no],[:])
308
+
309
+
# Restore the environment
310
+
cross_compiling=$save_cross_compiling
311
+
CC="$SAVE_CC"
312
+
CFLAGS="$SAVE_CFLAGS"
313
+
CPPFLAGS="$SAVE_CPPFLAGS"
314
+
LDFLAGS="$SAVE_LDFLAGS"
315
+
316
+
if test x"$working_native_cc" = x"no"; then
317
+
AC_MSG_RESULT([no])
318
+
set_precomp=no
319
+
m4_define([please_set_for_build], [Please set CC_FOR_BUILD, CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD, and/or LDFLAGS_FOR_BUILD.])
320
+
if test x"$use_ecmult_static_precomputation" = x"yes"; then
321
+
AC_MSG_ERROR([native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
322
+
else
323
+
AC_MSG_WARN([Disabling statically generated ecmult table because the native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
324
+
fi
325
+
else
326
+
AC_MSG_RESULT([yes])
327
+
set_precomp=yes
328
+
fi
329
+
fi
330
+
331
+
AC_SUBST(CC_FOR_BUILD)
332
+
AC_SUBST(CFLAGS_FOR_BUILD)
333
+
AC_SUBST(CPPFLAGS_FOR_BUILD)
334
+
AC_SUBST(LDFLAGS_FOR_BUILD)
335
+
else
336
+
set_precomp=no
337
+
fi
338
+
314
339
# select assembly optimization
315
340
use_external_asm=no
316
341
@@ -328,6 +353,11 @@ no)
328
353
;;
329
354
esac
330
355
356
+
if test x"$use_external_asm" = x"yes"; then
357
+
AC_DEFINE(USE_EXTERNAL_ASM, 1, [Define this symbol if an external (non-inline) assembly implementation is used])
358
+
fi
359
+
360
+
331
361
# select wide multiplication implementation
332
362
case $set_widemul in
333
363
int128)
@@ -457,10 +487,6 @@ if test x"$enable_module_extrakeys" = x"yes"; then
457
487
AC_DEFINE(ENABLE_MODULE_EXTRAKEYS, 1, [Define this symbol to enable the extrakeys module])
458
488
fi
459
489
460
-
if test x"$use_external_asm" = x"yes"; then
461
-
AC_DEFINE(USE_EXTERNAL_ASM, 1, [Define this symbol if an external (non-inline) assembly implementation is used])
462
-
fi
463
-
464
490
if test x"$use_external_default_callbacks" = x"yes"; then
465
491
AC_DEFINE(USE_EXTERNAL_DEFAULT_CALLBACKS, 1, [Define this symbol if an external implementation of the default callbacks is used])
0 commit comments