merge bitcoin#24391: stop overriding user autoconf flags

This commit is contained in:
Kittywhiskers Van Gogh 2022-02-18 15:53:18 +00:00
parent 548121d366
commit 11323c3851
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
3 changed files with 47 additions and 36 deletions

View File

@ -116,8 +116,8 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
BITCOIN_QT_CHECK([ BITCOIN_QT_CHECK([
TEMP_CPPFLAGS=$CPPFLAGS TEMP_CPPFLAGS=$CPPFLAGS
TEMP_CXXFLAGS=$CXXFLAGS TEMP_CXXFLAGS=$CXXFLAGS
CPPFLAGS="$QT_INCLUDES $CPPFLAGS" CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS"
CXXFLAGS="$PIC_FLAGS $CXXFLAGS" CXXFLAGS="$PIC_FLAGS $CORE_CXXFLAGS $CXXFLAGS"
_BITCOIN_QT_IS_STATIC _BITCOIN_QT_IS_STATIC
if test "x$bitcoin_cv_static_qt" = xyes; then if test "x$bitcoin_cv_static_qt" = xyes; then
_BITCOIN_QT_CHECK_STATIC_LIBS _BITCOIN_QT_CHECK_STATIC_LIBS
@ -177,8 +177,8 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
AC_MSG_CHECKING(whether -fPIE can be used with this Qt config) AC_MSG_CHECKING(whether -fPIE can be used with this Qt config)
TEMP_CPPFLAGS=$CPPFLAGS TEMP_CPPFLAGS=$CPPFLAGS
TEMP_CXXFLAGS=$CXXFLAGS TEMP_CXXFLAGS=$CXXFLAGS
CPPFLAGS="$QT_INCLUDES $CPPFLAGS" CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS"
CXXFLAGS="$PIE_FLAGS $CXXFLAGS" CXXFLAGS="$PIE_FLAGS $CORE_CXXFLAGS $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QtCore/qconfig.h> #include <QtCore/qconfig.h>
#ifndef QT_VERSION #ifndef QT_VERSION
@ -200,7 +200,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
BITCOIN_QT_CHECK([ BITCOIN_QT_CHECK([
AC_MSG_CHECKING(whether -fPIC is needed with this Qt config) AC_MSG_CHECKING(whether -fPIC is needed with this Qt config)
TEMP_CPPFLAGS=$CPPFLAGS TEMP_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$QT_INCLUDES $CPPFLAGS" CPPFLAGS="$QT_INCLUDES $CORE_CPPFLAGS $CPPFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QtCore/qconfig.h> #include <QtCore/qconfig.h>
#ifndef QT_VERSION #ifndef QT_VERSION

View File

@ -372,7 +372,9 @@ case $host in
esac esac
if test "x$enable_debug" = xyes; then if test "x$enable_debug" = xyes; then
dnl Clear default -g -O2 flags dnl If debugging is enabled, and the user hasn't overriden CXXFLAGS, clear
dnl them, to prevent autoconfs "-g -O2" being added. Otherwise we'd end up
dnl with "-O0 -g3 -g -O2".
if test "x$CXXFLAGS_overridden" = xno; then if test "x$CXXFLAGS_overridden" = xno; then
CXXFLAGS="" CXXFLAGS=""
fi fi
@ -532,7 +534,7 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
fi fi
dnl Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review. dnl Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review.
AX_CHECK_COMPILE_FLAG([-fno-extended-identifiers],[[CXXFLAGS="$CXXFLAGS -fno-extended-identifiers"]],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-fno-extended-identifiers],[[CORE_CXXFLAGS="$CORE_CXXFLAGS -fno-extended-identifiers"]],,[[$CXXFLAG_WERROR]])
enable_arm_crc=no enable_arm_crc=no
enable_arm_shani=no enable_arm_shani=no
@ -683,7 +685,7 @@ CXXFLAGS="$TEMP_CXXFLAGS"
fi fi
CPPFLAGS="$CPPFLAGS -DHAVE_BUILD_INFO -DGSL_NO_IOSTREAMS" CORE_CPPFLAGS="$CORE_CPPFLAGS -DHAVE_BUILD_INFO -DGSL_NO_IOSTREAMS"
AC_ARG_WITH([utils], AC_ARG_WITH([utils],
[AS_HELP_STRING([--with-utils], [AS_HELP_STRING([--with-utils],
@ -755,7 +757,7 @@ case $host in
AC_MSG_ERROR("windres not found") AC_MSG_ERROR("windres not found")
fi fi
CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -D_WIN32_WINNT=0x0601 -D_WIN32_IE=0x0501 -DWIN32_LEAN_AND_MEAN" CORE_CPPFLAGS="$CORE_CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -D_WIN32_WINNT=0x0601 -D_WIN32_IE=0x0501 -DWIN32_LEAN_AND_MEAN"
dnl libtool insists upon adding -nostdlib and a list of objects/libs to link against. dnl libtool insists upon adding -nostdlib and a list of objects/libs to link against.
dnl That breaks our ability to build dll's with static libgcc/libstdc++/libssp. Override dnl That breaks our ability to build dll's with static libgcc/libstdc++/libssp. Override
@ -766,14 +768,14 @@ case $host in
postdeps_CXX= postdeps_CXX=
dnl We require Windows 7 (NT 6.1) or later dnl We require Windows 7 (NT 6.1) or later
AX_CHECK_LINK_FLAG([[-Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1]],[LDFLAGS="$LDFLAGS -Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1"],,[[$LDFLAG_WERROR]]) AX_CHECK_LINK_FLAG([[-Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1]],[CORE_LDFLAGS="$CORE_LDFLAGS -Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1"],,[[$LDFLAG_WERROR]])
;; ;;
*darwin*) *darwin*)
TARGET_OS=darwin TARGET_OS=darwin
if test x$cross_compiling != xyes; then if test x$cross_compiling != xyes; then
BUILD_OS=darwin BUILD_OS=darwin
AX_CHECK_LINK_FLAG([[-Wl,-headerpad_max_install_names]], [LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"],, [[$LDFLAG_WERROR]]) AX_CHECK_LINK_FLAG([[-Wl,-headerpad_max_install_names]], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-headerpad_max_install_names"],, [[$LDFLAG_WERROR]])
AC_CHECK_PROG([BREW],brew, brew) AC_CHECK_PROG([BREW],brew, brew)
if test x$BREW = xbrew; then if test x$BREW = xbrew; then
@ -800,8 +802,8 @@ case $host in
gmp_prefix=$($BREW --prefix gmp 2>/dev/null) gmp_prefix=$($BREW --prefix gmp 2>/dev/null)
if test x$gmp_prefix != x; then if test x$gmp_prefix != x; then
CPPFLAGS="$CPPFLAGS -I$gmp_prefix/include" CORE_CPPFLAGS="$CORE_CPPFLAGS -I$gmp_prefix/include"
LDFLAGS="$LDFLAGS -L$gmp_prefix/lib" CORE_LDFLAGS="$CORE_LDFLAGS -L$gmp_prefix/lib"
fi fi
case $host in case $host in
@ -813,20 +815,20 @@ case $host in
if test "x$use_upnp" != xno && $BREW list --versions miniupnpc >/dev/null; then if test "x$use_upnp" != xno && $BREW list --versions miniupnpc >/dev/null; then
miniupnpc_prefix=$($BREW --prefix miniupnpc 2>/dev/null) miniupnpc_prefix=$($BREW --prefix miniupnpc 2>/dev/null)
if test "x$suppress_external_warnings" != xno; then if test "x$suppress_external_warnings" != xno; then
CPPFLAGS="$CPPFLAGS -isystem $miniupnpc_prefix/include" CORE_CPPFLAGS="$CORE_CPPFLAGS -isystem $miniupnpc_prefix/include"
else else
CPPFLAGS="$CPPFLAGS -I$miniupnpc_prefix/include" CORE_CPPFLAGS="$CORE_CPPFLAGS -I$miniupnpc_prefix/include"
fi fi
LDFLAGS="$LDFLAGS -L$miniupnpc_prefix/lib" CORE_LDFLAGS="$CORE_LDFLAGS -L$miniupnpc_prefix/lib"
fi fi
if test "x$use_natpmp" != xno && $BREW list --versions libnatpmp >/dev/null; then if test "x$use_natpmp" != xno && $BREW list --versions libnatpmp >/dev/null; then
libnatpmp_prefix=$($BREW --prefix libnatpmp 2>/dev/null) libnatpmp_prefix=$($BREW --prefix libnatpmp 2>/dev/null)
if test "x$suppress_external_warnings" != xno; then if test "x$suppress_external_warnings" != xno; then
CPPFLAGS="$CPPFLAGS -isystem $libnatpmp_prefix/include" CORE_CPPFLAGS="$CORE_CPPFLAGS -isystem $libnatpmp_prefix/include"
else else
CPPFLAGS="$CPPFLAGS -I$libnatpmp_prefix/include" CORE_CPPFLAGS="$CORE_CPPFLAGS -I$libnatpmp_prefix/include"
fi fi
LDFLAGS="$LDFLAGS -L$libnatpmp_prefix/lib" CORE_LDFLAGS="$CORE_LDFLAGS -L$libnatpmp_prefix/lib"
fi fi
;; ;;
esac esac
@ -849,7 +851,7 @@ case $host in
esac esac
fi fi
CPPFLAGS="$CPPFLAGS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0" CORE_CPPFLAGS="$CORE_CPPFLAGS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0"
OBJCXXFLAGS="$CXXFLAGS" OBJCXXFLAGS="$CXXFLAGS"
;; ;;
*android*) *android*)
@ -912,11 +914,17 @@ if test x$use_lcov = xyes; then
AC_SUBST(COV_TOOL_WRAPPER, "cov_tool_wrapper.sh") AC_SUBST(COV_TOOL_WRAPPER, "cov_tool_wrapper.sh")
LCOV="$LCOV --gcov-tool $(pwd)/$COV_TOOL_WRAPPER" LCOV="$LCOV --gcov-tool $(pwd)/$COV_TOOL_WRAPPER"
AX_CHECK_LINK_FLAG([[--coverage]], [LDFLAGS="$LDFLAGS --coverage"], AX_CHECK_LINK_FLAG([[--coverage]], [CORE_LDFLAGS="$CORE_LDFLAGS --coverage"],
[AC_MSG_ERROR("lcov testing requested but --coverage linker flag does not work")]) [AC_MSG_ERROR("lcov testing requested but --coverage linker flag does not work")])
AX_CHECK_COMPILE_FLAG([--coverage],[CXXFLAGS="$CXXFLAGS --coverage"], AX_CHECK_COMPILE_FLAG([--coverage],[CORE_CXXFLAGS="$CORE_CXXFLAGS --coverage"],
[AC_MSG_ERROR("lcov testing requested but --coverage flag does not work")]) [AC_MSG_ERROR("lcov testing requested but --coverage flag does not work")])
CXXFLAGS="$CXXFLAGS -Og" dnl If coverage is enabled, and the user hasn't overriden CXXFLAGS, clear
dnl them, to prevent autoconfs "-g -O2" being added. Otherwise we'd end up
dnl with "--coverage -Og -O0 -g -O2".
if test "$CXXFLAGS_overridden" = "no"; then
CXXFLAGS=""
fi
CORE_CXXFLAGS="$CORE_CXXFLAGS -Og -O0"
fi fi
if test x$use_lcov_branch != xno; then if test x$use_lcov_branch != xno; then
@ -942,13 +950,13 @@ AC_FUNC_STRERROR_R
if test x$ac_cv_sys_file_offset_bits != x && if test x$ac_cv_sys_file_offset_bits != x &&
test x$ac_cv_sys_file_offset_bits != xno && test x$ac_cv_sys_file_offset_bits != xno &&
test x$ac_cv_sys_file_offset_bits != xunknown; then test x$ac_cv_sys_file_offset_bits != xunknown; then
CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" CORE_CPPFLAGS="$CORE_CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
fi fi
if test x$ac_cv_sys_large_files != x && if test x$ac_cv_sys_large_files != x &&
test x$ac_cv_sys_large_files != xno && test x$ac_cv_sys_large_files != xno &&
test x$ac_cv_sys_large_files != xunknown; then test x$ac_cv_sys_large_files != xunknown; then
CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files" CORE_CPPFLAGS="$CORE_CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files"
fi fi
if test "x$enable_gprof" = xyes; then if test "x$enable_gprof" = xyes; then
@ -1037,8 +1045,8 @@ dnl These flags are specific to ld64, and may cause issues with other linkers.
dnl For example: GNU ld will interpret -dead_strip as -de and then try and use dnl For example: GNU ld will interpret -dead_strip as -de and then try and use
dnl "ad_strip" as the symbol for the entry point. dnl "ad_strip" as the symbol for the entry point.
if test x$TARGET_OS = xdarwin; then if test x$TARGET_OS = xdarwin; then
AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip"],, [[$LDFLAG_WERROR]]) AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-dead_strip"],, [[$LDFLAG_WERROR]])
AX_CHECK_LINK_FLAG([[-Wl,-dead_strip_dylibs]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip_dylibs"],, [[$LDFLAG_WERROR]]) AX_CHECK_LINK_FLAG([[-Wl,-dead_strip_dylibs]], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-dead_strip_dylibs"],, [[$LDFLAG_WERROR]])
AX_CHECK_LINK_FLAG([[-Wl,-fixup_chains]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-fixup_chains"], [], [[$LDFLAG_WERROR]]) AX_CHECK_LINK_FLAG([[-Wl,-fixup_chains]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-fixup_chains"], [], [[$LDFLAG_WERROR]])
fi fi
@ -1360,7 +1368,7 @@ if test "x$enable_fuzz" = "xyes"; then
[[-fsanitize=$use_sanitizers]], [[-fsanitize=$use_sanitizers]],
[AC_MSG_RESULT([no])], [AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes]) [AC_MSG_RESULT([yes])
CPPFLAGS="$CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"], CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"],
[], [],
[AC_LANG_PROGRAM([[ [AC_LANG_PROGRAM([[
#include <cstdint> #include <cstdint>
@ -1384,7 +1392,7 @@ else
QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES) QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES)
fi fi
CPPFLAGS="$CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION" CORE_CPPFLAGS="$CORE_CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"
fi fi
if test x$enable_wallet != xno; then if test x$enable_wallet != xno; then
@ -1517,7 +1525,7 @@ fi
dnl Check for reduced exports dnl Check for reduced exports
if test x$use_reduce_exports = xyes; then if test x$use_reduce_exports = xyes; then
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[CXXFLAGS="$CXXFLAGS -fvisibility=hidden"], AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[CORE_CXXFLAGS="$CORE_CXXFLAGS -fvisibility=hidden"],
[AC_MSG_ERROR([Cannot set hidden symbol visibility. Use --disable-reduce-exports.])],[[$CXXFLAG_WERROR]]) [AC_MSG_ERROR([Cannot set hidden symbol visibility. Use --disable-reduce-exports.])],[[$CXXFLAG_WERROR]])
AX_CHECK_LINK_FLAG([[-Wl,--exclude-libs,ALL]],[RELDFLAGS="-Wl,--exclude-libs,ALL"],,[[$LDFLAG_WERROR]]) AX_CHECK_LINK_FLAG([[-Wl,--exclude-libs,ALL]],[RELDFLAGS="-Wl,--exclude-libs,ALL"],,[[$LDFLAG_WERROR]])
AX_CHECK_LINK_FLAG([-Wl,-no_exported_symbols], [LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -Wl,-no_exported_symbols"], [], [$LDFLAG_WERROR]) AX_CHECK_LINK_FLAG([-Wl,-no_exported_symbols], [LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -Wl,-no_exported_symbols"], [], [$LDFLAG_WERROR])
@ -1869,6 +1877,9 @@ AC_SUBST(BITCOIN_MP_NODE_NAME)
AC_SUBST(BITCOIN_MP_GUI_NAME) AC_SUBST(BITCOIN_MP_GUI_NAME)
AC_SUBST(RELDFLAGS) AC_SUBST(RELDFLAGS)
AC_SUBST(CORE_LDFLAGS)
AC_SUBST(CORE_CPPFLAGS)
AC_SUBST(CORE_CXXFLAGS)
AC_SUBST(DEBUG_CPPFLAGS) AC_SUBST(DEBUG_CPPFLAGS)
AC_SUBST(WARN_CXXFLAGS) AC_SUBST(WARN_CXXFLAGS)
AC_SUBST(NOWARN_CXXFLAGS) AC_SUBST(NOWARN_CXXFLAGS)
@ -1995,9 +2006,9 @@ echo " build os = $build_os"
echo echo
echo " CC = $CC" echo " CC = $CC"
echo " CFLAGS = $PTHREAD_CFLAGS $CFLAGS" echo " CFLAGS = $PTHREAD_CFLAGS $CFLAGS"
echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CPPFLAGS" echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CORE_CPPFLAGS $CPPFLAGS"
echo " CXX = $CXX" echo " CXX = $CXX"
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CXXFLAGS" echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CORE_CXXFLAGS $CXXFLAGS"
echo " LDFLAGS = $PTHREAD_LIBS $HARDENED_LDFLAGS $GPROF_LDFLAGS $LDFLAGS" echo " LDFLAGS = $PTHREAD_LIBS $HARDENED_LDFLAGS $GPROF_LDFLAGS $CORE_LDFLAGS $LDFLAGS"
echo " ARFLAGS = $ARFLAGS" echo " ARFLAGS = $ARFLAGS"
echo echo

View File

@ -9,9 +9,9 @@ print-%: FORCE
DIST_SUBDIRS = secp256k1 DIST_SUBDIRS = secp256k1
AM_LDFLAGS = $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS) $(GPROF_LDFLAGS) $(SANITIZER_LDFLAGS) AM_LDFLAGS = $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS) $(GPROF_LDFLAGS) $(SANITIZER_LDFLAGS) $(CORE_LDFLAGS)
AM_CXXFLAGS = $(DEBUG_CXXFLAGS) $(HARDENED_CXXFLAGS) $(WARN_CXXFLAGS) $(NOWARN_CXXFLAGS) $(ERROR_CXXFLAGS) $(GPROF_CXXFLAGS) $(SANITIZER_CXXFLAGS) AM_CXXFLAGS = $(DEBUG_CXXFLAGS) $(HARDENED_CXXFLAGS) $(WARN_CXXFLAGS) $(NOWARN_CXXFLAGS) $(ERROR_CXXFLAGS) $(GPROF_CXXFLAGS) $(SANITIZER_CXXFLAGS) $(CORE_CXXFLAGS)
AM_CPPFLAGS = $(DEBUG_CPPFLAGS) $(HARDENED_CPPFLAGS) AM_CPPFLAGS = $(DEBUG_CPPFLAGS) $(HARDENED_CPPFLAGS) $(CORE_CPPFLAGS)
AM_LIBTOOLFLAGS = --preserve-dup-deps AM_LIBTOOLFLAGS = --preserve-dup-deps
PTHREAD_FLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) PTHREAD_FLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
EXTRA_LIBRARIES = EXTRA_LIBRARIES =