Skip to content

Instantly share code, notes, and snippets.

@noahp
Created March 8, 2018 22:08
Show Gist options
  • Save noahp/39b954c0b6a6cfbbb1712b3adc40a115 to your computer and use it in GitHub Desktop.
Save noahp/39b954c0b6a6cfbbb1712b3adc40a115 to your computer and use it in GitHub Desktop.
Patch v3.9.0.0 of kconfig-frontends (git://ymorin.is-a-geek.org/kconfig-frontends) to build on ubuntu 17.10
diff --git a/configure.ac b/configure.ac
index 814d8c8..5bc50fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -237,6 +237,22 @@ AS_IF(
[AC_MSG_ERROR([can not find a parser generator (such as yacc or bison)])]))
AC_SUBST([AM_YFLAGS], ["-t -l -p zconf"])
+#----------------------------------------
+# gperf 3.1 generates functions with 'size_t' instead of '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])
#----------------------------------------
# Check for gettext, for the kconfig frontends
[has_gettext="$enable_L10n"]
diff --git a/libs/parser/Makefile.am b/libs/parser/Makefile.am
index 567b1e8..b108d90 100644
--- a/libs/parser/Makefile.am
+++ b/libs/parser/Makefile.am
@@ -8,6 +8,7 @@ dist_EXTRA_libkconfig_parser_la_SOURCES = \
expr.c expr.h lkc.h lkc_proto.h
libkconfig_parser_la_CPPFLAGS = -DROOTMENU="\"$(root_menu)\"" \
-DCONFIG_=\"$(config_prefix)\" \
+ -DGPERF_LEN_TYPE="$(GPERF_LEN_TYPE)" \
$(intl_CPPFLAGS)
libkconfig_parser_la_CFLAGS = $(AM_CFLAGS) $(kf_CFLAGS)
libkconfig_parser_la_LDFLAGS = -release $(KCONFIGPARSER_LIB_VERSION) -no-undefined
diff --git a/libs/parser/hconf.gperf b/libs/parser/hconf.gperf
index f14ab41..17aac97 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
diff --git a/libs/parser/menu.c b/libs/parser/menu.c
index fd3f018..bea100b 100644
--- a/libs/parser/menu.c
+++ b/libs/parser/menu.c
@@ -525,7 +525,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
{
int i, j;
struct menu *submenu[8], *menu, *location = NULL;
- struct jump_key *jump;
+ struct jump_key *jump = NULL;
str_printf(r, _("Prompt: %s\n"), _(prop->text));
menu = prop->menu->parent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment