[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 37/46] meson: get glib compilation flags from GLIB_CFLAGS
From: |
Paolo Bonzini |
Subject: |
[PULL 37/46] meson: get glib compilation flags from GLIB_CFLAGS |
Date: |
Fri, 4 Sep 2020 07:41:13 -0400 |
The glib compilation flags were added to QEMU_CFLAGS. While we still
want them to be added to all compilation commands (at least for now),
do that via GLIB_CFLAGS rather than via QEMU_CFLAGS. This shows that
glib is a special case and makes it clearer that QEMU_CFLAGS is only
about compiler commands and not dependencies.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 19 +++++++++----------
meson.build | 7 +++++--
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/configure b/configure
index ca9a6eca93..e63b356234 100755
--- a/configure
+++ b/configure
@@ -3742,24 +3742,23 @@ if test "$plugins" = yes; then
glib_modules="$glib_modules gmodule-2.0"
fi
-# This workaround is required due to a bug in pkg-config file for glib as it
-# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
-
-if test "$static" = yes && test "$mingw32" = yes; then
- QEMU_CFLAGS="-DGLIB_STATIC_COMPILATION $QEMU_CFLAGS"
-fi
-
for i in $glib_modules; do
if $pkg_config --atleast-version=$glib_req_ver $i; then
glib_cflags=$($pkg_config --cflags $i)
glib_libs=$($pkg_config --libs $i)
- QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS"
LIBS="$glib_libs $LIBS"
else
error_exit "glib-$glib_req_ver $i is required to compile QEMU"
fi
done
+# This workaround is required due to a bug in pkg-config file for glib as it
+# doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
+
+if test "$static" = yes && test "$mingw32" = yes; then
+ glib_cflags="-DGLIB_STATIC_COMPILATION $glib_cflags"
+fi
+
if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
gio=yes
gio_cflags=$($pkg_config --cflags gio-2.0)
@@ -3794,7 +3793,7 @@ int main(void) {
}
EOF
-if ! compile_prog "$CFLAGS" "$LIBS" ; then
+if ! compile_prog "$glib_cflags" "$glib_libs" ; then
error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\
"You probably need to set PKG_CONFIG_LIBDIR"\
"to point to the right pkg-config files for your"\
@@ -3809,7 +3808,7 @@ EOF
if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
if cc_has_warning_flag "-Wno-unknown-attributes"; then
glib_cflags="-Wno-unknown-attributes $glib_cflags"
- QEMU_CFLAGS="-Wno-unknown-attributes $CFLAGS"
+ CFLAGS="-Wno-unknown-attributes $CFLAGS"
fi
fi
diff --git a/meson.build b/meson.build
index e62b304480..a10239cfa4 100644
--- a/meson.build
+++ b/meson.build
@@ -120,8 +120,11 @@ elif targetos == 'haiku'
cc.find_library('network'),
cc.find_library('bsd')]
endif
-glib = declare_dependency(compile_args: config_host['GLIB_CFLAGS'].split(),
- link_args: config_host['GLIB_LIBS'].split())
+# The path to glib.h is added to all compilation commands. This was
+# grandfathered in from the QEMU Makefiles.
+add_project_arguments(config_host['GLIB_CFLAGS'].split(),
+ native: false, language: ['c', 'cpp', 'objc'])
+glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split())
gio = not_found
if 'CONFIG_GIO' in config_host
gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
--
2.26.2
- [PULL 27/46] configure: remove dead code for in-tree builds, (continued)
- [PULL 27/46] configure: remove dead code for in-tree builds, Paolo Bonzini, 2020/09/04
- [PULL 28/46] meson: compute config_all_devices directly, Paolo Bonzini, 2020/09/04
- [PULL 29/46] Makefile: remove dead variables and includes, Paolo Bonzini, 2020/09/04
- [PULL 31/46] configure: move disassembler configuration to meson, Paolo Bonzini, 2020/09/04
- [PULL 32/46] configure: move C++ compiler handling to meson, Paolo Bonzini, 2020/09/04
- [PULL 33/46] meson: keep all compiler flags detection together, Paolo Bonzini, 2020/09/04
- [PULL 35/46] configure: remove unnecessary libm test, Paolo Bonzini, 2020/09/04
- [PULL 40/46] docs: suggest Meson replacements for various configure functions, Paolo Bonzini, 2020/09/04
- [PULL 41/46] configure: update dtc submodule, Paolo Bonzini, 2020/09/04
- [PULL 34/46] configure: move -ldl test to meson, Paolo Bonzini, 2020/09/04
- [PULL 37/46] meson: get glib compilation flags from GLIB_CFLAGS,
Paolo Bonzini <=
- [PULL 30/46] Makefile: inline the relevant parts of rules.mak, Paolo Bonzini, 2020/09/04
- [PULL 36/46] configure: do not look for install(1), Paolo Bonzini, 2020/09/04
- [PULL 39/46] configure: drop dead variables and functions, Paolo Bonzini, 2020/09/04
- [PULL 38/46] configure: do not include dependency flags in QEMU_CFLAGS and LIBS, Paolo Bonzini, 2020/09/04
- [PULL 43/46] meson: specify fuzz linker script as a project arg, Paolo Bonzini, 2020/09/04
- [PULL 46/46] meson: remove linkage of sdl to baum, Paolo Bonzini, 2020/09/04
- [PULL 44/46] fuzz: Add support for custom fuzzing library, Paolo Bonzini, 2020/09/04
- [PULL 45/46] meson: Convert undefsym.sh to undefsym.py, Paolo Bonzini, 2020/09/04
- [PULL 42/46] oss-fuzz: fix rpath, Paolo Bonzini, 2020/09/04
- Re: [PULL 00/46] Next round of Meson bugfixes and cleanups, Peter Maydell, 2020/09/06