Only add flags to CFLAGS_FOR_BUILD if $CC and $CC_FOR_BUILD are the same.

Otherwise, just because a flag is appropriate for $CC, that doesn't
necessarily mean it's appropriate for $CFLAGS_FOR_BUILD.

(We don't use CFLAGS_FOR_BUILD for many things, so it's probably not
worth making a lot of effort to throw all the warning flags into it if
we're cross-compiling; we *do* throw them in for native compilation,
which is what most developers use and test with, so that should be
sufficient to let the warnings catch problems with the build tools we're
building.)

Change-Id: Iad9d611b4687e9e154f9871f741f3c8f3b307c88
Reviewed-on: https://code.wireshark.org/review/8026
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2015-04-11 21:07:24 -07:00
parent 6c34e9a844
commit 5f933e8560
2 changed files with 25 additions and 9 deletions

View File

@ -1675,10 +1675,14 @@ if test "x$ac_supports_gcc_flags" = "xyes" ; then
# just the new option.
#
CFLAGS="$CFLAGS_saved $GCC_OPTION"
#
# Add it to the flags we use when building build tools.
#
CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD $GCC_OPTION"
if test "$CC" = "$CC_FOR_BUILD"; then
#
# We're building the build tools with the same compiler
# with which we're building Wireshark, so add the flags
# to the flags for that compiler as well.
#
CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD $GCC_OPTION"
fi
],
[
AC_MSG_RESULT(yes)
@ -1691,10 +1695,14 @@ if test "x$ac_supports_gcc_flags" = "xyes" ; then
# just the new option.
#
CFLAGS="$CFLAGS_saved $GCC_OPTION"
#
# Add it to the flags we use when building build tools.
#
CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD $GCC_OPTION"
if test "$CC" = "$CC_FOR_BUILD"; then
#
# We're building the build tools with the same compiler
# with which we're building Wireshark, so add the flags
# to the flags for that compiler as well.
#
CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD $GCC_OPTION"
fi
fi
],
[

View File

@ -1284,7 +1284,15 @@ else
# documentation I can find online.
#
CFLAGS="-Ae +O2 $CFLAGS"
CFLAGS_FOR_BUILD="-Ae +O2 $CFLAGS"
if test "$CC" = "$CC_FOR_BUILD"; then
#
# We're building the build tools with the same
# compiler as the one with which we're building
# Wireshark, so add the flags to the flags for
# that compiler as well.
#
CFLAGS_FOR_BUILD="-Ae +O2 $CFLAGS"
fi
CXXFLAGS="+O2 $CFLAGS"
AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
;;