Message ID | 20201014082149.26853-6-kraxel@redhat.com |
---|---|
State | New |
Headers | show |
Series | Ui 20201014 patches | expand |
On Wed, 2020-10-14 at 10:21 +0200, Gerd Hoffmann wrote: > From: Yonggang Luo <luoyonggang@gmail.com> > > The mingw pkg-config are showing following absolute path and contains > : as the separator, > > -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC:/CI- > Tools/msys64/mingw64/include/ncursesw:-I/usr/include/ncursesw: > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC > -pipe -lncursesw -lgnurx -ltre -lintl -liconv > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC > -lncursesw > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC > -lcursesw > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -pipe > -lncursesw -lgnurx -ltre -lintl -liconv > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw > -lncursesw > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw > -lcursesw > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -pipe -lncursesw -lgnurx > -ltre -lintl -liconv > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -lncursesw > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -lcursesw > > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> > Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> > Message-id: 20201012234348.1427-6-luoyonggang@gmail.com > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > --- > configure | 118 +++----------------------------------------- > -- > meson_options.txt | 4 ++ > meson.build | 83 +++++++++++++++++++++++++++----- > ui/meson.build | 2 +- > 4 files changed, 83 insertions(+), 124 deletions(-) > > diff --git a/configure b/configure > index 9a87685517ee..f839c2a557c3 100755 > --- a/configure > +++ b/configure > @@ -295,7 +295,8 @@ unset target_list_exclude > > brlapi="" > curl="" > -curses="" > +iconv="auto" > +curses="auto" > docs="" > fdt="auto" > netmap="no" > @@ -1173,13 +1174,13 @@ for opt do > ;; > --disable-safe-stack) safe_stack="no" > ;; > - --disable-curses) curses="no" > + --disable-curses) curses="disabled" > ;; > - --enable-curses) curses="yes" > + --enable-curses) curses="enabled" > ;; > - --disable-iconv) iconv="no" > + --disable-iconv) iconv="disabled" > ;; > - --enable-iconv) iconv="yes" > + --enable-iconv) iconv="enabled" > ;; > --disable-curl) curl="no" > ;; > @@ -3440,102 +3441,6 @@ EOF > fi > fi > > -########################################## > -# iconv probe > -if test "$iconv" != "no" ; then > - cat > $TMPC << EOF > -#include <iconv.h> > -int main(void) { > - iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); > - return conv != (iconv_t) -1; > -} > -EOF > - iconv_prefix_list="/usr/local:/usr" > - iconv_lib_list=":-liconv" > - IFS=: > - for iconv_prefix in $iconv_prefix_list; do > - IFS=: > - iconv_cflags="-I$iconv_prefix/include" > - iconv_ldflags="-L$iconv_prefix/lib" > - for iconv_link in $iconv_lib_list; do > - unset IFS > - iconv_lib="$iconv_ldflags $iconv_link" > - echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> > config.log > - if compile_prog "$iconv_cflags" "$iconv_lib" ; then > - iconv_found=yes > - break > - fi > - done > - if test "$iconv_found" = yes ; then > - break > - fi > - done > - if test "$iconv_found" = "yes" ; then > - iconv=yes > - else > - if test "$iconv" = "yes" ; then > - feature_not_found "iconv" "Install iconv devel" > - fi > - iconv=no > - fi > -fi > - > -########################################## > -# curses probe > -if test "$iconv" = "no" ; then > - # curses will need iconv > - curses=no > -fi > -if test "$curses" != "no" ; then > - if test "$mingw32" = "yes" ; then > - curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" > - curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):- > lpdcurses" > - else > - curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):- > I/usr/include/ncursesw:" > - curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):- > lncursesw:-lcursesw" > - fi > - curses_found=no > - cat > $TMPC << EOF > -#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; > -} > -EOF > - IFS=: > - for curses_inc in $curses_inc_list; do > - # Make sure we get the wide character prototypes > - curses_inc="-DNCURSES_WIDECHAR $curses_inc" > - IFS=: > - for curses_lib in $curses_lib_list; do > - unset IFS > - if compile_prog "$curses_inc" "$curses_lib" ; then > - curses_found=yes > - break > - fi > - done > - if test "$curses_found" = yes ; then > - break > - fi > - done > - unset IFS > - if test "$curses_found" = "yes" ; then > - curses=yes > - else > - if test "$curses" = "yes" ; then > - feature_not_found "curses" "Install ncurses devel" > - fi > - curses=no > - fi > -fi > - > ########################################## > # curl probe > if test "$curl" != "no" ; then > @@ -6200,16 +6105,6 @@ if test "$have_x11" = "yes" && test > "$need_x11" = "yes"; then > echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak > echo "X11_LIBS=$x11_libs" >> $config_host_mak > fi > -if test "$iconv" = "yes" ; then > - echo "CONFIG_ICONV=y" >> $config_host_mak > - echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak > - echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak > -fi > -if test "$curses" = "yes" ; then > - echo "CONFIG_CURSES=y" >> $config_host_mak > - echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak > - echo "CURSES_LIBS=$curses_lib" >> $config_host_mak > -fi > if test "$pipe2" = "yes" ; then > echo "CONFIG_PIPE2=y" >> $config_host_mak > fi > @@ -7181,6 +7076,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \ > -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg > -Dvnc_png=$vnc_png \ > -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \ > -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \ > + -Diconv=$iconv -Dcurses=$curses \ > $cross_arg \ > "$PWD" "$source_path" > > diff --git a/meson_options.txt b/meson_options.txt > index 1d3c94840a90..e6cb1e589b4e 100644 > --- a/meson_options.txt > +++ b/meson_options.txt > @@ -32,6 +32,10 @@ option('cocoa', type : 'feature', value : 'auto', > description: 'Cocoa user interface (macOS only)') > option('mpath', type : 'feature', value : 'auto', > description: 'Multipath persistent reservation passthrough') > +option('iconv', type : 'feature', value : 'auto', > + description: 'Font glyph conversion support') > +option('curses', type : 'feature', value : 'auto', > + description: 'curses UI') > option('sdl', type : 'feature', value : 'auto', > description: 'SDL user interface') > option('sdl_image', type : 'feature', value : 'auto', > diff --git a/meson.build b/meson.build > index ad6c7c90c787..1a4a48249243 100644 > --- a/meson.build > +++ b/meson.build > @@ -426,6 +426,74 @@ if targetos == 'linux' and have_tools and not > get_option('mpath').disabled() > endif > endif > > +iconv = not_found > +if not get_option('iconv').disabled() > + libiconv = cc.find_library('iconv', > + required: false, > + static: enable_static) > + if libiconv.found() > + 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 > +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 > + 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 > +if get_option('curses').enabled() and not curses.found() > + if not iconv.found() > + error('Cannot detect iconv API') > + else > + error('Cannot detect curses API') > + endif > +endif > + > brlapi = not_found > if 'CONFIG_BRLAPI' in config_host > brlapi = declare_dependency(link_args: > config_host['BRLAPI_LIBS'].split()) > @@ -504,16 +572,6 @@ if 'CONFIG_X11' in config_host > x11 = declare_dependency(compile_args: > config_host['X11_CFLAGS'].split(), > link_args: > config_host['X11_LIBS'].split()) > endif > -curses = not_found > -if 'CONFIG_CURSES' in config_host > - curses = declare_dependency(compile_args: > config_host['CURSES_CFLAGS'].split(), > - link_args: > config_host['CURSES_LIBS'].split()) > -endif > -iconv = not_found > -if 'CONFIG_ICONV' in config_host > - iconv = declare_dependency(compile_args: > config_host['ICONV_CFLAGS'].split(), > - link_args: > config_host['ICONV_LIBS'].split()) > -endif > vnc = not_found > png = not_found > jpeg = not_found > @@ -622,6 +680,7 @@ config_host_data.set('CONFIG_COCOA', > cocoa.found()) > config_host_data.set('CONFIG_LIBUDEV', libudev.found()) > config_host_data.set('CONFIG_MPATH', mpathpersist.found()) > config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api) > +config_host_data.set('CONFIG_CURSES', curses.found()) > config_host_data.set('CONFIG_SDL', sdl.found()) > config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) > config_host_data.set('CONFIG_VNC', vnc.found()) > @@ -1905,8 +1964,8 @@ if config_host.has_key('CONFIG_NETTLE') > endif > summary_info += > {'libtasn1': config_host.has_key('CONFIG_TASN1')} > summary_info += > {'PAM': config_host.has_key('CONFIG_AUTH_PAM')} > -summary_info += {'iconv > support': config_host.has_key('CONFIG_ICONV')} > -summary_info += {'curses > support': config_host.has_key('CONFIG_CURSES')} > +summary_info += {'iconv support': iconv.found()} > +summary_info += {'curses support': curses.found()} > # TODO: add back version > summary_info += {'virgl > support': config_host.has_key('CONFIG_VIRGL')} > summary_info += {'curl > support': config_host.has_key('CONFIG_CURL')} > diff --git a/ui/meson.build b/ui/meson.build > index 8a080c38e325..78ad792ffb8d 100644 > --- a/ui/meson.build > +++ b/ui/meson.build > @@ -39,7 +39,7 @@ specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: > opengl) > > ui_modules = {} > > -if config_host.has_key('CONFIG_CURSES') > +if curses.found() > curses_ss = ss.source_set() > curses_ss.add(when: [curses, iconv], if_true: [files('curses.c'), > pixman]) > ui_modules += {'curses' : curses_ss} I find that this change causes a configure failure when choosing either --enable-iconv or --enable-curses as follows: ../configure --enable-curses results in ../meson.build:491:4: ERROR: Problem encountered: Cannot detect iconv API ../configure --enable-iconv results in ../meson.build:446:2: ERROR: Problem encountered: Cannot detect iconv API I haven't yet learned meson well enough to identify further what is going wrong. Can someone take a look at what might be failing, or give me some clue what I can check on or report on from my end which would be helpful to resolve this? I am running openSUSE Tumbleweed, by the way. Thanks, Bruce
Because you didn't install the iconv. On Thu, Oct 15, 2020 at 2:22 AM Bruce Rogers <brogers@suse.com> wrote: > > On Wed, 2020-10-14 at 10:21 +0200, Gerd Hoffmann wrote: > > From: Yonggang Luo <luoyonggang@gmail.com> > > > > The mingw pkg-config are showing following absolute path and contains > > : as the separator, > > > > -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC:/CI- > > Tools/msys64/mingw64/include/ncursesw:-I/usr/include/ncursesw: > > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC > > -pipe -lncursesw -lgnurx -ltre -lintl -liconv > > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC > > -lncursesw > > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC > > -lcursesw > > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -pipe > > -lncursesw -lgnurx -ltre -lintl -liconv > > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw > > -lncursesw > > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw > > -lcursesw > > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -pipe -lncursesw -lgnurx > > -ltre -lintl -liconv > > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -lncursesw > > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -lcursesw > > > > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> > > Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> > > Message-id: 20201012234348.1427-6-luoyonggang@gmail.com > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > > --- > > configure | 118 +++----------------------------------------- > > -- > > meson_options.txt | 4 ++ > > meson.build | 83 +++++++++++++++++++++++++++----- > > ui/meson.build | 2 +- > > 4 files changed, 83 insertions(+), 124 deletions(-) > > > > diff --git a/configure b/configure > > index 9a87685517ee..f839c2a557c3 100755 > > --- a/configure > > +++ b/configure > > @@ -295,7 +295,8 @@ unset target_list_exclude > > > > brlapi="" > > curl="" > > -curses="" > > +iconv="auto" > > +curses="auto" > > docs="" > > fdt="auto" > > netmap="no" > > @@ -1173,13 +1174,13 @@ for opt do > > ;; > > --disable-safe-stack) safe_stack="no" > > ;; > > - --disable-curses) curses="no" > > + --disable-curses) curses="disabled" > > ;; > > - --enable-curses) curses="yes" > > + --enable-curses) curses="enabled" > > ;; > > - --disable-iconv) iconv="no" > > + --disable-iconv) iconv="disabled" > > ;; > > - --enable-iconv) iconv="yes" > > + --enable-iconv) iconv="enabled" > > ;; > > --disable-curl) curl="no" > > ;; > > @@ -3440,102 +3441,6 @@ EOF > > fi > > fi > > > > -########################################## > > -# iconv probe > > -if test "$iconv" != "no" ; then > > - cat > $TMPC << EOF > > -#include <iconv.h> > > -int main(void) { > > - iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); > > - return conv != (iconv_t) -1; > > -} > > -EOF > > - iconv_prefix_list="/usr/local:/usr" > > - iconv_lib_list=":-liconv" > > - IFS=: > > - for iconv_prefix in $iconv_prefix_list; do > > - IFS=: > > - iconv_cflags="-I$iconv_prefix/include" > > - iconv_ldflags="-L$iconv_prefix/lib" > > - for iconv_link in $iconv_lib_list; do > > - unset IFS > > - iconv_lib="$iconv_ldflags $iconv_link" > > - echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> > > config.log > > - if compile_prog "$iconv_cflags" "$iconv_lib" ; then > > - iconv_found=yes > > - break > > - fi > > - done > > - if test "$iconv_found" = yes ; then > > - break > > - fi > > - done > > - if test "$iconv_found" = "yes" ; then > > - iconv=yes > > - else > > - if test "$iconv" = "yes" ; then > > - feature_not_found "iconv" "Install iconv devel" > > - fi > > - iconv=no > > - fi > > -fi > > - > > -########################################## > > -# curses probe > > -if test "$iconv" = "no" ; then > > - # curses will need iconv > > - curses=no > > -fi > > -if test "$curses" != "no" ; then > > - if test "$mingw32" = "yes" ; then > > - curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" > > - curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):- > > lpdcurses" > > - else > > - curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):- > > I/usr/include/ncursesw:" > > - curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):- > > lncursesw:-lcursesw" > > - fi > > - curses_found=no > > - cat > $TMPC << EOF > > -#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; > > -} > > -EOF > > - IFS=: > > - for curses_inc in $curses_inc_list; do > > - # Make sure we get the wide character prototypes > > - curses_inc="-DNCURSES_WIDECHAR $curses_inc" > > - IFS=: > > - for curses_lib in $curses_lib_list; do > > - unset IFS > > - if compile_prog "$curses_inc" "$curses_lib" ; then > > - curses_found=yes > > - break > > - fi > > - done > > - if test "$curses_found" = yes ; then > > - break > > - fi > > - done > > - unset IFS > > - if test "$curses_found" = "yes" ; then > > - curses=yes > > - else > > - if test "$curses" = "yes" ; then > > - feature_not_found "curses" "Install ncurses devel" > > - fi > > - curses=no > > - fi > > -fi > > - > > ########################################## > > # curl probe > > if test "$curl" != "no" ; then > > @@ -6200,16 +6105,6 @@ if test "$have_x11" = "yes" && test > > "$need_x11" = "yes"; then > > echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak > > echo "X11_LIBS=$x11_libs" >> $config_host_mak > > fi > > -if test "$iconv" = "yes" ; then > > - echo "CONFIG_ICONV=y" >> $config_host_mak > > - echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak > > - echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak > > -fi > > -if test "$curses" = "yes" ; then > > - echo "CONFIG_CURSES=y" >> $config_host_mak > > - echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak > > - echo "CURSES_LIBS=$curses_lib" >> $config_host_mak > > -fi > > if test "$pipe2" = "yes" ; then > > echo "CONFIG_PIPE2=y" >> $config_host_mak > > fi > > @@ -7181,6 +7076,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \ > > -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg > > -Dvnc_png=$vnc_png \ > > -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \ > > -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \ > > + -Diconv=$iconv -Dcurses=$curses \ > > $cross_arg \ > > "$PWD" "$source_path" > > > > diff --git a/meson_options.txt b/meson_options.txt > > index 1d3c94840a90..e6cb1e589b4e 100644 > > --- a/meson_options.txt > > +++ b/meson_options.txt > > @@ -32,6 +32,10 @@ option('cocoa', type : 'feature', value : 'auto', > > description: 'Cocoa user interface (macOS only)') > > option('mpath', type : 'feature', value : 'auto', > > description: 'Multipath persistent reservation passthrough') > > +option('iconv', type : 'feature', value : 'auto', > > + description: 'Font glyph conversion support') > > +option('curses', type : 'feature', value : 'auto', > > + description: 'curses UI') > > option('sdl', type : 'feature', value : 'auto', > > description: 'SDL user interface') > > option('sdl_image', type : 'feature', value : 'auto', > > diff --git a/meson.build b/meson.build > > index ad6c7c90c787..1a4a48249243 100644 > > --- a/meson.build > > +++ b/meson.build > > @@ -426,6 +426,74 @@ if targetos == 'linux' and have_tools and not > > get_option('mpath').disabled() > > endif > > endif > > > > +iconv = not_found > > +if not get_option('iconv').disabled() > > + libiconv = cc.find_library('iconv', > > + required: false, > > + static: enable_static) > > + if libiconv.found() > > + 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 > > +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 > > + 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 > > +if get_option('curses').enabled() and not curses.found() > > + if not iconv.found() > > + error('Cannot detect iconv API') > > + else > > + error('Cannot detect curses API') > > + endif > > +endif > > + > > brlapi = not_found > > if 'CONFIG_BRLAPI' in config_host > > brlapi = declare_dependency(link_args: > > config_host['BRLAPI_LIBS'].split()) > > @@ -504,16 +572,6 @@ if 'CONFIG_X11' in config_host > > x11 = declare_dependency(compile_args: > > config_host['X11_CFLAGS'].split(), > > link_args: > > config_host['X11_LIBS'].split()) > > endif > > -curses = not_found > > -if 'CONFIG_CURSES' in config_host > > - curses = declare_dependency(compile_args: > > config_host['CURSES_CFLAGS'].split(), > > - link_args: > > config_host['CURSES_LIBS'].split()) > > -endif > > -iconv = not_found > > -if 'CONFIG_ICONV' in config_host > > - iconv = declare_dependency(compile_args: > > config_host['ICONV_CFLAGS'].split(), > > - link_args: > > config_host['ICONV_LIBS'].split()) > > -endif > > vnc = not_found > > png = not_found > > jpeg = not_found > > @@ -622,6 +680,7 @@ config_host_data.set('CONFIG_COCOA', > > cocoa.found()) > > config_host_data.set('CONFIG_LIBUDEV', libudev.found()) > > config_host_data.set('CONFIG_MPATH', mpathpersist.found()) > > config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api) > > +config_host_data.set('CONFIG_CURSES', curses.found()) > > config_host_data.set('CONFIG_SDL', sdl.found()) > > config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) > > config_host_data.set('CONFIG_VNC', vnc.found()) > > @@ -1905,8 +1964,8 @@ if config_host.has_key('CONFIG_NETTLE') > > endif > > summary_info += > > {'libtasn1': config_host.has_key('CONFIG_TASN1')} > > summary_info += > > {'PAM': config_host.has_key('CONFIG_AUTH_PAM')} > > -summary_info += {'iconv > > support': config_host.has_key('CONFIG_ICONV')} > > -summary_info += {'curses > > support': config_host.has_key('CONFIG_CURSES')} > > +summary_info += {'iconv support': iconv.found()} > > +summary_info += {'curses support': curses.found()} > > # TODO: add back version > > summary_info += {'virgl > > support': config_host.has_key('CONFIG_VIRGL')} > > summary_info += {'curl > > support': config_host.has_key('CONFIG_CURL')} > > diff --git a/ui/meson.build b/ui/meson.build > > index 8a080c38e325..78ad792ffb8d 100644 > > --- a/ui/meson.build > > +++ b/ui/meson.build > > @@ -39,7 +39,7 @@ specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: > > opengl) > > > > ui_modules = {} > > > > -if config_host.has_key('CONFIG_CURSES') > > +if curses.found() > > curses_ss = ss.source_set() > > curses_ss.add(when: [curses, iconv], if_true: [files('curses.c'), > > pixman]) > > ui_modules += {'curses' : curses_ss} > > I find that this change causes a configure failure when choosing either > --enable-iconv or --enable-curses as follows: > > ../configure --enable-curses results in > ../meson.build:491:4: ERROR: Problem encountered: Cannot detect iconv > API > > ../configure --enable-iconv results in > ../meson.build:446:2: ERROR: Problem encountered: Cannot detect iconv > API > > I haven't yet learned meson well enough to identify further what is > going wrong. > > Can someone take a look at what might be failing, or give me some clue > what I can check on or report on from my end which would be helpful to > resolve this? > I am running openSUSE Tumbleweed, by the way. > > Thanks, > > Bruce > -- 此致 礼 罗勇刚 Yours sincerely, Yonggang Luo <div dir="ltr">Because you didn't install the iconv.<br><br>On Thu, Oct 15, 2020 at 2:22 AM Bruce Rogers <<a href="mailto:brogers@suse.com">brogers@suse.com</a>> wrote:<br>><br>> On Wed, 2020-10-14 at 10:21 +0200, Gerd Hoffmann wrote:<br>> > From: Yonggang Luo <<a href="mailto:luoyonggang@gmail.com">luoyonggang@gmail.com</a>><br>> ><br>> > The mingw pkg-config are showing following absolute path and contains<br>> > : as the separator,<br>> ><br>> > -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC:/CI-<br>> > Tools/msys64/mingw64/include/ncursesw:-I/usr/include/ncursesw:<br>> > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC<br>> > -pipe -lncursesw -lgnurx -ltre -lintl -liconv<br>> > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC<br>> > -lncursesw<br>> > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC<br>> > -lcursesw<br>> > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -pipe<br>> > -lncursesw -lgnurx -ltre -lintl -liconv<br>> > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw<br>> > -lncursesw<br>> > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw<br>> > -lcursesw<br>> > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -pipe -lncursesw -lgnurx<br>> > -ltre -lintl -liconv<br>> > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -lncursesw<br>> > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -lcursesw<br>> ><br>> > Signed-off-by: Yonggang Luo <<a href="mailto:luoyonggang@gmail.com">luoyonggang@gmail.com</a>><br>> > Reviewed-by: Gerd Hoffmann <<a href="mailto:kraxel@redhat.com">kraxel@redhat.com</a>><br>> > Message-id: <a href="mailto:20201012234348.1427-6-luoyonggang@gmail.com">20201012234348.1427-6-luoyonggang@gmail.com</a><br>> > Signed-off-by: Gerd Hoffmann <<a href="mailto:kraxel@redhat.com">kraxel@redhat.com</a>><br>> > ---<br>> > configure | 118 +++-----------------------------------------<br>> > --<br>> > meson_options.txt | 4 ++<br>> > meson.build | 83 +++++++++++++++++++++++++++-----<br>> > ui/meson.build | 2 +-<br>> > 4 files changed, 83 insertions(+), 124 deletions(-)<br>> ><br>> > diff --git a/configure b/configure<br>> > index 9a87685517ee..f839c2a557c3 100755<br>> > --- a/configure<br>> > +++ b/configure<br>> > @@ -295,7 +295,8 @@ unset target_list_exclude<br>> > <br>> > brlapi=""<br>> > curl=""<br>> > -curses=""<br>> > +iconv="auto"<br>> > +curses="auto"<br>> > docs=""<br>> > fdt="auto"<br>> > netmap="no"<br>> > @@ -1173,13 +1174,13 @@ for opt do<br>> > ;;<br>> > --disable-safe-stack) safe_stack="no"<br>> > ;;<br>> > - --disable-curses) curses="no"<br>> > + --disable-curses) curses="disabled"<br>> > ;;<br>> > - --enable-curses) curses="yes"<br>> > + --enable-curses) curses="enabled"<br>> > ;;<br>> > - --disable-iconv) iconv="no"<br>> > + --disable-iconv) iconv="disabled"<br>> > ;;<br>> > - --enable-iconv) iconv="yes"<br>> > + --enable-iconv) iconv="enabled"<br>> > ;;<br>> > --disable-curl) curl="no"<br>> > ;;<br>> > @@ -3440,102 +3441,6 @@ EOF<br>> > fi<br>> > fi<br>> > <br>> > -##########################################<br>> > -# iconv probe<br>> > -if test "$iconv" != "no" ; then<br>> > - cat > $TMPC << EOF<br>> > -#include <iconv.h><br>> > -int main(void) {<br>> > - iconv_t conv = iconv_open("WCHAR_T", "UCS-2");<br>> > - return conv != (iconv_t) -1;<br>> > -}<br>> > -EOF<br>> > - iconv_prefix_list="/usr/local:/usr"<br>> > - iconv_lib_list=":-liconv"<br>> > - IFS=:<br>> > - for iconv_prefix in $iconv_prefix_list; do<br>> > - IFS=:<br>> > - iconv_cflags="-I$iconv_prefix/include"<br>> > - iconv_ldflags="-L$iconv_prefix/lib"<br>> > - for iconv_link in $iconv_lib_list; do<br>> > - unset IFS<br>> > - iconv_lib="$iconv_ldflags $iconv_link"<br>> > - echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >><br>> > config.log<br>> > - if compile_prog "$iconv_cflags" "$iconv_lib" ; then<br>> > - iconv_found=yes<br>> > - break<br>> > - fi<br>> > - done<br>> > - if test "$iconv_found" = yes ; then<br>> > - break<br>> > - fi<br>> > - done<br>> > - if test "$iconv_found" = "yes" ; then<br>> > - iconv=yes<br>> > - else<br>> > - if test "$iconv" = "yes" ; then<br>> > - feature_not_found "iconv" "Install iconv devel"<br>> > - fi<br>> > - iconv=no<br>> > - fi<br>> > -fi<br>> > -<br>> > -##########################################<br>> > -# curses probe<br>> > -if test "$iconv" = "no" ; then<br>> > - # curses will need iconv<br>> > - curses=no<br>> > -fi<br>> > -if test "$curses" != "no" ; then<br>> > - if test "$mingw32" = "yes" ; then<br>> > - curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"<br>> > - curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-<br>> > lpdcurses"<br>> > - else<br>> > - curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-<br>> > I/usr/include/ncursesw:"<br>> > - curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-<br>> > lncursesw:-lcursesw"<br>> > - fi<br>> > - curses_found=no<br>> > - cat > $TMPC << EOF<br>> > -#include <locale.h><br>> > -#include <curses.h><br>> > -#include <wchar.h><br>> > -int main(void) {<br>> > - wchar_t wch = L'w';<br>> > - setlocale(LC_ALL, "");<br>> > - resize_term(0, 0);<br>> > - addwstr(L"wide chars\n");<br>> > - addnwstr(&wch, 1);<br>> > - add_wch(WACS_DEGREE);<br>> > - return 0;<br>> > -}<br>> > -EOF<br>> > - IFS=:<br>> > - for curses_inc in $curses_inc_list; do<br>> > - # Make sure we get the wide character prototypes<br>> > - curses_inc="-DNCURSES_WIDECHAR $curses_inc"<br>> > - IFS=:<br>> > - for curses_lib in $curses_lib_list; do<br>> > - unset IFS<br>> > - if compile_prog "$curses_inc" "$curses_lib" ; then<br>> > - curses_found=yes<br>> > - break<br>> > - fi<br>> > - done<br>> > - if test "$curses_found" = yes ; then<br>> > - break<br>> > - fi<br>> > - done<br>> > - unset IFS<br>> > - if test "$curses_found" = "yes" ; then<br>> > - curses=yes<br>> > - else<br>> > - if test "$curses" = "yes" ; then<br>> > - feature_not_found "curses" "Install ncurses devel"<br>> > - fi<br>> > - curses=no<br>> > - fi<br>> > -fi<br>> > -<br>> > ##########################################<br>> > # curl probe<br>> > if test "$curl" != "no" ; then<br>> > @@ -6200,16 +6105,6 @@ if test "$have_x11" = "yes" && test<br>> > "$need_x11" = "yes"; then<br>> > echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak<br>> > echo "X11_LIBS=$x11_libs" >> $config_host_mak<br>> > fi<br>> > -if test "$iconv" = "yes" ; then<br>> > - echo "CONFIG_ICONV=y" >> $config_host_mak<br>> > - echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak<br>> > - echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak<br>> > -fi<br>> > -if test "$curses" = "yes" ; then<br>> > - echo "CONFIG_CURSES=y" >> $config_host_mak<br>> > - echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak<br>> > - echo "CURSES_LIBS=$curses_lib" >> $config_host_mak<br>> > -fi<br>> > if test "$pipe2" = "yes" ; then<br>> > echo "CONFIG_PIPE2=y" >> $config_host_mak<br>> > fi<br>> > @@ -7181,6 +7076,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \<br>> > -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg<br>> > -Dvnc_png=$vnc_png \<br>> > -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \<br>> > -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \<br>> > + -Diconv=$iconv -Dcurses=$curses \<br>> > $cross_arg \<br>> > "$PWD" "$source_path"<br>> > <br>> > diff --git a/meson_options.txt b/meson_options.txt<br>> > index 1d3c94840a90..e6cb1e589b4e 100644<br>> > --- a/meson_options.txt<br>> > +++ b/meson_options.txt<br>> > @@ -32,6 +32,10 @@ option('cocoa', type : 'feature', value : 'auto',<br>> > description: 'Cocoa user interface (macOS only)')<br>> > option('mpath', type : 'feature', value : 'auto',<br>> > description: 'Multipath persistent reservation passthrough')<br>> > +option('iconv', type : 'feature', value : 'auto',<br>> > + description: 'Font glyph conversion support')<br>> > +option('curses', type : 'feature', value : 'auto',<br>> > + description: 'curses UI')<br>> > option('sdl', type : 'feature', value : 'auto',<br>> > description: 'SDL user interface')<br>> > option('sdl_image', type : 'feature', value : 'auto',<br>> > diff --git a/meson.build b/meson.build<br>> > index ad6c7c90c787..1a4a48249243 100644<br>> > --- a/meson.build<br>> > +++ b/meson.build<br>> > @@ -426,6 +426,74 @@ if targetos == 'linux' and have_tools and not<br>> > get_option('mpath').disabled()<br>> > endif<br>> > endif<br>> > <br>> > +iconv = not_found<br>> > +if not get_option('iconv').disabled()<br>> > + libiconv = cc.find_library('iconv',<br>> > + required: false,<br>> > + static: enable_static)<br>> > + if libiconv.found()<br>> > + if cc.links('''<br>> > + #include <iconv.h><br>> > + int main(void) {<br>> > + iconv_t conv = iconv_open("WCHAR_T", "UCS-2");<br>> > + return conv != (iconv_t) -1;<br>> > + }''', dependencies: [libiconv])<br>> > + iconv = declare_dependency(dependencies: [libiconv])<br>> > + endif<br>> > + endif<br>> > +endif<br>> > +if get_option('iconv').enabled() and not iconv.found()<br>> > + error('Cannot detect iconv API')<br>> > +endif<br>> > +<br>> > +curses = not_found<br>> > +if iconv.found() and not get_option('curses').disabled()<br>> > + curses_libname_list = ['ncursesw', 'ncurses', 'cursesw',<br>> > 'pdcurses']<br>> > + curses_test = '''<br>> > + #include <locale.h><br>> > + #include <curses.h><br>> > + #include <wchar.h><br>> > + int main(void) {<br>> > + wchar_t wch = L'w';<br>> > + setlocale(LC_ALL, "");<br>> > + resize_term(0, 0);<br>> > + addwstr(L"wide chars\n");<br>> > + addnwstr(&wch, 1);<br>> > + add_wch(WACS_DEGREE);<br>> > + return 0;<br>> > + }'''<br>> > + foreach curses_libname : curses_libname_list<br>> > + libcurses = dependency(curses_libname,<br>> > + required: false,<br>> > + method: 'pkg-config',<br>> > + static: enable_static)<br>> > +<br>> > + if not libcurses.found()<br>> > + dirs = ['/usr/include/ncursesw']<br>> > + if targetos == 'windows'<br>> > + dirs = []<br>> > + endif<br>> > + libcurses = cc.find_library(curses_libname,<br>> > + required: false,<br>> > + dirs: dirs,<br>> > + static: enable_static)<br>> > + endif<br>> > + if libcurses.found()<br>> > + if cc.links(curses_test, dependencies: [libcurses])<br>> > + curses = declare_dependency(compile_args: '-<br>> > DNCURSES_WIDECHAR', dependencies: [libcurses])<br>> > + break<br>> > + endif<br>> > + endif<br>> > + endforeach<br>> > +endif<br>> > +if get_option('curses').enabled() and not curses.found()<br>> > + if not iconv.found()<br>> > + error('Cannot detect iconv API')<br>> > + else<br>> > + error('Cannot detect curses API')<br>> > + endif<br>> > +endif<br>> > +<br>> > brlapi = not_found<br>> > if 'CONFIG_BRLAPI' in config_host<br>> > brlapi = declare_dependency(link_args:<br>> > config_host['BRLAPI_LIBS'].split())<br>> > @@ -504,16 +572,6 @@ if 'CONFIG_X11' in config_host<br>> > x11 = declare_dependency(compile_args:<br>> > config_host['X11_CFLAGS'].split(),<br>> > link_args:<br>> > config_host['X11_LIBS'].split())<br>> > endif<br>> > -curses = not_found<br>> > -if 'CONFIG_CURSES' in config_host<br>> > - curses = declare_dependency(compile_args:<br>> > config_host['CURSES_CFLAGS'].split(),<br>> > - link_args:<br>> > config_host['CURSES_LIBS'].split())<br>> > -endif<br>> > -iconv = not_found<br>> > -if 'CONFIG_ICONV' in config_host<br>> > - iconv = declare_dependency(compile_args:<br>> > config_host['ICONV_CFLAGS'].split(),<br>> > - link_args:<br>> > config_host['ICONV_LIBS'].split())<br>> > -endif<br>> > vnc = not_found<br>> > png = not_found<br>> > jpeg = not_found<br>> > @@ -622,6 +680,7 @@ config_host_data.set('CONFIG_COCOA',<br>> > cocoa.found())<br>> > config_host_data.set('CONFIG_LIBUDEV', libudev.found())<br>> > config_host_data.set('CONFIG_MPATH', mpathpersist.found())<br>> > config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)<br>> > +config_host_data.set('CONFIG_CURSES', curses.found())<br>> > config_host_data.set('CONFIG_SDL', sdl.found())<br>> > config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())<br>> > config_host_data.set('CONFIG_VNC', vnc.found())<br>> > @@ -1905,8 +1964,8 @@ if config_host.has_key('CONFIG_NETTLE')<br>> > endif<br>> > summary_info +=<br>> > {'libtasn1': config_host.has_key('CONFIG_TASN1')}<br>> > summary_info +=<br>> > {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}<br>> > -summary_info += {'iconv<br>> > support': config_host.has_key('CONFIG_ICONV')}<br>> > -summary_info += {'curses<br>> > support': config_host.has_key('CONFIG_CURSES')}<br>> > +summary_info += {'iconv support': iconv.found()}<br>> > +summary_info += {'curses support': curses.found()}<br>> > # TODO: add back version<br>> > summary_info += {'virgl<br>> > support': config_host.has_key('CONFIG_VIRGL')}<br>> > summary_info += {'curl<br>> > support': config_host.has_key('CONFIG_CURL')}<br>> > diff --git a/ui/meson.build b/ui/meson.build<br>> > index 8a080c38e325..78ad792ffb8d 100644<br>> > --- a/ui/meson.build<br>> > +++ b/ui/meson.build<br>> > @@ -39,7 +39,7 @@ specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true:<br>> > opengl)<br>> > <br>> > ui_modules = {}<br>> > <br>> > -if config_host.has_key('CONFIG_CURSES')<br>> > +if curses.found()<br>> > curses_ss = ss.source_set()<br>> > curses_ss.add(when: [curses, iconv], if_true: [files('curses.c'),<br>> > pixman])<br>> > ui_modules += {'curses' : curses_ss}<br>><br>> I find that this change causes a configure failure when choosing either<br>> --enable-iconv or --enable-curses as follows:<br>><br>> ../configure --enable-curses results in<br>> ../meson.build:491:4: ERROR: Problem encountered: Cannot detect iconv<br>> API<br>><br>> ../configure --enable-iconv results in<br>> ../meson.build:446:2: ERROR: Problem encountered: Cannot detect iconv<br>> API<br>><br>> I haven't yet learned meson well enough to identify further what is<br>> going wrong.<br>><br>> Can someone take a look at what might be failing, or give me some clue<br>> what I can check on or report on from my end which would be helpful to<br>> resolve this?<br>> I am running openSUSE Tumbleweed, by the way.<br>><br>> Thanks,<br>><br>> Bruce<br>><br><br><br>--<br> 此致<br>礼<br>罗勇刚<br>Yours<br> sincerely,<br>Yonggang Luo</div>
If iconv installed then it's the meson's probme that didn't found the iconv properly On Thu, Oct 15, 2020 at 2:22 AM Bruce Rogers <brogers@suse.com> wrote: > > On Wed, 2020-10-14 at 10:21 +0200, Gerd Hoffmann wrote: > > From: Yonggang Luo <luoyonggang@gmail.com> > > > > The mingw pkg-config are showing following absolute path and contains > > : as the separator, > > > > -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC:/CI- > > Tools/msys64/mingw64/include/ncursesw:-I/usr/include/ncursesw: > > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC > > -pipe -lncursesw -lgnurx -ltre -lintl -liconv > > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC > > -lncursesw > > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC > > -lcursesw > > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -pipe > > -lncursesw -lgnurx -ltre -lintl -liconv > > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw > > -lncursesw > > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw > > -lcursesw > > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -pipe -lncursesw -lgnurx > > -ltre -lintl -liconv > > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -lncursesw > > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -lcursesw > > > > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> > > Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> > > Message-id: 20201012234348.1427-6-luoyonggang@gmail.com > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > > --- > > configure | 118 +++----------------------------------------- > > -- > > meson_options.txt | 4 ++ > > meson.build | 83 +++++++++++++++++++++++++++----- > > ui/meson.build | 2 +- > > 4 files changed, 83 insertions(+), 124 deletions(-) > > > > diff --git a/configure b/configure > > index 9a87685517ee..f839c2a557c3 100755 > > --- a/configure > > +++ b/configure > > @@ -295,7 +295,8 @@ unset target_list_exclude > > > > brlapi="" > > curl="" > > -curses="" > > +iconv="auto" > > +curses="auto" > > docs="" > > fdt="auto" > > netmap="no" > > @@ -1173,13 +1174,13 @@ for opt do > > ;; > > --disable-safe-stack) safe_stack="no" > > ;; > > - --disable-curses) curses="no" > > + --disable-curses) curses="disabled" > > ;; > > - --enable-curses) curses="yes" > > + --enable-curses) curses="enabled" > > ;; > > - --disable-iconv) iconv="no" > > + --disable-iconv) iconv="disabled" > > ;; > > - --enable-iconv) iconv="yes" > > + --enable-iconv) iconv="enabled" > > ;; > > --disable-curl) curl="no" > > ;; > > @@ -3440,102 +3441,6 @@ EOF > > fi > > fi > > > > -########################################## > > -# iconv probe > > -if test "$iconv" != "no" ; then > > - cat > $TMPC << EOF > > -#include <iconv.h> > > -int main(void) { > > - iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); > > - return conv != (iconv_t) -1; > > -} > > -EOF > > - iconv_prefix_list="/usr/local:/usr" > > - iconv_lib_list=":-liconv" > > - IFS=: > > - for iconv_prefix in $iconv_prefix_list; do > > - IFS=: > > - iconv_cflags="-I$iconv_prefix/include" > > - iconv_ldflags="-L$iconv_prefix/lib" > > - for iconv_link in $iconv_lib_list; do > > - unset IFS > > - iconv_lib="$iconv_ldflags $iconv_link" > > - echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> > > config.log > > - if compile_prog "$iconv_cflags" "$iconv_lib" ; then > > - iconv_found=yes > > - break > > - fi > > - done > > - if test "$iconv_found" = yes ; then > > - break > > - fi > > - done > > - if test "$iconv_found" = "yes" ; then > > - iconv=yes > > - else > > - if test "$iconv" = "yes" ; then > > - feature_not_found "iconv" "Install iconv devel" > > - fi > > - iconv=no > > - fi > > -fi > > - > > -########################################## > > -# curses probe > > -if test "$iconv" = "no" ; then > > - # curses will need iconv > > - curses=no > > -fi > > -if test "$curses" != "no" ; then > > - if test "$mingw32" = "yes" ; then > > - curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" > > - curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):- > > lpdcurses" > > - else > > - curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):- > > I/usr/include/ncursesw:" > > - curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):- > > lncursesw:-lcursesw" > > - fi > > - curses_found=no > > - cat > $TMPC << EOF > > -#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; > > -} > > -EOF > > - IFS=: > > - for curses_inc in $curses_inc_list; do > > - # Make sure we get the wide character prototypes > > - curses_inc="-DNCURSES_WIDECHAR $curses_inc" > > - IFS=: > > - for curses_lib in $curses_lib_list; do > > - unset IFS > > - if compile_prog "$curses_inc" "$curses_lib" ; then > > - curses_found=yes > > - break > > - fi > > - done > > - if test "$curses_found" = yes ; then > > - break > > - fi > > - done > > - unset IFS > > - if test "$curses_found" = "yes" ; then > > - curses=yes > > - else > > - if test "$curses" = "yes" ; then > > - feature_not_found "curses" "Install ncurses devel" > > - fi > > - curses=no > > - fi > > -fi > > - > > ########################################## > > # curl probe > > if test "$curl" != "no" ; then > > @@ -6200,16 +6105,6 @@ if test "$have_x11" = "yes" && test > > "$need_x11" = "yes"; then > > echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak > > echo "X11_LIBS=$x11_libs" >> $config_host_mak > > fi > > -if test "$iconv" = "yes" ; then > > - echo "CONFIG_ICONV=y" >> $config_host_mak > > - echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak > > - echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak > > -fi > > -if test "$curses" = "yes" ; then > > - echo "CONFIG_CURSES=y" >> $config_host_mak > > - echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak > > - echo "CURSES_LIBS=$curses_lib" >> $config_host_mak > > -fi > > if test "$pipe2" = "yes" ; then > > echo "CONFIG_PIPE2=y" >> $config_host_mak > > fi > > @@ -7181,6 +7076,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \ > > -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg > > -Dvnc_png=$vnc_png \ > > -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \ > > -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \ > > + -Diconv=$iconv -Dcurses=$curses \ > > $cross_arg \ > > "$PWD" "$source_path" > > > > diff --git a/meson_options.txt b/meson_options.txt > > index 1d3c94840a90..e6cb1e589b4e 100644 > > --- a/meson_options.txt > > +++ b/meson_options.txt > > @@ -32,6 +32,10 @@ option('cocoa', type : 'feature', value : 'auto', > > description: 'Cocoa user interface (macOS only)') > > option('mpath', type : 'feature', value : 'auto', > > description: 'Multipath persistent reservation passthrough') > > +option('iconv', type : 'feature', value : 'auto', > > + description: 'Font glyph conversion support') > > +option('curses', type : 'feature', value : 'auto', > > + description: 'curses UI') > > option('sdl', type : 'feature', value : 'auto', > > description: 'SDL user interface') > > option('sdl_image', type : 'feature', value : 'auto', > > diff --git a/meson.build b/meson.build > > index ad6c7c90c787..1a4a48249243 100644 > > --- a/meson.build > > +++ b/meson.build > > @@ -426,6 +426,74 @@ if targetos == 'linux' and have_tools and not > > get_option('mpath').disabled() > > endif > > endif > > > > +iconv = not_found > > +if not get_option('iconv').disabled() > > + libiconv = cc.find_library('iconv', > > + required: false, > > + static: enable_static) > > + if libiconv.found() > > + 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 > > +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 > > + 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 > > +if get_option('curses').enabled() and not curses.found() > > + if not iconv.found() > > + error('Cannot detect iconv API') > > + else > > + error('Cannot detect curses API') > > + endif > > +endif > > + > > brlapi = not_found > > if 'CONFIG_BRLAPI' in config_host > > brlapi = declare_dependency(link_args: > > config_host['BRLAPI_LIBS'].split()) > > @@ -504,16 +572,6 @@ if 'CONFIG_X11' in config_host > > x11 = declare_dependency(compile_args: > > config_host['X11_CFLAGS'].split(), > > link_args: > > config_host['X11_LIBS'].split()) > > endif > > -curses = not_found > > -if 'CONFIG_CURSES' in config_host > > - curses = declare_dependency(compile_args: > > config_host['CURSES_CFLAGS'].split(), > > - link_args: > > config_host['CURSES_LIBS'].split()) > > -endif > > -iconv = not_found > > -if 'CONFIG_ICONV' in config_host > > - iconv = declare_dependency(compile_args: > > config_host['ICONV_CFLAGS'].split(), > > - link_args: > > config_host['ICONV_LIBS'].split()) > > -endif > > vnc = not_found > > png = not_found > > jpeg = not_found > > @@ -622,6 +680,7 @@ config_host_data.set('CONFIG_COCOA', > > cocoa.found()) > > config_host_data.set('CONFIG_LIBUDEV', libudev.found()) > > config_host_data.set('CONFIG_MPATH', mpathpersist.found()) > > config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api) > > +config_host_data.set('CONFIG_CURSES', curses.found()) > > config_host_data.set('CONFIG_SDL', sdl.found()) > > config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) > > config_host_data.set('CONFIG_VNC', vnc.found()) > > @@ -1905,8 +1964,8 @@ if config_host.has_key('CONFIG_NETTLE') > > endif > > summary_info += > > {'libtasn1': config_host.has_key('CONFIG_TASN1')} > > summary_info += > > {'PAM': config_host.has_key('CONFIG_AUTH_PAM')} > > -summary_info += {'iconv > > support': config_host.has_key('CONFIG_ICONV')} > > -summary_info += {'curses > > support': config_host.has_key('CONFIG_CURSES')} > > +summary_info += {'iconv support': iconv.found()} > > +summary_info += {'curses support': curses.found()} > > # TODO: add back version > > summary_info += {'virgl > > support': config_host.has_key('CONFIG_VIRGL')} > > summary_info += {'curl > > support': config_host.has_key('CONFIG_CURL')} > > diff --git a/ui/meson.build b/ui/meson.build > > index 8a080c38e325..78ad792ffb8d 100644 > > --- a/ui/meson.build > > +++ b/ui/meson.build > > @@ -39,7 +39,7 @@ specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: > > opengl) > > > > ui_modules = {} > > > > -if config_host.has_key('CONFIG_CURSES') > > +if curses.found() > > curses_ss = ss.source_set() > > curses_ss.add(when: [curses, iconv], if_true: [files('curses.c'), > > pixman]) > > ui_modules += {'curses' : curses_ss} > > I find that this change causes a configure failure when choosing either > --enable-iconv or --enable-curses as follows: > > ../configure --enable-curses results in > ../meson.build:491:4: ERROR: Problem encountered: Cannot detect iconv > API > > ../configure --enable-iconv results in > ../meson.build:446:2: ERROR: Problem encountered: Cannot detect iconv > API > > I haven't yet learned meson well enough to identify further what is > going wrong. > > Can someone take a look at what might be failing, or give me some clue > what I can check on or report on from my end which would be helpful to > resolve this? > I am running openSUSE Tumbleweed, by the way. > > Thanks, > > Bruce > -- 此致 礼 罗勇刚 Yours sincerely, Yonggang Luo <div dir="ltr"><br>If iconv installed then it's the meson's probme that didn't found the iconv properly<br>On Thu, Oct 15, 2020 at 2:22 AM Bruce Rogers <<a href="mailto:brogers@suse.com">brogers@suse.com</a>> wrote:<br>><br>> On Wed, 2020-10-14 at 10:21 +0200, Gerd Hoffmann wrote:<br>> > From: Yonggang Luo <<a href="mailto:luoyonggang@gmail.com">luoyonggang@gmail.com</a>><br>> ><br>> > The mingw pkg-config are showing following absolute path and contains<br>> > : as the separator,<br>> ><br>> > -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC:/CI-<br>> > Tools/msys64/mingw64/include/ncursesw:-I/usr/include/ncursesw:<br>> > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC<br>> > -pipe -lncursesw -lgnurx -ltre -lintl -liconv<br>> > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC<br>> > -lncursesw<br>> > -DNCURSES_WIDECHAR -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199506L -IC<br>> > -lcursesw<br>> > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw -pipe<br>> > -lncursesw -lgnurx -ltre -lintl -liconv<br>> > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw<br>> > -lncursesw<br>> > -DNCURSES_WIDECHAR /CI-Tools/msys64/mingw64/include/ncursesw<br>> > -lcursesw<br>> > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -pipe -lncursesw -lgnurx<br>> > -ltre -lintl -liconv<br>> > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -lncursesw<br>> > -DNCURSES_WIDECHAR -I/usr/include/ncursesw -lcursesw<br>> ><br>> > Signed-off-by: Yonggang Luo <<a href="mailto:luoyonggang@gmail.com">luoyonggang@gmail.com</a>><br>> > Reviewed-by: Gerd Hoffmann <<a href="mailto:kraxel@redhat.com">kraxel@redhat.com</a>><br>> > Message-id: <a href="mailto:20201012234348.1427-6-luoyonggang@gmail.com">20201012234348.1427-6-luoyonggang@gmail.com</a><br>> > Signed-off-by: Gerd Hoffmann <<a href="mailto:kraxel@redhat.com">kraxel@redhat.com</a>><br>> > ---<br>> > configure | 118 +++-----------------------------------------<br>> > --<br>> > meson_options.txt | 4 ++<br>> > meson.build | 83 +++++++++++++++++++++++++++-----<br>> > ui/meson.build | 2 +-<br>> > 4 files changed, 83 insertions(+), 124 deletions(-)<br>> ><br>> > diff --git a/configure b/configure<br>> > index 9a87685517ee..f839c2a557c3 100755<br>> > --- a/configure<br>> > +++ b/configure<br>> > @@ -295,7 +295,8 @@ unset target_list_exclude<br>> > <br>> > brlapi=""<br>> > curl=""<br>> > -curses=""<br>> > +iconv="auto"<br>> > +curses="auto"<br>> > docs=""<br>> > fdt="auto"<br>> > netmap="no"<br>> > @@ -1173,13 +1174,13 @@ for opt do<br>> > ;;<br>> > --disable-safe-stack) safe_stack="no"<br>> > ;;<br>> > - --disable-curses) curses="no"<br>> > + --disable-curses) curses="disabled"<br>> > ;;<br>> > - --enable-curses) curses="yes"<br>> > + --enable-curses) curses="enabled"<br>> > ;;<br>> > - --disable-iconv) iconv="no"<br>> > + --disable-iconv) iconv="disabled"<br>> > ;;<br>> > - --enable-iconv) iconv="yes"<br>> > + --enable-iconv) iconv="enabled"<br>> > ;;<br>> > --disable-curl) curl="no"<br>> > ;;<br>> > @@ -3440,102 +3441,6 @@ EOF<br>> > fi<br>> > fi<br>> > <br>> > -##########################################<br>> > -# iconv probe<br>> > -if test "$iconv" != "no" ; then<br>> > - cat > $TMPC << EOF<br>> > -#include <iconv.h><br>> > -int main(void) {<br>> > - iconv_t conv = iconv_open("WCHAR_T", "UCS-2");<br>> > - return conv != (iconv_t) -1;<br>> > -}<br>> > -EOF<br>> > - iconv_prefix_list="/usr/local:/usr"<br>> > - iconv_lib_list=":-liconv"<br>> > - IFS=:<br>> > - for iconv_prefix in $iconv_prefix_list; do<br>> > - IFS=:<br>> > - iconv_cflags="-I$iconv_prefix/include"<br>> > - iconv_ldflags="-L$iconv_prefix/lib"<br>> > - for iconv_link in $iconv_lib_list; do<br>> > - unset IFS<br>> > - iconv_lib="$iconv_ldflags $iconv_link"<br>> > - echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >><br>> > config.log<br>> > - if compile_prog "$iconv_cflags" "$iconv_lib" ; then<br>> > - iconv_found=yes<br>> > - break<br>> > - fi<br>> > - done<br>> > - if test "$iconv_found" = yes ; then<br>> > - break<br>> > - fi<br>> > - done<br>> > - if test "$iconv_found" = "yes" ; then<br>> > - iconv=yes<br>> > - else<br>> > - if test "$iconv" = "yes" ; then<br>> > - feature_not_found "iconv" "Install iconv devel"<br>> > - fi<br>> > - iconv=no<br>> > - fi<br>> > -fi<br>> > -<br>> > -##########################################<br>> > -# curses probe<br>> > -if test "$iconv" = "no" ; then<br>> > - # curses will need iconv<br>> > - curses=no<br>> > -fi<br>> > -if test "$curses" != "no" ; then<br>> > - if test "$mingw32" = "yes" ; then<br>> > - curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"<br>> > - curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-<br>> > lpdcurses"<br>> > - else<br>> > - curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-<br>> > I/usr/include/ncursesw:"<br>> > - curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-<br>> > lncursesw:-lcursesw"<br>> > - fi<br>> > - curses_found=no<br>> > - cat > $TMPC << EOF<br>> > -#include <locale.h><br>> > -#include <curses.h><br>> > -#include <wchar.h><br>> > -int main(void) {<br>> > - wchar_t wch = L'w';<br>> > - setlocale(LC_ALL, "");<br>> > - resize_term(0, 0);<br>> > - addwstr(L"wide chars\n");<br>> > - addnwstr(&wch, 1);<br>> > - add_wch(WACS_DEGREE);<br>> > - return 0;<br>> > -}<br>> > -EOF<br>> > - IFS=:<br>> > - for curses_inc in $curses_inc_list; do<br>> > - # Make sure we get the wide character prototypes<br>> > - curses_inc="-DNCURSES_WIDECHAR $curses_inc"<br>> > - IFS=:<br>> > - for curses_lib in $curses_lib_list; do<br>> > - unset IFS<br>> > - if compile_prog "$curses_inc" "$curses_lib" ; then<br>> > - curses_found=yes<br>> > - break<br>> > - fi<br>> > - done<br>> > - if test "$curses_found" = yes ; then<br>> > - break<br>> > - fi<br>> > - done<br>> > - unset IFS<br>> > - if test "$curses_found" = "yes" ; then<br>> > - curses=yes<br>> > - else<br>> > - if test "$curses" = "yes" ; then<br>> > - feature_not_found "curses" "Install ncurses devel"<br>> > - fi<br>> > - curses=no<br>> > - fi<br>> > -fi<br>> > -<br>> > ##########################################<br>> > # curl probe<br>> > if test "$curl" != "no" ; then<br>> > @@ -6200,16 +6105,6 @@ if test "$have_x11" = "yes" && test<br>> > "$need_x11" = "yes"; then<br>> > echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak<br>> > echo "X11_LIBS=$x11_libs" >> $config_host_mak<br>> > fi<br>> > -if test "$iconv" = "yes" ; then<br>> > - echo "CONFIG_ICONV=y" >> $config_host_mak<br>> > - echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak<br>> > - echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak<br>> > -fi<br>> > -if test "$curses" = "yes" ; then<br>> > - echo "CONFIG_CURSES=y" >> $config_host_mak<br>> > - echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak<br>> > - echo "CURSES_LIBS=$curses_lib" >> $config_host_mak<br>> > -fi<br>> > if test "$pipe2" = "yes" ; then<br>> > echo "CONFIG_PIPE2=y" >> $config_host_mak<br>> > fi<br>> > @@ -7181,6 +7076,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \<br>> > -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg<br>> > -Dvnc_png=$vnc_png \<br>> > -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \<br>> > -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \<br>> > + -Diconv=$iconv -Dcurses=$curses \<br>> > $cross_arg \<br>> > "$PWD" "$source_path"<br>> > <br>> > diff --git a/meson_options.txt b/meson_options.txt<br>> > index 1d3c94840a90..e6cb1e589b4e 100644<br>> > --- a/meson_options.txt<br>> > +++ b/meson_options.txt<br>> > @@ -32,6 +32,10 @@ option('cocoa', type : 'feature', value : 'auto',<br>> > description: 'Cocoa user interface (macOS only)')<br>> > option('mpath', type : 'feature', value : 'auto',<br>> > description: 'Multipath persistent reservation passthrough')<br>> > +option('iconv', type : 'feature', value : 'auto',<br>> > + description: 'Font glyph conversion support')<br>> > +option('curses', type : 'feature', value : 'auto',<br>> > + description: 'curses UI')<br>> > option('sdl', type : 'feature', value : 'auto',<br>> > description: 'SDL user interface')<br>> > option('sdl_image', type : 'feature', value : 'auto',<br>> > diff --git a/meson.build b/meson.build<br>> > index ad6c7c90c787..1a4a48249243 100644<br>> > --- a/meson.build<br>> > +++ b/meson.build<br>> > @@ -426,6 +426,74 @@ if targetos == 'linux' and have_tools and not<br>> > get_option('mpath').disabled()<br>> > endif<br>> > endif<br>> > <br>> > +iconv = not_found<br>> > +if not get_option('iconv').disabled()<br>> > + libiconv = cc.find_library('iconv',<br>> > + required: false,<br>> > + static: enable_static)<br>> > + if libiconv.found()<br>> > + if cc.links('''<br>> > + #include <iconv.h><br>> > + int main(void) {<br>> > + iconv_t conv = iconv_open("WCHAR_T", "UCS-2");<br>> > + return conv != (iconv_t) -1;<br>> > + }''', dependencies: [libiconv])<br>> > + iconv = declare_dependency(dependencies: [libiconv])<br>> > + endif<br>> > + endif<br>> > +endif<br>> > +if get_option('iconv').enabled() and not iconv.found()<br>> > + error('Cannot detect iconv API')<br>> > +endif<br>> > +<br>> > +curses = not_found<br>> > +if iconv.found() and not get_option('curses').disabled()<br>> > + curses_libname_list = ['ncursesw', 'ncurses', 'cursesw',<br>> > 'pdcurses']<br>> > + curses_test = '''<br>> > + #include <locale.h><br>> > + #include <curses.h><br>> > + #include <wchar.h><br>> > + int main(void) {<br>> > + wchar_t wch = L'w';<br>> > + setlocale(LC_ALL, "");<br>> > + resize_term(0, 0);<br>> > + addwstr(L"wide chars\n");<br>> > + addnwstr(&wch, 1);<br>> > + add_wch(WACS_DEGREE);<br>> > + return 0;<br>> > + }'''<br>> > + foreach curses_libname : curses_libname_list<br>> > + libcurses = dependency(curses_libname,<br>> > + required: false,<br>> > + method: 'pkg-config',<br>> > + static: enable_static)<br>> > +<br>> > + if not libcurses.found()<br>> > + dirs = ['/usr/include/ncursesw']<br>> > + if targetos == 'windows'<br>> > + dirs = []<br>> > + endif<br>> > + libcurses = cc.find_library(curses_libname,<br>> > + required: false,<br>> > + dirs: dirs,<br>> > + static: enable_static)<br>> > + endif<br>> > + if libcurses.found()<br>> > + if cc.links(curses_test, dependencies: [libcurses])<br>> > + curses = declare_dependency(compile_args: '-<br>> > DNCURSES_WIDECHAR', dependencies: [libcurses])<br>> > + break<br>> > + endif<br>> > + endif<br>> > + endforeach<br>> > +endif<br>> > +if get_option('curses').enabled() and not curses.found()<br>> > + if not iconv.found()<br>> > + error('Cannot detect iconv API')<br>> > + else<br>> > + error('Cannot detect curses API')<br>> > + endif<br>> > +endif<br>> > +<br>> > brlapi = not_found<br>> > if 'CONFIG_BRLAPI' in config_host<br>> > brlapi = declare_dependency(link_args:<br>> > config_host['BRLAPI_LIBS'].split())<br>> > @@ -504,16 +572,6 @@ if 'CONFIG_X11' in config_host<br>> > x11 = declare_dependency(compile_args:<br>> > config_host['X11_CFLAGS'].split(),<br>> > link_args:<br>> > config_host['X11_LIBS'].split())<br>> > endif<br>> > -curses = not_found<br>> > -if 'CONFIG_CURSES' in config_host<br>> > - curses = declare_dependency(compile_args:<br>> > config_host['CURSES_CFLAGS'].split(),<br>> > - link_args:<br>> > config_host['CURSES_LIBS'].split())<br>> > -endif<br>> > -iconv = not_found<br>> > -if 'CONFIG_ICONV' in config_host<br>> > - iconv = declare_dependency(compile_args:<br>> > config_host['ICONV_CFLAGS'].split(),<br>> > - link_args:<br>> > config_host['ICONV_LIBS'].split())<br>> > -endif<br>> > vnc = not_found<br>> > png = not_found<br>> > jpeg = not_found<br>> > @@ -622,6 +680,7 @@ config_host_data.set('CONFIG_COCOA',<br>> > cocoa.found())<br>> > config_host_data.set('CONFIG_LIBUDEV', libudev.found())<br>> > config_host_data.set('CONFIG_MPATH', mpathpersist.found())<br>> > config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)<br>> > +config_host_data.set('CONFIG_CURSES', curses.found())<br>> > config_host_data.set('CONFIG_SDL', sdl.found())<br>> > config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())<br>> > config_host_data.set('CONFIG_VNC', vnc.found())<br>> > @@ -1905,8 +1964,8 @@ if config_host.has_key('CONFIG_NETTLE')<br>> > endif<br>> > summary_info +=<br>> > {'libtasn1': config_host.has_key('CONFIG_TASN1')}<br>> > summary_info +=<br>> > {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}<br>> > -summary_info += {'iconv<br>> > support': config_host.has_key('CONFIG_ICONV')}<br>> > -summary_info += {'curses<br>> > support': config_host.has_key('CONFIG_CURSES')}<br>> > +summary_info += {'iconv support': iconv.found()}<br>> > +summary_info += {'curses support': curses.found()}<br>> > # TODO: add back version<br>> > summary_info += {'virgl<br>> > support': config_host.has_key('CONFIG_VIRGL')}<br>> > summary_info += {'curl<br>> > support': config_host.has_key('CONFIG_CURL')}<br>> > diff --git a/ui/meson.build b/ui/meson.build<br>> > index 8a080c38e325..78ad792ffb8d 100644<br>> > --- a/ui/meson.build<br>> > +++ b/ui/meson.build<br>> > @@ -39,7 +39,7 @@ specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true:<br>> > opengl)<br>> > <br>> > ui_modules = {}<br>> > <br>> > -if config_host.has_key('CONFIG_CURSES')<br>> > +if curses.found()<br>> > curses_ss = ss.source_set()<br>> > curses_ss.add(when: [curses, iconv], if_true: [files('curses.c'),<br>> > pixman])<br>> > ui_modules += {'curses' : curses_ss}<br>><br>> I find that this change causes a configure failure when choosing either<br>> --enable-iconv or --enable-curses as follows:<br>><br>> ../configure --enable-curses results in<br>> ../meson.build:491:4: ERROR: Problem encountered: Cannot detect iconv<br>> API<br>><br>> ../configure --enable-iconv results in<br>> ../meson.build:446:2: ERROR: Problem encountered: Cannot detect iconv<br>> API<br>><br>> I haven't yet learned meson well enough to identify further what is<br>> going wrong.<br>><br>> Can someone take a look at what might be failing, or give me some clue<br>> what I can check on or report on from my end which would be helpful to<br>> resolve this?<br>> I am running openSUSE Tumbleweed, by the way.<br>><br>> Thanks,<br>><br>> Bruce<br>><br><br><br>--<br> 此致<br>礼<br>罗勇刚<br>Yours<br> sincerely,<br>Yonggang Luo</div>
I believe we shouldn't be conditionalizing running the iconv c program detection on the iconv library having been found. At least that's my semi-uninformed analysis so far. - Bruce
diff --git a/configure b/configure index 9a87685517ee..f839c2a557c3 100755 --- a/configure +++ b/configure @@ -295,7 +295,8 @@ unset target_list_exclude brlapi="" curl="" -curses="" +iconv="auto" +curses="auto" docs="" fdt="auto" netmap="no" @@ -1173,13 +1174,13 @@ for opt do ;; --disable-safe-stack) safe_stack="no" ;; - --disable-curses) curses="no" + --disable-curses) curses="disabled" ;; - --enable-curses) curses="yes" + --enable-curses) curses="enabled" ;; - --disable-iconv) iconv="no" + --disable-iconv) iconv="disabled" ;; - --enable-iconv) iconv="yes" + --enable-iconv) iconv="enabled" ;; --disable-curl) curl="no" ;; @@ -3440,102 +3441,6 @@ EOF fi fi -########################################## -# iconv probe -if test "$iconv" != "no" ; then - cat > $TMPC << EOF -#include <iconv.h> -int main(void) { - iconv_t conv = iconv_open("WCHAR_T", "UCS-2"); - return conv != (iconv_t) -1; -} -EOF - iconv_prefix_list="/usr/local:/usr" - iconv_lib_list=":-liconv" - IFS=: - for iconv_prefix in $iconv_prefix_list; do - IFS=: - iconv_cflags="-I$iconv_prefix/include" - iconv_ldflags="-L$iconv_prefix/lib" - for iconv_link in $iconv_lib_list; do - unset IFS - iconv_lib="$iconv_ldflags $iconv_link" - echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> config.log - if compile_prog "$iconv_cflags" "$iconv_lib" ; then - iconv_found=yes - break - fi - done - if test "$iconv_found" = yes ; then - break - fi - done - if test "$iconv_found" = "yes" ; then - iconv=yes - else - if test "$iconv" = "yes" ; then - feature_not_found "iconv" "Install iconv devel" - fi - iconv=no - fi -fi - -########################################## -# curses probe -if test "$iconv" = "no" ; then - # curses will need iconv - curses=no -fi -if test "$curses" != "no" ; then - if test "$mingw32" = "yes" ; then - curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):" - curses_lib_list="$($pkg_config --libs ncurses 2>/dev/null):-lpdcurses" - else - curses_inc_list="$($pkg_config --cflags ncursesw 2>/dev/null):-I/usr/include/ncursesw:" - curses_lib_list="$($pkg_config --libs ncursesw 2>/dev/null):-lncursesw:-lcursesw" - fi - curses_found=no - cat > $TMPC << EOF -#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; -} -EOF - IFS=: - for curses_inc in $curses_inc_list; do - # Make sure we get the wide character prototypes - curses_inc="-DNCURSES_WIDECHAR $curses_inc" - IFS=: - for curses_lib in $curses_lib_list; do - unset IFS - if compile_prog "$curses_inc" "$curses_lib" ; then - curses_found=yes - break - fi - done - if test "$curses_found" = yes ; then - break - fi - done - unset IFS - if test "$curses_found" = "yes" ; then - curses=yes - else - if test "$curses" = "yes" ; then - feature_not_found "curses" "Install ncurses devel" - fi - curses=no - fi -fi - ########################################## # curl probe if test "$curl" != "no" ; then @@ -6200,16 +6105,6 @@ if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak echo "X11_LIBS=$x11_libs" >> $config_host_mak fi -if test "$iconv" = "yes" ; then - echo "CONFIG_ICONV=y" >> $config_host_mak - echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak - echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak -fi -if test "$curses" = "yes" ; then - echo "CONFIG_CURSES=y" >> $config_host_mak - echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak - echo "CURSES_LIBS=$curses_lib" >> $config_host_mak -fi if test "$pipe2" = "yes" ; then echo "CONFIG_PIPE2=y" >> $config_host_mak fi @@ -7181,6 +7076,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \ -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \ -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \ + -Diconv=$iconv -Dcurses=$curses \ $cross_arg \ "$PWD" "$source_path" diff --git a/meson_options.txt b/meson_options.txt index 1d3c94840a90..e6cb1e589b4e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -32,6 +32,10 @@ option('cocoa', type : 'feature', value : 'auto', description: 'Cocoa user interface (macOS only)') option('mpath', type : 'feature', value : 'auto', description: 'Multipath persistent reservation passthrough') +option('iconv', type : 'feature', value : 'auto', + description: 'Font glyph conversion support') +option('curses', type : 'feature', value : 'auto', + description: 'curses UI') option('sdl', type : 'feature', value : 'auto', description: 'SDL user interface') option('sdl_image', type : 'feature', value : 'auto', diff --git a/meson.build b/meson.build index ad6c7c90c787..1a4a48249243 100644 --- a/meson.build +++ b/meson.build @@ -426,6 +426,74 @@ if targetos == 'linux' and have_tools and not get_option('mpath').disabled() endif endif +iconv = not_found +if not get_option('iconv').disabled() + libiconv = cc.find_library('iconv', + required: false, + static: enable_static) + if libiconv.found() + 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 +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 + 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 +if get_option('curses').enabled() and not curses.found() + if not iconv.found() + error('Cannot detect iconv API') + else + error('Cannot detect curses API') + endif +endif + brlapi = not_found if 'CONFIG_BRLAPI' in config_host brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split()) @@ -504,16 +572,6 @@ if 'CONFIG_X11' in config_host x11 = declare_dependency(compile_args: config_host['X11_CFLAGS'].split(), link_args: config_host['X11_LIBS'].split()) endif -curses = not_found -if 'CONFIG_CURSES' in config_host - curses = declare_dependency(compile_args: config_host['CURSES_CFLAGS'].split(), - link_args: config_host['CURSES_LIBS'].split()) -endif -iconv = not_found -if 'CONFIG_ICONV' in config_host - iconv = declare_dependency(compile_args: config_host['ICONV_CFLAGS'].split(), - link_args: config_host['ICONV_LIBS'].split()) -endif vnc = not_found png = not_found jpeg = not_found @@ -622,6 +680,7 @@ config_host_data.set('CONFIG_COCOA', cocoa.found()) config_host_data.set('CONFIG_LIBUDEV', libudev.found()) config_host_data.set('CONFIG_MPATH', mpathpersist.found()) config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api) +config_host_data.set('CONFIG_CURSES', curses.found()) config_host_data.set('CONFIG_SDL', sdl.found()) config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) config_host_data.set('CONFIG_VNC', vnc.found()) @@ -1905,8 +1964,8 @@ if config_host.has_key('CONFIG_NETTLE') endif summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')} summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')} -summary_info += {'iconv support': config_host.has_key('CONFIG_ICONV')} -summary_info += {'curses support': config_host.has_key('CONFIG_CURSES')} +summary_info += {'iconv support': iconv.found()} +summary_info += {'curses support': curses.found()} # TODO: add back version summary_info += {'virgl support': config_host.has_key('CONFIG_VIRGL')} summary_info += {'curl support': config_host.has_key('CONFIG_CURL')} diff --git a/ui/meson.build b/ui/meson.build index 8a080c38e325..78ad792ffb8d 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -39,7 +39,7 @@ specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: opengl) ui_modules = {} -if config_host.has_key('CONFIG_CURSES') +if curses.found() curses_ss = ss.source_set() curses_ss.add(when: [curses, iconv], if_true: [files('curses.c'), pixman]) ui_modules += {'curses' : curses_ss}