Use system __progname variable in progname module if available

This commit is contained in:
Guillem Jover 2011-07-06 16:29:26 +02:00
parent b5cc17d664
commit 8723226040
2 changed files with 13 additions and 0 deletions

View File

@ -37,6 +37,15 @@ AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
# Checks for library functions.
AC_MSG_CHECKING([for __progname])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[]],
[[extern char *__progname;
const char *p = __progname;]])],
[AC_DEFINE([HAVE___PROGNAME], [1], [Define to 1 if you have __progname])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AC_CHECK_FUNCS([getexecname])
AC_CONFIG_FILES([

View File

@ -33,7 +33,11 @@
#include <string.h>
#include <stdlib.h>
#ifdef HAVE___PROGNAME
extern const char *__progname;
#else
static const char *__progname = NULL;
#endif
const char *
getprogname(void)