diff options
| author | Lorenz Kästle <lorenz.kaestle@netways.de> | 2023-03-09 11:03:48 +0100 |
|---|---|---|
| committer | Lorenz Kästle <lorenz.kaestle@netways.de> | 2023-03-09 11:03:48 +0100 |
| commit | d0edb72a0c9bc1a28197ab4566928f7ee63a6d43 (patch) | |
| tree | 6d524fb16d2dd1aa9f2d98529ef1de7a39f52700 /gl/m4/getprogname.m4 | |
| parent | 9fdc82f0543c6e2891c7079f70297f92e8ef4619 (diff) | |
| parent | 269718094177fb8a7e3d3005d1310495009fe8c4 (diff) | |
| download | monitoring-plugins-d0edb72.tar.gz | |
Merge branch 'master' into RincewindsHat-patch-1
Diffstat (limited to 'gl/m4/getprogname.m4')
| -rw-r--r-- | gl/m4/getprogname.m4 | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gl/m4/getprogname.m4 b/gl/m4/getprogname.m4 new file mode 100644 index 00000000..b67c527c --- /dev/null +++ b/gl/m4/getprogname.m4 | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | # getprogname.m4 - check for getprogname or replacements for it | ||
| 2 | |||
| 3 | # Copyright (C) 2016-2023 Free Software Foundation, Inc. | ||
| 4 | # This file is free software; the Free Software Foundation | ||
| 5 | # gives unlimited permission to copy and/or distribute it, | ||
| 6 | # with or without modifications, as long as this notice is preserved. | ||
| 7 | |||
| 8 | # serial 4 | ||
| 9 | |||
| 10 | AC_DEFUN([gl_FUNC_GETPROGNAME], | ||
| 11 | [ | ||
| 12 | AC_CHECK_FUNCS_ONCE([getprogname getexecname]) | ||
| 13 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
| 14 | ac_found=0 | ||
| 15 | AC_CHECK_DECLS([program_invocation_name], [ac_found=1], [], | ||
| 16 | [#include <errno.h>]) | ||
| 17 | AC_CHECK_DECLS([program_invocation_short_name], [ac_found=1], [], | ||
| 18 | [#include <errno.h>]) | ||
| 19 | AC_CHECK_DECLS([__argv], [ac_found=1], [], [#include <stdlib.h>]) | ||
| 20 | |||
| 21 | # Incur the cost of this test only if none of the above worked. | ||
| 22 | if test $ac_found = 0; then | ||
| 23 | # On OpenBSD 5.1, using the global __progname variable appears to be | ||
| 24 | # the only way to implement getprogname. | ||
| 25 | AC_CACHE_CHECK([whether __progname is defined in default libraries], | ||
| 26 | [gl_cv_var___progname], | ||
| 27 | [ | ||
| 28 | gl_cv_var___progname= | ||
| 29 | AC_LINK_IFELSE( | ||
| 30 | [AC_LANG_PROGRAM( | ||
| 31 | [[extern char *__progname;]], | ||
| 32 | [[return *__progname;]] | ||
| 33 | )], | ||
| 34 | [gl_cv_var___progname=yes] | ||
| 35 | ) | ||
| 36 | ] | ||
| 37 | ) | ||
| 38 | if test "$gl_cv_var___progname" = yes; then | ||
| 39 | AC_DEFINE([HAVE_VAR___PROGNAME], 1, | ||
| 40 | [Define if you have a global __progname variable]) | ||
| 41 | fi | ||
| 42 | fi | ||
| 43 | ]) | ||
