From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1tbZ-0000eF-EY for qemu-devel@nongnu.org; Tue, 01 Jul 2014 04:40:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1tbT-0002T2-3S for qemu-devel@nongnu.org; Tue, 01 Jul 2014 04:39:57 -0400 Received: from mail-we0-x22d.google.com ([2a00:1450:400c:c03::22d]:56079) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1tbS-0002So-Ta for qemu-devel@nongnu.org; Tue, 01 Jul 2014 04:39:51 -0400 Received: by mail-we0-f173.google.com with SMTP id t60so9284991wes.32 for ; Tue, 01 Jul 2014 01:39:50 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 1 Jul 2014 10:39:43 +0200 Message-Id: <1404203983-18304-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1404203983-18304-1-git-send-email-pbonzini@redhat.com> References: <1404203983-18304-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL v2 for-2.1 3/3] configure: Fix -lm test, so that tools can be compiled on hosts that require -lm List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy From: Alexey Kardashevskiy The existing test whether "-lm" needs to be included or not is insufficient as it reports false negative on Fedora20/ppc64. This happens because sin(0.0) is a constant value which compiler can safely throw away and therefore there is no need to add "-lm". As the result, qemu-nbd/qemu-io/qemu-img tools cannot compile. This adds a global variable and uses it in the test to prevent from optimization. Signed-off-by: Alexey Kardashevskiy [Use Peter's improvement on the test to fool LTO, and remove the now useless -lm addition in Makefile.target. - Paolo] Signed-off-by: Paolo Bonzini --- Makefile.target | 4 ---- configure | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile.target b/Makefile.target index 6089d29..137d0b0 100644 --- a/Makefile.target +++ b/Makefile.target @@ -163,10 +163,6 @@ dummy := $(call unnest-vars,.., \ all-obj-y += $(common-obj-y) all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y) -ifndef CONFIG_HAIKU -LIBS+=-lm -endif - # build either PROG or PROGW $(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a $(call LINK,$^) diff --git a/configure b/configure index 23ecb37..ed41eda 100755 --- a/configure +++ b/configure @@ -3453,7 +3453,7 @@ fi # Do we need libm cat > $TMPC << EOF #include -int main(void) { return isnan(sin(0.0)); } +int main(int argc, char **argv) { return isnan(sin((double)argc)); } EOF if compile_prog "" "" ; then : -- 1.8.3.1