mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-25 14:49:20 +00:00
configure: factor out supported flag check
Factor out the function that checks if a compiler flag is supported or not. Backports commit 93b25869228a3c0c632a6aa66624cc4e549ba14a from qemu
This commit is contained in:
parent
d25e1a6216
commit
0aa640a303
1 changed files with 17 additions and 10 deletions
25
qemu/configure
vendored
25
qemu/configure
vendored
|
@ -268,6 +268,12 @@ EOF
|
||||||
compile_object
|
compile_object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
write_c_skeleton() {
|
||||||
|
cat > $TMPC <<EOF
|
||||||
|
int main(void) { return 0; }
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
if check_define __linux__ ; then
|
if check_define __linux__ ; then
|
||||||
targetos="Linux"
|
targetos="Linux"
|
||||||
elif check_define _WIN32 ; then
|
elif check_define _WIN32 ; then
|
||||||
|
@ -475,9 +481,7 @@ if test "$mingw32" = "yes" ; then
|
||||||
# enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
|
# enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
|
||||||
QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
|
QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
|
||||||
LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
|
LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
|
||||||
cat > $TMPC << EOF
|
write_c_skeleton;
|
||||||
int main(void) { return 0; }
|
|
||||||
EOF
|
|
||||||
if compile_prog "" "-liberty" ; then
|
if compile_prog "" "-liberty" ; then
|
||||||
LIBS="-liberty $LIBS"
|
LIBS="-liberty $LIBS"
|
||||||
fi
|
fi
|
||||||
|
@ -705,15 +709,18 @@ gcc_flags="-Wno-string-plus-int $gcc_flags"
|
||||||
# enable it for all configure tests. If a configure test failed due
|
# enable it for all configure tests. If a configure test failed due
|
||||||
# to -Werror this would just silently disable some features,
|
# to -Werror this would just silently disable some features,
|
||||||
# so it's too error prone.
|
# so it's too error prone.
|
||||||
cat > $TMPC << EOF
|
cc_has_warning_flag() {
|
||||||
int main(void) { return 0; }
|
write_c_skeleton;
|
||||||
EOF
|
|
||||||
for flag in $gcc_flags; do
|
|
||||||
# Use the positive sense of the flag when testing for -Wno-wombat
|
# Use the positive sense of the flag when testing for -Wno-wombat
|
||||||
# support (gcc will happily accept the -Wno- form of unknown
|
# support (gcc will happily accept the -Wno- form of unknown
|
||||||
# warning options).
|
# warning options).
|
||||||
optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
|
optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
|
||||||
if compile_prog "-Werror $optflag" "" ; then
|
compile_prog "-Werror $optflag" ""
|
||||||
|
}
|
||||||
|
|
||||||
|
for flag in $gcc_flags; do
|
||||||
|
if cc_has_warning_flag $flag ; then
|
||||||
QEMU_CFLAGS="$QEMU_CFLAGS $flag"
|
QEMU_CFLAGS="$QEMU_CFLAGS $flag"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue