Skip to content

Commit ac83be3

Browse files
committed
Merge bitcoin-core/secp256k1#1079: configure: Add hidden --enable-dev-mode to enable all the stuff
e0838d6 configure: Add hidden --enable-dev-mode to enable all the stuff (Tim Ruffing) fabd579 configure: Remove redundant code that sets _enable variables (Tim Ruffing) 0d4226c configure: Use canonical variable prefix _enable consistently (Tim Ruffing) Pull request description: ACKs for top commit: elichai: tACK e0838d6 jonasnick: ACK e0838d6 Tree-SHA512: dfa1977f8844b8c93c6e72e81845166b47892a0169d931413587ce4ca6b0516b38214635ccfcc008f657d49a07d00574bf9b2c3d40a6d538cc7493b8716219aa
2 parents 64b3497 + e0838d6 commit ac83be3

File tree

2 files changed

+53
-46
lines changed

2 files changed

+53
-46
lines changed

build-aux/m4/bitcoin_secp.m4

+13
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,16 @@ AC_DEFUN([SECP_TRY_APPEND_CFLAGS], [
3838
unset flag_works
3939
AC_SUBST($2)
4040
])
41+
42+
dnl SECP_SET_DEFAULT(VAR, default, default-dev-mode)
43+
dnl Set VAR to default or default-dev-mode, depending on whether dev mode is enabled
44+
AC_DEFUN([SECP_SET_DEFAULT], [
45+
if test "${enable_dev_mode+set}" != set; then
46+
AC_MSG_ERROR([[Set enable_dev_mode before calling SECP_SET_DEFAULT]])
47+
fi
48+
if test x"$enable_dev_mode" = x"yes"; then
49+
$1="$3"
50+
else
51+
$1="$2"
52+
fi
53+
])

configure.ac

+40-46
Original file line numberDiff line numberDiff line change
@@ -114,60 +114,54 @@ SECP_TRY_APPEND_DEFAULT_CFLAGS(SECP_CFLAGS)
114114
### Define config arguments
115115
###
116116

117+
# In dev mode, we enable all binaries and modules by default but individual options can still be overridden explicitly.
118+
# Check for dev mode first because SECP_SET_DEFAULT needs enable_dev_mode set.
119+
AC_ARG_ENABLE(dev_mode, [], [],
120+
[enable_dev_mode=no])
121+
117122
AC_ARG_ENABLE(benchmark,
118-
AS_HELP_STRING([--enable-benchmark],[compile benchmark [default=yes]]),
119-
[use_benchmark=$enableval],
120-
[use_benchmark=yes])
123+
AS_HELP_STRING([--enable-benchmark],[compile benchmark [default=yes]]), [],
124+
[SECP_SET_DEFAULT([enable_benchmark], [yes], [yes])])
121125

122126
AC_ARG_ENABLE(coverage,
123-
AS_HELP_STRING([--enable-coverage],[enable compiler flags to support kcov coverage analysis [default=no]]),
124-
[enable_coverage=$enableval],
125-
[enable_coverage=no])
127+
AS_HELP_STRING([--enable-coverage],[enable compiler flags to support kcov coverage analysis [default=no]]), [],
128+
[SECP_SET_DEFAULT([enable_coverage], [no], [no])])
126129

127130
AC_ARG_ENABLE(tests,
128-
AS_HELP_STRING([--enable-tests],[compile tests [default=yes]]),
129-
[use_tests=$enableval],
130-
[use_tests=yes])
131+
AS_HELP_STRING([--enable-tests],[compile tests [default=yes]]), [],
132+
[SECP_SET_DEFAULT([enable_tests], [yes], [yes])])
131133

132134
AC_ARG_ENABLE(experimental,
133-
AS_HELP_STRING([--enable-experimental],[allow experimental configure options [default=no]]),
134-
[use_experimental=$enableval],
135-
[use_experimental=no])
135+
AS_HELP_STRING([--enable-experimental],[allow experimental configure options [default=no]]), [],
136+
[SECP_SET_DEFAULT([enable_experimental], [no], [yes])])
136137

137138
AC_ARG_ENABLE(exhaustive_tests,
138-
AS_HELP_STRING([--enable-exhaustive-tests],[compile exhaustive tests [default=yes]]),
139-
[use_exhaustive_tests=$enableval],
140-
[use_exhaustive_tests=yes])
139+
AS_HELP_STRING([--enable-exhaustive-tests],[compile exhaustive tests [default=yes]]), [],
140+
[SECP_SET_DEFAULT([enable_exhaustive_tests], [yes], [yes])])
141141

142142
AC_ARG_ENABLE(examples,
143-
AS_HELP_STRING([--enable-examples],[compile the examples [default=no]]),
144-
[use_examples=$enableval],
145-
[use_examples=no])
143+
AS_HELP_STRING([--enable-examples],[compile the examples [default=no]]), [],
144+
[SECP_SET_DEFAULT([enable_examples], [no], [yes])])
146145

147146
AC_ARG_ENABLE(module_ecdh,
148-
AS_HELP_STRING([--enable-module-ecdh],[enable ECDH shared secret computation]),
149-
[enable_module_ecdh=$enableval],
150-
[enable_module_ecdh=no])
147+
AS_HELP_STRING([--enable-module-ecdh],[enable ECDH shared secret computation]), [],
148+
[SECP_SET_DEFAULT([enable_module_ecdh], [no], [yes])])
151149

152150
AC_ARG_ENABLE(module_recovery,
153-
AS_HELP_STRING([--enable-module-recovery],[enable ECDSA pubkey recovery module [default=no]]),
154-
[enable_module_recovery=$enableval],
155-
[enable_module_recovery=no])
151+
AS_HELP_STRING([--enable-module-recovery],[enable ECDSA pubkey recovery module [default=no]]), [],
152+
[SECP_SET_DEFAULT([enable_module_recovery], [no], [yes])])
156153

157154
AC_ARG_ENABLE(module_extrakeys,
158-
AS_HELP_STRING([--enable-module-extrakeys],[enable extrakeys module (experimental)]),
159-
[enable_module_extrakeys=$enableval],
160-
[enable_module_extrakeys=no])
155+
AS_HELP_STRING([--enable-module-extrakeys],[enable extrakeys module (experimental)]), [],
156+
[SECP_SET_DEFAULT([enable_module_extrakeys], [no], [yes])])
161157

162158
AC_ARG_ENABLE(module_schnorrsig,
163-
AS_HELP_STRING([--enable-module-schnorrsig],[enable schnorrsig module (experimental)]),
164-
[enable_module_schnorrsig=$enableval],
165-
[enable_module_schnorrsig=no])
159+
AS_HELP_STRING([--enable-module-schnorrsig],[enable schnorrsig module (experimental)]), [],
160+
[SECP_SET_DEFAULT([enable_module_schnorrsig], [no], [yes])])
166161

167162
AC_ARG_ENABLE(external_default_callbacks,
168-
AS_HELP_STRING([--enable-external-default-callbacks],[enable external default callback functions [default=no]]),
169-
[use_external_default_callbacks=$enableval],
170-
[use_external_default_callbacks=no])
163+
AS_HELP_STRING([--enable-external-default-callbacks],[enable external default callback functions [default=no]]), [],
164+
[SECP_SET_DEFAULT([enable_external_default_callbacks], [no], [no])])
171165

172166
# Test-only override of the (autodetected by the C code) "widemul" setting.
173167
# Legal values are int64 (for [u]int64_t), int128 (for [unsigned] __int128), and auto (the default).
@@ -257,14 +251,14 @@ else
257251
fi
258252

259253
# Select assembly optimization
260-
use_external_asm=no
254+
enable_external_asm=no
261255

262256
case $set_asm in
263257
x86_64)
264258
AC_DEFINE(USE_ASM_X86_64, 1, [Define this symbol to enable x86_64 assembly optimizations])
265259
;;
266260
arm)
267-
use_external_asm=yes
261+
enable_external_asm=yes
268262
;;
269263
no)
270264
;;
@@ -273,7 +267,7 @@ no)
273267
;;
274268
esac
275269

276-
if test x"$use_external_asm" = x"yes"; then
270+
if test x"$enable_external_asm" = x"yes"; then
277271
AC_DEFINE(USE_EXTERNAL_ASM, 1, [Define this symbol if an external (non-inline) assembly implementation is used])
278272
fi
279273

@@ -361,7 +355,7 @@ if test x"$enable_module_extrakeys" = x"yes"; then
361355
AC_DEFINE(ENABLE_MODULE_EXTRAKEYS, 1, [Define this symbol to enable the extrakeys module])
362356
fi
363357

364-
if test x"$use_external_default_callbacks" = x"yes"; then
358+
if test x"$enable_external_default_callbacks" = x"yes"; then
365359
AC_DEFINE(USE_EXTERNAL_DEFAULT_CALLBACKS, 1, [Define this symbol if an external implementation of the default callbacks is used])
366360
fi
367361

@@ -400,15 +394,15 @@ AC_SUBST(SECP_TEST_LIBS)
400394
AC_SUBST(SECP_TEST_INCLUDES)
401395
AC_SUBST(SECP_CFLAGS)
402396
AM_CONDITIONAL([ENABLE_COVERAGE], [test x"$enable_coverage" = x"yes"])
403-
AM_CONDITIONAL([USE_TESTS], [test x"$use_tests" != x"no"])
404-
AM_CONDITIONAL([USE_EXHAUSTIVE_TESTS], [test x"$use_exhaustive_tests" != x"no"])
405-
AM_CONDITIONAL([USE_EXAMPLES], [test x"$use_examples" != x"no"])
406-
AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" = x"yes"])
397+
AM_CONDITIONAL([USE_TESTS], [test x"$enable_tests" != x"no"])
398+
AM_CONDITIONAL([USE_EXHAUSTIVE_TESTS], [test x"$enable_exhaustive_tests" != x"no"])
399+
AM_CONDITIONAL([USE_EXAMPLES], [test x"$enable_examples" != x"no"])
400+
AM_CONDITIONAL([USE_BENCHMARK], [test x"$enable_benchmark" = x"yes"])
407401
AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"])
408402
AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"yes"])
409403
AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"yes"])
410404
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
411-
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$use_external_asm" = x"yes"])
405+
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$enable_external_asm" = x"yes"])
412406
AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm"])
413407
AM_CONDITIONAL([BUILD_WINDOWS], [test "$build_windows" = "yes"])
414408
AC_SUBST(LIB_VERSION_CURRENT, _LIB_VERSION_CURRENT)
@@ -424,11 +418,11 @@ AC_OUTPUT
424418

425419
echo
426420
echo "Build Options:"
427-
echo " with external callbacks = $use_external_default_callbacks"
428-
echo " with benchmarks = $use_benchmark"
429-
echo " with tests = $use_tests"
421+
echo " with external callbacks = $enable_external_default_callbacks"
422+
echo " with benchmarks = $enable_benchmark"
423+
echo " with tests = $enable_tests"
430424
echo " with coverage = $enable_coverage"
431-
echo " with examples = $use_examples"
425+
echo " with examples = $enable_examples"
432426
echo " module ecdh = $enable_module_ecdh"
433427
echo " module recovery = $enable_module_recovery"
434428
echo " module extrakeys = $enable_module_extrakeys"

0 commit comments

Comments
 (0)