[PATCH] Check for program_invocation_short_name

Ulf Hermann ulf.hermann@qt.io
Wed Feb 22 14:37:00 GMT 2017


If it doesn't exist use "<elfutil>" as generic replacement.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
 ChangeLog     | 4 ++++
 configure.ac  | 5 +++++
 lib/ChangeLog | 5 +++++
 lib/system.h  | 4 ++++
 src/ChangeLog | 4 ++++
 src/elfcmp.c  | 1 +
 6 files changed, 23 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 1acc8ba..31285e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* configure.ac: Add check for program_invocation_short_name.
+
+2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* configure.ac: Check for strerror_r and its variants.
 
 2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
diff --git a/configure.ac b/configure.ac
index ce40539..9a9404b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -309,6 +309,10 @@ AC_CHECK_DECLS([fputs_unlocked],[],[],
                [#define _GNU_SOURCE
                 #include <stdio.h>])
 
+AC_CHECK_DECLS([program_invocation_short_name],[],[],
+               [#define _GNU_SOURCE
+                #include <errno.h>])
+
 AC_FUNC_STRERROR_R
 
 AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl
@@ -407,6 +411,7 @@ else
 	with_argp="yes"
 	argp_LDADD=""
 fi
+
 AC_SUBST([argp_LDADD])
 AM_CONDITIONAL(ARGP, [test "x$with_argp" = "xyes"])
 
diff --git a/lib/ChangeLog b/lib/ChangeLog
index d9aabfa..847ca87 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,5 +1,10 @@
 2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* system.h: Define program_invocation_short_name to "<elfutil>" if
+	!HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME.
+
+2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* system.h: Define fputs_unlocked to fputs if
 	!HAVE_DECL_FPUTS_UNLOCKED.
 
diff --git a/lib/system.h b/lib/system.h
index dc78997..f71e85c 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -88,6 +88,10 @@ char *basename (const char *path);
 #define fputs_unlocked(str, stream) fputs (str, stream)
 #endif
 
+#if !HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
+#define program_invocation_short_name "<elfutil>"
+#endif
+
 /* A special gettext function we use if the strings are too short.  */
 #define sgettext(Str) \
   ({ const char *__res = strrchr (gettext (Str), '|');			      \
diff --git a/src/ChangeLog b/src/ChangeLog
index bdf04cc..29aa8eb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
 2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* elfcmp.c: Include system.h.
+
+2017-02-22  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* arlib-argp.c: Include system.h.
 	* unstrip.c: Likewise.
 
diff --git a/src/elfcmp.c b/src/elfcmp.c
index 7673cf2..ea34527 100644
--- a/src/elfcmp.c
+++ b/src/elfcmp.c
@@ -34,6 +34,7 @@
 #include <unistd.h>
 
 #include <printversion.h>
+#include <system.h>
 #include "../libelf/elf-knowledge.h"
 #include "../libebl/libeblP.h"
 
-- 
2.1.4



More information about the Elfutils-devel mailing list