source: trunk/essentials/sys-apps/findutils/gnulib/m4/getcwd.m4

Last change on this file was 3170, checked in by bird, 18 years ago

findutils 4.3.2

File size: 1.5 KB
Line 
1# getcwd.m4 - check for working getcwd that is compatible with glibc
2
3# Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
4# This file is free software; the Free Software Foundation
5# gives unlimited permission to copy and/or distribute it,
6# with or without modifications, as long as this notice is preserved.
7
8# Written by Paul Eggert.
9
10AC_DEFUN([gl_FUNC_GETCWD_NULL],
11 [
12 AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result],
13 [gl_cv_func_getcwd_null],
14 [AC_TRY_RUN(
15 [
16# include <stdlib.h>
17# include <unistd.h>
18# ifndef getcwd
19 char *getcwd ();
20# endif
21 int
22 main ()
23 {
24 if (chdir ("/") != 0)
25 exit (1);
26 else
27 {
28 char *f = getcwd (NULL, 0);
29 exit (! (f && f[0] == '/' && !f[1]));
30 }
31 }],
32 [gl_cv_func_getcwd_null=yes],
33 [gl_cv_func_getcwd_null=no],
34 [gl_cv_func_getcwd_null=no])])
35])
36
37AC_DEFUN([gl_FUNC_GETCWD],
38[
39 AC_REQUIRE([gl_FUNC_GETCWD_NULL])
40
41 gl_abort_bug=no
42 case $gl_cv_func_getcwd_null in
43 yes)
44 gl_FUNC_GETCWD_PATH_MAX
45 gl_FUNC_GETCWD_ABORT_BUG([gl_abort_bug=yes]);;
46 esac
47
48 case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_path_max,$gl_abort_bug in
49 yes,yes,no) ;;
50 *)
51 AC_LIBOBJ([getcwd])
52 AC_DEFINE([__GETCWD_PREFIX], [[rpl_]],
53 [Define to rpl_ if the getcwd replacement function should be used.])
54 gl_PREREQ_GETCWD;;
55 esac
56])
57
58# Prerequisites of lib/getcwd.c.
59AC_DEFUN([gl_PREREQ_GETCWD],
60[
61 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
62 AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO])
63 :
64])
Note: See TracBrowser for help on using the repository browser.