kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>
Subject: [kvm-unit-tests PATCH 1/4] configure: Add the possibility to specify additional cflags
Date: Tue, 22 Jun 2021 15:55:14 +0200	[thread overview]
Message-ID: <20210622135517.234801-2-thuth@redhat.com> (raw)
In-Reply-To: <20210622135517.234801-1-thuth@redhat.com>

For certain compilers or experiments, it might be necessary to
specify additional CFLAGS for the build. Let's add an option to
the configure script to specify such additional compiler flags.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 Makefile  |  3 ---
 configure | 10 ++++++++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 1afa90e..f7b9f28 100644
--- a/Makefile
+++ b/Makefile
@@ -22,9 +22,6 @@ DESTDIR := $(PREFIX)/share/kvm-unit-tests/
 cc-option = $(shell if $(CC) -Werror $(1) -S -o /dev/null -xc /dev/null \
               > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
 
-#make sure env CFLAGS variable is not used
-CFLAGS =
-
 libcflat := lib/libcflat.a
 cflatobjs := \
 	lib/argv.o \
diff --git a/configure b/configure
index d21601f..c48ab3d 100755
--- a/configure
+++ b/configure
@@ -8,6 +8,7 @@ fi
 srcdir=$(cd "$(dirname "$0")"; pwd)
 prefix=/usr/local
 cc=gcc
+cflags=
 ld=ld
 objcopy=objcopy
 objdump=objdump
@@ -38,8 +39,9 @@ usage() {
 	    --target=TARGET        target platform that the tests will be running on (qemu or
 	                           kvmtool, default is qemu) (arm/arm64 only)
 	    --cross-prefix=PREFIX  cross compiler prefix
-	    --cc=CC		   c compiler to use ($cc)
-	    --ld=LD		   ld linker to use ($ld)
+	    --cc=CC                c compiler to use ($cc)
+	    --cflags=FLAGS         extra options to be passed to the c compiler
+	    --ld=LD                ld linker to use ($ld)
 	    --prefix=PREFIX        where to install things ($prefix)
 	    --endian=ENDIAN        endianness to compile for (little or big, ppc64 only)
 	    --[enable|disable]-pretty-print-stacks
@@ -100,6 +102,9 @@ while [[ "$1" = -* ]]; do
 	--cc)
 	    cc="$arg"
 	    ;;
+	--cflags)
+	    cflags="$arg"
+	    ;;
 	--ld)
 	    ld="$arg"
 	    ;;
@@ -316,6 +321,7 @@ ARCH=$arch
 ARCH_NAME=$arch_name
 PROCESSOR=$processor
 CC=$cross_prefix$cc
+CFLAGS=$cflags
 LD=$cross_prefix$ld
 OBJCOPY=$cross_prefix$objcopy
 OBJDUMP=$cross_prefix$objdump
-- 
2.27.0


  reply	other threads:[~2021-06-22 13:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 13:55 [kvm-unit-tests PATCH 0/4] Test compiling with Clang in the Travis-CI Thomas Huth
2021-06-22 13:55 ` Thomas Huth [this message]
2021-06-22 13:55 ` [kvm-unit-tests PATCH 2/4] powerpc: Probe whether the compiler understands -mabi=no-altivec Thomas Huth
2021-06-22 13:55 ` [kvm-unit-tests PATCH 3/4] lib/s390x: Fix the epsw inline assembly Thomas Huth
2021-06-22 14:12   ` Claudio Imbrenda
2021-06-22 16:40     ` Thomas Huth
2021-06-23  7:33   ` Janosch Frank
2021-06-22 13:55 ` [kvm-unit-tests PATCH 4/4] Test compilation with Clang on aarch64, ppc64le and s390x in Travis-CI Thomas Huth
2021-06-22 16:25 ` [kvm-unit-tests PATCH 0/4] Test compiling with Clang in the Travis-CI Paolo Bonzini

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=20210622135517.234801-2-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).