diff options
author | Ton Voon <ton.voon@opsera.com> | 2010-06-24 09:02:31 (GMT) |
---|---|---|
committer | Ton Voon <ton.voon@opsera.com> | 2010-06-24 09:02:31 (GMT) |
commit | 342f3b403e888800fb1b0502bf4e0d8268358573 (patch) | |
tree | 47a0031fcf01edae3131fc147304d14f6f2aee20 /gl/m4/environ.m4 | |
parent | f789a37b057b6f34820ea4f95d63f53b5a84c980 (diff) | |
download | monitoring-plugins-342f3b403e888800fb1b0502bf4e0d8268358573.tar.gz |
Added unsetenv and setenv from gnulib
Diffstat (limited to 'gl/m4/environ.m4')
-rw-r--r-- | gl/m4/environ.m4 | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gl/m4/environ.m4 b/gl/m4/environ.m4 new file mode 100644 index 0000000..4c6849a --- /dev/null +++ b/gl/m4/environ.m4 | |||
@@ -0,0 +1,36 @@ | |||
1 | # environ.m4 serial 4 | ||
2 | dnl Copyright (C) 2001-2004, 2006-2010 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | ||
4 | dnl gives unlimited permission to copy and/or distribute it, | ||
5 | dnl with or without modifications, as long as this notice is preserved. | ||
6 | |||
7 | AC_DEFUN_ONCE([gl_ENVIRON], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) | ||
10 | dnl Persuade glibc <unistd.h> to declare environ. | ||
11 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
12 | gt_CHECK_VAR_DECL([#include <unistd.h>], environ) | ||
13 | if test $gt_cv_var_environ_declaration != yes; then | ||
14 | HAVE_DECL_ENVIRON=0 | ||
15 | fi | ||
16 | ]) | ||
17 | |||
18 | # Check if a variable is properly declared. | ||
19 | # gt_CHECK_VAR_DECL(includes,variable) | ||
20 | AC_DEFUN([gt_CHECK_VAR_DECL], | ||
21 | [ | ||
22 | define([gt_cv_var], [gt_cv_var_]$2[_declaration]) | ||
23 | AC_MSG_CHECKING([if $2 is properly declared]) | ||
24 | AC_CACHE_VAL([gt_cv_var], [ | ||
25 | AC_TRY_COMPILE([$1 | ||
26 | extern struct { int foo; } $2;], | ||
27 | [$2.foo = 1;], | ||
28 | gt_cv_var=no, | ||
29 | gt_cv_var=yes)]) | ||
30 | AC_MSG_RESULT([$gt_cv_var]) | ||
31 | if test $gt_cv_var = yes; then | ||
32 | AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1, | ||
33 | [Define if you have the declaration of $2.]) | ||
34 | fi | ||
35 | undefine([gt_cv_var]) | ||
36 | ]) | ||