~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to m4/getcwd-path-max.m4

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# serial 16
 
1
# serial 19
2
2
# Check for several getcwd bugs with long file names.
3
3
# If so, arrange to compile the wrapper function.
4
4
 
6
6
# I've heard that this is due to a Linux kernel bug, and that it has
7
7
# been fixed between 2.4.21-pre3 and 2.4.21-pre4.
8
8
 
9
 
# Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc.
 
9
# Copyright (C) 2003-2007, 2009-2012 Free Software Foundation, Inc.
10
10
# This file is free software; the Free Software Foundation
11
11
# gives unlimited permission to copy and/or distribute it,
12
12
# with or without modifications, as long as this notice is preserved.
16
16
AC_DEFUN([gl_FUNC_GETCWD_PATH_MAX],
17
17
[
18
18
  AC_CHECK_DECLS_ONCE([getcwd])
 
19
  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
19
20
  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
 
21
  AC_CHECK_HEADERS_ONCE([unistd.h])
 
22
  AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ])
20
23
  AC_CACHE_CHECK([whether getcwd handles long file names properly],
21
24
    gl_cv_func_getcwd_path_max,
22
25
    [# Arrange for deletion of the temporary directory this test creates.
27
30
          [[
28
31
#include <errno.h>
29
32
#include <stdlib.h>
30
 
#include <unistd.h>
 
33
#if HAVE_UNISTD_H
 
34
# include <unistd.h>
 
35
#else
 
36
# include <direct.h>
 
37
#endif
31
38
#include <string.h>
32
39
#include <limits.h>
33
40
#include <sys/stat.h>
34
41
#include <sys/types.h>
35
42
#include <fcntl.h>
36
43
 
 
44
]gl_PATHMAX_SNIPPET[
 
45
 
37
46
#ifndef AT_FDCWD
38
47
# define AT_FDCWD 0
39
48
#endif
116
125
              fail = 11;
117
126
              break;
118
127
            }
119
 
          if (c || ! (errno == ERANGE || is_ENAMETOOLONG (errno)))
 
128
          if (c)
 
129
            {
 
130
              fail = 31;
 
131
              break;
 
132
            }
 
133
          if (! (errno == ERANGE || is_ENAMETOOLONG (errno)))
120
134
            {
121
135
              fail = 21;
122
136
              break;
176
190
    [gl_cv_func_getcwd_path_max=yes],
177
191
    [case $? in
178
192
     10|11|12) gl_cv_func_getcwd_path_max='no, but it is partly working';;
 
193
     31) gl_cv_func_getcwd_path_max='no, it has the AIX bug';;
179
194
     *) gl_cv_func_getcwd_path_max=no;;
180
195
     esac],
181
 
    [gl_cv_func_getcwd_path_max=no])
 
196
    [case "$host_os" in
 
197
       aix*) gl_cv_func_getcwd_path_max='no, it has the AIX bug';;
 
198
       *) gl_cv_func_getcwd_path_max=no;;
 
199
     esac])
182
200
  ])
183
 
  case $gl_cv_func_getcwd_path_max in
184
 
  no,*)
185
 
    AC_DEFINE([HAVE_PARTLY_WORKING_GETCWD], [1],
186
 
      [Define to 1 if getcwd works, except it sometimes fails when it shouldn't,
187
 
       setting errno to ERANGE, ENAMETOOLONG, or ENOENT.]);;
188
 
  esac
189
201
])