Hi,

For some time now, ncurses can be built in a mode where the low level
terminfo functionality lives in a separate lib called libtinfo.  Because
some people do, this means Mutt needs to include this library in that
case to avoid linking errors like so:

commands.c:226: error: undefined reference to 'stdscr'
commands.c:226: error: undefined reference to 'keypad'
commands.c:312: error: undefined reference to 'COLS'
commands.c:325: error: undefined reference to 'LINES'
commands.c:325: error: undefined reference to 'stdscr'
commands.c:325: error: undefined reference to 'stdscr'
...

Because some binary apps appear to need libtinfo.so, some distros have
decided to symlink libtinfo to libncurses, in order to provide the
necessary symbols, however in the scenario where libtinfo was built by
ncurses, the symbols like above do NOT live in libcnurses any more.

In Gentoo we've used the following patch since 1.5.22:

--- a/configure.ac
+++ b/configure.ac
@@ -331,6 +331,10 @@ main ()
                fi],
 
                 [CF_CURSES_LIBS])
+                 for lib in ncurses ncursesw tinfo
+                 do
+                     AC_CHECK_LIB($lib, stdscr,MUTTLIBS="$MUTTLIBS -l$lib")
+                 done
                ])
 
                old_LIBS="$LIBS"

I noticed SuSE uses another variant, which essentially achieves the same
goal as far as I can see:

--- a/configure.ac
+++ b/configure.ac
@@ -320,9 +320,14 @@ main ()
        do
                AC_CHECK_LIB($lib, waddnwstr, [cf_ncurses="$lib"; break])
        done
+       cf_tinfo=""
+       AC_CHECK_LIB(tinfo, tgetent, [cf_tinfo="tinfo"])
         AC_CHECK_LIB($cf_ncurses, initscr,
-                [MUTTLIBS="$MUTTLIBS -l$cf_ncurses"
-               
+                [if test x$cf_tinfo = x ; then
+                       MUTTLIBS="$MUTTLIBS -l$cf_ncurses"
+               else
+                       MUTTLIBS="$MUTTLIBS -l$cf_ncurses -l$cf_tinfo"
+               fi
                 if test "$cf_ncurses" = ncursesw; then
                        
AC_CHECK_HEADERS(ncursesw/ncurses.h,[cf_cv_ncurses_header="ncursesw/ncurses.h"])
else


I don't have a preference here, but I would like to see one approach
applied to the Mutt repository for the next release, as this might
potentially be beneficial for more people.

I'm affraid the only way to test this is to get an ncurses with split
tinfo library installed.

Thanks,
Fabian

-- 
Fabian Groffen
Gentoo on a different level

Attachment: signature.asc
Description: Digital signature

Reply via email to