mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-22 12:41:01 +00:00
configure: Never use 'uname' to identify target OS
For a very long time we have used 'uname -s' as our fallback if we don't identify the target OS using a compiler #define. This obviously doesn't work for cross-compilation, and we've had a comment suggesting we fix this in configure for a long time. Since we now have an exhaustive list of which OSes we can run on (thanks to commit 898be3e0415 making an unrecognized OS be a fatal error), we know which ones we're missing. Add check_define tests for the remaining OSes we support. The defines checked are based on ones we already use in the codebase for identifying the host OS (with the exception of GNU/kFreeBSD). We can now set bogus_os immediately rather than doing it later. We leave the comment about uname being bad untouched, since there is still a use of it for the fallback for unrecognized host CPU type. Backports commit 951fedfceeda1b09ac8aa1f5263288b65e13caca from qemu
This commit is contained in:
parent
9601f82746
commit
714781d9e0
24
qemu/configure
vendored
24
qemu/configure
vendored
|
@ -290,8 +290,22 @@ elif check_define __sun__ ; then
|
|||
targetos='SunOS'
|
||||
elif check_define __HAIKU__ ; then
|
||||
targetos='Haiku'
|
||||
elif check_define __FreeBSD__ ; then
|
||||
targetos='FreeBSD'
|
||||
elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then
|
||||
targetos='GNU/kFreeBSD'
|
||||
elif check_define __DragonFly__ ; then
|
||||
targetos='DragonFly'
|
||||
elif check_define __NetBSD__; then
|
||||
targetos='NetBSD'
|
||||
elif check_define __APPLE__; then
|
||||
targetos='Darwin'
|
||||
else
|
||||
targetos=$(uname -s)
|
||||
# This is a fatal error, but don't report it yet, because we
|
||||
# might be going to just print the --help text, or it might
|
||||
# be the result of a missing compiler.
|
||||
targetos='bogus'
|
||||
bogus_os='yes'
|
||||
fi
|
||||
|
||||
# Some host OSes need non-standard checks for which CPU to use.
|
||||
|
@ -462,12 +476,6 @@ Linux)
|
|||
linux="yes"
|
||||
supported_os="yes"
|
||||
;;
|
||||
*)
|
||||
# This is a fatal error, but don't report it yet, because we
|
||||
# might be going to just print the --help text, or it might
|
||||
# be the result of a missing compiler.
|
||||
bogus_os="yes"
|
||||
;;
|
||||
esac
|
||||
|
||||
: ${make=${MAKE-make}}
|
||||
|
@ -713,7 +721,7 @@ if test "$bogus_os" = "yes"; then
|
|||
# the compiler works (so the results of the check_defines we used
|
||||
# to identify the OS are reliable), if we didn't recognize the
|
||||
# host OS we should stop now.
|
||||
error_exit "Unrecognized host OS $targetos"
|
||||
error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
|
||||
fi
|
||||
|
||||
gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
|
||||
|
|
Loading…
Reference in a new issue