From nobody Tue May 7 06:45:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499959071596889.8936822600433; Thu, 13 Jul 2017 08:17:51 -0700 (PDT) Received: from localhost ([::1]:60626 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVfs8-0007KB-GY for importer@patchew.org; Thu, 13 Jul 2017 11:17:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVfq8-00064Z-Sk for qemu-devel@nongnu.org; Thu, 13 Jul 2017 11:15:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVfq4-0005tn-Hw for qemu-devel@nongnu.org; Thu, 13 Jul 2017 11:15:40 -0400 Received: from orth.archaic.org.uk ([81.2.115.148]:48452) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVfq4-0005sa-7u; Thu, 13 Jul 2017 11:15:36 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1dVfq1-00061b-8L; Thu, 13 Jul 2017 16:15:33 +0100 From: Peter Maydell To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org Date: Thu, 13 Jul 2017 16:15:32 +0100 Message-Id: <1499958932-23839-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 81.2.115.148 Subject: [Qemu-devel] [PATCH] configure: Never use 'uname' to identify target OS X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- All of these OSes except OSX are on the "not actually supported" list, so I don't care very much if we break them. I did sanity check FreeBSD and NetBSD which are the two most plausible ones to get back into supported status. configure | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 5096cbc..d733a05 100755 --- a/configure +++ b/configure @@ -536,8 +536,24 @@ elif check_define __sun__ ; then targetos=3D'SunOS' elif check_define __HAIKU__ ; then targetos=3D'Haiku' +elif check_define __FreeBSD__ ; then + targetos=3D'FreeBSD' +elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then + targetos=3D'GNU/kFreeBSD' +elif check_define __DragonFly__ ; then + targetos=3D'DragonFly' +elif check_define __NetBSD__; then + targetos=3D'NetBSD' +elif check_define __APPLE__; then + targetos=3D'Darwin' +elif check_define _AIX; then + targetos=3D'AIX' else - targetos=3D$(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=3D'bogus' + bogus_os=3D'yes' fi =20 # Some host OSes need non-standard checks for which CPU to use. @@ -781,12 +797,6 @@ Linux) QEMU_INCLUDES=3D"-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QE= MU_INCLUDES" supported_os=3D"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=3D"yes" -;; esac =20 if [ "$bsd" =3D "yes" ] ; then @@ -1576,7 +1586,7 @@ if test "$bogus_os" =3D "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 =20 gcc_flags=3D"-Wold-style-declaration -Wold-style-definition -Wtype-limits" --=20 2.7.4