libs_parser_libkconfig_parser_la_CPPFLAGS = \
-DROOTMENU="\"$(root_menu)\"" \
-DCONFIG_=\"$(config_prefix)\" \
+ -DGPERF_LEN_TYPE="$(GPERF_LEN_TYPE)" \
$(intl_CPPFLAGS) \
-I$(top_srcdir)/libs/parser
libs_parser_libkconfig_parser_la_CFLAGS = \
AC_PROG_CXX
AC_C_INLINE
AC_PROG_MAKE_SET
-AC_CHECK_PROGS(
- [GPERF],
- [gperf])
-AS_IF(
- [test -z "$GPERF"],
- [AC_MSG_ERROR([can not find gperf])])
AS_IF(
[test "$need_pkgconfig" = "yes"],
[PKG_PROG_PKG_CONFIG()])
[AC_MSG_ERROR([can not find a parser generator (such as yacc or bison)])]))
AC_SUBST([AM_YFLAGS], ["-t -l -p zconf"])
+#----------------------------------------
+# Special section to check for gperf.
+AC_CHECK_PROGS(
+ [GPERF],
+ [gperf])
+AS_IF(
+ [test -z "$GPERF"],
+ [AC_MSG_ERROR([can not find gperf])])
+
+# gperf 3.1 generates functions with 'size_t' instead of 'unsigned int'
+AC_MSG_CHECKING([for the type used in gperf declarations])
+GPERF_LEN_TYPE=
+AS_VAR_SET(
+ [GPERF_PROLOG],
+ [`echo foo,bar | ${GPERF} -L ANSI-C`])
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <string.h>
+ ${GPERF_PROLOG}
+ const char * in_word_set(const char *, size_t);
+ ]])
+ ],
+ [GPERF_LEN_TYPE='size_t'],
+ [
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <string.h>
+ ${GPERF_PROLOG}
+ const char * in_word_set(const char *, unsigned int);
+ ]])
+ ],
+ [GPERF_LEN_TYPE='unsigned int'],
+ [AC_MSG_RESULT([not size_t, not unsigned int. What else?])
+ AC_MSG_FAILURE([unable to detect the type used in gperf declarations])
+ ])])
+AC_MSG_RESULT([${GPERF_LEN_TYPE}])
+AC_SUBST([GPERF_LEN_TYPE])
+
#----------------------------------------
# Check for gettext, for the kconfig frontends
[has_gettext="$enable_L10n"]
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
--- /dev/null
+diff --git a/libs/parser/hconf.gperf b/libs/parser/hconf.gperf
+index ead02ed..e5f0af7 100644
+--- a/libs/parser/hconf.gperf
++++ b/libs/parser/hconf.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