From 51d33b9f614f228100bc04224aa103dfb8311187 Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Tue, 9 Sep 2014 18:19:05 +0200 Subject: [PATCH] Fix build when panel header is not in /usr/include When there's no pkg-config file for the panel library, the build breaks if the header is not in /usr/include. At least in openSUSE, we have /usr/include/ncurses.h and /usr/include/ncurses/panel.h. --- configure.ac | 9 ++++++++- src/nwipe.h | 7 +++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 6244c6d..28597ff 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,14 @@ PKG_CHECK_MODULES( CFLAGS="${CFLAGS} ${PANEL_CFLAGS}" LIBS="${LIBS} ${PANEL_LIBS}" ], - [AC_CHECK_LIB([panel], [main], ,[AC_MSG_ERROR([ncurses panel library not found])])] + [AC_CHECK_LIB([panel], [main], [ + LIBS="-lpanel $LIBS" + AC_CHECK_HEADERS(panel.h,, [ + AC_CHECK_HEADERS(ncurses/panel.h, [ + AC_DEFINE([PANEL_IN_SUBDIR], [ncurses/], [Look for ncurses headers in subdir]) + ], [AC_MSG_ERROR([ncurses panel headers not found])]) + ]) + ], [AC_MSG_ERROR([ncurses panel library not found])])] ) PKG_CHECK_MODULES( diff --git a/src/nwipe.h b/src/nwipe.h index 600c6e6..18cce4e 100644 --- a/src/nwipe.h +++ b/src/nwipe.h @@ -65,12 +65,15 @@ extern int log_current_element; extern int log_elements_allocated; extern pthread_mutex_t mutex1; -/* Ncurses headers. Assume panel.h is in same place.*/ +/* Ncurses headers. */ #ifdef NCURSES_IN_SUBDIR #include - #include #else #include +#endif +#ifdef PANEL_IN_SUBDIR + #include +#else #include #endif