Don't check for -Wl,{option} support.

Not all AC_WIRESHARK_LDFLAGS_CHECK flags are -Wl,{option} flags, so
don't check for that first.  If we want to check for specific compilers
and linkers, we should do that, not for -Wl,{option} support.

Change-Id: Ib9581d4a1573a1ffa2493ce08e6d5845d2601352
Reviewed-on: https://code.wireshark.org/review/2755
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2014-07-01 12:46:38 -07:00
parent b378f72545
commit aa0f80981a
2 changed files with 17 additions and 49 deletions

View File

@ -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

View File

@ -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