Merge #17703: build: Improve configure.ac formatting

3ab18246254019896132d1cdb8af2dcdb213ec3b build: Use dnl for all comments in configure.ac, rather than # (fanquake)
8ddcbb4e41fa91e7f80efe6d9c4d5e9bb1355036 build: Remove backticks from configure.ac (fanquake)

Pull request description:

  Use `dnl` for all comments, rather than `#`.
  Remove backticks - Their usage for the `bdb_prefix` and `qt5_prefix` commands may have improved backwards compatibility in some cases, however we now require recent versions of macOS. I'm not sure why they were being used in the `HAVE_STD__SYSTEM` and `HAVE_WSYSTEM` defines.

ACKs for top commit:
  dongcarl:
    ACK 3ab18246254019896132d1cdb8af2dcdb213ec3b
  hebasto:
    ACK 3ab18246254019896132d1cdb8af2dcdb213ec3b, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 2bcffb52c365acff87a0e6b9527ae31f36fdabb7ea095a8fd261f9a39b2c2848f5dfc148bc38d21e21e7bd761b1a2960e9a96f508c66be84d9569b8a401e812a
This commit is contained in:
MarcoFalke 2019-12-10 13:16:11 -05:00 committed by Konstantin Akimov
parent d64b7229cd
commit 59c55fd274

View File

@ -251,28 +251,28 @@ AC_ARG_ENABLE(man,
enable_man=yes) enable_man=yes)
AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no) AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no)
# Enable debug dnl Enable debug
AC_ARG_ENABLE([debug], AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [AS_HELP_STRING([--enable-debug],
[use compiler flags and macros suited for debugging (default is no)])], [use compiler flags and macros suited for debugging (default is no)])],
[enable_debug=$enableval], [enable_debug=$enableval],
[enable_debug=no]) [enable_debug=no])
# Enable exception stacktraces dnl Enable exception stacktraces
AC_ARG_ENABLE([stacktraces], AC_ARG_ENABLE([stacktraces],
[AS_HELP_STRING([--enable-stacktraces], [AS_HELP_STRING([--enable-stacktraces],
[gather and print exception stack traces (default is yes)])], [gather and print exception stack traces (default is yes)])],
[enable_stacktraces=$enableval], [enable_stacktraces=$enableval],
[enable_stacktraces=yes]) [enable_stacktraces=yes])
# Enable crash hooks dnl Enable crash hooks
AC_ARG_ENABLE([crash-hooks], AC_ARG_ENABLE([crash-hooks],
[AS_HELP_STRING([--enable-crash-hooks], [AS_HELP_STRING([--enable-crash-hooks],
[hook into exception/signal/assert handling to gather stack traces (default is no)])], [hook into exception/signal/assert handling to gather stack traces (default is no)])],
[enable_crashhooks=$enableval], [enable_crashhooks=$enableval],
[enable_crashhooks=no]) [enable_crashhooks=no])
# Enable in-wallet miner dnl Enable in-wallet miner
AC_ARG_ENABLE([miner], AC_ARG_ENABLE([miner],
[AS_HELP_STRING([--enable-miner], [AS_HELP_STRING([--enable-miner],
[enable in-wallet miner (default is yes)])], [enable in-wallet miner (default is yes)])],
@ -283,20 +283,20 @@ if test "x$enable_miner" = xyes; then
AC_DEFINE(ENABLE_MINER, 1, [Define this symbol if in-wallet miner should be enabled]) AC_DEFINE(ENABLE_MINER, 1, [Define this symbol if in-wallet miner should be enabled])
fi fi
# Enable different -fsanitize options dnl Enable different -fsanitize options
AC_ARG_WITH([sanitizers], AC_ARG_WITH([sanitizers],
[AS_HELP_STRING([--with-sanitizers], [AS_HELP_STRING([--with-sanitizers],
[comma separated list of extra sanitizers to build with (default is none enabled)])], [comma separated list of extra sanitizers to build with (default is none enabled)])],
[use_sanitizers=$withval]) [use_sanitizers=$withval])
# Enable gprof profiling dnl Enable gprof profiling
AC_ARG_ENABLE([gprof], AC_ARG_ENABLE([gprof],
[AS_HELP_STRING([--enable-gprof], [AS_HELP_STRING([--enable-gprof],
[use gprof profiling compiler flags (default is no)])], [use gprof profiling compiler flags (default is no)])],
[enable_gprof=$enableval], [enable_gprof=$enableval],
[enable_gprof=no]) [enable_gprof=no])
# Turn warnings into errors dnl Turn warnings into errors
AC_ARG_ENABLE([werror], AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--enable-werror], [AS_HELP_STRING([--enable-werror],
[Treat certain compiler warnings as errors (default is no)])], [Treat certain compiler warnings as errors (default is no)])],
@ -307,15 +307,15 @@ AC_LANG_PUSH([C++])
AX_CHECK_COMPILE_FLAG([-Werror],[CXXFLAG_WERROR="-Werror"],[CXXFLAG_WERROR=""]) AX_CHECK_COMPILE_FLAG([-Werror],[CXXFLAG_WERROR="-Werror"],[CXXFLAG_WERROR=""])
if test "x$enable_debug" = xyes; then if test "x$enable_debug" = xyes; then
# Clear default -g -O2 flags dnl Clear default -g -O2 flags
if test "x$CXXFLAGS_overridden" = xno; then if test "x$CXXFLAGS_overridden" = xno; then
CXXFLAGS="" CXXFLAGS=""
fi fi
# Disable all optimizations dnl Disable all optimizations
AX_CHECK_COMPILE_FLAG([-O0], [[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -O0"]],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-O0], [[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -O0"]],,[[$CXXFLAG_WERROR]])
# Prefer -g3, fall back to -g if that is unavailable. dnl Prefer -g3, fall back to -g if that is unavailable.
AX_CHECK_COMPILE_FLAG( AX_CHECK_COMPILE_FLAG(
[-g3], [-g3],
[[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -g3"]], [[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -g3"]],
@ -366,19 +366,19 @@ fi
AX_CHECK_COMPILE_FLAG([-Wa,-mbig-obj], [CXXFLAGS="$CXXFLAGS -Wa,-mbig-obj"],,,) AX_CHECK_COMPILE_FLAG([-Wa,-mbig-obj], [CXXFLAGS="$CXXFLAGS -Wa,-mbig-obj"],,,)
if test x$use_sanitizers != x; then if test x$use_sanitizers != x; then
# First check if the compiler accepts flags. If an incompatible pair like dnl First check if the compiler accepts flags. If an incompatible pair like
# -fsanitize=address,thread is used here, this check will fail. This will also dnl -fsanitize=address,thread is used here, this check will fail. This will also
# fail if a bad argument is passed, e.g. -fsanitize=undfeined dnl fail if a bad argument is passed, e.g. -fsanitize=undfeined
AX_CHECK_COMPILE_FLAG( AX_CHECK_COMPILE_FLAG(
[[-fsanitize=$use_sanitizers]], [[-fsanitize=$use_sanitizers]],
[[SANITIZER_CXXFLAGS=-fsanitize=$use_sanitizers]], [[SANITIZER_CXXFLAGS=-fsanitize=$use_sanitizers]],
[AC_MSG_ERROR([compiler did not accept requested flags])]) [AC_MSG_ERROR([compiler did not accept requested flags])])
# Some compilers (e.g. GCC) require additional libraries like libasan, dnl Some compilers (e.g. GCC) require additional libraries like libasan,
# libtsan, libubsan, etc. Make sure linking still works with the sanitize dnl libtsan, libubsan, etc. Make sure linking still works with the sanitize
# flag. This is a separate check so we can give a better error message when dnl flag. This is a separate check so we can give a better error message when
# the sanitize flags are supported by the compiler but the actual sanitizer dnl the sanitize flags are supported by the compiler but the actual sanitizer
# libs are missing. dnl libs are missing.
AX_CHECK_LINK_FLAG( AX_CHECK_LINK_FLAG(
[[-fsanitize=$use_sanitizers]], [[-fsanitize=$use_sanitizers]],
[[SANITIZER_LDFLAGS=-fsanitize=$use_sanitizers]], [[SANITIZER_LDFLAGS=-fsanitize=$use_sanitizers]],
@ -432,9 +432,9 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
[AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])]) [AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])])
AX_CHECK_COMPILE_FLAG([-Wunreachable-code-loop-increment],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunreachable-code-loop-increment"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Wunreachable-code-loop-increment],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunreachable-code-loop-increment"],,[[$CXXFLAG_WERROR]])
## Some compilers (gcc) ignore unknown -Wno-* options, but warn about all dnl Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
## unknown options if any other warning is produced. Test the -Wfoo case, and dnl unknown options if any other warning is produced. Test the -Wfoo case, and
## set the -Wno-foo case if it works. dnl set the -Wno-foo case if it works.
AX_CHECK_COMPILE_FLAG([-Wunused-parameter],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-parameter"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Wunused-parameter],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-parameter"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wself-assign],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-self-assign"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Wself-assign],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-self-assign"],,[[$CXXFLAG_WERROR]])
AX_CHECK_COMPILE_FLAG([-Wunused-local-typedef],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-local-typedef"],,[[$CXXFLAG_WERROR]]) AX_CHECK_COMPILE_FLAG([-Wunused-local-typedef],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-local-typedef"],,[[$CXXFLAG_WERROR]])
@ -640,8 +640,8 @@ case $host in
AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(libiphlpapi missing)) AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(libiphlpapi missing))
AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(libcrypt32 missing)) AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(libcrypt32 missing))
# -static is interpreted by libtool, where it has a different meaning. dnl -static is interpreted by libtool, where it has a different meaning.
# In libtool-speak, it's -all-static. dnl In libtool-speak, it's -all-static.
AX_CHECK_LINK_FLAG([[-static]],[LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -all-static"]) AX_CHECK_LINK_FLAG([[-static]],[LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -all-static"])
AC_PATH_PROG([MAKENSIS], [makensis], none) AC_PATH_PROG([MAKENSIS], [makensis], none)
@ -680,8 +680,8 @@ case $host in
dnl It's safe to add these paths even if the functionality is disabled by dnl It's safe to add these paths even if the functionality is disabled by
dnl the user (--without-wallet or --without-gui for example). dnl the user (--without-wallet or --without-gui for example).
bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null` bdb_prefix=$($BREW --prefix berkeley-db4 2>/dev/null)
qt5_prefix=`$BREW --prefix qt5 2>/dev/null` qt5_prefix=$($BREW --prefix qt5 2>/dev/null)
if test x$bdb_prefix != x; then if test x$bdb_prefix != x; then
CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include" CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include"
LIBS="$LIBS -L$bdb_prefix/lib" LIBS="$LIBS -L$bdb_prefix/lib"
@ -801,11 +801,11 @@ AC_C_BIGENDIAN
dnl Check for pthread compile/link requirements dnl Check for pthread compile/link requirements
AX_PTHREAD AX_PTHREAD
# The following macro will add the necessary defines to dash-config.h, but dnl The following macro will add the necessary defines to dash-config.h, but
# they also need to be passed down to any subprojects. Pull the results out of dnl they also need to be passed down to any subprojects. Pull the results out of
# the cache and add them to CPPFLAGS. dnl the cache and add them to CPPFLAGS.
AC_SYS_LARGEFILE AC_SYS_LARGEFILE
# detect POSIX or GNU variant of strerror_r dnl detect POSIX or GNU variant of strerror_r
AC_FUNC_STRERROR_R AC_FUNC_STRERROR_R
if test x$ac_cv_sys_file_offset_bits != x && if test x$ac_cv_sys_file_offset_bits != x &&
@ -826,8 +826,8 @@ AX_GCC_FUNC_ATTRIBUTE([dllimport])
if test x$use_glibc_compat != xno; then if test x$use_glibc_compat != xno; then
#__fdelt_chk's params and return type have changed from long unsigned int to long int. dnl __fdelt_chk's params and return type have changed from long unsigned int to long int.
# See which one is present here. dnl See which one is present here.
AC_MSG_CHECKING(__fdelt_chk type) AC_MSG_CHECKING(__fdelt_chk type)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef _FORTIFY_SOURCE AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef _FORTIFY_SOURCE
#undef _FORTIFY_SOURCE #undef _FORTIFY_SOURCE
@ -869,22 +869,22 @@ if test "x$enable_gprof" = xyes; then
fi fi
if test x$TARGET_OS != xwindows; then if test x$TARGET_OS != xwindows; then
# All windows code is PIC, forcing it on just adds useless compile warnings dnl All windows code is PIC, forcing it on just adds useless compile warnings
AX_CHECK_COMPILE_FLAG([-fPIC],[PIC_FLAGS="-fPIC"]) AX_CHECK_COMPILE_FLAG([-fPIC],[PIC_FLAGS="-fPIC"])
fi fi
# All versions of gcc that we commonly use for building are subject to bug dnl All versions of gcc that we commonly use for building are subject to bug
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set
# -fstack-reuse=none for all gcc builds. (Only gcc understands this flag) dnl -fstack-reuse=none for all gcc builds. (Only gcc understands this flag)
AX_CHECK_COMPILE_FLAG([-fstack-reuse=none],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-reuse=none"]) AX_CHECK_COMPILE_FLAG([-fstack-reuse=none],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-reuse=none"])
if test x$use_hardening != xno; then if test x$use_hardening != xno; then
use_hardening=yes use_hardening=yes
AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"]) AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"])
AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"]) AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"])
# When enable_debug is yes, all optimizations are disabled. dnl When enable_debug is yes, all optimizations are disabled.
# However, FORTIFY_SOURCE requires that there is some level of optimization, otherwise it does nothing and just creates a compiler warning. dnl However, FORTIFY_SOURCE requires that there is some level of optimization, otherwise it does nothing and just creates a compiler warning.
# Since FORTIFY_SOURCE is a no-op without optimizations, do not enable it when enable_debug is yes. dnl Since FORTIFY_SOURCE is a no-op without optimizations, do not enable it when enable_debug is yes.
if test x$enable_debug != xyes; then if test x$enable_debug != xyes; then
AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=2],[ AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=2],[
AX_CHECK_PREPROC_FLAG([-U_FORTIFY_SOURCE],[ AX_CHECK_PREPROC_FLAG([-U_FORTIFY_SOURCE],[
@ -919,8 +919,8 @@ fi
AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h sys/select.h sys/prctl.h sys/sysctl.h vm/vm_param.h sys/vmmeter.h sys/resources.h]) AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h sys/select.h sys/prctl.h sys/sysctl.h vm/vm_param.h sys/vmmeter.h sys/resources.h])
# FD_ZERO may be dependent on a declaration of memcpy, e.g. in SmartOS dnl FD_ZERO may be dependent on a declaration of memcpy, e.g. in SmartOS
# check that it fails to build without memcpy, then that it builds with dnl check that it fails to build without memcpy, then that it builds with
AC_MSG_CHECKING(FD_ZERO memcpy dependence) AC_MSG_CHECKING(FD_ZERO memcpy dependence)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <cstddef> #include <cstddef>
@ -958,7 +958,7 @@ AC_CHECK_DECLS([getifaddrs, freeifaddrs],,,
) )
AC_CHECK_DECLS([strnlen]) AC_CHECK_DECLS([strnlen])
# Check for daemon(3), unrelated to --with-daemon (although used by it) dnl Check for daemon(3), unrelated to --with-daemon (although used by it)
AC_CHECK_DECLS([daemon]) AC_CHECK_DECLS([daemon])
AC_CHECK_DECLS([le16toh, le32toh, le64toh, htole16, htole32, htole64, be16toh, be32toh, be64toh, htobe16, htobe32, htobe64],,, AC_CHECK_DECLS([le16toh, le32toh, le64toh, htole16, htole32, htole64, be16toh, be32toh, be64toh, htobe16, htobe32, htobe64],,,
@ -1024,19 +1024,19 @@ if test "x$use_thread_local" = xyes || { test "x$use_thread_local" = xauto && te
[ [
case $host in case $host in
*mingw*) *mingw*)
# mingw32's implementation of thread_local has also been shown to behave dnl mingw32's implementation of thread_local has also been shown to behave
# erroneously under concurrent usage; see: dnl erroneously under concurrent usage; see:
# https://gist.github.com/jamesob/fe9a872051a88b2025b1aa37bfa98605 dnl https://gist.github.com/jamesob/fe9a872051a88b2025b1aa37bfa98605
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
;; ;;
*darwin*) *darwin*)
# TODO enable thread_local on later versions of Darwin where it is dnl TODO enable thread_local on later versions of Darwin where it is
# supported (per https://stackoverflow.com/a/29929949) dnl supported (per https://stackoverflow.com/a/29929949)
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
;; ;;
*freebsd*) *freebsd*)
# FreeBSD's implementation of thread_local is also buggy (per dnl FreeBSD's implementation of thread_local is also buggy (per
# https://groups.google.com/d/msg/bsdmailinglist/22ncTZAbDp4/Dii_pII5AwAJ) dnl https://groups.google.com/d/msg/bsdmailinglist/22ncTZAbDp4/Dii_pII5AwAJ)
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
;; ;;
*) *)
@ -1068,7 +1068,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ctime>]],
] ]
) )
# Check for different ways of gathering OS randomness dnl Check for different ways of gathering OS randomness
AC_MSG_CHECKING(for Linux getrandom syscall) AC_MSG_CHECKING(for Linux getrandom syscall)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h> AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
#include <sys/syscall.h> #include <sys/syscall.h>
@ -1124,7 +1124,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdint.h>
[ AC_MSG_RESULT(no)] [ AC_MSG_RESULT(no)]
) )
# ensure backtrace() is found, check -lexecinfo if necessary dnl ensure backtrace() is found, check -lexecinfo if necessary
if test x$TARGET_OS != xwindows; then if test x$TARGET_OS != xwindows; then
if test "x$enable_stacktraces" != xno; then if test "x$enable_stacktraces" != xno; then
AC_SEARCH_LIBS([backtrace], [execinfo], [], [ AC_SEARCH_LIBS([backtrace], [execinfo], [], [