configure: check for program_invocation_name

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.
This commit is contained in:
Rainer Müller 2013-02-20 18:31:48 +01:00
parent f7a9d5d139
commit 042776e04c
13 changed files with 35 additions and 3 deletions

View 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 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 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_MSG_CHECKING(whether program_invocation_short_name is defined)
AC_TRY_COMPILE([#include <errno.h>], AC_TRY_COMPILE([#include <errno.h>],
[program_invocation_short_name = "test";], [program_invocation_short_name = "test";],

4
free.c
View File

@ -223,7 +223,9 @@ int main(int argc, char **argv)
args.repeat_interval = 1000000; args.repeat_interval = 1000000;
args.repeat_counter = 0; 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, ""); setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);

View File

@ -832,7 +832,9 @@ int main (int argc, char **argv)
struct el *procs; struct el *procs;
int num; int num;
#ifdef HAVE_PROGRAM_INVOCATION_NAME
program_invocation_name = program_invocation_short_name; program_invocation_name = program_invocation_short_name;
#endif
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);

2
pmap.c
View File

@ -1013,7 +1013,9 @@ int main(int argc, char **argv)
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
#ifdef HAVE_PROGRAM_INVOCATION_NAME
program_invocation_name = program_invocation_short_name; program_invocation_name = program_invocation_short_name;
#endif
nls_initialize(); nls_initialize();
atexit(close_stdout); atexit(close_stdout);

4
pwdx.c
View File

@ -74,7 +74,9 @@ int main(int argc, char *argv[])
{NULL, 0, 0, 0} {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, ""); setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);

View File

@ -629,7 +629,9 @@ static void skillsnice_parse(int argc,
/* main body */ /* main body */
int main(int argc, char ** argv) 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; struct run_time_conf_t run_time;
memset(&run_time, 0, sizeof(struct run_time_conf_t)); memset(&run_time, 0, sizeof(struct run_time_conf_t));
my_pid = getpid(); my_pid = getpid();

View File

@ -300,7 +300,9 @@ int main(int argc, char *argv[])
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
#ifdef HAVE_PROGRAM_INVOCATION_NAME
program_invocation_name = program_invocation_short_name; program_invocation_name = program_invocation_short_name;
#endif
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);

View File

@ -675,7 +675,9 @@ int main(int argc, char *argv[])
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
#ifdef HAVE_PROGRAM_INVOCATION_NAME
program_invocation_name = program_invocation_short_name; program_invocation_name = program_invocation_short_name;
#endif
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);

View File

@ -114,7 +114,9 @@ int main(int argc, char **argv)
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
#ifdef HAVE_PROGRAM_INVOCATION_NAME
program_invocation_name = program_invocation_short_name; program_invocation_name = program_invocation_short_name;
#endif
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);

View File

@ -77,7 +77,9 @@ int main(int argc, char **argv)
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
#ifdef HAVE_PROGRAM_INVOCATION_NAME
program_invocation_name = program_invocation_short_name; program_invocation_name = program_invocation_short_name;
#endif
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);

View File

@ -724,7 +724,9 @@ int main(int argc, char *argv[])
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
#ifdef HAVE_PROGRAM_INVOCATION_NAME
program_invocation_name = program_invocation_short_name; program_invocation_name = program_invocation_short_name;
#endif
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);

2
w.c
View File

@ -483,7 +483,9 @@ int main(int argc, char **argv)
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
#ifdef HAVE_PROGRAM_INVOCATION_NAME
program_invocation_name = program_invocation_short_name; program_invocation_name = program_invocation_short_name;
#endif
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);

View File

@ -590,7 +590,9 @@ int main(int argc, char *argv[])
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
#ifdef HAVE_PROGRAM_INVOCATION_NAME
program_invocation_name = program_invocation_short_name; program_invocation_name = program_invocation_short_name;
#endif
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);