On Sat, Oct 3, 2020 at 4:43 PM Paolo Bonzini wrote: > > On 03/10/20 10:29, 罗勇刚(Yonggang Luo) wrote: > > For some meson script like this: > > curses = not_found > > if iconv.found() and not get_option('curses').disabled() > > curses_libname_list = ['ncursesw', 'ncurses', 'cursesw', 'pdcurses'] > > curses_test = ''' > > #include > > #include > > #include > > 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', > > static: enable_static) > > > > if not libcurses.found() > > dirs = ['/usr/include/ncursesw'] > > if targetos == 'windows' > > dirs = [] > > endif > > libcurses = cc.find_library(curses_libname, > > required: false, > > dirs: dirs, > > static: enable_static) > > endif > > if libcurses.found() > > if cc.links(curses_test, dependencies: [libcurses]) > > curses = declare_dependency(compile_args: > > '-DNCURSES_WIDECHAR', dependencies: [libcurses]) > > break > > endif > > endif > > endforeach > > endif > > > > We also need to define extra compile_args '-DNCURSES_WIDECHAR' as the > > part of dependencies. > > You can do that with #define before including . Yeap, but the -DNCURSES_WIDECHAR not only used for testing compile of #include but also as a dependencies of qemu. > > Paolo > -- 此致 礼 罗勇刚 Yours sincerely, Yonggang Luo