Skip to content

Commit d5674c5

Browse files
author
MarcoFalke
committed
Merge #17703: build: Improve configure.ac formatting
3ab1824 build: Use dnl for all comments in configure.ac, rather than # (fanquake) 8ddcbb4 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 3ab1824 hebasto: ACK 3ab1824, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: 2bcffb52c365acff87a0e6b9527ae31f36fdabb7ea095a8fd261f9a39b2c2848f5dfc148bc38d21e21e7bd761b1a2960e9a96f508c66be84d9569b8a401e812a
2 parents 2126d6c + 3ab1824 commit d5674c5

File tree

1 file changed

+54
-55
lines changed

1 file changed

+54
-55
lines changed

configure.ac

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -243,27 +243,27 @@ AC_ARG_ENABLE(man,
243243
enable_man=yes)
244244
AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no)
245245

246-
# Enable debug
246+
dnl Enable debug
247247
AC_ARG_ENABLE([debug],
248248
[AS_HELP_STRING([--enable-debug],
249249
[use compiler flags and macros suited for debugging (default is no)])],
250250
[enable_debug=$enableval],
251251
[enable_debug=no])
252252

253-
# Enable different -fsanitize options
253+
dnl Enable different -fsanitize options
254254
AC_ARG_WITH([sanitizers],
255255
[AS_HELP_STRING([--with-sanitizers],
256256
[comma separated list of extra sanitizers to build with (default is none enabled)])],
257257
[use_sanitizers=$withval])
258258

259-
# Enable gprof profiling
259+
dnl Enable gprof profiling
260260
AC_ARG_ENABLE([gprof],
261261
[AS_HELP_STRING([--enable-gprof],
262262
[use gprof profiling compiler flags (default is no)])],
263263
[enable_gprof=$enableval],
264264
[enable_gprof=no])
265265

266-
# Turn warnings into errors
266+
dnl Turn warnings into errors
267267
AC_ARG_ENABLE([werror],
268268
[AS_HELP_STRING([--enable-werror],
269269
[Treat certain compiler warnings as errors (default is no)])],
@@ -274,15 +274,15 @@ AC_LANG_PUSH([C++])
274274
AX_CHECK_COMPILE_FLAG([-Werror],[CXXFLAG_WERROR="-Werror"],[CXXFLAG_WERROR=""])
275275

276276
if test "x$enable_debug" = xyes; then
277-
# Clear default -g -O2 flags
277+
dnl Clear default -g -O2 flags
278278
if test "x$CXXFLAGS_overridden" = xno; then
279279
CXXFLAGS=""
280280
fi
281281

282-
# Disable all optimizations
282+
dnl Disable all optimizations
283283
AX_CHECK_COMPILE_FLAG([-O0], [[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -O0"]],,[[$CXXFLAG_WERROR]])
284284

285-
# Prefer -g3, fall back to -g if that is unavailable.
285+
dnl Prefer -g3, fall back to -g if that is unavailable.
286286
AX_CHECK_COMPILE_FLAG(
287287
[-g3],
288288
[[DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -g3"]],
@@ -295,19 +295,19 @@ if test "x$enable_debug" = xyes; then
295295
fi
296296

297297
if test x$use_sanitizers != x; then
298-
# First check if the compiler accepts flags. If an incompatible pair like
299-
# -fsanitize=address,thread is used here, this check will fail. This will also
300-
# fail if a bad argument is passed, e.g. -fsanitize=undfeined
298+
dnl First check if the compiler accepts flags. If an incompatible pair like
299+
dnl -fsanitize=address,thread is used here, this check will fail. This will also
300+
dnl fail if a bad argument is passed, e.g. -fsanitize=undfeined
301301
AX_CHECK_COMPILE_FLAG(
302302
[[-fsanitize=$use_sanitizers]],
303303
[[SANITIZER_CXXFLAGS=-fsanitize=$use_sanitizers]],
304304
[AC_MSG_ERROR([compiler did not accept requested flags])])
305305

306-
# Some compilers (e.g. GCC) require additional libraries like libasan,
307-
# libtsan, libubsan, etc. Make sure linking still works with the sanitize
308-
# flag. This is a separate check so we can give a better error message when
309-
# the sanitize flags are supported by the compiler but the actual sanitizer
310-
# libs are missing.
306+
dnl Some compilers (e.g. GCC) require additional libraries like libasan,
307+
dnl libtsan, libubsan, etc. Make sure linking still works with the sanitize
308+
dnl flag. This is a separate check so we can give a better error message when
309+
dnl the sanitize flags are supported by the compiler but the actual sanitizer
310+
dnl libs are missing.
311311
AX_CHECK_LINK_FLAG(
312312
[[-fsanitize=$use_sanitizers]],
313313
[[SANITIZER_LDFLAGS=-fsanitize=$use_sanitizers]],
@@ -344,9 +344,9 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
344344
AX_CHECK_COMPILE_FLAG([-Wredundant-decls],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wredundant-decls"],,[[$CXXFLAG_WERROR]])
345345
AX_CHECK_COMPILE_FLAG([-Wunused-variable],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused-variable"],,[[$CXXFLAG_WERROR]])
346346

347-
## Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
348-
## unknown options if any other warning is produced. Test the -Wfoo case, and
349-
## set the -Wno-foo case if it works.
347+
dnl Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
348+
dnl unknown options if any other warning is produced. Test the -Wfoo case, and
349+
dnl set the -Wno-foo case if it works.
350350
AX_CHECK_COMPILE_FLAG([-Wunused-parameter],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-parameter"],,[[$CXXFLAG_WERROR]])
351351
AX_CHECK_COMPILE_FLAG([-Wself-assign],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-self-assign"],,[[$CXXFLAG_WERROR]])
352352
AX_CHECK_COMPILE_FLAG([-Wunused-local-typedef],[NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-local-typedef"],,[[$CXXFLAG_WERROR]])
@@ -361,9 +361,9 @@ enable_shani=no
361361

362362
if test "x$use_asm" = "xyes"; then
363363

364-
# Check for optional instruction set support. Enabling these does _not_ imply that all code will
365-
# be compiled with them, rather that specific objects/libs may use them after checking for runtime
366-
# compatibility.
364+
dnl Check for optional instruction set support. Enabling these does _not_ imply that all code will
365+
dnl be compiled with them, rather that specific objects/libs may use them after checking for runtime
366+
dnl compatibility.
367367
AX_CHECK_COMPILE_FLAG([-msse4.2],[[SSE42_CXXFLAGS="-msse4.2"]],,[[$CXXFLAG_WERROR]])
368368
AX_CHECK_COMPILE_FLAG([-msse4.1],[[SSE41_CXXFLAGS="-msse4.1"]],,[[$CXXFLAG_WERROR]])
369369
AX_CHECK_COMPILE_FLAG([-mavx -mavx2],[[AVX2_CXXFLAGS="-mavx -mavx2"]],,[[$CXXFLAG_WERROR]])
@@ -506,8 +506,8 @@ case $host in
506506
AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(libiphlpapi missing))
507507
AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(libcrypt32 missing))
508508

509-
# -static is interpreted by libtool, where it has a different meaning.
510-
# In libtool-speak, it's -all-static.
509+
dnl -static is interpreted by libtool, where it has a different meaning.
510+
dnl In libtool-speak, it's -all-static.
511511
AX_CHECK_LINK_FLAG([[-static]],[LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -all-static"])
512512

513513
AC_PATH_PROG([MAKENSIS], [makensis], none)
@@ -555,8 +555,8 @@ case $host in
555555
dnl It's safe to add these paths even if the functionality is disabled by
556556
dnl the user (--without-wallet or --without-gui for example).
557557

558-
bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null`
559-
qt5_prefix=`$BREW --prefix qt5 2>/dev/null`
558+
bdb_prefix=$($BREW --prefix berkeley-db4 2>/dev/null)
559+
qt5_prefix=$($BREW --prefix qt5 2>/dev/null)
560560
if test x$bdb_prefix != x; then
561561
CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include"
562562
LIBS="$LIBS -L$bdb_prefix/lib"
@@ -673,11 +673,11 @@ AC_C_BIGENDIAN
673673
dnl Check for pthread compile/link requirements
674674
AX_PTHREAD
675675

676-
# The following macro will add the necessary defines to bitcoin-config.h, but
677-
# they also need to be passed down to any subprojects. Pull the results out of
678-
# the cache and add them to CPPFLAGS.
676+
dnl The following macro will add the necessary defines to bitcoin-config.h, but
677+
dnl they also need to be passed down to any subprojects. Pull the results out of
678+
dnl the cache and add them to CPPFLAGS.
679679
AC_SYS_LARGEFILE
680-
# detect POSIX or GNU variant of strerror_r
680+
dnl detect POSIX or GNU variant of strerror_r
681681
AC_FUNC_STRERROR_R
682682

683683
if test x$ac_cv_sys_file_offset_bits != x &&
@@ -700,12 +700,12 @@ AX_GCC_FUNC_ATTRIBUTE([dllimport])
700700

701701
if test x$use_glibc_compat != xno; then
702702

703-
#glibc absorbed clock_gettime in 2.17. librt (its previous location) is safe to link
704-
#in anyway for back-compat.
703+
dnl glibc absorbed clock_gettime in 2.17. librt (its previous location) is safe to link
704+
dnl in anyway for back-compat.
705705
AC_CHECK_LIB([rt],[clock_gettime],, AC_MSG_ERROR(librt missing))
706706

707-
#__fdelt_chk's params and return type have changed from long unsigned int to long int.
708-
# See which one is present here.
707+
dnl __fdelt_chk's params and return type have changed from long unsigned int to long int.
708+
dnl See which one is present here.
709709
AC_MSG_CHECKING(__fdelt_chk type)
710710
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef _FORTIFY_SOURCE
711711
#undef _FORTIFY_SOURCE
@@ -741,22 +741,22 @@ if test "x$enable_gprof" = xyes; then
741741
fi
742742

743743
if test x$TARGET_OS != xwindows; then
744-
# All windows code is PIC, forcing it on just adds useless compile warnings
744+
dnl All windows code is PIC, forcing it on just adds useless compile warnings
745745
AX_CHECK_COMPILE_FLAG([-fPIC],[PIC_FLAGS="-fPIC"])
746746
fi
747747

748-
# All versions of gcc that we commonly use for building are subject to bug
749-
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set
750-
# -fstack-reuse=none for all gcc builds. (Only gcc understands this flag)
748+
dnl All versions of gcc that we commonly use for building are subject to bug
749+
dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set
750+
dnl -fstack-reuse=none for all gcc builds. (Only gcc understands this flag)
751751
AX_CHECK_COMPILE_FLAG([-fstack-reuse=none],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-reuse=none"])
752752
if test x$use_hardening != xno; then
753753
use_hardening=yes
754754
AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"])
755755
AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"])
756756

757-
# When enable_debug is yes, all optimizations are disabled.
758-
# However, FORTIFY_SOURCE requires that there is some level of optimization, otherwise it does nothing and just creates a compiler warning.
759-
# Since FORTIFY_SOURCE is a no-op without optimizations, do not enable it when enable_debug is yes.
757+
dnl When enable_debug is yes, all optimizations are disabled.
758+
dnl However, FORTIFY_SOURCE requires that there is some level of optimization, otherwise it does nothing and just creates a compiler warning.
759+
dnl Since FORTIFY_SOURCE is a no-op without optimizations, do not enable it when enable_debug is yes.
760760
if test x$enable_debug != xyes; then
761761
AX_CHECK_PREPROC_FLAG([-D_FORTIFY_SOURCE=2],[
762762
AX_CHECK_PREPROC_FLAG([-U_FORTIFY_SOURCE],[
@@ -788,8 +788,8 @@ fi
788788

789789
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])
790790

791-
# FD_ZERO may be dependent on a declaration of memcpy, e.g. in SmartOS
792-
# check that it fails to build without memcpy, then that it builds with
791+
dnl FD_ZERO may be dependent on a declaration of memcpy, e.g. in SmartOS
792+
dnl check that it fails to build without memcpy, then that it builds with
793793
AC_MSG_CHECKING(FD_ZERO memcpy dependence)
794794
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
795795
#include <cstddef>
@@ -827,7 +827,7 @@ AC_CHECK_DECLS([getifaddrs, freeifaddrs],,,
827827
)
828828
AC_CHECK_DECLS([strnlen])
829829

830-
# Check for daemon(3), unrelated to --with-daemon (although used by it)
830+
dnl Check for daemon(3), unrelated to --with-daemon (although used by it)
831831
AC_CHECK_DECLS([daemon])
832832

833833
AC_CHECK_DECLS([le16toh, le32toh, le64toh, htole16, htole32, htole64, be16toh, be32toh, be64toh, htobe16, htobe32, htobe64],,,
@@ -893,19 +893,19 @@ if test "x$use_thread_local" = xyes || { test "x$use_thread_local" = xauto && te
893893
[
894894
case $host in
895895
*mingw*)
896-
# mingw32's implementation of thread_local has also been shown to behave
897-
# erroneously under concurrent usage; see:
898-
# https://gist.github.com/jamesob/fe9a872051a88b2025b1aa37bfa98605
896+
dnl mingw32's implementation of thread_local has also been shown to behave
897+
dnl erroneously under concurrent usage; see:
898+
dnl https://gist.github.com/jamesob/fe9a872051a88b2025b1aa37bfa98605
899899
AC_MSG_RESULT(no)
900900
;;
901901
*darwin*)
902-
# TODO enable thread_local on later versions of Darwin where it is
903-
# supported (per https://stackoverflow.com/a/29929949)
902+
dnl TODO enable thread_local on later versions of Darwin where it is
903+
dnl supported (per https://stackoverflow.com/a/29929949)
904904
AC_MSG_RESULT(no)
905905
;;
906906
*freebsd*)
907-
# FreeBSD's implementation of thread_local is also buggy (per
908-
# https://groups.google.com/d/msg/bsdmailinglist/22ncTZAbDp4/Dii_pII5AwAJ)
907+
dnl FreeBSD's implementation of thread_local is also buggy (per
908+
dnl https://groups.google.com/d/msg/bsdmailinglist/22ncTZAbDp4/Dii_pII5AwAJ)
909909
AC_MSG_RESULT(no)
910910
;;
911911
*)
@@ -921,7 +921,7 @@ if test "x$use_thread_local" = xyes || { test "x$use_thread_local" = xauto && te
921921
LDFLAGS="$TEMP_LDFLAGS"
922922
fi
923923

924-
# Check for different ways of gathering OS randomness
924+
dnl Check for different ways of gathering OS randomness
925925
AC_MSG_CHECKING(for Linux getrandom syscall)
926926
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
927927
#include <sys/syscall.h>
@@ -975,7 +975,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdint.h>
975975
[ AC_MSG_RESULT(no)]
976976
)
977977

978-
# Check for reduced exports
978+
dnl Check for reduced exports
979979
if test x$use_reduce_exports = xyes; then
980980
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[RE_CXXFLAGS="-fvisibility=hidden"],
981981
[AC_MSG_ERROR([Cannot set default symbol visibility. Use --disable-reduce-exports.])])
@@ -987,7 +987,7 @@ AC_LINK_IFELSE(
987987
[[ #include <cstdlib> ]],
988988
[[ int nErr = std::system(""); ]]
989989
)],
990-
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STD__SYSTEM, 1, Define to 1 if you have the `std::system' function.)],
990+
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STD__SYSTEM, 1, Define to 1 if std::system is available.)],
991991
[ AC_MSG_RESULT(no) ]
992992
)
993993

@@ -997,11 +997,10 @@ AC_LINK_IFELSE(
997997
[[ ]],
998998
[[ int nErr = ::_wsystem(""); ]]
999999
)],
1000-
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_WSYSTEM, 1, Define to 1 if you have the `::wsystem' function.)],
1000+
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_WSYSTEM, 1, Define to 1 if ::wsystem is available.)],
10011001
[ AC_MSG_RESULT(no) ]
10021002
)
10031003

1004-
# Define to 1 if std::system or ::wsystem (Windows) is available
10051004
AC_DEFINE([HAVE_SYSTEM], [HAVE_STD__SYSTEM || HAVE_WSYSTEM], [std::system or ::wsystem])
10061005

10071006
LEVELDB_CPPFLAGS=

0 commit comments

Comments
 (0)