rpm-ostree/0001-build-Deal-with-gperf-3.1-changing-to-size_t.patch
2017-02-18 09:00:47 -05:00

62 lines
2.0 KiB
Diff

From f6842838d709439c30b82ba90324d201b0498dbf Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Fri, 17 Feb 2017 12:29:10 -0500
Subject: [PATCH] build: Deal with gperf 3.1 changing to size_t
https://bugzilla.redhat.com/show_bug.cgi?id=1424268
Closes: #631
Approved by: jlebon
---
configure.ac | 20 ++++++++++++++++++++
src/libpriv/rpmostree-scripts.h | 2 +-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 6273806..b088b89 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,6 +102,26 @@ AC_CHECK_TOOL(GPERF, gperf)
AS_IF([test -z "$GPERF"],
AC_MSG_ERROR([*** gperf not found])
)
+dnl stolen from https://github.com/systemd/systemd/commit/c9f7b4d
+GPERF_TEST="$(echo foo,bar | ${GPERF} -L ANSI-C)"
+AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([
+#include <string.h>
+const char * in_word_set(const char *, size_t);
+$GPERF_TEST]
+)],
+[GPERF_LEN_TYPE=size_t],
+[AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([
+#include <string.h>
+const char * in_word_set(const char *, unsigned);
+$GPERF_TEST]
+)],
+[GPERF_LEN_TYPE=unsigned],
+[AC_MSG_ERROR([** unable to determine gperf len type])]
+)]
+)
+AC_DEFINE_UNQUOTED([GPERF_LEN_TYPE], [$GPERF_LEN_TYPE], [gperf len type])
m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
GOBJECT_INTROSPECTION_CHECK([1.34.0])
diff --git a/src/libpriv/rpmostree-scripts.h b/src/libpriv/rpmostree-scripts.h
index c981131..87d64d2 100644
--- a/src/libpriv/rpmostree-scripts.h
+++ b/src/libpriv/rpmostree-scripts.h
@@ -43,7 +43,7 @@ struct RpmOstreePackageScriptHandler {
RpmOstreeScriptAction action;
};
-const struct RpmOstreePackageScriptHandler* rpmostree_script_gperf_lookup(const char *key, unsigned length);
+const struct RpmOstreePackageScriptHandler* rpmostree_script_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
gboolean rpmostree_script_ignore_hash_from_strv (const char *const *strv,
GHashTable **out_hash,
--
2.9.3