]> granicus.if.org Git - procps-ng/commitdiff
configure: check for program_invocation_name
authorRainer Müller <raimue@codingfarm.de>
Wed, 20 Feb 2013 17:31:48 +0000 (18:31 +0100)
committerRainer Müller <raimue@codingfarm.de>
Wed, 20 Mar 2013 15:32:06 +0000 (16:32 +0100)
For portabiliy, check for program_invocation_name during configure and
define HAVE_PROGRAM_INVOCATION_NAME accordingly. Use of this symbol is
now enclosed with the appropriate #ifdef block.

The symbol program_invocation_name is only used for error message
handling using error(), so it's safe to omit this if it is not
available.

13 files changed:
configure.ac
free.c
pgrep.c
pmap.c
pwdx.c
skill.c
slabtop.c
sysctl.c
tload.c
uptime.c
vmstat.c
w.c
watch.c

index 711be2abd1bf41516e57d8f449ac436293933686..afb24cee939bad5a843e89449b50d22e2e827bbd 100644 (file)
@@ -137,6 +137,14 @@ dnl else
 dnl    ALL_LINGUAS="af am ar as be bg bn_IN bn ca cs cy da de el en_GB es et eu_ES fa fi fr gl gu he hi hr hu hy id is it ja ka kn ko ku lo lt lv mk ml mr ms my nb nl nn no nso or pa pl pt_BR pt ro ru si sk sl sq sr@Latn sr sv ta te th tr uk ur vi zh_CN zh_TW zu"
 dnl fi
 
+AC_MSG_CHECKING(whether program_invocation_name is defined)
+AC_TRY_COMPILE([#include <errno.h>],
+               [program_invocation_name = "test";],
+               AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME, 1,
+                       [Define if program_invocation_name is defined])
+               AC_MSG_RESULT(yes),
+               AC_MSG_RESULT(no))
+
 AC_MSG_CHECKING(whether program_invocation_short_name is defined)
 AC_TRY_COMPILE([#include <errno.h>],
                [program_invocation_short_name = "test";],
diff --git a/free.c b/free.c
index ecaeccdd9b7fc6426e392c19729111dca59f3a04..ffc4b86feadaebfcf4743ba0002ebec28fa488a7 100644 (file)
--- a/free.c
+++ b/free.c
@@ -223,7 +223,9 @@ int main(int argc, char **argv)
        args.repeat_interval = 1000000;
        args.repeat_counter = 0;
 
-    program_invocation_name = program_invocation_short_name;
+#ifdef HAVE_PROGRAM_INVOCATION_NAME
+       program_invocation_name = program_invocation_short_name;
+#endif
        setlocale (LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
diff --git a/pgrep.c b/pgrep.c
index 349221a6527fb696731f259daf3af8e37f497192..7c54d964747565fe1b0a982eb4e5966edd3a2b97 100644 (file)
--- a/pgrep.c
+++ b/pgrep.c
@@ -832,7 +832,9 @@ int main (int argc, char **argv)
        struct el *procs;
        int num;
 
+#ifdef HAVE_PROGRAM_INVOCATION_NAME
        program_invocation_name = program_invocation_short_name;
+#endif
        setlocale (LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
diff --git a/pmap.c b/pmap.c
index 8d19294b8a09b9e800ba738c10a5aa0784b991d8..7b88fec25000a0dab9a6988893bae9e4b4e2d0ef 100644 (file)
--- a/pmap.c
+++ b/pmap.c
@@ -1013,7 +1013,9 @@ int main(int argc, char **argv)
                {NULL, 0, NULL, 0}
        };
 
+#ifdef HAVE_PROGRAM_INVOCATION_NAME
        program_invocation_name = program_invocation_short_name;
+#endif
        nls_initialize();
        atexit(close_stdout);
 
diff --git a/pwdx.c b/pwdx.c
index 4aee389bea99f74f58f3d78818967571bd53019a..214275a94ec02f463da07e2aca030314d75c2104 100644 (file)
--- a/pwdx.c
+++ b/pwdx.c
@@ -74,7 +74,9 @@ int main(int argc, char *argv[])
                {NULL, 0, 0, 0}
        };
 
-    program_invocation_name = program_invocation_short_name;
+#ifdef HAVE_PROGRAM_INVOCATION_NAME
+       program_invocation_name = program_invocation_short_name;
+#endif
        setlocale (LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
diff --git a/skill.c b/skill.c
index 03df229cf024ea8d38dee9480ab68bd93430a8bc..fb57305a0ea7f0fe207b3d059537cc2de257a5cd 100644 (file)
--- a/skill.c
+++ b/skill.c
@@ -629,7 +629,9 @@ static void skillsnice_parse(int argc,
 /* main body */
 int main(int argc, char ** argv)
 {
-    program_invocation_name = program_invocation_short_name;
+#ifdef HAVE_PROGRAM_INVOCATION_NAME
+       program_invocation_name = program_invocation_short_name;
+#endif
        struct run_time_conf_t run_time;
        memset(&run_time, 0, sizeof(struct run_time_conf_t));
        my_pid = getpid();
index 9e535d4fbab4eb25e667b8c0a12773a61edbf273..ebdae8d44bdc6ab26ef4bdf8db3b15dfc8cb61e9 100644 (file)
--- a/slabtop.c
+++ b/slabtop.c
@@ -300,7 +300,9 @@ int main(int argc, char *argv[])
                {  NULL, 0, NULL, 0 }
        };
 
+#ifdef HAVE_PROGRAM_INVOCATION_NAME
        program_invocation_name = program_invocation_short_name;
+#endif
        setlocale (LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
index 075687886786624a705577eacf5a551e41be39f1..2eeacd9147e43f9cb92052fa6054e9a916236bb0 100644 (file)
--- a/sysctl.c
+++ b/sysctl.c
@@ -675,7 +675,9 @@ int main(int argc, char *argv[])
                {NULL, 0, NULL, 0}
        };
 
+#ifdef HAVE_PROGRAM_INVOCATION_NAME
        program_invocation_name = program_invocation_short_name;
+#endif
        setlocale(LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
diff --git a/tload.c b/tload.c
index 765ed17725cd61dbd305b1647171d33a7fad117a..a5fe14a07b0a80f6c9485a39aa704e73e9a1340d 100644 (file)
--- a/tload.c
+++ b/tload.c
@@ -114,7 +114,9 @@ int main(int argc, char **argv)
                {NULL, 0, NULL, 0}
        };
  
+#ifdef HAVE_PROGRAM_INVOCATION_NAME
        program_invocation_name = program_invocation_short_name;
+#endif
        setlocale (LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
index ac4579cd9209b7789b070aa4ed555c4ae7977ae7..27421895ff90d20608eaafdf169f382a6c93f610 100644 (file)
--- a/uptime.c
+++ b/uptime.c
@@ -77,7 +77,9 @@ int main(int argc, char **argv)
                {NULL, 0, NULL, 0}
        };
 
+#ifdef HAVE_PROGRAM_INVOCATION_NAME
        program_invocation_name = program_invocation_short_name;
+#endif
        setlocale (LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
index a2627b8de479548c1370a36027e7f136298623fe..6f95f095848a22ec46a64527ed61ae1bb1dcfda0 100644 (file)
--- a/vmstat.c
+++ b/vmstat.c
@@ -724,7 +724,9 @@ int main(int argc, char *argv[])
                {NULL, 0, NULL, 0}
        };
 
+#ifdef HAVE_PROGRAM_INVOCATION_NAME
        program_invocation_name = program_invocation_short_name;
+#endif
        setlocale (LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
diff --git a/w.c b/w.c
index 27c7d2229e130962c115ec12785b6c86c1e521d3..a73f3282f6eaa9462c3d81dbda17f6f86a1ebed3 100644 (file)
--- a/w.c
+++ b/w.c
@@ -483,7 +483,9 @@ int main(int argc, char **argv)
                {NULL, 0, NULL, 0}
        };
 
+#ifdef HAVE_PROGRAM_INVOCATION_NAME
        program_invocation_name = program_invocation_short_name;
+#endif
        setlocale (LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
diff --git a/watch.c b/watch.c
index 0fe0a8fb84d2fc49cbe2c329283fc276fe902b7d..5a229528f7f29c3a481078fbda2080d49c57112e 100644 (file)
--- a/watch.c
+++ b/watch.c
@@ -590,7 +590,9 @@ int main(int argc, char *argv[])
                {0, 0, 0, 0}
        };
 
+#ifdef HAVE_PROGRAM_INVOCATION_NAME
        program_invocation_name = program_invocation_short_name;
+#endif
        setlocale(LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);