[PATCH weston 5/8] Use getprogname as fallback for program_invocation_short_name

Greg V greg at unrelenting.technology
Sun Dec 17 19:04:39 UTC 2017


---
 configure.ac | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/configure.ac b/configure.ac
index 253f7e73..c800d1aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -107,6 +107,27 @@ AC_CHECK_HEADERS([execinfo.h linux/memfd.h])
 
 AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
 
+AC_MSG_CHECKING([for program_invocation_short_name])
+AC_TRY_COMPILE([#include <errno.h>],
+	       [const char *pn = program_invocation_short_name;],
+	       AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME, 1, [Define to 1 if program_invocation_short_name exists])
+	       AC_MSG_RESULT(yes),
+	       AC_MSG_RESULT(no))
+
+AC_MSG_CHECKING([for getprogname])
+AC_TRY_COMPILE([#include <stdlib.h>],
+	       [getprogname();],
+	       AC_DEFINE(HAVE_GETPROGNAME, 1, [Define to 1 if getprogname exists])
+	       AC_MSG_RESULT(yes),
+	       AC_MSG_RESULT(no))
+
+AH_BOTTOM([#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
+#ifdef HAVE_GETPROGNAME
+#include <stdlib.h>
+#define program_invocation_short_name getprogname()
+#endif
+#endif])
+
 # check for libdrm as a build-time dependency only
 # libdrm 2.4.30 introduced drm_fourcc.h.
 PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.30], [], [AC_MSG_ERROR([
-- 
2.15.1



More information about the wayland-devel mailing list