2 dnl Copyright (C) 2001-2004, 2006-2013 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_ONCE([gl_ENVIRON],
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
10 dnl Persuade glibc <unistd.h> to declare environ.
11 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
13 AC_CHECK_HEADERS_ONCE([unistd.h])
18 /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
22 if test $gt_cv_var_environ_declaration != yes; then
27 # Check if a variable is properly declared.
28 # gt_CHECK_VAR_DECL(includes,variable)
29 AC_DEFUN([gt_CHECK_VAR_DECL],
31 define([gt_cv_var], [gt_cv_var_]$2[_declaration])
32 AC_MSG_CHECKING([if $2 is properly declared])
33 AC_CACHE_VAL([gt_cv_var], [
37 extern struct { int foo; } $2;]],
41 AC_MSG_RESULT([$gt_cv_var])
42 if test $gt_cv_var = yes; then
43 AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1,
44 [Define if you have the declaration of $2.])