~ubuntu-branches/ubuntu/trusty/patch/trusty-security

« back to all changes in this revision

Viewing changes to m4/setenv.m4

  • Committer: Package Import Robot
  • Author(s): Christoph Berg
  • Date: 2013-01-03 17:34:45 UTC
  • mto: (6.1.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20130103173445-5vf8qmnfgd7ug67h
Tags: upstream-2.7.1
ImportĀ upstreamĀ versionĀ 2.7.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# setenv.m4 serial 21
2
 
dnl Copyright (C) 2001-2004, 2006-2011 Free Software Foundation, Inc.
 
1
# setenv.m4 serial 26
 
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],
8
8
[
9
9
  AC_REQUIRE([gl_FUNC_SETENV_SEPARATE])
10
 
  if test $HAVE_SETENV$REPLACE_SETENV != 10; then
11
 
    AC_LIBOBJ([setenv])
12
 
  fi
13
 
])
14
 
 
15
 
# Like gl_FUNC_SETENV, except prepare for separate compilation (no AC_LIBOBJ).
16
 
AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
17
 
[
18
 
  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
19
 
  AC_CHECK_DECLS_ONCE([setenv])
20
 
  if test $ac_cv_have_decl_setenv = no; then
21
 
    HAVE_DECL_SETENV=0
22
 
  fi
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
25
12
    HAVE_SETENV=0
26
13
  else
47
34
       return result;
48
35
      ]])],
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
52
 
      REPLACE_SETENV=1
53
 
      AC_LIBOBJ([setenv])
54
 
    fi
55
 
  fi
 
37
      [case "$host_os" in
 
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" ;;
 
42
       esac
 
43
      ])])
 
44
    case "$gl_cv_func_setenv_works" in
 
45
      *yes) ;;
 
46
      *)
 
47
        REPLACE_SETENV=1
 
48
        ;;
 
49
    esac
 
50
  fi
 
51
])
 
52
 
 
53
# Like gl_FUNC_SETENV, except prepare for separate compilation
 
54
# (no REPLACE_SETENV, no AC_LIBOBJ).
 
55
AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
 
56
[
 
57
  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
 
58
  AC_CHECK_DECLS_ONCE([setenv])
 
59
  if test $ac_cv_have_decl_setenv = no; then
 
60
    HAVE_DECL_SETENV=0
 
61
  fi
 
62
  AC_CHECK_FUNCS_ONCE([setenv])
56
63
  gl_PREREQ_SETENV
57
64
])
58
65
 
59
66
AC_DEFUN([gl_FUNC_UNSETENV],
60
67
[
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
65
73
  fi
66
74
  AC_CHECK_FUNCS([unsetenv])
67
75
  if test $ac_cv_func_unsetenv = no; then
68
 
    AC_LIBOBJ([unsetenv])
69
 
    gl_PREREQ_UNSETENV
 
76
    HAVE_UNSETENV=0
70
77
  else
 
78
    HAVE_UNSETENV=1
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(
80
88
#ifdef __cplusplus
81
89
"C"
82
90
#endif
83
 
#if defined(__STDC__) || defined(__cplusplus)
84
91
int unsetenv (const char *name);
85
 
#else
86
 
int unsetenv();
87
 
#endif
88
92
            ]],
89
93
            [[]])],
90
94
         [gt_cv_func_unsetenv_ret='int'],
93
97
      AC_DEFINE([VOID_UNSETENV], [1], [Define to 1 if unsetenv returns void
94
98
       instead of int.])
95
99
      REPLACE_UNSETENV=1
96
 
      AC_LIBOBJ([unsetenv])
97
100
    fi
98
101
 
99
102
    dnl Solaris 10 unsetenv does not remove all copies of a name.
123
126
       if (getenv ("a")) return 6;
124
127
      ]])],
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
128
 
      REPLACE_UNSETENV=1
129
 
      AC_LIBOBJ([unsetenv])
130
 
    fi
 
129
      [case "$host_os" in
 
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" ;;
 
134
       esac
 
135
      ])])
 
136
    case "$gl_cv_func_unsetenv_works" in
 
137
      *yes) ;;
 
138
      *)
 
139
        REPLACE_UNSETENV=1
 
140
        ;;
 
141
    esac
131
142
  fi
132
143
])
133
144