• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/ap/gpl/timemachine/gettext-0.17/gettext-tools/gnulib-m4/
1# setenv.m4 serial 8
2dnl Copyright (C) 2001-2004, 2006-2007 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([gl_FUNC_SETENV],
8[
9  AC_CHECK_FUNCS_ONCE([setenv])
10  if test $ac_cv_func_setenv = no; then
11    AC_LIBOBJ([setenv])
12    gl_PREREQ_SETENV
13  fi
14])
15
16# Like gl_FUNC_SETENV, except prepare for separate compilation (no AC_LIBOBJ).
17AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
18[
19  AC_CHECK_FUNCS_ONCE([setenv])
20  gl_PREREQ_SETENV
21])
22
23AC_DEFUN([gl_FUNC_UNSETENV],
24[
25  AC_CHECK_FUNCS([unsetenv])
26  if test $ac_cv_func_unsetenv = no; then
27    AC_LIBOBJ([unsetenv])
28    gl_PREREQ_UNSETENV
29  else
30    AC_CACHE_CHECK([for unsetenv() return type], gt_cv_func_unsetenv_ret,
31      [AC_TRY_COMPILE([#include <stdlib.h>
32extern
33#ifdef __cplusplus
34"C"
35#endif
36#if defined(__STDC__) || defined(__cplusplus)
37int unsetenv (const char *name);
38#else
39int unsetenv();
40#endif
41], , gt_cv_func_unsetenv_ret='int', gt_cv_func_unsetenv_ret='void')])
42    if test $gt_cv_func_unsetenv_ret = 'void'; then
43      AC_DEFINE(VOID_UNSETENV, 1, [Define if unsetenv() returns void, not int.])
44    fi
45  fi
46])
47
48# Check if a variable is properly declared.
49# gt_CHECK_VAR_DECL(includes,variable)
50AC_DEFUN([gt_CHECK_VAR_DECL],
51[
52  define([gt_cv_var], [gt_cv_var_]$2[_declaration])
53  AC_MSG_CHECKING([if $2 is properly declared])
54  AC_CACHE_VAL(gt_cv_var, [
55    AC_TRY_COMPILE([$1
56      extern struct { int foo; } $2;],
57      [$2.foo = 1;],
58      gt_cv_var=no,
59      gt_cv_var=yes)])
60  AC_MSG_RESULT($gt_cv_var)
61  if test $gt_cv_var = yes; then
62    AC_DEFINE([HAVE_]translit($2, [a-z], [A-Z])[_DECL], 1,
63              [Define if you have the declaration of $2.])
64  fi
65])
66
67# Prerequisites of lib/setenv.c.
68AC_DEFUN([gl_PREREQ_SETENV],
69[
70  AC_REQUIRE([AC_FUNC_ALLOCA])
71  AC_CHECK_HEADERS_ONCE(unistd.h)
72  AC_CHECK_HEADERS(search.h)
73  AC_CHECK_FUNCS(tsearch)
74  gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
75])
76
77# Prerequisites of lib/unsetenv.c.
78AC_DEFUN([gl_PREREQ_UNSETENV],
79[
80  AC_CHECK_HEADERS_ONCE(unistd.h)
81  gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
82])
83