From nobody Wed May  7 09:54:53 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1611918741; cv=none;
	d=zohomail.com; s=zohoarc;
	b=WKixS/IqgR7sGh7cVfwTeXSUq9LTRTSr0iAFKgHjbJkFVgP18VtiSgreGK3yYCv1ehGv4TfIG2HpOqqOqV8Jwfg6b055/Y7FO6BpSm4WSCqUsI1BiglrgA6UsAhsh2e2x7YFVBXYyKCpH3LmYsebbcztM6cDGEIidKYX4dzzeJg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1611918741;
 h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=zFshe6a9XOs+UpYhaoy/bCbUaTZ0COXMECt5cI7PQd8=;
	b=AFcDH0bVMjSOrJ5B9jtjXad10WhnLyY43wenr0i3xQSIZ9znRQF4UcoLdNAjC00W5SzqqzYQ4TSwTAS7Ok6/ruAGPGccRD2ZqcnlNt8ZFYHypxZLNUdXvOAk3CIX5qVRG2eKv9etOITPL+sc+o6KKGQlEptjIHovOiOrfVw0tS4=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1611918741179462.6558804060902;
 Fri, 29 Jan 2021 03:12:21 -0800 (PST)
Received: from localhost ([::1]:43696 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1l5RhM-0004eV-41
	for importer@patchew.org; Fri, 29 Jan 2021 06:12:20 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:59806)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1l5RW9-0004ck-S8
 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:45 -0500
Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:45856)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1l5RVx-0006zU-JH
 for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:45 -0500
Received: by mail-wr1-x432.google.com with SMTP id m13so8384001wro.12
 for <qemu-devel@nongnu.org>; Fri, 29 Jan 2021 03:00:29 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.27
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 29 Jan 2021 03:00:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=zFshe6a9XOs+UpYhaoy/bCbUaTZ0COXMECt5cI7PQd8=;
 b=yD4+BBLsRwM9XpgywxFDhTiYSby5V7R0G5WdUBdsYIuMS36w+UhTy6GwWCBgOUnZBW
 S+QPX9CtEdH6R3yJiHxv341fTGlf3ofCRZSOy5fNbYmJN3LoIyY3LpMkEouQYdd3/H+O
 FozKmNWJHyby6XAFf9bfcVUEmguvpeFyvWktnaWYY5/0TKwXx0YJdTcwbPbJM7opMViM
 d6JChUGvWOHC1WhU9jYP7NOaPakLoreA/dtsAfeuWFXPRJxrpUppkLzkCkgEmb2psUUO
 DaibqDKgW35tvRTY5DEdWuANR5/qSL739DGxLkQyVc+OqGdvKVYeLwCgygUQX/cDGXwA
 6HSQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=zFshe6a9XOs+UpYhaoy/bCbUaTZ0COXMECt5cI7PQd8=;
 b=P1GE52z/byD0M6WMDs0yivXmteC7DqCVy+CDacuRQotAh33fN+RSpacFicWLUMU4b0
 r63i+FvRoI8XSJUqAX++82DLGnyF4VVgSyhQirRJpnkkkWBm5rSpiFAI1ObqJZMKPLJx
 9GewPHNACcTWV2pTTthVy+n/pYCcS1PKJfKX5NSiV6KvDYojkD+445MBKdB2LnAhn01+
 E76jGvgedBPTiyMABLmiW9fjuAusdVbP7swQNCPN+Q9IVOymKpSq7udBhLZQZWlEL2/O
 O2pVtUqDXlAXIfYL3nLqFViqT0RY83kAmMOMS7d3+HTpH/wG3LAbzHkd5p+pTcBEy1hv
 homw==
X-Gm-Message-State: AOAM531Z35b1PkvCMiozj5Ket4QyuGyVcwVnjd8CyIYx2afsoIp2NpGs
 2wMhw7bKNEsk418b4F3B80xYH8OywSwFSA==
X-Google-Smtp-Source: 
 ABdhPJytGBSV6M4Dout4xPqTcitdIvuF5OU8ecgh/opSBelyZfewgzW6dx7V65b4kLDKLcx8NY2PDg==
X-Received: by 2002:adf:eb4e:: with SMTP id u14mr3882960wrn.99.1611918028674;
 Fri, 29 Jan 2021 03:00:28 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 15/46] darwin: detect CoreAudio for build
Date: Fri, 29 Jan 2021 10:59:41 +0000
Message-Id: <20210129110012.8660-16-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org>
References: <20210129110012.8660-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::432;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)

From: Joelle van Dyne <j@getutm.app>

On iOS there is no CoreAudio, so we should not assume Darwin always
has it.

Signed-off-by: Joelle van Dyne <j@getutm.app>
Reviewed-by: Philippe Mathieu-Daud=C3=A9 <f4bug@amsat.org>
Message-id: 20210126012457.39046-11-j@getutm.app
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 configure | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 5cf075ac60e..99bf6275087 100755
--- a/configure
+++ b/configure
@@ -319,6 +319,7 @@ fdt=3D"auto"
 netmap=3D"no"
 sdl=3D"auto"
 sdl_image=3D"auto"
+coreaudio=3D"auto"
 virtiofsd=3D"auto"
 virtfs=3D"auto"
 libudev=3D"auto"
@@ -778,7 +779,7 @@ Darwin)
     QEMU_CFLAGS=3D"-arch x86_64 $QEMU_CFLAGS"
     QEMU_LDFLAGS=3D"-arch x86_64 $QEMU_LDFLAGS"
   fi
-  audio_drv_list=3D"coreaudio try-sdl"
+  audio_drv_list=3D"try-coreaudio try-sdl"
   audio_possible_drivers=3D"coreaudio sdl"
   # Disable attempts to use ObjectiveC features in os/object.h since they
   # won't work when we're compiling with gcc as a C compiler.
@@ -3146,6 +3147,24 @@ EOF
   fi
 fi
=20
+##########################################
+# detect CoreAudio
+if test "$coreaudio" !=3D "no" ; then
+  coreaudio_libs=3D"-framework CoreAudio"
+  cat > $TMPC << EOF
+#include <CoreAudio/CoreAudio.h>
+int main(void)
+{
+  return (int)AudioGetCurrentHostTime();
+}
+EOF
+  if compile_prog "" "$coreaudio_libs" ; then
+    coreaudio=3Dyes
+  else
+    coreaudio=3Dno
+  fi
+fi
+
 ##########################################
 # Sound support libraries probe
=20
@@ -3202,8 +3221,20 @@ for drv in $audio_drv_list; do
     fi
     ;;
=20
-    coreaudio)
+    coreaudio | try-coreaudio)
+    if test "$coreaudio" =3D "no"; then
+      if test "$drv" =3D "try-coreaudio"; then
+        audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-coreaudi=
o//')
+      else
+        error_exit "$drv check failed" \
+                "Make sure to have the $drv is available."
+      fi
+    else
       coreaudio_libs=3D"-framework CoreAudio"
+      if test "$drv" =3D "try-coreaudio"; then
+        audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-coreaudi=
o/coreaudio/')
+      fi
+    fi
     ;;
=20
     dsound)
--=20
2.20.1