public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, "Alex Bennée" <alex.bennee@linaro.org>
Subject: [PATCH kvm-unit-tests v2] configure: fix non-newlib cross-compiling
Date: Mon, 16 Jan 2017 17:07:06 +0100	[thread overview]
Message-ID: <20170116160706.8822-1-drjones@redhat.com> (raw)

Commit 529046c3 "libcflat: add PRI(dux)32 format types" applies a
detection trick that requires native compiling or cross-compiling
with newlib, an embedded system C standard library. We can avoid
the new dependency with a different trick.

Cc: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Andrew Jones <drjones@redhat.com>

---
v2: drop the awk magic and just grep for long, as not all compilers
    have long in the same place
---
 configure | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 127868ce3090..a05a4e3a5bc3 100755
--- a/configure
+++ b/configure
@@ -12,6 +12,7 @@ host=$arch
 cross_prefix=
 endian=""
 pretty_print_stacks=yes
+u32_long=
 
 usage() {
     cat <<-EOF
@@ -110,16 +111,11 @@ if [ -f $testdir/run ]; then
 fi
 
 # check if uint32_t needs a long format modifier
-cat << EOF > lib_test.c
-#include <inttypes.h>
+cat << EOF > lib-test.c
+__UINT32_TYPE__
 EOF
-
-$cross_prefix$cc lib_test.c -E | grep "typedef" | grep "long" | grep "uint32_t" &> /dev/null
-exit=$?
-if [ $exit -eq 0 ]; then
-    u32_long=true
-fi
-rm -f lib_test.c
+u32_long=$(gcc -E lib-test.c | grep -v '^#' | grep -q long && echo yes)
+rm -f lib-test.c
 
 # check for dependent 32 bit libraries
 if [ "$arch" != "arm" ]; then
-- 
2.9.3


             reply	other threads:[~2017-01-16 16:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 16:07 Andrew Jones [this message]
2017-01-17 11:54 ` [PATCH kvm-unit-tests v2] configure: fix non-newlib cross-compiling Alex Bennée
2017-01-17 12:36   ` Andrew Jones
2017-01-17 15:21     ` Alex Bennée
2017-01-17 15:55       ` Andrew Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170116160706.8822-1-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox