autoconf: update curses.m4
[openafs.git] / src / cf / curses.m4
index a0cdc60..24c6535 100644 (file)
@@ -16,7 +16,10 @@ AC_DEFUN([OPENAFS_CURSES_LIB],
 [AC_CACHE_VAL([openafs_cv_curses_lib],
    [save_LIBS="$LIBS"
     openafs_cv_curses_lib=
-    AC_CHECK_LIB([ncurses], [initscr], [openafs_cv_curses_lib=-lncurses])
+    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"])])])
     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],
@@ -34,8 +37,10 @@ AC_DEFUN([_OPENAFS_CURSES_GETMAXYX_XTI],
  AC_CACHE_CHECK([getmaxyx macro], [openafs_cv_curses_getmaxyx],
    [save_LIBS="$LIBS"
     LIBS="$LIBS $LIB_curses"
-    AC_TRY_LINK(_OPENAFS_CURSES_HEADERS,
-               [int mx, my; initscr(); getmaxyx(stdscr, my, mx); endwin();],
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM(
+               _OPENAFS_CURSES_HEADERS,
+               [int mx, my; initscr(); getmaxyx(stdscr, my, mx); endwin();])],
                [openafs_cv_curses_getmaxyx=yes],
                [openafs_cv_curses_getmaxyx=no])
     LIBS="$save_LIBS"])
@@ -55,7 +60,7 @@ AC_DEFUN([_OPENAFS_CURSES_GETMAXYX_BSD43],
  dnl possibly this may need to be done as above in some cases?
  AC_CHECK_FUNCS([getmaxx getmaxy], [], [_openafs_curses_bsd43=no])
  LIBS="$save_LIBS"
- AS_IF([$_openafs_curses_bsd43 = yes], [$1], [$2])])
+ AS_IF([test "$_openafs_curses_bsd43" = yes], [$1], [$2])])
 
 dnl _OPENAFS_CURSES_GETMAXYX_BSDVI([ACTION-IF-SUCCESS], [ACTION_IF_FAILURE])
 dnl test for getmaxx() and getmaxy() as from BSD curses as bodily ripped
@@ -68,7 +73,7 @@ AC_DEFUN([_OPENAFS_CURSES_GETMAXYX_BSDVI],
  AC_CHECK_MEMBERS([WINDOW._maxx WINDOW._maxy], [], [_openafs_curses_bsdvi=no],
                  _OPENAFS_CURSES_HEADERS)
  LIBS="$save_LIBS"
- AS_IF([$_openafs_curses_bsdvi = yes], [$1], [$2])])
+ AS_IF([test "$_openafs_curses_bsdvi" = yes], [$1], [$2])])
 
 dnl OPENAFS_CURSES_WINDOW_EXTENTS([ACTION-IF-SUCCESS], [ACTION_IF_FAILURE])
 dnl check for standard getmaxyx macro. failing that, try the
@@ -78,11 +83,11 @@ AC_DEFUN([OPENAFS_CURSES_WINDOW_EXTENTS],
 [OPENAFS_CURSES_LIB
  openafs_curses_extent=none
  _OPENAFS_CURSES_GETMAXYX_XTI([openafs_curses_extent=xti])
- AS_IF([test $openafs_curses_extent = none],
+ AS_IF([test "$openafs_curses_extent" = none],
        [_OPENAFS_CURSES_GETMAXYX_BSD43([openafs_curses_extent=bsd])])
- AS_IF([test $openafs_curses_extent = none],
+ AS_IF([test "$openafs_curses_extent" = none],
        [_OPENAFS_CURSES_GETMAXYX_BSDVI([openafs_curses_extent=vi])],)
- AS_IF([test $openafs_curses_extent != none], [$1], [$2])])
+ AS_IF([test "$openafs_curses_extent" != none], [$1], [$2])])
 
 dnl The top level curses group
 AC_DEFUN([OPENAFS_CURSES],