diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-22 16:22:21 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-28 18:25:21 +0900 |
commit | 1c5af5cf9308fff327f52c7efd2dfa732d370871 (patch) | |
tree | 4213cc0e09349a31a41715acb94b6196f415abdb /scripts/kconfig/lxdialog | |
parent | b464ef583dc71bb066ea83bda43317196f94da9c (diff) |
kconfig: refactor ncurses package checks for building mconf and nconf
The mconf (or its infrastructure, lxdiaglog) depends on the ncurses.
Move and rename check-lxdialog.sh to mconf-cfg.sh to make it work in
the same way as for qconf and gconf.
This commit fixes some more weirdnesses.
The nconf also needs ncurses packages. HOSTLOADLIBES_nconf is set
to the libraries needed for nconf, but the cflags is not explicitly
set. Actually, nconf relies on the check-lxdialog.sh for the proper
cflags:
HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
-DLOCALE
The code above passes the ncurses flags to all objects, even for conf,
qconf, gconf. Let's pass the ncurses flags only to mconf and nconf.
Currently, the presence of ncurses is not checked for nconf. Let's
show a prompt like the mconf case.
According to Randy's report, the shell scripts still need to carry
the fallback code in case the pkg-config fails to find the ncurses
packages.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig/lxdialog')
-rwxr-xr-x | scripts/kconfig/lxdialog/check-lxdialog.sh | 93 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/dialog.h | 2 |
2 files changed, 1 insertions, 94 deletions
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh deleted file mode 100755 index 6c0bcd9c472d..000000000000 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0 -# Check ncurses compatibility - -# What library to link -ldflags() -{ - 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 - echo "-l${lib}" - exit - fi - done - done - exit 1 -} - -# Where is ncurses.h? -ccflags() -{ - 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="<curses.h>"' - elif [ -f /usr/include/ncurses.h ]; then - echo '-DCURSES_LOC="<ncurses.h>"' - else - echo '-DCURSES_LOC="<curses.h>"' - fi -} - -# Temp file, try to clean up after us -tmp=.lxdialog.tmp -trap "rm -f $tmp" 0 1 2 3 15 - -# Check if we can link to ncurses -check() { - $cc -x c - -o $tmp 2>/dev/null <<'EOF' -#include CURSES_LOC -main() {} -EOF - if [ $? != 0 ]; then - echo " *** Unable to find the ncurses libraries or the" 1>&2 - echo " *** required header files." 1>&2 - echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2 - echo " *** " 1>&2 - echo " *** Install ncurses (ncurses-devel or libncurses-dev " 1>&2 - echo " *** depending on your distribution) and try again." 1>&2 - echo " *** " 1>&2 - exit 1 - fi -} - -usage() { - printf "Usage: $0 [-check compiler options|-ccflags|-ldflags compiler options]\n" -} - -if [ $# -eq 0 ]; then - usage - exit 1 -fi - -cc="" -case "$1" in - "-check") - shift - cc="$@" - check - ;; - "-ccflags") - ccflags - ;; - "-ldflags") - shift - cc="$@" - ldflags - ;; - "*") - usage - exit 1 - ;; -esac diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index fcffd5b41fb0..52e30a0012f1 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h @@ -35,7 +35,7 @@ #ifdef __sun__ #define CURS_MACROS #endif -#include CURSES_LOC +#include <ncurses.h> /* * Colors in ncurses 1.9.9e do not work properly since foreground and |