1
mirror of https://github.com/mpv-player/mpv synced 2024-08-04 14:59:58 +02:00

configure: Separate compiler warning flags from other flags

This allows setting some warning flags for C but not for C++ and fixes
a bunch of warnings that resulted from compiling C++ files with C-only
warning flags.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32173 b3059339-0415-0410-9bf9-f77b7e298cf2

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32227 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
diego 2010-09-11 23:30:52 +00:00 committed by Uoti Urpala
parent 44f851a3ed
commit 14ff4026c2

32
configure vendored
View File

@ -64,9 +64,9 @@ compile_check() {
echo >> "$TMPLOG"
cat "$source" >> "$TMPLOG"
echo >> "$TMPLOG"
echo "$_cc $source $CFLAGS $extra_cflags $_ld_static $extra_ldflags $libs_mplayer $libs_mencoder -o $TMPEXE $@" >> "$TMPLOG"
echo "$_cc $WARNFLAGS $WARN_CFLAGS $CFLAGS $source $extra_cflags $_ld_static $extra_ldflags $libs_mplayer $libs_mencoder -o $TMPEXE $@" >> "$TMPLOG"
rm -f "$TMPEXE"
$_cc $CFLAGS "$source" $extra_cflags $_ld_static $extra_ldflags $libs_mplayer $libs_mencoder -o "$TMPEXE" "$@" >> "$TMPLOG" 2>&1
$_cc $WARNFLAGS $WARN_CFLAGS $CFLAGS "$source" $extra_cflags $_ld_static $extra_ldflags $libs_mplayer $libs_mencoder -o "$TMPEXE" "$@" >> "$TMPLOG" 2>&1
TMPRES="$?"
echo >> "$TMPLOG"
echo >> "$TMPLOG"
@ -2422,11 +2422,13 @@ fi # if darwin && test "$cc_vendor" = "gnu" ; then
# Checking for CFLAGS
_install_strip="-s"
if test "$_profile" != "" || test "$_debug" != "" ; then
CFLAGS="-W -Wall -O2 $_march $_mcpu $_pipe $_debug $_profile"
CFLAGS="-O2 $_march $_mcpu $_pipe $_debug $_profile"
WARNFLAGS="-W -Wall"
_install_strip=
elif test -z "$CFLAGS" ; then
if test "$cc_vendor" = "intel" ; then
CFLAGS="-O2 $_march $_mcpu $_pipe -fomit-frame-pointer -wd167 -wd556 -wd144"
CFLAGS="-O2 $_march $_mcpu $_pipe -fomit-frame-pointer"
WARNFLAGS="-wd167 -wd556 -wd144"
elif test "$cc_vendor" = "sun" ; then
CFLAGS="-O2 $_march $_mcpu $_pipe -xc99 -xregs=frameptr"
elif test "$cc_vendor" = "clang"; then
@ -2434,7 +2436,8 @@ elif test -z "$CFLAGS" ; then
elif test "$cc_vendor" != "gnu" ; then
CFLAGS="-O2 $_march $_mcpu $_pipe"
else
CFLAGS="-Wall -Wno-switch -Wno-parentheses -Wpointer-arith -Wredundant-decls -O2 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
CFLAGS="-O2 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
WARNFLAGS="-Wall -Wno-switch -Wno-parentheses -Wpointer-arith -Wredundant-decls"
extra_ldflags="$extra_ldflags -ffast-math"
fi
else
@ -2442,12 +2445,15 @@ else
fi
if test "$cc_vendor" = "gnu" ; then
cflag_check -std=gnu99 && CFLAGS="-std=gnu99 $CFLAGS"
cflag_check -Wno-pointer-sign && CFLAGS="-Wno-pointer-sign $CFLAGS"
cflag_check -Wdisabled-optimization && CFLAGS="-Wdisabled-optimization $CFLAGS"
cflag_check -Wundef && CFLAGS="-Wundef $CFLAGS"
cflag_check -Wmissing-prototypes && CFLAGS="-Wmissing-prototypes $CFLAGS"
cflag_check -Wstrict-prototypes && CFLAGS="-Wstrict-prototypes $CFLAGS"
cflag_check -Wundef && WARNFLAGS="-Wundef $WARNFLAGS"
# -std=gnu99 is not a warning flag but is placed in WARN_CFLAGS because
# that's the only variable specific to C now, and this option is not valid
# for C++.
cflag_check -std=gnu99 && WARN_CFLAGS="-std=gnu99 $WARN_CFLAGS"
cflag_check -Wno-pointer-sign && WARN_CFLAGS="-Wno-pointer-sign $WARN_CFLAGS"
cflag_check -Wdisabled-optimization && WARN_CFLAGS="-Wdisabled-optimization $WARN_CFLAGS"
cflag_check -Wmissing-prototypes && WARN_CFLAGS="-Wmissing-prototypes $WARN_CFLAGS"
cflag_check -Wstrict-prototypes && WARN_CFLAGS="-Wstrict-prototypes $WARN_CFLAGS"
else
CFLAGS="-D_ISOC99_SOURCE -D_BSD_SOURCE $CFLAGS"
fi
@ -7768,8 +7774,8 @@ INSTALL = $_install
INSTALLSTRIP = $_install_strip
WINDRES = $_windres
CFLAGS = $CFLAGS $extra_cflags
CXXFLAGS = $CXXFLAGS $extra_cflags $extra_cxxflags
CFLAGS = $WARNFLAGS $WARN_CFLAGS $CFLAGS $extra_cflags
CXXFLAGS = $WARNFLAGS $CXXFLAGS $extra_cflags $extra_cxxflags
DEPFLAGS = $DEPFLAGS
CFLAGS_DHAHELPER = $cflags_dhahelper