ncurses: fix cross build on MacOS
(cherry picked from commit ad553bd419a81274e9369e91753b74d3942ce938)