From bc7614b9705c62b62a356408afa3578d1e519512 Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 19 Dec 2018 19:22:35 -0500 Subject: project: custom config: handle all ncurses-related bits at config-time. --- project/config/cfgdefs.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) (limited to 'project/config') diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh index f184cb3..492dd3f 100644 --- a/project/config/cfgdefs.sh +++ b/project/config/cfgdefs.sh @@ -114,15 +114,56 @@ cfgdefs_perform_common_tests() cfgtest_cflags_append '-DHAVE_GETRANDOM_SYSCALL' fi + # ncurses + cfgtest_newline + cfgtest_comment 'ncurses/ncursesw' + mb_cfgtest_headers='ncurses.h' + + if [ $mb_cfgtest_cfgtype = 'target' ]; then + mb_cfgtest_makevar='CFLAGS_NCURSES' + else + mb_cfgtest_makevar='NATIVE_CC_CFLAGS' + fi + + cfgtest_unit_header_presence 'curses.h' + cfgtest_unit_header_presence 'ncurses.h' + + cfgtest_unit_header_presence 'ncurses/panel.h' && mb_panel_wrapper='yes' + cfgtest_unit_header_presence 'ncursesw/panel.h' && mb_panel_wrapper='yes' + + if cfgtest_unit_interface_presence 'is_term_resized'; then + cfgtest_makevar_append '-DHAVE_CURSES_IS_TERM_RESIZED' + fi + + if cfgtest_unit_interface_presence 'resizeterm'; then + cfgtest_makevar_append '-DHAVE_CURSES_RESIZETERM' + fi + + if cfgtest_unit_interface_presence 'resize_term'; then + cfgtest_makevar_append '-DHAVE_CURSES_RESIZE_TERM' + fi + + # ncursesw + if cfgtest_unit_interface_presence 'mvwget_wch'; then + cfgtest_makevar_append '-DHAVE_NCURSESW' + fi + # ncurses: python refers to members of typedef struct _win_st WINDOW - cfgtest_cflags_append '-DNCURSES_INTERNALS' + cfgtest_makevar_append '-DNCURSES_INTERNALS' + + # + if [ -n "$mb_panel_wrapper" ]; then + cfgtest_makevar_append '-I$(PROJECT_DIR)/wrappers' + unset mb_panel_wrapper + fi # ncurses libs (common part) mb_ncurses_libs='-lpanelw -lncursesw' mb_ncurses_tinfo='-ltinfo' - cfgtest_library_presence $mb_ncurses_tinfo \ - && mb_ncurses_libs="$mb_ncurses_libs $mb_ncurses_tinfo" + if cfgtest_library_presence $mb_ncurses_tinfo; then + mb_ncurses_libs="$mb_ncurses_libs $mb_ncurses_tinfo" + fi } @@ -138,6 +179,14 @@ cfgdefs_perform_target_tests() mb_cfgtest_makevar='LDFLAGS_NCURSES_LIBS' cfgtest_makevar_append $mb_ncurses_libs + mb_cfgtest_makevar='LDFLAGS_NCURSES' + cfgtest_makevar_append \ + '-Wl,--as-needed $(LDFLAGS_NCURSES_LIBS)' \ + '-Wl,--no-as-needed' + + mb_cfgtest_makevar='LDFLAGS_NCURSES_STATIC' + cfgtest_makevar_append '$(LDFLAGS_NCURSES)' + # ndbm cfgtest_newline cfgtest_comment 'ndbm' -- cgit v1.2.3