mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-26 02:51:16 -03:00
[cmake] Clean up curses vs ncurses includes
There were several issues with the way that the include tests for curses.h were being done that were ultimately causing fish to use the headers from ncurses but link against curses on platforms that provide an actual libcurses.so that isn't just a symlink to libncurses.so In particular, the old code was first testing for curses's cureses.h and then falling back to libncurses's implementation of the same - but that logic was reversed when it came to including term.h, in which case it was testing for the ncurses term.h and falling back to the curses.h header. Long story short, while cmake will link against libcurses.so if both libcurses.so and libncurses.so are present (unless CURSES_NEED_NCURSES evaluates to TRUE, but that makes ncurses a hard requirement), but we were brining in some of the defines from the ncurses headers, causing SIGSEGV panics when fish ultimately tried to access variables that weren't exported or were mapped to undefined areas of memory in the other library. Additionally it is an error to include termios.h prior to including the plain Jane curses.h (not ncurses/curses.h), causing errors about unimplemented types SGTTY/chtype. So far as I can tell, both curses.h and ncurses/curses.h pull in termios.h themselves so it shouldn't even be necessary to manually include it, but I have just moved its #include below that of curses.h
This commit is contained in:
@@ -15,12 +15,12 @@
|
||||
#include <unistd.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#if HAVE_NCURSES_H
|
||||
#if HAVE_CURSES_H
|
||||
#include <curses.h>
|
||||
#elif HAVE_NCURSES_H
|
||||
#include <ncurses.h>
|
||||
#elif HAVE_NCURSES_CURSES_H
|
||||
#include <ncurses/curses.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
#endif
|
||||
#if HAVE_TERM_H
|
||||
#include <term.h>
|
||||
|
||||
Reference in New Issue
Block a user