From: Paolo Bonzini <pbonzini@redhat.com>
To: Thomas Huth <thuth@redhat.com>, Owen LaGarde <olagarde@gmail.com>,
qemu-devel@nongnu.org
Subject: Re: configure --extra-cflags and --extra-ldflags values not propagating to meson?
Date: Mon, 25 Oct 2021 19:26:28 +0200 [thread overview]
Message-ID: <e5ae0f02-4e21-faa3-7ef1-8e95422be21f@redhat.com> (raw)
In-Reply-To: <a105f305-b1e8-f97a-fa09-f083190e34cb@redhat.com>
On 25/10/21 15:10, Thomas Huth wrote:
>
> I see a similar behavior with netmap now - I've got the corresponding
> header file in a non-standard directory, and up to commit
> 837b84b1c078bf3e909 it used to work fine to do:
>
> .../configure --enable-netmap \
> --extra-cflags=-I/path/to/netmap/sys
>
> but since the conversion to meson, this does not seem to work anymore.
>
> Paolo, any ideas?
Meson (intentionally) does not add QEMU_CFLAGS to cc.compiles/cc.links
tests, as they are supposed to be independent. This however is not
true of CFLAGS.
The fix should be to add --extra-cflags/--extra-ldflags to the c_args
and c_link_args of config-meson.cross, instead of adding them to
QEMU_CFLAGS/QEMU_LDFLAGS:
diff --git a/configure b/configure
index 99051f3254..94224b9931 100755
--- a/configure
+++ b/configure
@@ -174,14 +174,14 @@ update_cxxflags() {
compile_object() {
local_cflags="$1"
- do_cc $CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
+ do_cc $CFLAGS $EXTRA_CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
}
compile_prog() {
local_cflags="$1"
local_ldflags="$2"
- do_cc $CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC \
- $LDFLAGS $CONFIGURE_LDFLAGS $QEMU_LDFLAGS $local_ldflags
+ do_cc $CFLAGS $EXTRA_CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC \
+ $LDFLAGS $EXTRA_LDFLAGS $CONFIGURE_LDFLAGS $QEMU_LDFLAGS $local_ldflags
}
# symbolically link $1 to $2. Portable version of "ln -sf".
@@ -285,6 +285,9 @@ for opt do
esac
done
+EXTRA_CFLAGS=""
+EXTRA_LDFLAGS=""
+
xen_ctrl_version="$default_feature"
xfs="$default_feature"
membarrier="$default_feature"
@@ -357,13 +360,11 @@ for opt do
;;
--cpu=*) cpu="$optarg"
;;
- --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
- QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg"
+ --extra-cflags=*) EXTRA_CFLAGS="$EXTRA_CFLAGS $optarg"
;;
--extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
;;
- --extra-ldflags=*) QEMU_LDFLAGS="$QEMU_LDFLAGS $optarg"
- EXTRA_LDFLAGS="$optarg"
+ --extra-ldflags=*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS $optarg"
;;
--enable-debug-info) debug_info="yes"
;;
@@ -3508,10 +3509,10 @@ if test "$skip_meson" = no; then
test -z "$cxx" && echo "link_language = 'c'" >> $cross
echo "[built-in options]" >> $cross
- echo "c_args = [${CFLAGS:+$(meson_quote $CFLAGS)}]" >> $cross
- echo "cpp_args = [${CXXFLAGS:+$(meson_quote $CXXFLAGS)}]" >> $cross
- echo "c_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross
- echo "cpp_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross
+ echo "c_args = [${CFLAGS:+$(meson_quote $CFLAGS $EXTRA_CFLAGS)}]" >> $cross
+ echo "cpp_args = [${CXXFLAGS:+$(meson_quote $CXXFLAGS $EXTRA_CFLAGS)}]" >> $cross
+ echo "c_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS $EXTRA_LDFLAGS)}]" >> $cross
+ echo "cpp_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS $EXTRA_LDFLAGS)}]" >> $cross
echo "[binaries]" >> $cross
echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross
test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross
except that I haven't figured out the exact (current) behavior of
--extra-cxxflags. Also, it would require a re-configure of any tree that
includes --extra-cflags or --extra-ldflags.
Thanks,
Paolo
prev parent reply other threads:[~2021-10-25 17:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-22 11:20 configure --extra-cflags and --extra-ldflags values not propagating to meson? Owen LaGarde
2021-10-25 13:10 ` Thomas Huth
2021-10-25 17:26 ` Paolo Bonzini [this message]
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=e5ae0f02-4e21-faa3-7ef1-8e95422be21f@redhat.com \
--to=pbonzini@redhat.com \
--cc=olagarde@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@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).