autoconf: Additional library test for ncurses 89/14889/3
authorCheyenne Wills <cwills@sinenomine.net>
Wed, 9 Feb 2022 21:00:13 +0000 (14:00 -0700)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 18 Aug 2022 15:44:05 +0000 (11:44 -0400)
Depending on how the ncurses libraries were built the external symbol
'LINES' may be replaced with the '_nc_LINES' external symbol.  Because
the symbol 'LINES' may or may not be present, the autoconf test can fail
to detect the correct libraries needed for curses support.

Add an additional AC_CHECK_LIBs for the symbol _nc_LINES (within the
ncurses or tinfo libraries) when setting the $LIB_curses.

This commit was adapted from the openSuSE source packaging for openafs.

Background: when ncurses is built with --enable-reentrant, LINES is
defined as a C preprocessor macro that expands to a call to _nc_LINES

Change-Id: If5e93078ff8cd0af5a50a25a8be7b462261a4f6f
Reviewed-on: https://gerrit.openafs.org/14889
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Ralf Brunckhorst <rbrunckhorst@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/cf/curses.m4

index 24c6535..1691845 100644 (file)
@@ -19,7 +19,11 @@ AC_DEFUN([OPENAFS_CURSES_LIB],
     AC_CHECK_LIB([ncurses], [initscr],
                 [AC_CHECK_LIB([ncurses], [LINES], [openafs_cv_curses_lib=-lncurses],
                               [AC_CHECK_LIB([tinfo], [LINES],
-                                            [openafs_cv_curses_lib="-lncurses -ltinfo"])])])
+                                            [openafs_cv_curses_lib="-lncurses -ltinfo"],
+                                            [AC_CHECK_LIB([ncurses], [_nc_LINES],
+                                                          [openafs_cv_curses_lib=-lncurses],
+                                                          [AC_CHECK_LIB([tinfo], [_nc_LINES],
+                                                                        [openafs_cv_curses_lib="-lncurses -ltinfo"])])])])])
     AS_IF([test "x$openafs_cv_curses_lib" = x],
          [AC_CHECK_LIB([Hcurses], [initscr], [openafs_cv_curses_lib=-lHcurses])])
     AS_IF([test "x$openafs_cv_curses_lib" = x],