summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-08 15:20:28 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-08 15:31:38 -0800
commit96d84072fe0d0dcbd047cc8f9b3012e0c522d125 (patch)
tree9107a33a9252950abb82dc6d7d9466ec6a938c33
parentb0491c6f37255e200c6f434616f7f7d72ece5302 (diff)
Fix builds on Solaris
Need to include the ncurses version of curses.h when linking against ncurses, as the standard Solaris curses.h is incompatible with ncurses. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--configure.ac4
-rw-r--r--xrestop.c8
2 files changed, 10 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 99df638..0bd998d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,9 @@ XORG_DEFAULT_OPTIONS
PKG_CHECK_MODULES(XLIBS, x11 xres xext)
# check for ncurses, fall back to curses
-AC_CHECK_LIB([ncurses], [initscr],,AC_CHECK_LIB([curses], [initscr]))
+AC_SEARCH_LIBS([initscr], [ncurses curses])
+AS_IF([test "x$ac_cv_search_initscr" = "x-lncurses"],
+ [AC_CHECK_HEADERS([ncurses.h ncurses/curses.h])])
AC_SEARCH_LIBS([stdscr], [tinfo])
# Checks for typedefs, structures, and compiler characteristics.
diff --git a/xrestop.c b/xrestop.c
index 16b4887..58b2e44 100644
--- a/xrestop.c
+++ b/xrestop.c
@@ -34,6 +34,10 @@
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -44,8 +48,10 @@
#include <X11/Xatom.h>
#include <X11/extensions/XRes.h>
-#ifdef HAVE_LIBNCURSES
+#ifdef HAVE_NCURSES_H
#include <ncurses.h>
+#elif defined(HAVE_NCURSES_CURSES_H)
+#include <ncurses/curses.h>
#else
#include <curses.h>
#endif