@@ -8,10 +8,6 @@ AH_TOP([#define LIBSECP256K1_CONFIG_H])
8
8
AH_BOTTOM ( [ #endif /*LIBSECP256K1_CONFIG_H*/] )
9
9
AM_INIT_AUTOMAKE ( [ foreign subdir-objects] )
10
10
11
- # Set -g if CFLAGS are not already set, which matches the default autoconf
12
- # behavior (see PROG_CC in the Autoconf manual) with the exception that we don't
13
- # set -O2 here because we set it in any case (see further down).
14
- : ${CFLAGS="-g"}
15
11
LT_INIT
16
12
17
13
# Make the compilation flags quiet unless V=1 is used.
84
80
# These executables are compiled from C source file for which our flags may not be appropriate,
85
81
# e.g., -std=c89 flag has lead to undesirable warnings in the past.
86
82
#
87
- # TODO We still touch the CFLAGS for --coverage and -O0/-O2.
88
83
# TODO We should analogously not touch CPPFLAGS and LDFLAGS but currently there are no issues.
89
84
AC_DEFUN ( [ SECP_TRY_APPEND_DEFAULT_CFLAGS] , [
90
85
# Try to append -Werror=unknown-warning-option to CFLAGS temporarily. Otherwise clang will
@@ -220,10 +215,14 @@ AM_CONDITIONAL([VALGRIND_ENABLED],[test "$enable_valgrind" = "yes"])
220
215
221
216
if test x"$enable_coverage" = x"yes"; then
222
217
AC_DEFINE ( COVERAGE , 1 , [ Define this symbol to compile out all VERIFY code] )
223
- CFLAGS ="-O0 --coverage $CFLAGS "
218
+ SECP_CFLAGS ="-O0 --coverage $SECP_CFLAGS "
224
219
LDFLAGS="--coverage $LDFLAGS"
225
220
else
226
- CFLAGS="-O2 $CFLAGS"
221
+ # Most likely the CFLAGS already contain -O2 because that is autoconf's default.
222
+ # We still add it here because passing it twice is not an issue, and handling
223
+ # this case would just add unnecessary complexity (see #896).
224
+ SECP_CFLAGS="-O2 $SECP_CFLAGS"
225
+ SECP_CFLAGS_FOR_BUILD="-O2 $SECP_CFLAGS_FOR_BUILD"
227
226
fi
228
227
229
228
if test x"$req_asm" = x"auto"; then
0 commit comments