]> granicus.if.org Git - procps-ng/commitdiff
configure: add macro to check for __PROGNAME
authorHenrik Grimler <henrik@grimler.se>
Wed, 26 May 2021 13:45:02 +0000 (15:45 +0200)
committerCraig Small <csmall@dropbear.xyz>
Sat, 29 May 2021 06:14:52 +0000 (16:14 +1000)
in include/c.h we check if HAVE___PROGNAME is defined, but the
corresponding macro for setting (or not setting) it is missing from
the configure script. This commit adds the missing macro, by
copying it from the macro in tmux.

configure.ac

index 88831b31f35e750829e6d7a9edf901d574897028..1d303b9506bb49a670c781404f072e08d5afc4eb 100644 (file)
@@ -117,6 +117,22 @@ AC_CHECK_HEADERS(error.h, [], [], AC_INCLUDES_DEFAULT)
 
 AC_CHECK_HEADERS(stdio_ext.h, [], [], AC_INCLUDES_DEFAULT)
 
+AC_MSG_CHECKING(for __progname)
+AC_LINK_IFELSE([AC_LANG_SOURCE(
+       [
+               #include <stdio.h>
+               #include <stdlib.h>
+               extern char *__progname;
+               int main(void) {
+                       const char *cp = __progname;
+                       printf("%s\n", cp);
+                       exit(0);
+               }
+       ])],
+       AC_DEFINE(HAVE___PROGNAME, 1, [Define if __progname exists])
+       AC_MSG_RESULT(yes),
+       AC_MSG_RESULT(no))
+
 AC_MSG_CHECKING(whether program_invocation_name is defined)
 AC_TRY_COMPILE([#include <errno.h>],
                [program_invocation_name = "test";],