Skip to content

Commit 5e6bc43

Browse files
committed
build: cleanup AX_CHECK_LINK_FLAG() usage
There should be no functional change.
1 parent a874637 commit 5e6bc43

File tree

2 files changed

+32
-33
lines changed

2 files changed

+32
-33
lines changed

build-aux/m4/bitcoin_qt.m4

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
154154
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QXcbIntegrationPlugin], [-lqxcb])
155155
AC_DEFINE(QT_QPA_PLATFORM_XCB, 1, [Define this symbol if the qt platform is xcb])
156156
elif test "x$TARGET_OS" = xdarwin; then
157-
AX_CHECK_LINK_FLAG([[-framework Carbon]],[QT_LIBS="$QT_LIBS -framework Carbon"],[AC_MSG_ERROR(could not link against Carbon framework)])
158-
AX_CHECK_LINK_FLAG([[-framework IOSurface]],[QT_LIBS="$QT_LIBS -framework IOSurface"],[AC_MSG_ERROR(could not link against IOSurface framework)])
159-
AX_CHECK_LINK_FLAG([[-framework Metal]],[QT_LIBS="$QT_LIBS -framework Metal"],[AC_MSG_ERROR(could not link against Metal framework)])
160-
AX_CHECK_LINK_FLAG([[-framework QuartzCore]],[QT_LIBS="$QT_LIBS -framework QuartzCore"],[AC_MSG_ERROR(could not link against QuartzCore framework)])
157+
AX_CHECK_LINK_FLAG([-framework Carbon], [QT_LIBS="$QT_LIBS -framework Carbon"], [AC_MSG_ERROR(could not link against Carbon framework)])
158+
AX_CHECK_LINK_FLAG([-framework IOSurface], [QT_LIBS="$QT_LIBS -framework IOSurface"], [AC_MSG_ERROR(could not link against IOSurface framework)])
159+
AX_CHECK_LINK_FLAG([-framework Metal], [QT_LIBS="$QT_LIBS -framework Metal"], [AC_MSG_ERROR(could not link against Metal framework)])
160+
AX_CHECK_LINK_FLAG([-framework QuartzCore], [QT_LIBS="$QT_LIBS -framework QuartzCore"], [AC_MSG_ERROR(could not link against QuartzCore framework)])
161161
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QCocoaIntegrationPlugin], [-lqcocoa])
162162
_BITCOIN_QT_CHECK_STATIC_PLUGIN([QMacStylePlugin], [-lqmacstyle])
163163
AC_DEFINE(QT_QPA_PLATFORM_COCOA, 1, [Define this symbol if the qt platform is cocoa])
@@ -234,12 +234,12 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
234234
BITCOIN_QT_CHECK([
235235
MOC_DEFS="${MOC_DEFS} -DQ_OS_MAC"
236236
base_frameworks="-framework Foundation -framework AppKit"
237-
AX_CHECK_LINK_FLAG([[$base_frameworks]],[QT_LIBS="$QT_LIBS $base_frameworks"],[AC_MSG_ERROR(could not find base frameworks)])
237+
AX_CHECK_LINK_FLAG([$base_frameworks], [QT_LIBS="$QT_LIBS $base_frameworks"], [AC_MSG_ERROR(could not find base frameworks)])
238238
])
239239
;;
240240
*mingw*)
241241
BITCOIN_QT_CHECK([
242-
AX_CHECK_LINK_FLAG([[-mwindows]],[QT_LDFLAGS="$QT_LDFLAGS -mwindows"],[AC_MSG_WARN(-mwindows linker support not detected)])
242+
AX_CHECK_LINK_FLAG([-mwindows], [QT_LDFLAGS="$QT_LDFLAGS -mwindows"], [AC_MSG_WARN(-mwindows linker support not detected)])
243243
])
244244
esac
245245

configure.ac

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,10 @@ dnl
341341
dnl LDFLAG_WERROR Should only be used when testing -Wl,*
342342
case $host in
343343
*darwin*)
344-
AX_CHECK_LINK_FLAG([-Wl,-fatal_warnings],[LDFLAG_WERROR="-Wl,-fatal_warnings"],[LDFLAG_WERROR=""])
344+
AX_CHECK_LINK_FLAG([-Wl,-fatal_warnings], [LDFLAG_WERROR="-Wl,-fatal_warnings"], [LDFLAG_WERROR=""])
345345
;;
346346
*)
347-
AX_CHECK_LINK_FLAG([-Wl,--fatal-warnings],[LDFLAG_WERROR="-Wl,--fatal-warnings"],[LDFLAG_WERROR=""])
347+
AX_CHECK_LINK_FLAG([-Wl,--fatal-warnings], [LDFLAG_WERROR="-Wl,--fatal-warnings"], [LDFLAG_WERROR=""])
348348
;;
349349
esac
350350

@@ -385,8 +385,8 @@ if test x$use_sanitizers != x; then
385385
dnl the sanitize flags are supported by the compiler but the actual sanitizer
386386
dnl libs are missing.
387387
AX_CHECK_LINK_FLAG(
388-
[[-fsanitize=$use_sanitizers]],
389-
[[SANITIZER_LDFLAGS=-fsanitize=$use_sanitizers]],
388+
[-fsanitize=$use_sanitizers],
389+
[SANITIZER_LDFLAGS="-fsanitize=$use_sanitizers"],
390390
[AC_MSG_ERROR([linker did not accept requested flags, you are missing required libraries])],
391391
[],
392392
[AC_LANG_PROGRAM([[
@@ -645,7 +645,7 @@ case $host in
645645

646646
dnl -static is interpreted by libtool, where it has a different meaning.
647647
dnl In libtool-speak, it's -all-static.
648-
AX_CHECK_LINK_FLAG([[-static]],[LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -all-static"])
648+
AX_CHECK_LINK_FLAG([-static], [LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -all-static"])
649649

650650
AC_PATH_PROG([MAKENSIS], [makensis], none)
651651
if test x$MAKENSIS = xnone; then
@@ -668,7 +668,7 @@ case $host in
668668
postdeps_CXX=
669669

670670
dnl We require Windows 7 (NT 6.1) or later
671-
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]])
671+
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])
672672
;;
673673
*darwin*)
674674
TARGET_OS=darwin
@@ -749,7 +749,7 @@ case $host in
749749
esac
750750
fi
751751

752-
AX_CHECK_LINK_FLAG([[-Wl,-headerpad_max_install_names]], [LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"],, [[$LDFLAG_WERROR]])
752+
AX_CHECK_LINK_FLAG([-Wl,-headerpad_max_install_names], [LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"], [], [$LDFLAG_WERROR])
753753
CPPFLAGS="$CPPFLAGS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0"
754754
OBJCXXFLAGS="$CXXFLAGS"
755755
;;
@@ -816,7 +816,7 @@ if test x$use_lcov = xyes; then
816816
AC_SUBST(COV_TOOL_WRAPPER, "cov_tool_wrapper.sh")
817817
LCOV="$LCOV --gcov-tool $(pwd)/$COV_TOOL_WRAPPER"
818818

819-
AX_CHECK_LINK_FLAG([[--coverage]], [LDFLAGS="$LDFLAGS --coverage"],
819+
AX_CHECK_LINK_FLAG([--coverage], [LDFLAGS="$LDFLAGS --coverage"],
820820
[AC_MSG_ERROR("lcov testing requested but --coverage linker flag does not work")])
821821
AX_CHECK_COMPILE_FLAG([--coverage],[CXXFLAGS="$CXXFLAGS --coverage"],
822822
[AC_MSG_ERROR("lcov testing requested but --coverage flag does not work")])
@@ -869,9 +869,9 @@ if test "x$enable_gprof" = xyes; then
869869
AX_CHECK_COMPILE_FLAG([-pg],[GPROF_CXXFLAGS="-pg"],
870870
[AC_MSG_ERROR(gprof profiling requested but not available)], [[$CXXFLAG_WERROR]])
871871

872-
AX_CHECK_LINK_FLAG([[-no-pie]], [GPROF_LDFLAGS="-no-pie"])
873-
AX_CHECK_LINK_FLAG([[-pg]],[GPROF_LDFLAGS="$GPROF_LDFLAGS -pg"],
874-
[AC_MSG_ERROR(gprof profiling requested but not available)], [[$GPROF_LDFLAGS]])
872+
AX_CHECK_LINK_FLAG([-no-pie], [GPROF_LDFLAGS="-no-pie"])
873+
AX_CHECK_LINK_FLAG([-pg], [GPROF_LDFLAGS="$GPROF_LDFLAGS -pg"],
874+
[AC_MSG_ERROR(gprof profiling requested but not available)], [$GPROF_LDFLAGS])
875875
fi
876876

877877
if test x$TARGET_OS != xwindows; then
@@ -891,7 +891,7 @@ if test x$use_hardening != xno; then
891891
dnl -fcf-protection used with Clang 7 causes ld to emit warnings:
892892
dnl ld: error: ... <corrupt x86 feature size: 0x8>
893893
dnl Use CHECK_LINK_FLAG & --fatal-warnings to ensure we won't use the flag in this case.
894-
AX_CHECK_LINK_FLAG([-fcf-protection=full],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fcf-protection=full"],, [[$LDFLAG_WERROR]])
894+
AX_CHECK_LINK_FLAG([-fcf-protection=full], [HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fcf-protection=full"], [], [$LDFLAG_WERROR])
895895

896896
case $host in
897897
*mingw*)
@@ -916,14 +916,14 @@ if test x$use_hardening != xno; then
916916
])
917917
fi
918918

919-
AX_CHECK_LINK_FLAG([[-Wl,--enable-reloc-section]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--enable-reloc-section"],, [[$LDFLAG_WERROR]])
920-
AX_CHECK_LINK_FLAG([[-Wl,--dynamicbase]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"],, [[$LDFLAG_WERROR]])
921-
AX_CHECK_LINK_FLAG([[-Wl,--nxcompat]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"],, [[$LDFLAG_WERROR]])
922-
AX_CHECK_LINK_FLAG([[-Wl,--high-entropy-va]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--high-entropy-va"],, [[$LDFLAG_WERROR]])
923-
AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],, [[$LDFLAG_WERROR]])
924-
AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],, [[$LDFLAG_WERROR]])
925-
AX_CHECK_LINK_FLAG([[-Wl,-z,separate-code]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,separate-code"],, [[$LDFLAG_WERROR]])
926-
AX_CHECK_LINK_FLAG([[-fPIE -pie]], [PIE_FLAGS="-fPIE"; HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],, [[$CXXFLAG_WERROR]])
919+
AX_CHECK_LINK_FLAG([-Wl,--enable-reloc-section], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--enable-reloc-section"], [], [$LDFLAG_WERROR])
920+
AX_CHECK_LINK_FLAG([-Wl,--dynamicbase], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"], [], [$LDFLAG_WERROR])
921+
AX_CHECK_LINK_FLAG([-Wl,--nxcompat], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"], [], [$LDFLAG_WERROR])
922+
AX_CHECK_LINK_FLAG([-Wl,--high-entropy-va], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--high-entropy-va"], [], [$LDFLAG_WERROR])
923+
AX_CHECK_LINK_FLAG([-Wl,-z,relro], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"], [], [$LDFLAG_WERROR])
924+
AX_CHECK_LINK_FLAG([-Wl,-z,now], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"], [], [$LDFLAG_WERROR])
925+
AX_CHECK_LINK_FLAG([-Wl,-z,separate-code], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,separate-code"], [], [$LDFLAG_WERROR])
926+
AX_CHECK_LINK_FLAG([-fPIE -pie], [PIE_FLAGS="-fPIE"; HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"], [], [$CXXFLAG_WERROR])
927927

928928
case $host in
929929
*mingw*)
@@ -936,9 +936,9 @@ dnl These flags are specific to ld64, and may cause issues with other linkers.
936936
dnl For example: GNU ld will interpret -dead_strip as -de and then try and use
937937
dnl "ad_strip" as the symbol for the entry point.
938938
if test x$TARGET_OS = xdarwin; then
939-
AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip"],, [[$LDFLAG_WERROR]])
940-
AX_CHECK_LINK_FLAG([[-Wl,-dead_strip_dylibs]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip_dylibs"],, [[$LDFLAG_WERROR]])
941-
AX_CHECK_LINK_FLAG([[-Wl,-bind_at_load]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-bind_at_load"],, [[$LDFLAG_WERROR]])
939+
AX_CHECK_LINK_FLAG([-Wl,-dead_strip], [LDFLAGS="$LDFLAGS -Wl,-dead_strip"], [], [$LDFLAG_WERROR])
940+
AX_CHECK_LINK_FLAG([-Wl,-dead_strip_dylibs], [LDFLAGS="$LDFLAGS -Wl,-dead_strip_dylibs"], [], [$LDFLAG_WERROR])
941+
AX_CHECK_LINK_FLAG([-Wl,-bind_at_load], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-bind_at_load"], [], [$LDFLAG_WERROR])
942942
fi
943943

944944
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])
@@ -1274,10 +1274,9 @@ if test "x$enable_fuzz" = "xyes"; then
12741274

12751275
AC_MSG_CHECKING([whether main function is needed for fuzz binary])
12761276
AX_CHECK_LINK_FLAG(
1277-
[[-fsanitize=$use_sanitizers]],
1277+
[-fsanitize=$use_sanitizers],
12781278
[AC_MSG_RESULT([no])],
1279-
[AC_MSG_RESULT([yes])
1280-
CPPFLAGS="$CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"],
1279+
[AC_MSG_RESULT([yes]); CPPFLAGS="$CPPFLAGS -DPROVIDE_FUZZ_MAIN_FUNCTION"],
12811280
[],
12821281
[AC_LANG_PROGRAM([[
12831282
#include <cstdint>
@@ -1452,7 +1451,7 @@ dnl Check for reduced exports
14521451
if test x$use_reduce_exports = xyes; then
14531452
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[CXXFLAGS="$CXXFLAGS -fvisibility=hidden"],
14541453
[AC_MSG_ERROR([Cannot set hidden symbol visibility. Use --disable-reduce-exports.])],[[$CXXFLAG_WERROR]])
1455-
AX_CHECK_LINK_FLAG([[-Wl,--exclude-libs,ALL]],[RELDFLAGS="-Wl,--exclude-libs,ALL"],,[[$LDFLAG_WERROR]])
1454+
AX_CHECK_LINK_FLAG([-Wl,--exclude-libs,ALL], [RELDFLAGS="-Wl,--exclude-libs,ALL"], [], [$LDFLAG_WERROR])
14561455
fi
14571456

14581457
if test x$use_tests = xyes; then

0 commit comments

Comments
 (0)