2 dnl Copyright (C) 2001-2004, 2006-2009 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.
7 AC_DEFUN([gl_FUNC_SETENV],
9 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
10 AC_CHECK_FUNCS_ONCE([setenv])
11 if test $ac_cv_func_setenv = no; then
18 # Like gl_FUNC_SETENV, except prepare for separate compilation (no AC_LIBOBJ).
19 AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
21 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
22 AC_CHECK_FUNCS_ONCE([setenv])
23 if test $ac_cv_func_setenv = no; then
29 AC_DEFUN([gl_FUNC_UNSETENV],
31 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
32 AC_CHECK_FUNCS([unsetenv])
33 if test $ac_cv_func_unsetenv = no; then
38 AC_CACHE_CHECK([for unsetenv() return type], [gt_cv_func_unsetenv_ret],
39 [AC_TRY_COMPILE([#include <stdlib.h>
44 #if defined(__STDC__) || defined(__cplusplus)
45 int unsetenv (const char *name);
49 ], , gt_cv_func_unsetenv_ret='int', gt_cv_func_unsetenv_ret='void')])
50 if test $gt_cv_func_unsetenv_ret = 'void'; then
56 # Prerequisites of lib/setenv.c.
57 AC_DEFUN([gl_PREREQ_SETENV],
59 AC_REQUIRE([AC_FUNC_ALLOCA])
60 AC_REQUIRE([gl_ENVIRON])
61 AC_CHECK_HEADERS_ONCE([unistd.h])
62 AC_CHECK_HEADERS([search.h])
63 AC_CHECK_FUNCS([tsearch])
66 # Prerequisites of lib/unsetenv.c.
67 AC_DEFUN([gl_PREREQ_UNSETENV],
69 AC_REQUIRE([gl_ENVIRON])
70 AC_CHECK_HEADERS_ONCE([unistd.h])