From b8d47696fa8930d42cb6c6639f5dc78f340b60d3 Mon Sep 17 00:00:00 2001 From: David Gow Date: Wed, 30 Jun 2021 20:58:15 +0800 Subject: [PATCH] Handle 'panel.h' being in an 'ncurses' directory Some Linux distributions (such as OpenSUSE) do not keep the ncurses 'panel.h' file in the default include path, but rather in a subdirectory. Update the configure script and curses/ConWin.hpp file to look in both places for a 'panel.h' file. 'panel.h' is still preferred over 'ncurses/panel.h', as we expect other ncurses headers to be in the include path. --- config.h.in | 3 +++ configure.ac | 2 +- curses/ConWin.hpp | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config.h.in b/config.h.in index f98ea63..7abfbc9 100644 --- a/config.h.in +++ b/config.h.in @@ -21,6 +21,9 @@ /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET +/* Define to 1 if you have the header file. */ +#undef HAVE_NCURSES_PANEL_H + /* Define to 1 if you have the header file. */ #undef HAVE_PANEL_H diff --git a/configure.ac b/configure.ac index 26c781f..29806af 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,7 @@ AC_SEARCH_LIBS([new_panel], [panel], , # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([errno.h fcntl.h limits.h panel.h stdlib.h string.h unistd.h]) +AC_CHECK_HEADERS([errno.h fcntl.h limits.h panel.h ncurses/panel.h stdlib.h string.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL diff --git a/curses/ConWin.hpp b/curses/ConWin.hpp index 6ad2989..46c2f51 100644 --- a/curses/ConWin.hpp +++ b/curses/ConWin.hpp @@ -23,7 +23,14 @@ #define INCLUDED_CONWIN_HPP +#include "config.h" +#if defined(HAVE_PANEL_H) #include +#elif defined(HAVE_NCURSES_PANEL_H) +#include +#else +#error "Couldn't find a panel.h header." +#endif #undef border // It interferes with my member function #define KEY_ESCAPE 0x1B