kconfig/lxdialog/check-lxdialog.sh
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Wed Dec 14 16:55:22 2011 +0100 (2011-12-14)
branch1.13
changeset 2848 1ff89596dab0
parent 2125 4009fc9c47d5
permissions -rw-r--r--
libc/eglibc: fix localedef 2.14 build

The localedef of eglibc 2.14 requires NOT_IN_libc to be defined in order to
compile intl/l10nflist.c.

This is because localedef is built separately from eglibc and uses some parts of
eglibc that don't compile in standalone without this preprocessor definition.

This fixes the following error:

[ALL ] gcc -g -O2 -DNO_SYSCONF -DNO_UNCOMPRESS
-DLOCALE_PATH='"/usr/lib/locale:/usr/share/i18n"'
-DLOCALEDIR='"/usr/lib/locale"' -DLOCALE_ALIAS_PATH='"/usr/share/locale"'
-DCHARMAP_PATH='"/usr/share/i18n/charmaps"'
-DREPERTOIREMAP_PATH='"/usr/share/i18n/repertoiremaps"'
-DLOCSRCDIR='"/usr/share/i18n/locales"' -Iglibc/locale/programs -Iglibc/locale
-I/<snip>/.build/src/eglibc-localedef-2_14/include
-I/<snip>/.build/src/eglibc-localedef-2_14 -I.
-include /<snip>/.build/src/eglibc-localedef-2_14/include/always.h -Wall
-Wno-format -c -o locarchive.o glibc/locale/programs/locarchive.c
[ALL ] glibc/locale/programs/locarchive.c: In function 'enlarge_archive':
[ALL ] glibc/locale/programs/locarchive.c:303:21: warning: variable
'oldlocrectab' set but not used [-Wunused-but-set-variable]
[ALL ] In file included from glibc/locale/programs/locarchive.c:651:0:
[ALL ] glibc/locale/programs/../../intl/l10nflist.c: In function
'_nl_normalize_codeset':
[ERROR] glibc/locale/programs/../../intl/l10nflist.c:342:9: error:
'_nl_C_locobj_ptr' undeclared (first use in this function)
[ALL ] glibc/locale/programs/../../intl/l10nflist.c:342:9: note: each
undeclared identifier is reported only once for each function it appears in
[ALL ] glibc/locale/programs/locarchive.c: In function
'add_locales_to_archive':
[ALL ] glibc/locale/programs/locarchive.c:1450:7: warning: passing argument
1 of '__xpg_basename' discards 'const' qualifier from pointer target type
[enabled by default]
[ALL ] /usr/include/libgen.h:35:14: note: expected 'char *' but argument is
of type 'const char *'
[ERROR] make[1]: *** [locarchive.o] Error 1

Signed-off-by: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
(transplanted from 4cd9134739b594451794cf61a6e1b137422cdafd)
     1 #!/bin/sh
     2 # Check ncurses compatibility
     3 
     4 # What library to link
     5 ldflags()
     6 {
     7 	for ext in so a dylib ; do
     8 		for lib in ncursesw ncurses curses ; do
     9 			$cc -print-file-name=lib${lib}.${ext} | grep -q /
    10 			if [ $? -eq 0 ]; then
    11 				echo "-l${lib}"
    12 				exit
    13 			fi
    14 		done
    15 	done
    16 	exit 1
    17 }
    18 
    19 # Where is ncurses.h?
    20 ccflags()
    21 {
    22 	if [ -f /usr/include/ncurses/ncurses.h ]; then
    23 		echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
    24 	elif [ -f /usr/include/ncurses/curses.h ]; then
    25 		echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
    26 	elif [ -f /usr/include/ncursesw/curses.h ]; then
    27 		echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
    28 	elif [ -f /usr/include/ncurses.h ]; then
    29 		echo '-DCURSES_LOC="<ncurses.h>"'
    30 	else
    31 		echo '-DCURSES_LOC="<curses.h>"'
    32 	fi
    33 }
    34 
    35 # Temp file, try to clean up after us
    36 tmp=.lxdialog.tmp
    37 trap "rm -f $tmp" 0 1 2 3 15
    38 
    39 # Check if we can link to ncurses
    40 check() {
    41         $cc -xc - -o $tmp 2>/dev/null <<'EOF'
    42 #include CURSES_LOC
    43 main() {}
    44 EOF
    45 	if [ $? != 0 ]; then
    46 	    echo " *** Unable to find the ncurses libraries or the"       1>&2
    47 	    echo " *** required header files."                            1>&2
    48 	    echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
    49 	    echo " *** "                                                  1>&2
    50 	    echo " *** Install ncurses (ncurses-devel) and try again."    1>&2
    51 	    echo " *** "                                                  1>&2
    52 	    exit 1
    53 	fi
    54 }
    55 
    56 usage() {
    57 	printf "Usage: $0 [-check compiler options|-ccflags|-ldflags compiler options]\n"
    58 }
    59 
    60 if [ $# -eq 0 ]; then
    61 	usage
    62 	exit 1
    63 fi
    64 
    65 cc=""
    66 case "$1" in
    67 	"-check")
    68 		shift
    69 		cc="$@"
    70 		check
    71 		;;
    72 	"-ccflags")
    73 		ccflags
    74 		;;
    75 	"-ldflags")
    76 		shift
    77 		cc="$@"
    78 		ldflags
    79 		;;
    80 	"*")
    81 		usage
    82 		exit 1
    83 		;;
    84 esac