From 3bb2bcd2a328fb56332398783e91899ce3bc3556 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Thu, 12 Jan 2017 17:35:35 -0800 Subject: Add a check for gperf function signature. Loosely based on: https://github.com/systemd/systemd/commit/c9f7b4d356a453a01aa77a6bb74ca7ef49732c08 Signed-off-by: Alexey Neyman diff --git a/Makefile.in b/Makefile.in index 16ab72a..4fb85bb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -69,6 +69,7 @@ export objdump := @OBJDUMP@ export readelf := @READELF@ export patch := @PATCH@ export gperf := @GPERF@ +export gperf_len_type := @GPERF_LEN_TYPE@ export CC := @CC@ export CPP := @CPP@ export CPPFLAGS := @CPPFLAGS@ diff --git a/configure.ac b/configure.ac index 492d315..76f0d30 100644 --- a/configure.ac +++ b/configure.ac @@ -134,9 +134,9 @@ AS_IF([test -z "$CC"], AC_PROG_CPP #--------------------------------------------------------------------- -# Check to see if gcc can static link -AC_MSG_CHECKING([if gcc can static link]) -echo "int main() {}" | gcc -static -o /dev/null -xc - > /dev/null 2>&1 +# Check to see if the compiler can link statically +AC_MSG_CHECKING([if $CC can static link]) +echo "int main() {}" | ${CC} -static -o /dev/null -xc - > /dev/null 2>&1 static_test=$? AS_IF([test $static_test -eq 0], [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_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 " > 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... #-------------------------------------------------------------------- diff --git a/kconfig/Makefile b/kconfig/Makefile index 9f30566..ee838aa 100644 --- a/kconfig/Makefile +++ b/kconfig/Makefile @@ -6,7 +6,8 @@ all: conf mconf nconf @true # Just be silent, you fscking son of a fscking beach... # 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) # Compiler flags to use gettext diff --git a/kconfig/zconf.gperf b/kconfig/zconf.gperf index ac498f0..434483b 100644 --- a/kconfig/zconf.gperf +++ b/kconfig/zconf.gperf @@ -9,7 +9,7 @@ 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 -- cgit v0.10.2-6-g49f6