From: Paolo Bonzini <pbonzini@redhat.com> To: qemu-devel@nongnu.org Subject: [PULL 13/22] meson: cleanup curses/iconv test Date: Fri, 16 Oct 2020 07:48:05 -0400 Message-ID: <20201016114814.1564523-14-pbonzini@redhat.com> (raw) In-Reply-To: <20201016114814.1564523-1-pbonzini@redhat.com> Skip the test if it is system emulation is not requested, and differentiate errors for lack of iconv and lack of curses. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- meson.build | 85 ++++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 40 deletions(-) diff --git a/meson.build b/meson.build index c1c45e9845..15732f4701 100644 --- a/meson.build +++ b/meson.build @@ -455,40 +455,40 @@ if targetos == 'linux' and have_tools and not get_option('mpath').disabled() endif iconv = not_found -if not get_option('iconv').disabled() - libiconv = cc.find_library('iconv', - required: false, - static: enable_static) - if cc.links(''' - #include <iconv.h> - int main(void) { - iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); - return conv != (iconv_t) -1; - }''', dependencies: [libiconv]) - iconv = declare_dependency(dependencies: [libiconv]) - endif -endif -if get_option('iconv').enabled() and not iconv.found() - error('Cannot detect iconv API') -endif - curses = not_found -if iconv.found() and not get_option('curses').disabled() - curses_libname_list = ['ncursesw', 'ncurses', 'cursesw', 'pdcurses'] - curses_test = ''' - #include <locale.h> - #include <curses.h> - #include <wchar.h> - int main(void) { - wchar_t wch = L'w'; - setlocale(LC_ALL, ""); - resize_term(0, 0); - addwstr(L"wide chars\n"); - addnwstr(&wch, 1); - add_wch(WACS_DEGREE); - return 0; - }''' - foreach curses_libname : curses_libname_list +if have_system and not get_option('curses').disabled() + if not get_option('iconv').disabled() + libiconv = cc.find_library('iconv', + required: false, + static: enable_static) + if cc.links(''' + #include <iconv.h> + int main(void) { + iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); + return conv != (iconv_t) -1; + }''', dependencies: [libiconv]) + iconv = declare_dependency(dependencies: [libiconv]) + endif + endif + if get_option('iconv').enabled() and not iconv.found() + error('Cannot detect iconv API') + endif + if iconv.found() + curses_libname_list = ['ncursesw', 'ncurses', 'cursesw', 'pdcurses'] + curses_test = ''' + #include <locale.h> + #include <curses.h> + #include <wchar.h> + int main(void) { + wchar_t wch = L'w'; + setlocale(LC_ALL, ""); + resize_term(0, 0); + addwstr(L"wide chars\n"); + addnwstr(&wch, 1); + add_wch(WACS_DEGREE); + return 0; + }''' + foreach curses_libname : curses_libname_list libcurses = dependency(curses_libname, required: false, method: 'pkg-config', @@ -510,13 +510,18 @@ if iconv.found() and not get_option('curses').disabled() break endif endif - endforeach -endif -if get_option('curses').enabled() and not curses.found() - if not iconv.found() - error('Cannot detect iconv API') - else - error('Cannot detect curses API') + endforeach + endif + if not curses.found() + if iconv.found() + if get_option('curses').enabled() + error('Cannot find curses') + endif + elif get_option('curses').enabled() + error('iconv required for curses UI but not available') + else + warning('iconv required for curses UI but not available, disabling') + endif endif endif -- 2.26.2
next prev parent reply index Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-16 11:47 [PULL 00/22] Build system + misc changes for 2020-10-16 Paolo Bonzini 2020-10-16 11:47 ` [PULL 01/22] submodules: bump meson to 0.55.3 Paolo Bonzini 2020-10-16 11:47 ` [PULL 02/22] Makefile: Ensure cscope.out/tags/TAGS are generated in the source tree Paolo Bonzini 2020-10-16 11:47 ` [PULL 03/22] tests/Makefile.include: unbreak non-tcg builds Paolo Bonzini 2020-10-16 11:47 ` [PULL 04/22] make: run shell with pipefail Paolo Bonzini 2020-10-16 11:47 ` [PULL 05/22] tests: add missing generated sources to testqapi Paolo Bonzini 2020-10-16 11:47 ` [PULL 06/22] configure: move QEMU_INCLUDES to meson Paolo Bonzini 2020-10-16 11:47 ` [PULL 07/22] dockerfiles: enable Centos 8 PowerTools Paolo Bonzini 2020-10-16 11:48 ` [PULL 08/22] add ninja to dockerfiles, CI configurations and test VMs Paolo Bonzini 2020-10-16 11:48 ` [PULL 09/22] build: cleanups to Makefile Paolo Bonzini 2020-10-16 11:48 ` [PULL 10/22] build: replace ninjatool with ninja Paolo Bonzini 2020-10-16 11:48 ` [PULL 11/22] build: add --enable/--disable-libudev Paolo Bonzini 2020-10-16 11:48 ` [PULL 12/22] meson.build: don't condition iconv detection on library detection Paolo Bonzini 2020-10-16 11:48 ` Paolo Bonzini [this message] 2020-10-16 11:48 ` [PULL 14/22] configure: fix handling of --docdir parameter Paolo Bonzini 2020-10-16 11:48 ` [PULL 15/22] meson: Only install icons and qemu.desktop if have_system Paolo Bonzini 2020-10-16 11:48 ` [PULL 16/22] docs: Fix Sphinx configuration for msys2/mingw Paolo Bonzini 2020-10-16 11:48 ` [PULL 17/22] meson: move SPHINX_ARGS references within "if build_docs" Paolo Bonzini 2020-10-16 11:48 ` [PULL 18/22] meson: Move the detection logic for sphinx to meson Paolo Bonzini 2020-10-16 13:27 ` 罗勇刚(Yonggang Luo) 2020-10-19 19:40 ` Eric Blake 2020-10-16 11:48 ` [PULL 19/22] cirrus: Enable doc build on msys2/mingw Paolo Bonzini 2020-10-16 11:48 ` [PULL 20/22] fuzz: Disable QEMU's SIG{INT,HUP,TERM} handlers Paolo Bonzini 2020-10-16 11:48 ` [PULL 21/22] hax: unbreak accelerator cpu code after cpus.c split Paolo Bonzini 2020-10-16 11:48 ` [PULL 22/22] ci: include configure and meson logs in all jobs if configure fails 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=20201016114814.1564523-14-pbonzini@redhat.com \ --to=pbonzini@redhat.com \ --cc=qemu-devel@nongnu.org \ /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
QEMU-Devel Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git git clone --mirror https://lore.kernel.org/qemu-devel/2 qemu-devel/git/2.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \ qemu-devel@nongnu.org public-inbox-index qemu-devel Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git