summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2017-03-24 13:33:02 +0200
committerPanu Matilainen <pmatilai@redhat.com>2017-03-24 13:41:04 +0200
commit2a7e395f011291c638b64c3b89f0361d25ff393f (patch)
treec684c85ed4510d77af423d45a2472172b9f6e758
parentfa06b68ed7640c0e42a8a63dd9cb0bf8d4c73525 (diff)
downloadrpm-2a7e395f011291c638b64c3b89f0361d25ff393f.tar.gz
Determine setprogname() availability by actually testing for it
This way we dont need to include separate tests for the entire BSD'ish family tree and who knows, might even cover some other cases too.
-rw-r--r--configure.ac1
-rw-r--r--system.h10
2 files changed, 2 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index d3dda0023..813e32268 100644
--- a/configure.ac
+++ b/configure.ac
@@ -708,6 +708,7 @@ AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
AC_CHECK_FUNCS(lutimes)
AC_CHECK_FUNCS(mergesort)
AC_CHECK_FUNCS(getauxval)
+AC_CHECK_FUNCS(setprogname, [], [], [#include <stdlib.h>])
AC_REPLACE_FUNCS(stpcpy stpncpy)
diff --git a/system.h b/system.h
index 6514d9318..c34a55a68 100644
--- a/system.h
+++ b/system.h
@@ -98,15 +98,7 @@ extern int fdatasync(int fildes);
setprogname(*pn) must be the first call in main() in order to set the name
as soon as possible. */
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
-/* `man setprogname' v. May 21, 2011 (NetBSD 6.1) says:
- Portable programs that wish to use getprogname() should call setprogname()
- in main(). In some systems (like NetBSD) it can be set only once and it is
- done before an execution of main() -- therefore calling it again has no
- effect.
-
- Getprogname and setprogname function calls appeared in NetBSD 1.6
- (released in 2002). So nothing to (re)implement for this platform. */
+#if defined(HAVE_SETPROGNAME)
# include <stdlib.h> /* Make sure this header is included */
# define xsetprogname(pn) setprogname(pn)
# define xgetprogname(pn) getprogname(pn)