Make the kconfig stuff build under Cygwin.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Nov 30 20:59:15 2008 +0000 (2008-11-30)
changeset 10875be36a4b304d
parent 1086 dadcb6221683
child 1088 3c7c98b6cda9
Make the kconfig stuff build under Cygwin.

/trunk/kconfig/kconfig.mk | 7 5 2 0 ++++--
/trunk/kconfig/lxdialog/check-lxdialog.sh | 44 21 23 0 ++++++++++++++++++-------------------
2 files changed, 26 insertions(+), 25 deletions(-)
kconfig/kconfig.mk
kconfig/lxdialog/check-lxdialog.sh
     1.1 --- a/kconfig/kconfig.mk	Sun Nov 30 20:46:17 2008 +0000
     1.2 +++ b/kconfig/kconfig.mk	Sun Nov 30 20:59:15 2008 +0000
     1.3 @@ -82,6 +82,9 @@
     1.4  mconf_DEP = $(patsubst %.c,%.dep,$(mconf_SRC))
     1.5  $(mconf_OBJ) $(mconf_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)
     1.6  $(obj)/mconf: LDFLAGS += $(NCURSES_LDFLAGS)
     1.7 +ifeq ($(shell uname -o 2>/dev/null || echo unknown),Cygwin)
     1.8 +$(obj)/mconf: LDFLAGS += -Wl,--enable-auto-import
     1.9 +endif
    1.10  
    1.11  # These are generated files:
    1.12  ALL_OBJS = $(sort $(COMMON_OBJ) $(LX_OBJ) $(conf_OBJ) $(mconf_OBJ))
    1.13 @@ -139,11 +142,11 @@
    1.14  # Actual link
    1.15  $(obj)/mconf: $(COMMON_OBJ) $(LX_OBJ) $(mconf_OBJ)
    1.16  	@$(ECHO) '  LD    $@'
    1.17 -	$(SILENT)$(HOST_LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ $^
    1.18 +	$(SILENT)$(HOST_LD) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
    1.19  
    1.20  $(obj)/conf: $(COMMON_OBJ) $(conf_OBJ)
    1.21  	@$(ECHO) '  LD    $@'
    1.22 -	$(SILENT)$(HOST_LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ $^
    1.23 +	$(SILENT)$(HOST_LD) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
    1.24  
    1.25  #-----------------------------------------------------------
    1.26  # Cleaning up the mess...
     2.1 --- a/kconfig/lxdialog/check-lxdialog.sh	Sun Nov 30 20:46:17 2008 +0000
     2.2 +++ b/kconfig/lxdialog/check-lxdialog.sh	Sun Nov 30 20:59:15 2008 +0000
     2.3 @@ -4,21 +4,15 @@
     2.4  # What library to link
     2.5  ldflags()
     2.6  {
     2.7 -	$cc -print-file-name=libncursesw.so | grep -q /
     2.8 -	if [ $? -eq 0 ]; then
     2.9 -		echo '-lncursesw'
    2.10 -		exit
    2.11 -	fi
    2.12 -	$cc -print-file-name=libncurses.so | grep -q /
    2.13 -	if [ $? -eq 0 ]; then
    2.14 -		echo '-lncurses'
    2.15 -		exit
    2.16 -	fi
    2.17 -	$cc -print-file-name=libcurses.so | grep -q /
    2.18 -	if [ $? -eq 0 ]; then
    2.19 -		echo '-lcurses'
    2.20 -		exit
    2.21 -	fi
    2.22 +	for ext in so a dylib ; do
    2.23 +		for lib in ncursesw ncurses curses ; do
    2.24 +			$cc -print-file-name=lib${lib}.${ext} | grep -q /
    2.25 +			if [ $? -eq 0 ]; then
    2.26 +				echo "-l${lib}"
    2.27 +				exit
    2.28 +			fi
    2.29 +		done
    2.30 +	done
    2.31  	exit 1
    2.32  }
    2.33  
    2.34 @@ -42,14 +36,18 @@
    2.35  
    2.36  # Check if we can link to ncurses
    2.37  check() {
    2.38 -	echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null
    2.39 -	if [ $? -ne 0 ]; then
    2.40 -		echo " *** Unable to find the ncurses libraries."          1>&2
    2.41 -		echo " *** make menuconfig require the ncurses libraries"  1>&2
    2.42 -		echo " *** "                                               1>&2
    2.43 -		echo " *** Install ncurses (ncurses-devel) and try again"  1>&2
    2.44 -		echo " *** "                                               1>&2
    2.45 -		exit 1
    2.46 +        $cc -xc - -o $tmp 2>/dev/null <<'EOF'
    2.47 +#include CURSES_LOC
    2.48 +main() {}
    2.49 +EOF
    2.50 +	if [ $? != 0 ]; then
    2.51 +	    echo " *** Unable to find the ncurses libraries or the"       1>&2
    2.52 +	    echo " *** required header files."                            1>&2
    2.53 +	    echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
    2.54 +	    echo " *** "                                                  1>&2
    2.55 +	    echo " *** Install ncurses (ncurses-devel) and try again."    1>&2
    2.56 +	    echo " *** "                                                  1>&2
    2.57 +	    exit 1
    2.58  	fi
    2.59  }
    2.60