2
dnl Copyright (C) 2001-2004, 2006-2011 Free Software Foundation, Inc.
2
dnl Copyright (C) 2001-2004, 2006-2012 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
7
7
AC_DEFUN([gl_FUNC_SETENV],
9
9
AC_REQUIRE([gl_FUNC_SETENV_SEPARATE])
10
if test $HAVE_SETENV$REPLACE_SETENV != 10; then
15
# Like gl_FUNC_SETENV, except prepare for separate compilation (no AC_LIBOBJ).
16
AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
18
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
19
AC_CHECK_DECLS_ONCE([setenv])
20
if test $ac_cv_have_decl_setenv = no; then
23
AC_CHECK_FUNCS_ONCE([setenv])
10
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
24
11
if test $ac_cv_func_setenv = no; then
49
36
[gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no],
50
[gl_cv_func_setenv_works="guessing no"])])
51
if test "$gl_cv_func_setenv_works" != yes; then
38
# Guess yes on glibc systems.
39
*-gnu*) gl_cv_func_setenv_works="guessing yes" ;;
40
# If we don't know, assume the worst.
41
*) gl_cv_func_setenv_works="guessing no" ;;
44
case "$gl_cv_func_setenv_works" in
53
# Like gl_FUNC_SETENV, except prepare for separate compilation
54
# (no REPLACE_SETENV, no AC_LIBOBJ).
55
AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
57
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
58
AC_CHECK_DECLS_ONCE([setenv])
59
if test $ac_cv_have_decl_setenv = no; then
62
AC_CHECK_FUNCS_ONCE([setenv])
59
66
AC_DEFUN([gl_FUNC_UNSETENV],
61
68
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
69
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
62
70
AC_CHECK_DECLS_ONCE([unsetenv])
63
71
if test $ac_cv_have_decl_unsetenv = no; then
64
72
HAVE_DECL_UNSETENV=0
66
74
AC_CHECK_FUNCS([unsetenv])
67
75
if test $ac_cv_func_unsetenv = no; then
71
79
dnl Some BSDs return void, failing to do error checking.
72
80
AC_CACHE_CHECK([for unsetenv() return type], [gt_cv_func_unsetenv_ret],
73
81
[AC_COMPILE_IFELSE(
123
126
if (getenv ("a")) return 6;
125
128
[gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no],
126
[gl_cv_func_unsetenv_works="guessing no"])])
127
if test "$gl_cv_func_unsetenv_works" != yes; then
129
AC_LIBOBJ([unsetenv])
130
# Guess yes on glibc systems.
131
*-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;;
132
# If we don't know, assume the worst.
133
*) gl_cv_func_unsetenv_works="guessing no" ;;
136
case "$gl_cv_func_unsetenv_works" in