VirtualBox

source: kBuild/trunk/src/grep/m4/putenv.m4

Last change on this file was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:eol-style set to LF
File size: 2.0 KB
Line 
1# putenv.m4 serial 25
2dnl Copyright (C) 2002-2021 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Jim Meyering.
8dnl
9dnl Check whether putenv ("FOO") removes FOO from the environment.
10dnl The putenv in libc on at least SunOS 4.1.4 does *not* do that.
11
12AC_DEFUN([gl_FUNC_PUTENV],
13[
14 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
15 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
16 AC_CACHE_CHECK([for putenv compatible with GNU and SVID],
17 [gl_cv_func_svid_putenv],
18 [AC_RUN_IFELSE(
19 [AC_LANG_PROGRAM(
20 [AC_INCLUDES_DEFAULT
21 GL_MDA_DEFINES],
22 [[
23 /* Put it in env. */
24 if (putenv ("CONFTEST_putenv=val"))
25 return 1;
26
27 /* Try to remove it. */
28 if (putenv ("CONFTEST_putenv"))
29 return 2;
30
31 /* Make sure it was deleted. */
32 if (getenv ("CONFTEST_putenv") != 0)
33 return 3;
34
35 return 0;
36 ]])],
37 [gl_cv_func_svid_putenv=yes],
38 [gl_cv_func_svid_putenv=no],
39 [dnl When crosscompiling, assume putenv is broken.
40 case "$host_os" in
41 # Guess yes on glibc systems.
42 *-gnu* | gnu*) gl_cv_func_svid_putenv="guessing yes" ;;
43 # Guess yes on musl systems.
44 *-musl*) gl_cv_func_svid_putenv="guessing yes" ;;
45 # Guess no on native Windows.
46 mingw*) gl_cv_func_svid_putenv="guessing no" ;;
47 # If we don't know, obey --enable-cross-guesses.
48 *) gl_cv_func_svid_putenv="$gl_cross_guess_normal" ;;
49 esac
50 ])
51 ])
52 case "$gl_cv_func_svid_putenv" in
53 *yes) ;;
54 *)
55 REPLACE_PUTENV=1
56 ;;
57 esac
58])
59
60# Prerequisites of lib/putenv.c.
61AC_DEFUN([gl_PREREQ_PUTENV],
62[
63 AC_CHECK_DECLS([_putenv])
64])
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette