From: Pietro Cerutti Date: Thu, 5 Apr 2018 11:20:31 +0000 (+0100) Subject: Build: restructure ncurses/tinfo checks (#1119) X-Git-Tag: neomutt-20180512~64 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6c995c776e6d9d612765bfd1f7a294063ed89b3d;p=neomutt Build: restructure ncurses/tinfo checks (#1119) * Build: restructure ncurses/tinfo checks Issue #1118 * Fallback to ncurses library for tgetent This fixes the configure phase in NetBSD, which doesn't have a separate tinfo library in base. Issue #1118 --- diff --git a/auto.def b/auto.def index 1d492ff20..b6155c8ca 100644 --- a/auto.def +++ b/auto.def @@ -470,45 +470,53 @@ if {[get-define want-fmemopen]} { switch [opt-val with-ui ncurses] { ncurses { define-append CFLAGS -DNCURSES_WIDECHAR - # Locate the library defining waddnwstr() set ncurses_prefix [opt-val with-ncurses $prefix] + cc-with [list -libs -L$ncurses_prefix/lib] { - foreach ncurses_lib {ncursesw ncurses curses} { - if {[cc-check-function-in-lib waddnwstr $ncurses_lib]} { + + set tinfo_libs {tinfow tinfo} + set ncurses_libs {ncursesw ncurses curses} + + # Locate the library defining tgetent() + # This must be done *before* checking for ncurses functions, see + # https://github.com/neomutt/neomutt/issues/1118 + foreach tinfo_lib [concat $tinfo_libs $ncurses_libs] { + if {[cc-check-function-in-lib tgetent $tinfo_lib]} { break } } - } - if {![have-feature waddnwstr]} { - user-error "Unable to find ncursesw library" - } - # Locate the directory containing ncurses.h - # See https://github.com/neomutt/neomutt/pull/679 - set found 0 - cc-with [list -cflags -I$ncurses_prefix/include] { - foreach ncurses_inc {ncursesw/ ncurses/ curses/ {}} { - if {[cc-check-includes ${ncurses_inc}ncurses.h] || - [cc-check-includes ${ncurses_inc}curses.h]} { - set found 1 + # Locate the library defining waddnwstr() + foreach ncurses_lib $ncurses_libs { + if {[cc-check-function-in-lib waddnwstr $ncurses_lib]} { break } } - } - if {!$found} { - user-error "Unable to find ncurses headers" - } - cc-with [list -libs -L$ncurses_prefix/lib] { - if {![cc-check-function-in-lib tgetent $ncurses_lib]} { - cc-check-function-in-lib tgetent tinfo + if {![have-feature waddnwstr] || ![have-feature tgetent]} { + user-error "Unable to find ncursesw library" } + foreach f {start_color typeahead bkgdset curs_set meta use_default_colors} { cc-check-function-in-lib $f $ncurses_lib } cc-check-functions use_extended_names } + # Locate the directory containing ncurses.h + # See https://github.com/neomutt/neomutt/pull/679 + apply {{ncurses_prefix} { + cc-with [list -cflags -I$ncurses_prefix/include] { + foreach ncurses_inc {ncursesw/ ncurses/ curses/ {}} { + if {[cc-check-includes ${ncurses_inc}ncurses.h] || + [cc-check-includes ${ncurses_inc}curses.h]} { + return + } + } + user-error "Unable to find ncurses headers" + } + }} $ncurses_prefix + if {[have-feature start_color]} { define-feature COLOR }