diff --git a/erts/configure.ac b/erts/configure.ac index 540cc4b3cba4..aed58c9d17de 100644 --- a/erts/configure.ac +++ b/erts/configure.ac @@ -1250,6 +1250,7 @@ AS_IF([test "x$with_termcap" != "xno" && test "X$host" != "Xwin32"], ]) AC_SUBST(TERMCAP_LIB) +AC_CHECK_HEADERS([termcap.h curses.h term.h]) if test "x$TERMCAP_LIB" != "x"; then diff --git a/erts/emulator/nifs/common/prim_tty_nif.c b/erts/emulator/nifs/common/prim_tty_nif.c index 2a99f4d18713..fe31a1cfe392 100644 --- a/erts/emulator/nifs/common/prim_tty_nif.c +++ b/erts/emulator/nifs/common/prim_tty_nif.c @@ -41,9 +41,17 @@ #include #include #include -#ifdef HAVE_TERMCAP +#if defined(HAVE_TERMCAP) && (defined(HAVE_TERMCAP_H) || (defined(HAVE_CURSES_H) && defined(HAVE_TERM_H))) #include +#ifdef HAVE_TERMCAP_H #include +#else /* !HAVE_TERMCAP_H */ +#include +#include +#endif +#else +/* We detected TERMCAP support, but could not find the correct headers to include */ +#undef HAVE_TERMCAP #endif #ifndef __WIN32__ #include