Simplify symlink portability workaround.

This commit is contained in:
Paul Eggert 2011-02-25 12:05:36 -08:00
parent 4394ee0474
commit 36f13e1667
12 changed files with 86 additions and 201 deletions

View file

@ -1,5 +1,11 @@
2011-02-25 Paul Eggert <eggert@cs.ucla.edu>
Simplify symlink portability workaround.
* m4/dos.m4: Remove.
* aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, lib/stat.c:
* m4/gl-comp.m4, m4/stat.m4, src/config.in: Regenerate from gnulib.
* lib/dosname.h: New file, regenerated from gnulib.
* configure, lib/Makefile.in, lib/getopt_int.h, lib/gnulib.mk:
* lib/stdlib.in.h, m4/stdlib_h.m4: Regenerate.

1
aclocal.m4 vendored
View file

@ -986,7 +986,6 @@ AC_SUBST([am__untar])
m4_include([m4/00gnulib.m4])
m4_include([m4/c-strtod.m4])
m4_include([m4/dos.m4])
m4_include([m4/extensions.m4])
m4_include([m4/filemode.m4])
m4_include([m4/getloadavg.m4])

99
configure vendored
View file

@ -6128,6 +6128,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
# Code from module arg-nonnull:
# Code from module c++defs:
# Code from module crypto/md5:
# Code from module dosname:
# Code from module dtoastr:
# Code from module extensions:
@ -14687,102 +14688,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system is Windows or MSDOS" >&5
$as_echo_n "checking whether system is Windows or MSDOS... " >&6; }
if ${ac_cv_win_or_dos+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__
neither MSDOS nor Windows
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_win_or_dos=yes
else
ac_cv_win_or_dos=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_win_or_dos" >&5
$as_echo "$ac_cv_win_or_dos" >&6; }
if test x"$ac_cv_win_or_dos" = xyes; then
ac_fs_accepts_drive_letter_prefix=1
ac_fs_backslash_is_file_name_separator=1
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether drive letter can start relative path" >&5
$as_echo_n "checking whether drive letter can start relative path... " >&6; }
if ${ac_cv_drive_letter_can_be_relative+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#if defined __CYGWIN__
drive letters are always absolute
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_drive_letter_can_be_relative=yes
else
ac_cv_drive_letter_can_be_relative=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_drive_letter_can_be_relative" >&5
$as_echo "$ac_cv_drive_letter_can_be_relative" >&6; }
if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then
ac_fs_drive_letter_can_be_relative=1
else
ac_fs_drive_letter_can_be_relative=0
fi
else
ac_fs_accepts_drive_letter_prefix=0
ac_fs_backslash_is_file_name_separator=0
ac_fs_drive_letter_can_be_relative=0
fi
cat >>confdefs.h <<_ACEOF
#define FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX $ac_fs_accepts_drive_letter_prefix
_ACEOF
cat >>confdefs.h <<_ACEOF
#define FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR $ac_fs_backslash_is_file_name_separator
_ACEOF
cat >>confdefs.h <<_ACEOF
#define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE $ac_fs_drive_letter_can_be_relative
_ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
if ${ac_cv_header_stdbool_h+:} false; then :
@ -15347,6 +15252,7 @@ fi
:
# Code from module dosname:
# Code from module dtoastr:
# Code from module extensions:
@ -16358,7 +16264,6 @@ $as_echo "#define READLINK_TRAILING_SLASH_BUG 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on directories" >&5
$as_echo_n "checking whether stat handles trailing slashes on directories... " >&6; }
if ${gl_cv_func_stat_dir_slash+:} false; then :

View file

@ -50,10 +50,10 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
subdir = lib
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
$(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/dos.m4 \
$(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/filemode.m4 \
$(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \
$(top_srcdir)/m4/gl-comp.m4 $(top_srcdir)/m4/gnulib-common.m4 \
$(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \
$(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/getloadavg.m4 \
$(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gl-comp.m4 \
$(top_srcdir)/m4/gnulib-common.m4 \
$(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \
$(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/md5.m4 \
$(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/multiarch.m4 \
@ -604,12 +604,12 @@ BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \
$(STDDEF_H) $(STDINT_H) stdlib.h sys/stat.h time.h unistd.h \
warn-on-use.h
EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \
md5.c md5.h ftoastr.c ftoastr.h filemode.c filemode.h \
getloadavg.c getopt.c getopt.in.h getopt1.c getopt_int.h \
intprops.h lstat.c mktime-internal.h mktime.c readlink.c \
stat.c stdbool.in.h stddef.in.h stdint.in.h stdlib.in.h \
strftime.c strftime.h symlink.c sys_stat.in.h time.in.h \
time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h
md5.c md5.h dosname.h ftoastr.c ftoastr.h filemode.c \
filemode.h getloadavg.c getopt.c getopt.in.h getopt1.c \
getopt_int.h intprops.h lstat.c mktime-internal.h mktime.c \
readlink.c stat.c stdbool.in.h stddef.in.h stdint.in.h \
stdlib.in.h strftime.c strftime.h symlink.c sys_stat.in.h \
time.in.h time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h
MOSTLYCLEANDIRS = sys
MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \
c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \

53
lib/dosname.h Normal file
View file

@ -0,0 +1,53 @@
/* File names on MS-DOS/Windows systems.
Copyright (C) 2000-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
From Paul Eggert and Jim Meyering. */
#ifndef _DOSNAME_H
#define _DOSNAME_H
#if (defined _WIN32 || defined __WIN32__ || \
defined __MSDOS__ || defined __CYGWIN__ || \
defined __EMX__ || defined __DJGPP__)
/* This internal macro assumes ASCII, but all hosts that support drive
letters use ASCII. */
# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \
<= 'z' - 'a')
# define FILE_SYSTEM_PREFIX_LEN(Filename) \
(_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0)
# ifndef __CYGWIN__
# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1
# endif
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
#else
# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
# define ISSLASH(C) ((C) == '/')
#endif
#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
#endif
#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
# else
# define IS_ABSOLUTE_FILE_NAME(F) \
(ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0)
#endif
#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
#endif /* DOSNAME_H_ */

View file

@ -78,6 +78,13 @@ EXTRA_libgnu_a_SOURCES += md5.c
## end gnulib module crypto/md5
## begin gnulib module dosname
EXTRA_DIST += dosname.h
## end gnulib module dosname
## begin gnulib module dtoastr
libgnu_a_SOURCES += dtoastr.c

View file

@ -37,6 +37,7 @@ orig_stat (const char *filename, struct stat *buf)
#include <limits.h>
#include <stdbool.h>
#include <string.h>
#include "dosname.h"
/* Store information about NAME into ST. Work around bugs with
trailing slashes. Mingw has other bugs (such as st_ino always

View file

@ -1,71 +0,0 @@
#serial 11 -*- autoconf -*-
# Define some macros required for proper operation of code in lib/*.c
# on MSDOS/Windows systems.
# Copyright (C) 2000-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# From Jim Meyering.
AC_DEFUN([gl_AC_DOS],
[
AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__
neither MSDOS nor Windows
#endif]])],
[ac_cv_win_or_dos=yes],
[ac_cv_win_or_dos=no])
])
if test x"$ac_cv_win_or_dos" = xyes; then
ac_fs_accepts_drive_letter_prefix=1
ac_fs_backslash_is_file_name_separator=1
AC_CACHE_CHECK([whether drive letter can start relative path],
[ac_cv_drive_letter_can_be_relative],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
#if defined __CYGWIN__
drive letters are always absolute
#endif]])],
[ac_cv_drive_letter_can_be_relative=yes],
[ac_cv_drive_letter_can_be_relative=no])
])
if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then
ac_fs_drive_letter_can_be_relative=1
else
ac_fs_drive_letter_can_be_relative=0
fi
else
ac_fs_accepts_drive_letter_prefix=0
ac_fs_backslash_is_file_name_separator=0
ac_fs_drive_letter_can_be_relative=0
fi
AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
$ac_fs_accepts_drive_letter_prefix,
[Define on systems for which file names may have a so-called
`drive letter' prefix, define this to compute the length of that
prefix, including the colon.])
AH_VERBATIM(ISSLASH,
[#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
#else
# define ISSLASH(C) ((C) == '/')
#endif])
AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
$ac_fs_backslash_is_file_name_separator,
[Define if the backslash character may also serve as a file name
component separator.])
AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE],
$ac_fs_drive_letter_can_be_relative,
[Define if a drive letter prefix denotes a relative path if it is
not followed by a file name component separator.])
])

View file

@ -29,6 +29,7 @@ AC_DEFUN([gl_EARLY],
# Code from module arg-nonnull:
# Code from module c++defs:
# Code from module crypto/md5:
# Code from module dosname:
# Code from module dtoastr:
# Code from module extensions:
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
@ -78,6 +79,7 @@ AC_DEFUN([gl_INIT],
# Code from module c++defs:
# Code from module crypto/md5:
gl_MD5
# Code from module dosname:
# Code from module dtoastr:
AC_REQUIRE([gl_C99_STRTOLD])
# Code from module extensions:
@ -279,6 +281,7 @@ AC_DEFUN([gl_FILE_LIST], [
build-aux/arg-nonnull.h
build-aux/c++defs.h
build-aux/warn-on-use.h
lib/dosname.h
lib/dtoastr.c
lib/filemode.c
lib/filemode.h
@ -312,7 +315,6 @@ AC_DEFUN([gl_FILE_LIST], [
lib/unistd.in.h
m4/00gnulib.m4
m4/c-strtod.m4
m4/dos.m4
m4/extensions.m4
m4/filemode.m4
m4/getloadavg.m4

View file

@ -1,4 +1,4 @@
# serial 6
# serial 7
# Copyright (C) 2009-2011 Free Software Foundation, Inc.
#
@ -9,7 +9,6 @@
AC_DEFUN([gl_FUNC_STAT],
[
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_REQUIRE([gl_AC_DOS])
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
AC_CHECK_FUNCS_ONCE([lstat])
dnl mingw is the only known platform where stat(".") and stat("./") differ

View file

@ -1,5 +1,8 @@
2011-02-25 Paul Eggert <eggert@cs.ucla.edu>
Simplify symlink portability workaround.
* config.in: Regenerate.
* dired.c (Ffile_attributes): Increase size of modes from 10 to 12
as per recent filemodestring API change. Reported by Jonas Öster in
<http://lists.gnu.org/archive/html/emacs-devel/2011-02/msg01069.html>.

View file

@ -72,19 +72,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Enable expensive run-time checking of data types? */
#undef ENABLE_CHECKING
/* Define on systems for which file names may have a so-called `drive letter'
prefix, define this to compute the length of that prefix, including the
colon. */
#undef FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
/* Define if the backslash character may also serve as a file name component
separator. */
#undef FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
/* Define if a drive letter prefix denotes a relative path if it is not
followed by a file name component separator. */
#undef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
/* Define this to check for errors in cons list. */
#undef GC_CHECK_CONS_LIST
@ -907,12 +894,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to support using a Hesiod database to find the POP server. */
#undef HESIOD
#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
#else
# define ISSLASH(C) ((C) == '/')
#endif
/* Define to support Kerberos-authenticated POP mail retrieval. */
#undef KERBEROS