kconfig: resync curses check with Linux kernel 1.8
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Oct 04 00:16:56 2010 +0200 (2010-10-04)
branch1.8
changeset 21269b8063d9b84f
parent 2108 68d038933dc4
child 2127 9945836fbd70
kconfig: resync curses check with Linux kernel

check-lxdialog.sh breaks on 64-bit distributions which are lacking
the lib -> lib64 symlinks (eg. some Fedora).

The script from the 2.6.35 Linux kernel is reportedly functional
on the systems that were requiring the current hack. See:
http://sourceware.org/ml/crossgcc/2010-09/msg00113.html

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from 4009fc9c47d5d2c4e7765f1e9fb6721a87217ae5)
kconfig/kconfig.mk
kconfig/lxdialog/check-lxdialog.sh
     1.1 --- a/kconfig/kconfig.mk	Tue Aug 31 23:24:40 2010 +0200
     1.2 +++ b/kconfig/kconfig.mk	Mon Oct 04 00:16:56 2010 +0200
     1.3 @@ -73,7 +73,11 @@
     1.4  
     1.5  # Compiler and linker flags to use ncurses
     1.6  NCURSES_CFLAGS = $(shell $(SHELL) $(check_lxdialog) -ccflags)
     1.7 -NCURSES_LDFLAGS = $(shell $(SHELL) $(check_lxdialog) -ldflags $(HOST_CC) $(LX_FLAGS) $(EXTRA_CFLAGS))
     1.8 +NCURSES_LDFLAGS = $(shell $(SHELL) $(check_lxdialog) -ldflags $(HOST_CC))
     1.9 +
    1.10 +# Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
    1.11 +dochecklxdialog:
    1.12 +	$(SILENT)$(SHELL) $(check_lxdialog) -check $(HOST_CC) $(NCURSES_CFLAGS) $(NCURSES_LDFLAGS)
    1.13  
    1.14  # Common source files
    1.15  COMMON_SRC = kconfig/zconf.tab.c
    1.16 @@ -113,6 +117,8 @@
    1.17  # We must be carefull what we enclose, because we need some of the variable
    1.18  # definitions for clean (and distclean) at least.
    1.19  # Just protecting the "-include $(DEPS)" line should be sufficient.
    1.20 +# And in case we want menuconfig, we have to check that lxdialog
    1.21 +# can find a curses lib.
    1.22  
    1.23  ifneq ($(strip $(MAKECMDGOALS)),)
    1.24  ifneq ($(strip $(filter $(configurators),$(MAKECMDGOALS))),)
    1.25 @@ -123,6 +129,9 @@
    1.26  endif
    1.27  ifneq ($(strip $(filter menuconfig,$(MAKECMDGOALS))),)
    1.28  DEPS += $(mconf_DEP) $(LX_DEP)
    1.29 +$(COMMON_OBJ) $(COMMON_DEP): |dochecklxdialog
    1.30 +$(LX_OBJ) $(LX_DEP): |dochecklxdialog
    1.31 +$(mconf_OBJ) $(mconf_DEP): |dochecklxdialog
    1.32  endif
    1.33  
    1.34  -include $(DEPS)
     2.1 --- a/kconfig/lxdialog/check-lxdialog.sh	Tue Aug 31 23:24:40 2010 +0200
     2.2 +++ b/kconfig/lxdialog/check-lxdialog.sh	Mon Oct 04 00:16:56 2010 +0200
     2.3 @@ -1,24 +1,14 @@
     2.4  #!/bin/sh
     2.5  # Check ncurses compatibility
     2.6  
     2.7 -OS=`uname`
     2.8 -
     2.9 -# Under MACOS make sure that the macports-installed version is used.
    2.10 -case "$OS" in
    2.11 -	Darwin) BASEDIR="/opt/local";;
    2.12 -	*)      BASEDIR="/usr";;
    2.13 -esac
    2.14 -
    2.15 -INCLUDEPATH="${BASEDIR}/include"
    2.16 -LIBPATH="${BASEDIR}/lib"
    2.17 -
    2.18  # What library to link
    2.19  ldflags()
    2.20  {
    2.21  	for ext in so a dylib ; do
    2.22  		for lib in ncursesw ncurses curses ; do
    2.23 -			if [ -f "${LIBPATH}/lib${lib}.${ext}" ]; then
    2.24 -				echo "-L${LIBPATH} -l${lib}"
    2.25 +			$cc -print-file-name=lib${lib}.${ext} | grep -q /
    2.26 +			if [ $? -eq 0 ]; then
    2.27 +				echo "-l${lib}"
    2.28  				exit
    2.29  			fi
    2.30  		done
    2.31 @@ -29,20 +19,14 @@
    2.32  # Where is ncurses.h?
    2.33  ccflags()
    2.34  {
    2.35 -	if [ -f "${INCLUDEPATH}/ncursesw/ncurses.h" ]; then
    2.36 -		echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncursesw/ncurses.h>\""
    2.37 -	elif [ -f "${INCLUDEPATH}/ncurses/ncurses.h" ]; then
    2.38 -		echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncurses/ncurses.h>\""
    2.39 -	elif [ -f "${INCLUDEPATH}/ncursesw/curses.h" ]; then
    2.40 -		echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncursesw/curses.h>\""
    2.41 -	elif [ -f "${INCLUDEPATH}/ncurses/curses.h" ]; then
    2.42 -		echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncurses/curses.h>\""
    2.43 -	elif [ -f "${INCLUDEPATH}/ncurses.h" ]; then
    2.44 -		echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncurses.h>\""
    2.45 -	elif [ -f "${INCLUDEPATH}/curses.h" ]; then
    2.46 -		echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<curses.h>\""
    2.47 +	if [ -f /usr/include/ncurses/ncurses.h ]; then
    2.48 +		echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
    2.49 +	elif [ -f /usr/include/ncurses/curses.h ]; then
    2.50 +		echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
    2.51 +	elif [ -f /usr/include/ncurses.h ]; then
    2.52 +		echo '-DCURSES_LOC="<ncurses.h>"'
    2.53  	else
    2.54 -		exit 1
    2.55 +		echo '-DCURSES_LOC="<curses.h>"'
    2.56  	fi
    2.57  }
    2.58  
    2.59 @@ -52,8 +36,7 @@
    2.60  
    2.61  # Check if we can link to ncurses
    2.62  check() {
    2.63 -        IF=`echo $(ccflags) | sed -e 's/"//g'`
    2.64 -        $cc $IF $(ldflags) -xc - -o $tmp 2>/dev/null <<'EOF'
    2.65 +        $cc -xc - -o $tmp 2>/dev/null <<'EOF'
    2.66  #include CURSES_LOC
    2.67  main() {}
    2.68  EOF