@@ -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
@@ -219,10 +214,14 @@ AM_CONDITIONAL([VALGRIND_ENABLED],[test "$enable_valgrind" = "yes"])
219
214
220
215
if test x"$enable_coverage" = x"yes"; then
221
216
AC_DEFINE ( COVERAGE , 1 , [ Define this symbol to compile out all VERIFY code] )
222
- CFLAGS ="-O0 --coverage $CFLAGS "
217
+ SECP_CFLAGS ="-O0 --coverage $SECP_CFLAGS "
223
218
LDFLAGS="--coverage $LDFLAGS"
224
219
else
225
- CFLAGS="-O2 $CFLAGS"
220
+ # Most likely the CFLAGS already contain -O2 because that is autoconf's default.
221
+ # We still add it here because passing it twice is not an issue, and handling
222
+ # this case would just add unnecessary complexity (see #896).
223
+ SECP_CFLAGS="-O2 $SECP_CFLAGS"
224
+ SECP_CFLAGS_FOR_BUILD="-O2 $SECP_CFLAGS_FOR_BUILD"
226
225
fi
227
226
228
227
if test x"$req_asm" = x"auto"; then
0 commit comments