[PATCH evtest v1] fix program_invocation_short_name undeclared

Peter Seiderer ps.report at gmx.net
Thu Mar 19 16:25:49 PDT 2015


Add fallback in case program_invocation_short_name is undeclared,
e.g. in case of some uclibc configurations.

See [1] for a detailed buildroot failure description.

[1] http://lists.busybox.net/pipermail/buildroot/2015-March/122710.html

Signed-off-by: Peter Seiderer <ps.report at gmx.net>
---
 configure.ac | 8 ++++++++
 evtest.c     | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/configure.ac b/configure.ac
index 8dabc81..c13b05e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,4 +22,12 @@ if test "x$XMLTO" = "x" || test "x$ASCIIDOC" = "x"; then
 	AC_MSG_WARN([xmlto or asciidoc not found - cannot create man pages without it])
 fi
 
+AC_MSG_CHECKING([for program_invocation_short_name])
+AC_TRY_COMPILE([#define _GNU_SOURCE
+		#include <errno.h>], 
+	[strlen(program_invocation_short_name)],
+	AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME, 1,
+		[Defined if program_invocation_short_name is defined])
+	AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
+
 AC_OUTPUT([Makefile])
diff --git a/evtest.c b/evtest.c
index 40bc82b..d601889 100644
--- a/evtest.c
+++ b/evtest.c
@@ -86,6 +86,11 @@
 
 #define NAME_ELEMENT(element) [element] = #element
 
+/* fallback to canonical name */
+#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
+static char *program_invocation_short_name = "evtest";
+#endif
+
 enum evtest_mode {
 	MODE_CAPTURE,
 	MODE_QUERY,
-- 
2.1.4



More information about the Input-tools mailing list