VirtualBox

source: kBuild/trunk/src/grep/m4/environ.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: 1.4 KB
Line 
1# environ.m4 serial 8
2dnl Copyright (C) 2001-2004, 2006-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
7AC_DEFUN_ONCE([gl_ENVIRON],
8[
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
10 dnl Persuade glibc <unistd.h> to declare environ.
11 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12
13 AC_CHECK_HEADERS_ONCE([unistd.h])
14 gt_CHECK_VAR_DECL(
15 [#if HAVE_UNISTD_H
16 #include <unistd.h>
17 #endif
18 /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
19 #include <stdlib.h>
20 ],
21 [environ])
22 if test $gt_cv_var_environ_declaration != yes; then
23 HAVE_DECL_ENVIRON=0
24 fi
25])
26
27# Check if a variable is properly declared.
28# gt_CHECK_VAR_DECL(includes,variable)
29AC_DEFUN([gt_CHECK_VAR_DECL],
30[
31 define([gt_cv_var], [gt_cv_var_]$2[_declaration])
32 AC_CACHE_CHECK([if $2 is properly declared], [gt_cv_var],
33 [AC_COMPILE_IFELSE(
34 [AC_LANG_PROGRAM(
35 [[$1
36 typedef struct { int foo; } foo_t;
37 extern foo_t $2;]],
38 [[$2.foo = 1;]])],
39 [gt_cv_var=no],
40 [gt_cv_var=yes])])
41 if test $gt_cv_var = yes; then
42 AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1,
43 [Define if you have the declaration of $2.])
44 fi
45 undefine([gt_cv_var])
46])
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