Skip to content

Commit

Permalink
Rely on pkg-config to find the proper ncurses.h
Browse files Browse the repository at this point in the history
On Ubuntu, /usr/include/ncursesw/ncurses.h is a symlink to ../ncurses.h.
On Gentoo, however, /usr/include/ncurses.h and
/usr/include/ncursesw/ncurses.h are different files, and only the latter
defines the wide character functions: we need to give the compiler the
proper -I flag.

For the sake of portability, ask pgk-config for the correct compiler
flags (including -I). Default to the flags used on Gentoo, which also
work on Ubuntu.
  • Loading branch information
edgar-bonet committed Nov 17, 2023
1 parent ba79765 commit 5bdee13
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ DESTDIR ?=
PREFIX ?= /usr/local
MANPREFIX ?= $(PREFIX)/man
CFLAGS += -Wall -Wextra
CFLAGS += `pkg-config --cflags ncursesw 2>/dev/null || echo '-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -I/usr/include/ncursesw'`
LDLIBS += `pkg-config --libs ncursesw 2>/dev/null || echo '-lcursesw -ltinfo'`
torture: LDLIBS = -lm

Expand Down
1 change: 0 additions & 1 deletion ttyplot.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// Apache License 2.0
//

#define _XOPEN_SOURCE 500 // Get ncurses wchar_t support from SUSv2 (UNIX 98)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Expand Down

0 comments on commit 5bdee13

Please sign in to comment.