Merge pull request #4704 from fish-shell/curses_ncurses

Fix curses includes on platforms offering real libcurses.
This commit is contained in:
Mahmoud Al-Qudsi 2018-02-06 10:44:29 -06:00 committed by GitHub
commit 7fafdee98e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 24 additions and 21 deletions

View file

@ -41,8 +41,10 @@ CHECK_CXX_SYMBOL_EXISTS(killpg "sys/types.h;signal.h" HAVE_KILLPG)
CHECK_CXX_SYMBOL_EXISTS(lrand48_r stdlib.h HAVE_LRAND48_R) CHECK_CXX_SYMBOL_EXISTS(lrand48_r stdlib.h HAVE_LRAND48_R)
# mkostemp is in stdlib in glibc and FreeBSD, but unistd on macOS # mkostemp is in stdlib in glibc and FreeBSD, but unistd on macOS
CHECK_CXX_SYMBOL_EXISTS(mkostemp "stdlib.h;unistd.h" HAVE_MKOSTEMP) CHECK_CXX_SYMBOL_EXISTS(mkostemp "stdlib.h;unistd.h" HAVE_MKOSTEMP)
SET(HAVE_CURSES_H ${CURSES_HAVE_CURSES_H})
SET(HAVE_NCURSES_CURSES_H ${CURSES_HAVE_NCURSES_CURSES_H}) SET(HAVE_NCURSES_CURSES_H ${CURSES_HAVE_NCURSES_CURSES_H})
SET(HAVE_NCURSES_H ${CURSES_HAVE_NCURSES_H}) SET(HAVE_NCURSES_H ${CURSES_HAVE_NCURSES_H})
CHECK_INCLUDE_FILES("curses.h;term.h" HAVE_TERM_H)
CHECK_INCLUDE_FILE_CXX("ncurses/term.h" HAVE_NCURSES_TERM_H) CHECK_INCLUDE_FILE_CXX("ncurses/term.h" HAVE_NCURSES_TERM_H)
CHECK_INCLUDE_FILE_CXX(siginfo.h HAVE_SIGINFO_H) CHECK_INCLUDE_FILE_CXX(siginfo.h HAVE_SIGINFO_H)
CHECK_INCLUDE_FILE_CXX(spawn.h HAVE_SPAWN_H) CHECK_INCLUDE_FILE_CXX(spawn.h HAVE_SPAWN_H)
@ -60,7 +62,6 @@ CHECK_INCLUDE_FILE_CXX(sys/ioctl.h HAVE_SYS_IOCTL_H)
CHECK_INCLUDE_FILE_CXX(sys/select.h HAVE_SYS_SELECT_H) CHECK_INCLUDE_FILE_CXX(sys/select.h HAVE_SYS_SELECT_H)
CHECK_INCLUDE_FILES("sys/types.h;sys/sysctl.h" HAVE_SYS_SYSCTL_H) CHECK_INCLUDE_FILES("sys/types.h;sys/sysctl.h" HAVE_SYS_SYSCTL_H)
CHECK_INCLUDE_FILE_CXX(termios.h HAVE_TERMIOS_H) # Needed for TIOCGWINSZ CHECK_INCLUDE_FILE_CXX(termios.h HAVE_TERMIOS_H) # Needed for TIOCGWINSZ
CHECK_INCLUDE_FILE_CXX(term.h HAVE_TERM_H)
CHECK_CXX_SYMBOL_EXISTS(wcscasecmp wchar.h HAVE_WCSCASECMP) CHECK_CXX_SYMBOL_EXISTS(wcscasecmp wchar.h HAVE_WCSCASECMP)
CHECK_CXX_SYMBOL_EXISTS(wcsdup wchar.h HAVE_WCSDUP) CHECK_CXX_SYMBOL_EXISTS(wcsdup wchar.h HAVE_WCSDUP)
CHECK_CXX_SYMBOL_EXISTS(wcslcpy wchar.h HAVE_WCSLCPY) CHECK_CXX_SYMBOL_EXISTS(wcslcpy wchar.h HAVE_WCSLCPY)

View file

@ -40,6 +40,9 @@
/* Define to 1 if you have the `mkostemp' function. */ /* Define to 1 if you have the `mkostemp' function. */
#cmakedefine HAVE_MKOSTEMP 1 #cmakedefine HAVE_MKOSTEMP 1
/* Define to 1 if you have the <curses.h> header file. */
#cmakedefine HAVE_CURSES_H 1
/* Define to 1 if you have the <ncurses/curses.h> header file. */ /* Define to 1 if you have the <ncurses/curses.h> header file. */
#cmakedefine HAVE_NCURSES_CURSES_H 1 #cmakedefine HAVE_NCURSES_CURSES_H 1

View file

@ -4,12 +4,12 @@
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#if HAVE_NCURSES_H #if HAVE_CURSES_H
#include <curses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h> #include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H #elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h> #include <ncurses/curses.h>
#else
#include <curses.h>
#endif #endif
#if HAVE_TERM_H #if HAVE_TERM_H
#include <term.h> #include <term.h>

View file

@ -16,12 +16,12 @@
#include <unistd.h> #include <unistd.h>
#include <wchar.h> #include <wchar.h>
#if HAVE_NCURSES_H #if HAVE_CURSES_H
#include <curses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h> #include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H #elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h> #include <ncurses/curses.h>
#else
#include <curses.h>
#endif #endif
#if HAVE_TERM_H #if HAVE_TERM_H
#include <term.h> #include <term.h>

View file

@ -23,12 +23,12 @@
#if HAVE_GETTEXT #if HAVE_GETTEXT
#include <libintl.h> #include <libintl.h>
#endif #endif
#if HAVE_NCURSES_H #if HAVE_CURSES_H
#include <curses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h> // IWYU pragma: keep #include <ncurses.h> // IWYU pragma: keep
#elif HAVE_NCURSES_CURSES_H #elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h> #include <ncurses/curses.h>
#else
#include <curses.h>
#endif #endif
#if HAVE_TERM_H #if HAVE_TERM_H
#include <term.h> // IWYU pragma: keep #include <term.h> // IWYU pragma: keep

View file

@ -15,9 +15,6 @@
// in <wchar.h>. At least on OS X if we don't do this we get compilation errors do to the macro // in <wchar.h>. At least on OS X if we don't do this we get compilation errors do to the macro
// substitution if wchar.h is included after this header. // substitution if wchar.h is included after this header.
#include <wchar.h> // IWYU pragma: keep #include <wchar.h> // IWYU pragma: keep
#if HAVE_NCURSES_H
#include <ncurses.h> // IWYU pragma: keep
#endif
/// fish's internal versions of wcwidth and wcswidth, which can use an internal implementation if /// fish's internal versions of wcwidth and wcswidth, which can use an internal implementation if
/// the system one is busted. /// the system one is busted.

View file

@ -2,14 +2,15 @@
#include "config.h" #include "config.h"
#include <errno.h> #include <errno.h>
#include <termios.h>
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
#if HAVE_TERM_H #if HAVE_TERM_H
#include <curses.h>
#include <term.h> #include <term.h>
#elif HAVE_NCURSES_TERM_H #elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h> #include <ncurses/term.h>
#endif #endif
#include <termios.h>
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>

View file

@ -4,12 +4,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#if HAVE_NCURSES_H #if HAVE_CURSES_H
#include <curses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h> #include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H #elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h> #include <ncurses/curses.h>
#else
#include <curses.h>
#endif #endif
#if HAVE_TERM_H #if HAVE_TERM_H
#include <term.h> #include <term.h>

View file

@ -10,16 +10,17 @@
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <termios.h>
#include <unistd.h> #include <unistd.h>
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
#if HAVE_TERM_H #if HAVE_TERM_H
#include <curses.h>
#include <term.h> #include <term.h>
#elif HAVE_NCURSES_TERM_H #elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h> #include <ncurses/term.h>
#endif #endif
#include <termios.h>
#ifdef HAVE_SIGINFO_H #ifdef HAVE_SIGINFO_H
#include <siginfo.h> #include <siginfo.h>
#endif #endif

View file

@ -15,12 +15,12 @@
#include <unistd.h> #include <unistd.h>
#include <wchar.h> #include <wchar.h>
#if HAVE_NCURSES_H #if HAVE_CURSES_H
#include <curses.h>
#elif HAVE_NCURSES_H
#include <ncurses.h> #include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H #elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h> #include <ncurses/curses.h>
#else
#include <curses.h>
#endif #endif
#if HAVE_TERM_H #if HAVE_TERM_H
#include <term.h> #include <term.h>