mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-24 02:51:43 +01:00
Base getprogname() on program_invocation_short_name presence instead of glibc
This commit is contained in:
parent
d5d9186937
commit
752997462a
@ -45,6 +45,15 @@ AC_CHECK_DECL([F_CLOSEM],
|
||||
#include <fcntl.h>])
|
||||
|
||||
# Checks for library functions.
|
||||
AC_MSG_CHECKING([for program_invocation_short_name])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <errno.h>]],
|
||||
[[const char *p = program_invocation_short_name;]])],
|
||||
[AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
|
||||
[Define to 1 if you have program_invocation_short_name])
|
||||
AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])])
|
||||
|
||||
AC_MSG_CHECKING([for __progname])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([[]],
|
||||
|
@ -42,7 +42,7 @@ static const char *__progname = NULL;
|
||||
const char *
|
||||
getprogname(void)
|
||||
{
|
||||
#ifdef __GLIBC__
|
||||
#if defined(HAVE_PROGRAM_INVOCATION_SHORT_NAME)
|
||||
if (__progname == NULL)
|
||||
__progname = program_invocation_short_name;
|
||||
#elif defined(HAVE_GETEXECNAME)
|
||||
|
Loading…
x
Reference in New Issue
Block a user