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,7 +455,9 @@ if targetos == 'linux' and have_tools and not get_option('mpath').disabled()
endif
iconv = not_found
if not get_option('iconv').disabled()
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,
static: enable_static)
@ -467,13 +469,11 @@ if not get_option('iconv').disabled()
}''', dependencies: [libiconv])
iconv = declare_dependency(dependencies: [libiconv])
endif
endif
if get_option('iconv').enabled() and not iconv.found()
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()
endif
if iconv.found()
curses_libname_list = ['ncursesw', 'ncurses', 'cursesw', 'pdcurses']
curses_test = '''
#include <locale.h>
@ -511,12 +511,17 @@ if iconv.found() and not get_option('curses').disabled()
endif
endif
endforeach
endif
if get_option('curses').enabled() and not curses.found()
if not iconv.found()
error('Cannot detect iconv API')
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
error('Cannot detect curses API')
warning('iconv required for curses UI but not available, disabling')
endif
endif
endif