Add a check for gperf function signature.

Loosely based on:
c9f7b4d356

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2017-01-12 17:35:35 -08:00
parent dc9dac2220
commit 3bb2bcd2a3
4 changed files with 23 additions and 5 deletions

View File

@ -69,6 +69,7 @@ export objdump := @OBJDUMP@
export readelf := @READELF@ export readelf := @READELF@
export patch := @PATCH@ export patch := @PATCH@
export gperf := @GPERF@ export gperf := @GPERF@
export gperf_len_type := @GPERF_LEN_TYPE@
export CC := @CC@ export CC := @CC@
export CPP := @CPP@ export CPP := @CPP@
export CPPFLAGS := @CPPFLAGS@ export CPPFLAGS := @CPPFLAGS@

View File

@ -134,9 +134,9 @@ AS_IF([test -z "$CC"],
AC_PROG_CPP AC_PROG_CPP
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Check to see if gcc can static link # Check to see if the compiler can link statically
AC_MSG_CHECKING([if gcc can static link]) AC_MSG_CHECKING([if $CC can static link])
echo "int main() {}" | gcc -static -o /dev/null -xc - > /dev/null 2>&1 echo "int main() {}" | ${CC} -static -o /dev/null -xc - > /dev/null 2>&1
static_test=$? static_test=$?
AS_IF([test $static_test -eq 0], AS_IF([test $static_test -eq 0],
[static_link=y [static_link=y
@ -305,6 +305,22 @@ AC_CACHE_CHECK([for GNU automake >= 1.10], [ac_cv_path_automake],
AC_MSG_ERROR([could not find GNU automake >= 1.10])])]) AC_MSG_ERROR([could not find GNU automake >= 1.10])])])
AC_SUBST([automake], [$ac_cv_path_automake]) AC_SUBST([automake], [$ac_cv_path_automake])
#----------------------------------------
# Gperf 3.1 started generating functions with size_t rather than unsigned int
AC_MSG_CHECKING([for the type used in gperf declarations])
echo "#include <string.h>" > conftest.gperf.c
echo "const char * in_word_set(const char *, GPERF_LEN_TYPE);" >> conftest.gperf.c
echo foo,bar | ${GPERF} -L ANSI-C >> conftest.gperf.c
AS_IF([${CC} -c -o /dev/null conftest.gperf.c -DGPERF_LEN_TYPE='size_t' >/dev/null 2>&1],
[AC_MSG_RESULT([size_t])
GPERF_LEN_TYPE='size_t'],
[${CC} -c -o /dev/null conftest.gperf.c -DGPERF_LEN_TYPE='unsigned int' >/dev/null 2>&1],
[AC_MSG_RESULT([unsigned int])
GPERF_LEN_TYPE='unsigned int'],
[AC_MSG_ERROR([unable to determine gperf len type])])
rm -f conftest.gperf.c
AC_SUBST([GPERF_LEN_TYPE])
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Boring again... But still a bit of work to do... # Boring again... But still a bit of work to do...
#-------------------------------------------------------------------- #--------------------------------------------------------------------

View File

@ -6,7 +6,8 @@ all: conf mconf nconf
@true # Just be silent, you fscking son of a fscking beach... @true # Just be silent, you fscking son of a fscking beach...
# Build flags # Build flags
CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\"" CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\"" \
-DGPERF_LEN_TYPE="$(gperf_len_type)"
LDFLAGS = $(INTL_LIBS) LDFLAGS = $(INTL_LIBS)
# Compiler flags to use gettext # Compiler flags to use gettext

View File

@ -9,7 +9,7 @@
struct kconf_id; struct kconf_id;
static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); static const struct kconf_id *kconf_id_lookup(register const char *str, register GPERF_LEN_TYPE len);
%% %%
mainmenu, T_MAINMENU, TF_COMMAND mainmenu, T_MAINMENU, TF_COMMAND