Commit 96c929f8 authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

Use ncurses*-config scripts bundled with ncurses.

Ensure that all necessary libs and flags are passed along,
such as adding -ltinfo when needed.

Closes #198.
parent d34645f8
...@@ -144,14 +144,25 @@ if test "x$enable_taskstats" = xyes; then ...@@ -144,14 +144,25 @@ if test "x$enable_taskstats" = xyes; then
AC_DEFINE(HAVE_TASKSTATS, 1, [Define if taskstats support enabled.]) AC_DEFINE(HAVE_TASKSTATS, 1, [Define if taskstats support enabled.])
fi fi
# HTOP_CHECK_NCURSES_LIBRARY(LIBNAME, FUNCTION, DEFINE, CONFIG_SCRIPT, ELSE_PART)
m4_define([HTOP_CHECK_NCURSES_LIBRARY],
[
AC_CHECK_LIB([$1], [$2], [
AC_DEFINE([$3], 1, [The library is present.])
config_script=$([$4] --libs 2> /dev/null)
if test ! "x$config_script" = x; then
LIBS="$config_script $LIBS "
else
LIBS="-l[$1] $LIBS "
fi
], [$5])
])
AC_ARG_ENABLE(unicode, [AC_HELP_STRING([--enable-unicode], [enable Unicode support])], ,enable_unicode="yes") AC_ARG_ENABLE(unicode, [AC_HELP_STRING([--enable-unicode], [enable Unicode support])], ,enable_unicode="yes")
if test "x$enable_unicode" = xyes; then if test "x$enable_unicode" = xyes; then
AC_CHECK_LIB([ncursesw6], [addnwstr], [ HTOP_CHECK_NCURSES_LIBRARY([ncursesw6], [addnwstr], [HAVE_LIBNCURSESW], "ncursesw6-config", [
AC_DEFINE(HAVE_LIBNCURSESW, 1, []) HTOP_CHECK_NCURSES_LIBRARY([ncursesw], [addnwstr], [HAVE_LIBNCURSESW], "ncursesw5-config", [
LIBS="-lncursesw6 $LIBS " HTOP_CHECK_NCURSES_LIBRARY([ncurses], [addnwstr], [HAVE_LIBNCURSES], "ncurses5-config", [
], [
AC_CHECK_LIB([ncursesw], [addnwstr], [], [
AC_CHECK_LIB([ncurses], [addnwstr], [], [
missing_libraries="$missing_libraries libncursesw" missing_libraries="$missing_libraries libncursesw"
AC_MSG_ERROR([You may want to use --disable-unicode or install libncursesw.]) AC_MSG_ERROR([You may want to use --disable-unicode or install libncursesw.])
]) ])
...@@ -162,7 +173,11 @@ if test "x$enable_unicode" = xyes; then ...@@ -162,7 +173,11 @@ if test "x$enable_unicode" = xyes; then
[AC_CHECK_HEADERS([ncurses/curses.h],[:], [AC_CHECK_HEADERS([ncurses/curses.h],[:],
[AC_CHECK_HEADERS([ncurses.h],[:],[missing_headers="$missing_headers $ac_header"])])])]) [AC_CHECK_HEADERS([ncurses.h],[:],[missing_headers="$missing_headers $ac_header"])])])])
else else
AC_CHECK_LIB([ncurses], [refresh], [], [missing_libraries="$missing_libraries libncurses"]) HTOP_CHECK_NCURSES_LIBRARY([ncurses6], [refresh], [HAVE_LIBNCURSES], "ncurses6-config", [
HTOP_CHECK_NCURSES_LIBRARY([ncurses], [refresh], [HAVE_LIBNCURSES], "ncurses5-config", [
missing_libraries="$missing_libraries libncurses"
])
])
AC_CHECK_HEADERS([curses.h],[:], AC_CHECK_HEADERS([curses.h],[:],
[AC_CHECK_HEADERS([ncurses/curses.h],[:], [AC_CHECK_HEADERS([ncurses/curses.h],[:],
[AC_CHECK_HEADERS([ncurses/ncurses.h],[:], [AC_CHECK_HEADERS([ncurses/ncurses.h],[:],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment