From patchwork Tue Feb 28 11:25:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Barcelo X-Patchwork-Id: 143437 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9BDA3B6EEE for ; Tue, 28 Feb 2012 22:59:55 +1100 (EST) Received: from localhost ([::1]:54613 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2LDP-0004Uu-03 for incoming@patchwork.ozlabs.org; Tue, 28 Feb 2012 06:27:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2LCS-000291-Le for qemu-devel@nongnu.org; Tue, 28 Feb 2012 06:26:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2LCM-0007Ve-5O for qemu-devel@nongnu.org; Tue, 28 Feb 2012 06:26:32 -0500 Received: from mail-ww0-f53.google.com ([74.125.82.53]:37141) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2LCL-0007VV-SH for qemu-devel@nongnu.org; Tue, 28 Feb 2012 06:26:26 -0500 Received: by wgbdr1 with SMTP id dr1so2840709wgb.10 for ; Tue, 28 Feb 2012 03:26:23 -0800 (PST) Received-SPF: pass (google.com: domain of alex.barcelo@gmail.com designates 10.180.14.73 as permitted sender) client-ip=10.180.14.73; Authentication-Results: mr.google.com; spf=pass (google.com: domain of alex.barcelo@gmail.com designates 10.180.14.73 as permitted sender) smtp.mail=alex.barcelo@gmail.com; dkim=pass header.i=alex.barcelo@gmail.com Received: from mr.google.com ([10.180.14.73]) by 10.180.14.73 with SMTP id n9mr37719700wic.16.1330428383780 (num_hops = 1); Tue, 28 Feb 2012 03:26:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=OTlckhb2V5ALMCE+8wWG0mJi8LbtVryt9d7V0Pjnl2o=; b=Nks1Dnoo6qjy+1c1AFJLkrNNKESQS/Z1uVJu+qjIGJJ+xFioXT+PrAObCsrL2kWnSA PbmFI3+0Fuy+9zvTtc05bscju72fIRRclpG8NZLz3DYspj8JLFbd4MIu1/SN60AunyUB R7qq5d8QaSqidlBimP7iV9KPqtsilKXBIQ7wo= Received: by 10.180.14.73 with SMTP id n9mr29869336wic.16.1330428383705; Tue, 28 Feb 2012 03:26:23 -0800 (PST) Received: from localhost.localdomain (62.57.1.36.dyn.user.ono.com. [62.57.1.36]) by mx.google.com with ESMTPS id s2sm69580022wix.3.2012.02.28.03.26.21 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Feb 2012 03:26:22 -0800 (PST) From: Alex Barcelo To: qemu-devel@nongnu.org, Kevin Wolf Date: Tue, 28 Feb 2012 12:25:50 +0100 Message-Id: <1330428351-6605-3-git-send-email-abarcelo@ac.upc.edu> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1330428351-6605-1-git-send-email-abarcelo@ac.upc.edu> References: <1330428351-6605-1-git-send-email-abarcelo@ac.upc.edu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.53 Cc: Alex Barcelo Subject: [Qemu-devel] [PATCH v2 2/3] coroutine: adding configure choose mechanism for coroutine backend X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Configure tries, as a default, ucontext functions for the coroutines. But now the user can force another backend by --with-coroutine=BACKEND option v2: Using --with-coroutine=BACKEND instead of enable disable individual configure options Signed-off-by: Alex Barcelo --- configure | 37 +++++++++++++++++++++++++++++-------- 1 files changed, 29 insertions(+), 8 deletions(-) diff --git a/configure b/configure index f9d5330..5a12c56 100755 --- a/configure +++ b/configure @@ -191,6 +191,7 @@ opengl="" zlib="yes" guest_agent="yes" libiscsi="" +coroutine="" # parse CC options first for opt do @@ -771,6 +772,8 @@ for opt do ;; --with-pkgversion=*) pkgversion=" ($optarg)" ;; + --with-coroutine=*) coroutine="$optarg" + ;; --disable-docs) docs="no" ;; --enable-docs) docs="yes" @@ -1095,6 +1098,8 @@ echo " --disable-usb-redir disable usb network redirection support" echo " --enable-usb-redir enable usb network redirection support" echo " --disable-guest-agent disable building of the QEMU Guest Agent" echo " --enable-guest-agent enable building of the QEMU Guest Agent" +echo " --with-coroutine=BACKEND coroutine backend. Supported options:" +echo " gthread, ucontext, windows" echo "" echo "NOTE: The object files are built at the place where configure is launched" exit 1 @@ -2722,21 +2727,36 @@ EOF fi ########################################## -# check if we have makecontext -# (and that it's not a glibc stub which always returns -1) +# check and set a backend for coroutine -ucontext_coroutine=no -if test "$darwin" != "yes"; then - cat > $TMPC << EOF +# default is ucontext, but always fallback to gthread +# windows autodetected by make +if test "$coroutine" = "" -o "$coroutine" = "ucontext"; then + if test "$darwin" != "yes"; then + cat > $TMPC << EOF #include #ifdef __stub_makecontext #error Ignoring glibc stub makecontext which will always fail #endif int main(void) { makecontext(0, 0, 0); return 0; } EOF - if compile_prog "" "" ; then - ucontext_coroutine=yes + if compile_prog "" "" ; then + coroutine_backend=ucontext + else + coroutine_backend=gthread + fi + else + echo "Silently falling back into gthread backend under darwin" fi +elif test "$coroutine" = "gthread" ; then + coroutine_backend=gthread +elif test "$coroutine" = "windows" ; then + coroutine_backend=windows +else + echo + echo "Error: unknown coroutine backend $coroutine" + echo + exit 1 fi ########################################## @@ -2930,6 +2950,7 @@ echo "usb net redir $usb_redir" echo "OpenGL support $opengl" echo "libiscsi support $libiscsi" echo "build guest agent $guest_agent" +echo "coroutine backend $coroutine_backend" if test "$sdl_too_old" = "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support" @@ -3251,7 +3272,7 @@ if test "$rbd" = "yes" ; then echo "CONFIG_RBD=y" >> $config_host_mak fi -if test "$ucontext_coroutine" = "yes" ; then +if test "$coroutine_backend" = "ucontext" ; then echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak fi