mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
replace: Add check for variable program_invocation_short_name
It appears that wafsamba's configure() defines _GNU_SOURCE unconditionally, so checking _GNU_SOURCE isn't enough to know if this variable is available. For example, it isn't available on AIX with the xlc compiler: [ 6/10] Compiling lib/replace/replace.c ... "../../lib/replace/replace.c", line 991.16: 1506-045 (S) Undeclared identifier program_invocation_short_name. Instead, add a configure check for program_invocation_short_name and use it. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Nov 13 11:11:11 CET 2018 on sn-devel-144
This commit is contained in:
parent
63a9fe1d44
commit
9f5768106f
@ -980,16 +980,16 @@ int rep_memset_s(void *dest, size_t destsz, int ch, size_t count)
|
||||
#endif /* HAVE_MEMSET_S */
|
||||
|
||||
#ifndef HAVE_GETPROGNAME
|
||||
# ifndef _GNU_SOURCE
|
||||
# ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
|
||||
# define PROGNAME_SIZE 32
|
||||
static char rep_progname[PROGNAME_SIZE];
|
||||
# endif /* _GNU_SOURCE */
|
||||
# endif /* HAVE_PROGRAM_INVOCATION_SHORT_NAME */
|
||||
|
||||
const char *rep_getprogname(void)
|
||||
{
|
||||
#ifdef _GNU_SOURCE
|
||||
#ifdef HAVE_PROGRAM_INVOCATION_SHORT_NAME
|
||||
return program_invocation_short_name;
|
||||
#else /* _GNU_SOURCE */
|
||||
#else /* HAVE_PROGRAM_INVOCATION_SHORT_NAME */
|
||||
FILE *fp = NULL;
|
||||
char cmdline[4096] = {0};
|
||||
char *p = NULL;
|
||||
@ -1053,6 +1053,6 @@ const char *rep_getprogname(void)
|
||||
(void)snprintf(rep_progname, sizeof(rep_progname), "%s", p);
|
||||
|
||||
return rep_progname;
|
||||
#endif /* _GNU_SOURCE */
|
||||
#endif /* HAVE_PROGRAM_INVOCATION_SHORT_NAME */
|
||||
}
|
||||
#endif /* HAVE_GETPROGNAME */
|
||||
|
@ -607,6 +607,7 @@ def configure(conf):
|
||||
|
||||
conf.CHECK_VARIABLE('rl_event_hook', define='HAVE_DECL_RL_EVENT_HOOK', always=True,
|
||||
headers='readline.h readline/readline.h readline/history.h')
|
||||
conf.CHECK_VARIABLE('program_invocation_short_name', headers='errno.h')
|
||||
|
||||
conf.CHECK_DECLS('snprintf vsnprintf asprintf vasprintf')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user