meson: cleanup curses/iconv test

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>
This commit is contained in:
Paolo Bonzini 2020-10-15 13:26:50 -04:00
parent ac0c8351ab
commit 30fe76b17c

View file

@ -455,6 +455,8 @@ if targetos == 'linux' and have_tools and not get_option('mpath').disabled()
endif
iconv = not_found
curses = not_found
if have_system and not get_option('curses').disabled()
if not get_option('iconv').disabled()
libiconv = cc.find_library('iconv',
required: false,
@ -471,9 +473,7 @@ 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()
if iconv.found()
curses_libname_list = ['ncursesw', 'ncurses', 'cursesw', 'pdcurses']
curses_test = '''
#include <locale.h>
@ -512,11 +512,16 @@ if iconv.found() and not get_option('curses').disabled()
endif
endforeach
endif
if get_option('curses').enabled() and not curses.found()
if not iconv.found()
error('Cannot detect iconv API')
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
error('Cannot detect curses API')
warning('iconv required for curses UI but not available, disabling')
endif
endif
endif