summaryrefslogtreecommitdiff
path: root/adk/config/lxdialog
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2021-02-25 00:07:42 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2021-02-25 10:05:12 +0100
commitaa3c71ca2b6006105e1919bcf3eaf2c12d342256 (patch)
treec7825ba2aca5cd0bedfadab1c7995f340d62b27a /adk/config/lxdialog
parent009336f7557ef8a74873f6bddcaa31399eede451 (diff)
prereq: Use check-lxdialog.sh to determine curses library
Curses detection in adk/config/Makefile is a mess - pkg-config was designed to avoid exactly that, so make it a required tool on all host OSs and call check-lxdialog.sh from mconf sources which uses it to define the required curses LIBS and CFLAGS from prereq.sh. Since pkg-config output also contains the right arguments for libtinfo (which depends on the chosen curses variant), no mismatches between the two may happen anymore. While being at it, sync check-lxdialog.sh with current linux sources so it covers installations with widechar support as well. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'adk/config/lxdialog')
-rw-r--r--adk/config/lxdialog/check-lxdialog.sh17
1 files changed, 13 insertions, 4 deletions
diff --git a/adk/config/lxdialog/check-lxdialog.sh b/adk/config/lxdialog/check-lxdialog.sh
index fcef0f59d..5075ebf2d 100644
--- a/adk/config/lxdialog/check-lxdialog.sh
+++ b/adk/config/lxdialog/check-lxdialog.sh
@@ -4,7 +4,9 @@
# What library to link
ldflags()
{
- for ext in so a dylib ; do
+ pkg-config --libs ncursesw 2>/dev/null && exit
+ pkg-config --libs ncurses 2>/dev/null && exit
+ for ext in so a dll.a dylib ; do
for lib in ncursesw ncurses curses ; do
$cc -print-file-name=lib${lib}.${ext} | grep -q /
if [ $? -eq 0 ]; then
@@ -19,10 +21,17 @@ ldflags()
# Where is ncurses.h?
ccflags()
{
- if [ -f /usr/include/ncurses/ncurses.h ]; then
+ if pkg-config --cflags ncursesw 2>/dev/null; then
+ echo '-DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1'
+ elif pkg-config --cflags ncurses 2>/dev/null; then
+ echo '-DCURSES_LOC="<ncurses.h>"'
+ elif [ -f /usr/include/ncursesw/curses.h ]; then
+ echo '-I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"'
+ echo ' -DNCURSES_WIDECHAR=1'
+ elif [ -f /usr/include/ncurses/ncurses.h ]; then
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
elif [ -f /usr/include/ncurses/curses.h ]; then
- echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
+ echo '-I/usr/include/ncurses -DCURSES_LOC="<curses.h>"'
elif [ -f /usr/include/ncurses.h ]; then
echo '-DCURSES_LOC="<ncurses.h>"'
else
@@ -36,7 +45,7 @@ trap "rm -f $tmp" 0 1 2 3 15
# Check if we can link to ncurses
check() {
- $cc -xc - -o $tmp 2>/dev/null <<'EOF'
+ $cc -x c - -o $tmp 2>/dev/null <<'EOF'
#include CURSES_LOC
main() {}
EOF