Use ncurses OR curses, don't mix header and library. Tested by Rob Paisley.

This commit is contained in:
Nicholas Marriott
2016-09-08 19:28:56 +01:00
parent 3ed0973493
commit c6cdab1f79

View File

@@ -162,28 +162,44 @@ PKG_CHECK_MODULES(
[ [
CPPFLAGS="$LIBNCURSES_CFLAGS $CPPFLAGS" CPPFLAGS="$LIBNCURSES_CFLAGS $CPPFLAGS"
LIBS="$LIBNCURSES_LIBS $LIBS" LIBS="$LIBNCURSES_LIBS $LIBS"
found_curses=yes found_ncurses=yes
], ],
[ found_ncurses=no
AC_SEARCH_LIBS( )
if test "x$found_ncurses" = xno; then
# pkg-config didn't work, try ncurses.
AC_CHECK_LIB(
ncurses,
setupterm,
found_ncurses=yes,
found_ncurses=no
)
AC_CHECK_HEADER(
ncurses.h,
,
found_ncurses=no)
fi
if test "x$found_ncurses" = xyes; then
LIBS="$LIBS -lncurses"
AC_DEFINE(HAVE_NCURSES_H)
else
# No ncurses, try curses.
AC_CHECK_LIB(
curses,
setupterm, setupterm,
[ncurses curses terminfo],
found_curses=yes, found_curses=yes,
found_curses=no found_curses=no
) )
]
)
AC_CHECK_HEADER(
ncurses.h,
AC_DEFINE(HAVE_NCURSES_H),
AC_CHECK_HEADER( AC_CHECK_HEADER(
curses.h, curses.h,
AC_DEFINE(HAVE_CURSES_H), ,
found_curses=no found_curses=no)
) if test "x$found_curses" = xyes; then
) LIBS="$LIBS -lcurses"
if test "x$found_curses" = xno; then AC_DEFINE(HAVE_CURSES_H)
AC_MSG_ERROR("curses not found") else
AC_MSG_ERROR("curses or ncurses not found")
fi
fi fi
# Look for utempter. # Look for utempter.