Mercurial > hg > octave-shane > gnulib-hg
annotate m4/stat.m4 @ 14393:9f47f8c334f2
dirname: move m4/dos.m4 functionality into lib/dosname.h
m4/dos.m4 needs to go. It laboriously invokes the C compiler, and
extracts symbols from it, puts them into config.h; but it's much
easier to use the symbols directly. filename.h already does this,
but it disagrees with dos.m4 in some respects. This patch
introduces a different include file dosname.h that packages up
dos.m4, and then later we can work on merging filename.h and
dosname.h. Applications that need only the easy-to-configure
symbols should consider including dosname.h rather than dirname.h.
* NEWS: Mention incompatible changes.
* m4/dos.m4: Remove.
* lib/dosname.h, modules/dosname: New files.
* lib/dirname.h (ISSLASH, FILE_SYSTEM_PREFIX_LEN):
(FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE):
(IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME): Move to lib/dosname.h.
* lib/at-func.c, lib/at-func2.c, lib/openat.c, lib/savewd.c:
Include dosname.h, not dirname.h.
* lib/rmdir.c, lib/stat.c, lib/unlink.c, lib/unlinkat.c:
Include dosname.h, for definitions of symbols like ISSLASH
that used to be in config.h.
* m4/dirname.m4 (gl_DIRNAME_LGPL): Do not require gl_AC_DOS.
* m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise.
* m4/stat.m4 (gl_FUNC_STAT): Likewise.
* m4/unlink.m4 (gl_FUNC_UNLINK): Likewise.
* modules/dirname-lgpl (Files): Omit m4/dos.m4.
* modules/rmdir (Files): Likewise.
* modules/stat (Files): Likewise.
* modules/unlink (Files): Likewise.
* modules/dirname-lgpl (Depends-on): Add dosname.
* modules/lstat (Depends-on): Likewise.
* modules/openat (Depends-on): Likewise.
* modules/rmdir (Depends-on): Likewise.
* modules/savewd (Depends-on): Likewise.
* modules/stat (Depends-on): Likewise.
* modules/unlink (Depends-on): Likewise.
* modules/openat (Depends-on): Remove dirname-lgpl.
* modules/savewd (Depends-on): Likewise.
* tests/test-dirname.c: Do not use removed symbols like
FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR. Instead, use
the remaining symbols, e.g., ISSLASH ('\\').
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Fri, 25 Feb 2011 10:52:37 -0800 |
parents | 97fc9a21a8fb |
children | 93a1703f75df |
rev | line source |
---|---|
14393
9f47f8c334f2
dirname: move m4/dos.m4 functionality into lib/dosname.h
Paul Eggert <eggert@cs.ucla.edu>
parents:
14079
diff
changeset
|
1 # serial 7 |
12036 | 2 |
14079
97fc9a21a8fb
maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents:
13918
diff
changeset
|
3 # Copyright (C) 2009-2011 Free Software Foundation, Inc. |
12036 | 4 # |
5 # This file is free software; the Free Software Foundation | |
6 # gives unlimited permission to copy and/or distribute it, | |
7 # with or without modifications, as long as this notice is preserved. | |
8 | |
9 AC_DEFUN([gl_FUNC_STAT], | |
10 [ | |
11 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | |
12 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | |
12258 | 13 AC_CHECK_FUNCS_ONCE([lstat]) |
12036 | 14 dnl mingw is the only known platform where stat(".") and stat("./") differ |
12037 | 15 AC_CACHE_CHECK([whether stat handles trailing slashes on directories], |
16 [gl_cv_func_stat_dir_slash], | |
12036 | 17 [AC_RUN_IFELSE( |
18 [AC_LANG_PROGRAM( | |
19 [[#include <sys/stat.h> | |
20 ]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])], | |
12037 | 21 [gl_cv_func_stat_dir_slash=yes], [gl_cv_func_stat_dir_slash=no], |
12036 | 22 [case $host_os in |
12037 | 23 mingw*) gl_cv_func_stat_dir_slash="guessing no";; |
24 *) gl_cv_func_stat_dir_slash="guessing yes";; | |
12036 | 25 esac])]) |
13499
af9512fc5d24
stat: Update regarding AIX.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
26 dnl AIX 7.1, Solaris 9 mistakenly succeed on stat("file/") |
12258 | 27 dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/") |
12037 | 28 AC_CACHE_CHECK([whether stat handles trailing slashes on files], |
29 [gl_cv_func_stat_file_slash], | |
30 [touch conftest.tmp | |
12258 | 31 # Assume that if we have lstat, we can also check symlinks. |
32 if test $ac_cv_func_lstat = yes; then | |
33 ln -s conftest.tmp conftest.lnk | |
34 fi | |
12037 | 35 AC_RUN_IFELSE( |
36 [AC_LANG_PROGRAM( | |
37 [[#include <sys/stat.h> | |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13499
diff
changeset
|
38 ]], [[int result = 0; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13499
diff
changeset
|
39 struct stat st; |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13499
diff
changeset
|
40 if (!stat ("conftest.tmp/", &st)) |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13499
diff
changeset
|
41 result |= 1; |
12258 | 42 #if HAVE_LSTAT |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13499
diff
changeset
|
43 if (!stat ("conftest.lnk/", &st)) |
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13499
diff
changeset
|
44 result |= 2; |
12258 | 45 #endif |
13918
d5a74c6ec06b
Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents:
13499
diff
changeset
|
46 return result; |
12258 | 47 ]])], |
12037 | 48 [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], |
12258 | 49 [gl_cv_func_stat_file_slash="guessing no"]) |
50 rm -f conftest.tmp conftest.lnk]) | |
12037 | 51 case $gl_cv_func_stat_dir_slash in |
52 *no) REPLACE_STAT=1 | |
53 AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs | |
54 help when passed a directory name with a trailing slash]);; | |
12036 | 55 esac |
12037 | 56 case $gl_cv_func_stat_file_slash in |
57 *no) REPLACE_STAT=1 | |
58 AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs | |
59 help when passed a file name with a trailing slash]);; | |
60 esac | |
61 if test $REPLACE_STAT = 1; then | |
62 AC_LIBOBJ([stat]) | |
12542
ea823743f290
Use AC_C_INLINE where necessary.
Bruno Haible <bruno@clisp.org>
parents:
12258
diff
changeset
|
63 dnl Prerequisites of lib/stat.c. |
ea823743f290
Use AC_C_INLINE where necessary.
Bruno Haible <bruno@clisp.org>
parents:
12258
diff
changeset
|
64 AC_REQUIRE([AC_C_INLINE]) |
12037 | 65 fi |
12036 | 66 ]) |