diff options
-rw-r--r-- | acinclude.m4 | 44 | ||||
-rw-r--r-- | configure.ac | 22 |
2 files changed, 17 insertions, 49 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 66615b354a..52e5b967f9 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1553,35 +1553,25 @@ AC_DEFUN([AC_WIRESHARK_GEOIP_CHECK], # # $1 : ldflag(s) to test # -# If we've determined that the compiler supports "-Wl,{option}" to -# pass options through to the linker, we use that to attempt to -# compile with the defined ldflags. The defined flags are added to -# LDFLAGS only if the compilation succeeds. -# -# XXX - not all flags passed to AC_WIRESHARK_LDFLAGS_CHECK are -# -Wl,{option} flags; should we just try the flag without bothering -# to check whether -Wl,{option} is supported? +# We attempt to compile and link a test program with the specified linker +# flag. The defined flag is added to LDFLAGS only if the link succeeds. # AC_DEFUN([AC_WIRESHARK_LDFLAGS_CHECK], -[GCC_OPTION="$1" -AC_MSG_CHECKING(whether we can add $GCC_OPTION to LDFLAGS) -if test "x$ac_supports_W_linker_passthrough" = "xyes"; then - LDFLAGS_saved="$LDFLAGS" - LDFLAGS="$LDFLAGS $GCC_OPTION" - AC_LINK_IFELSE([ - AC_LANG_SOURCE([[ - main() { return; } - ]])], - [ - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_RESULT(no) - LDFLAGS="$LDFLAGS_saved" - ]) -else - AC_MSG_RESULT(no) -fi +[LD_OPTION="$1" +AC_MSG_CHECKING(whether we can add $LD_OPTION to LDFLAGS) +LDFLAGS_saved="$LDFLAGS" +LDFLAGS="$LDFLAGS $LD_OPTION" +AC_LINK_IFELSE( + [ + AC_LANG_SOURCE([[main() { return; }]]) + ], + [ + AC_MSG_RESULT(yes) + ], + [ + AC_MSG_RESULT(no) + LDFLAGS="$LDFLAGS_saved" + ]) ]) dnl diff --git a/configure.ac b/configure.ac index ee431db579..15f910c59b 100644 --- a/configure.ac +++ b/configure.ac @@ -216,28 +216,6 @@ if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then ac_supports_gcc_flags=yes fi -# -# Set "ac_supports_W_linker_passthrough" if the compiler is known to -# support "-Wl,{options}" to pass options through to the linker. -# Currently, we assume GCC, xlc, and clang do; other compilers should -# be added here. -# -if test "x$GCC" = "xyes" -o "x$CC" = "xxlc" -o "x$CC" = "xclang" ; then - ac_supports_W_linker_passthrough=yes -fi - -# -# Set "ac_supports_W_linker_passthrough" if the compiler is known to -# support "-Wl,{option}" to pass options through to the linker. -# Currently, we assume GCC and clang do; other compilers should -# be added here. -# -# XXX - do this with a compiler test? -# -if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then - ac_supports_W_linker_passthrough=yes -fi - if test "x$CC_FOR_BUILD" = x then CC_FOR_BUILD=$CC |