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