summaryrefslogtreecommitdiff
path: root/gl/m4/setenv.m4
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2022-02-04 15:11:47 +0000
committerColin Watson <cjwatson@debian.org>2022-02-04 15:11:47 +0000
commit828b489c68a5a022c106656cfdff19bb9b584eec (patch)
tree7225919cd6e445d94080fa108a1a6b05fb890cf7 /gl/m4/setenv.m4
parenta2d4ffce13a855f29a63bac2099ebe0f5a4e50bd (diff)
parentbfe34108bc20e9d75e3f08bfc8305e4f4cd632a9 (diff)
Import man-db_2.10.0.orig.tar.xz
Diffstat (limited to 'gl/m4/setenv.m4')
-rw-r--r--gl/m4/setenv.m466
1 files changed, 35 insertions, 31 deletions
diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4
index ef03673d..2000039a 100644
--- a/gl/m4/setenv.m4
+++ b/gl/m4/setenv.m4
@@ -1,5 +1,5 @@
-# setenv.m4 serial 29
-dnl Copyright (C) 2001-2004, 2006-2020 Free Software Foundation, Inc.
+# setenv.m4 serial 30
+dnl Copyright (C) 2001-2004, 2006-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -106,35 +106,39 @@ int unsetenv (const char *name);
dnl OpenBSD 4.7 unsetenv("") does not fail.
AC_CACHE_CHECK([whether unsetenv obeys POSIX],
[gl_cv_func_unsetenv_works],
- [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
- #include <stdlib.h>
- #include <errno.h>
- extern char **environ;
- ]], [[
- char entry1[] = "a=1";
- char entry2[] = "b=2";
- char *env[] = { entry1, entry2, NULL };
- if (putenv ((char *) "a=1")) return 1;
- if (putenv (entry2)) return 2;
- entry2[0] = 'a';
- unsetenv ("a");
- if (getenv ("a")) return 3;
- if (!unsetenv ("") || errno != EINVAL) return 4;
- entry2[0] = 'b';
- environ = env;
- if (!getenv ("a")) return 5;
- entry2[0] = 'a';
- unsetenv ("a");
- if (getenv ("a")) return 6;
- ]])],
- [gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no],
- [case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;;
- # If we don't know, obey --enable-cross-guesses.
- *) gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;;
- esac
- ])])
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #include <stdlib.h>
+ #include <errno.h>
+ extern char **environ;
+ ]GL_MDA_DEFINES],
+ [[
+ char entry1[] = "a=1";
+ char entry2[] = "b=2";
+ char *env[] = { entry1, entry2, NULL };
+ if (putenv ((char *) "a=1")) return 1;
+ if (putenv (entry2)) return 2;
+ entry2[0] = 'a';
+ unsetenv ("a");
+ if (getenv ("a")) return 3;
+ if (!unsetenv ("") || errno != EINVAL) return 4;
+ entry2[0] = 'b';
+ environ = env;
+ if (!getenv ("a")) return 5;
+ entry2[0] = 'a';
+ unsetenv ("a");
+ if (getenv ("a")) return 6;
+ ]])],
+ [gl_cv_func_unsetenv_works=yes],
+ [gl_cv_func_unsetenv_works=no],
+ [case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;;
+ # If we don't know, obey --enable-cross-guesses.
+ *) gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;;
+ esac
+ ])
+ ])
case "$gl_cv_func_unsetenv_works" in
*yes) ;;
*)