Skip to content

Commit

Permalink
kconfig: get rid of stray a.o, support ncursesw
Browse files Browse the repository at this point in the history
scripts/kconfig/lxdialog/check-lxdialog.sh uses gcc to check for
what libraries are present. Redirect output to /dev/null
so we do not generate an a.out.
Also included support for ncursesw - so if present prefer that
instead of ncurses.
The order is now (first is preferred):
1) ncursesw
2) ncurses
3) curses

The latter is to support SunOS.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
  • Loading branch information
Sam Ravnborg committed Jan 15, 2006
1 parent 7c7dce9 commit 60f33b8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
6 changes: 3 additions & 3 deletions scripts/kconfig/lxdialog/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Makefile to build lxdialog package
#

check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh
HOST_EXTRACFLAGS := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
HOST_LOADLIBES := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags)
check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh
HOST_EXTRACFLAGS:= $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
HOST_LOADLIBES := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))

HOST_EXTRACFLAGS += -DLOCALE

Expand Down
23 changes: 18 additions & 5 deletions scripts/kconfig/lxdialog/check-lxdialog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@
# What library to link
ldflags()
{
if [ `uname` == SunOS ]; then
echo '-lcurses'
else
echo "main() {}" | $cc -lncursesw -xc - -o /dev/null 2> /dev/null
if [ $? -eq 0 ]; then
echo '-lncursesw'
exit
fi
echo "main() {}" | $cc -lncurses -xc - -o /dev/null 2> /dev/null
if [ $? -eq 0 ]; then
echo '-lncurses'
exit
fi
echo "main() {}" | $cc -lcurses -xc - -o /dev/null 2> /dev/null
if [ $? -eq 0 ]; then
echo '-lcurses'
exit
fi
exit 1
}

# Where is ncurses.h?
Expand All @@ -28,7 +39,7 @@ ccflags()
compiler=""
# Check if we can link to ncurses
check() {
echo "main() {}" | $compiler -xc -
echo "main() {}" | $cc -xc - -o /dev/null 2> /dev/null
if [ $? != 0 ]; then
echo " *** Unable to find the ncurses libraries." 1>&2
echo " *** make menuconfig require the ncurses libraries" 1>&2
Expand All @@ -51,13 +62,15 @@ fi
case "$1" in
"-check")
shift
compiler="$@"
cc="$@"
check
;;
"-ccflags")
ccflags
;;
"-ldflags")
shift
cc="$@"
ldflags
;;
"*")
Expand Down

0 comments on commit 60f33b8

Please sign in to comment.