From patchwork Wed Aug 22 11:23:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Natanael Copa X-Patchwork-Id: 179301 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 AA15C2C0096 for ; Wed, 22 Aug 2012 21:24:29 +1000 (EST) Received: from localhost ([::1]:39323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T492x-0000uX-5N for incoming@patchwork.ozlabs.org; Wed, 22 Aug 2012 07:24:27 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T492l-0000tN-Et for qemu-devel@nongnu.org; Wed, 22 Aug 2012 07:24:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T492f-0008Gy-Fc for qemu-devel@nongnu.org; Wed, 22 Aug 2012 07:24:15 -0400 Received: from mail-ey0-f173.google.com ([209.85.215.173]:45660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T492f-0008Gq-9j for qemu-devel@nongnu.org; Wed, 22 Aug 2012 07:24:09 -0400 Received: by eaac13 with SMTP id c13so279906eaa.4 for ; Wed, 22 Aug 2012 04:24:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=yHfOUp7CXgrtCZXrMg+gFSCNTX2S/iawJuTtH+Q48Y0=; b=Dba5rkQmMxMKBvpjL4+cuXVKF5CAS3zwYOC/DC2ZAWAMtsN5liz9mYorrfzUkfak7u 5Ig3d7m1ya/eF7ks722KlA2h4AmIK8Nlgtv1FXjAV2aO56f7sWNMT6LVljgj51zFlnUe uFZEaHIbX0n5u8HPPpZaxbWDd5GsUecWtJXjHiktFaA04c0Zf9Zdw/OwjLb52gSp5SqC 7vQWie3Kqn4vEy13C8++sxZln0vuXhktKI1PvzNFFR8FpO6695/rNeDeCHzm1l1p0+ub fzmvbLrDSaRuYzX8NoQW99FcEjLOocBWWMp2YxDmoZHawLKT89wLqOuIGVWsP9UaxIgm Nk/Q== Received: by 10.14.202.66 with SMTP id c42mr18014323eeo.35.1345634646910; Wed, 22 Aug 2012 04:24:06 -0700 (PDT) Received: from ncdev.alpinelinux.org (ncdev.alpinelinux.org. [91.220.88.21]) by mx.google.com with ESMTPS id a7sm12051545eep.14.2012.08.22.04.24.06 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Aug 2012 04:24:06 -0700 (PDT) From: Natanael Copa To: qemu-devel@nongnu.org Date: Wed, 22 Aug 2012 11:23:15 +0000 Message-Id: <1345634595-9960-1-git-send-email-ncopa@alpinelinux.org> X-Mailer: git-send-email 1.7.12 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.215.173 Cc: Natanael Copa Subject: [Qemu-devel] [PATCH v4] configure: properly check if -lrt and -lm is needed 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 Fixes build against uClibc. uClibc provides 2 versions of clock_gettime(), one with realtime support and one without (this is so you can avoid linking in -lrt unless actually needed). This means that the clock_gettime() don't need -lrt. We still need it for timer_create() so we check for this function in addition. We also need check if -lm is needed for isnan(). Both -lm and -lrt are needed for libs_qga. Signed-off-by: Natanael Copa --- Changes v3->v4: - Use $pthread_lib from previous pthread test We don't need to add it to $LIBS since it should be there already configure | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/configure b/configure index edf9da4..31eee91 100755 --- a/configure +++ b/configure @@ -2624,17 +2624,49 @@ fi ########################################## +# Do we need libm +cat > $TMPC << EOF +#include +int main(void) { return isnan(sin(0.0)); } +EOF +if compile_prog "" "" ; then + : +elif compile_prog "" "-lm" ; then + LIBS="-lm $LIBS" + libs_qga="-lm $libs_qga" +else + echo + echo "Error: libm check failed" + echo + exit 1 +fi + +########################################## # Do we need librt +# uClibc provides 2 versions of clock_gettime(), one with realtime +# support and one without. This means that the clock_gettime() don't +# need -lrt. We still need it for timer_create() so we check for this +# function in addition. cat > $TMPC < #include -int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); } +int main(void) { + timer_create(CLOCK_REALTIME, NULL, NULL); + return clock_gettime(CLOCK_REALTIME, NULL); +} EOF if compile_prog "" "" ; then : -elif compile_prog "" "-lrt" ; then +# we need pthread for static linking. use previous pthread test result +elif compile_prog "" "-lrt $pthread_lib" ; then LIBS="-lrt $LIBS" + libs_qga="-lrt $libs_qga" +else + echo + echo "Error: librt check failed" + echo + exit 1 fi if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \