Import readlink

This patch is to import readlink gnulib module.  stat module is imported
too, but it isn't used by gdb.

gdb:

2014-11-28  Yao Qi  <yao@codesourcery.com>

	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add readlink.
	* gnulib/aclocal.m4: Re-generated.
	* gnulib/config.in: Likewise.
	* gnulib/configure: Likewise.
	* gnulib/import/Makefile.am: Likewise.
	* gnulib/import/Makefile.in: Likewise.
	* gnulib/import/m4/gnulib-cache.m4: Likewise.
	* gnulib/import/m4/gnulib-comp.m4: Likewise.
	* gnulib/import/dosname.h: New file
 	* gnulib/import/m4/largefile.m4: New file.
	* gnulib/import/m4/readlink.m4: New file.
	* gnulib/import/m4/stat.m4: New file.
	* gnulib/import/readlink.c: New file.
 	* gnulib/import/stat.c: New file.
This commit is contained in:
Yao Qi 2014-11-23 21:49:20 +08:00
parent 7014e923da
commit 2196f55f01
15 changed files with 1245 additions and 67 deletions

View File

@ -1,3 +1,20 @@
2014-11-28 Yao Qi <yao@codesourcery.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add readlink.
* gnulib/aclocal.m4: Re-generated.
* gnulib/config.in: Likewise.
* gnulib/configure: Likewise.
* gnulib/import/Makefile.am: Likewise.
* gnulib/import/Makefile.in: Likewise.
* gnulib/import/m4/gnulib-cache.m4: Likewise.
* gnulib/import/m4/gnulib-comp.m4: Likewise.
* gnulib/import/dosname.h: New file
* gnulib/import/m4/largefile.m4: New file.
* gnulib/import/m4/readlink.m4: New file.
* gnulib/import/m4/stat.m4: New file.
* gnulib/import/readlink.c: New file.
* gnulib/import/stat.c: New file.
2014-11-26 Mark Wielaard <mjw@redhat.com>
* dwarf2read.c (set_cu_language): Recognize DW_LANG_C11,

View File

@ -1037,6 +1037,7 @@ m4_include([import/m4/inttypes-pri.m4])
m4_include([import/m4/inttypes.m4])
m4_include([import/m4/isnand.m4])
m4_include([import/m4/isnanl.m4])
m4_include([import/m4/largefile.m4])
m4_include([import/m4/localcharset.m4])
m4_include([import/m4/locale-fr.m4])
m4_include([import/m4/locale-ja.m4])
@ -1053,7 +1054,9 @@ m4_include([import/m4/mmap-anon.m4])
m4_include([import/m4/multiarch.m4])
m4_include([import/m4/off_t.m4])
m4_include([import/m4/pathmax.m4])
m4_include([import/m4/readlink.m4])
m4_include([import/m4/ssize_t.m4])
m4_include([import/m4/stat.m4])
m4_include([import/m4/stdbool.m4])
m4_include([import/m4/stddef_h.m4])
m4_include([import/m4/stdint.m4])

View File

@ -67,6 +67,12 @@
/* Define to 1 when the gnulib module memmem should be tested. */
#undef GNULIB_TEST_MEMMEM
/* Define to 1 when the gnulib module readlink should be tested. */
#undef GNULIB_TEST_READLINK
/* Define to 1 when the gnulib module stat should be tested. */
#undef GNULIB_TEST_STAT
/* Define to 1 when the gnulib module strstr should be tested. */
#undef GNULIB_TEST_STRSTR
@ -158,6 +164,9 @@
/* Define to 1 if the system has the type 'long long int'. */
#undef HAVE_LONG_LONG_INT
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
/* Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including
config.h and <sys/mman.h>. */
#undef HAVE_MAP_ANONYMOUS
@ -837,6 +846,9 @@
/* Define to 1 if wmemset is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WMEMSET
/* Define to 1 if you have the `readlink' function. */
#undef HAVE_READLINK
/* Define to 1 if 'long double' and 'double' have the same representation. */
#undef HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
@ -971,6 +983,17 @@
'ptrdiff_t'. */
#undef PTRDIFF_T_SUFFIX
/* Define to 1 if readlink fails to recognize a trailing slash. */
#undef READLINK_TRAILING_SLASH_BUG
/* Define to 1 if stat needs help when passed a directory name with a trailing
slash */
#undef REPLACE_FUNC_STAT_DIR
/* Define to 1 if stat needs help when passed a file name with a trailing
slash */
#undef REPLACE_FUNC_STAT_FILE
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
'sig_atomic_t'. */
#undef SIG_ATOMIC_T_SUFFIX
@ -1013,10 +1036,21 @@
# endif
#endif
/* Enable large inode numbers on Mac OS X. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define to 1 if Gnulib overrides 'struct stat' on Windows so that struct
stat.st_size becomes 64-bit. */
#undef _GL_WINDOWS_64_BIT_ST_SIZE
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to 1 if on MINIX. */
#undef _MINIX

612
gdb/gnulib/configure vendored
View File

@ -681,6 +681,19 @@ MKDIR_P
WINDOWS_64_BIT_ST_SIZE
NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H
NEXT_SYS_STAT_H
NEXT_AS_FIRST_DIRECTIVE_STRING_H
NEXT_STRING_H
NEXT_AS_FIRST_DIRECTIVE_STDDEF_H
NEXT_STDDEF_H
GL_GENERATE_STDDEF_H_FALSE
GL_GENERATE_STDDEF_H_TRUE
STDDEF_H
HAVE_WCHAR_T
REPLACE_NULL
HAVE__BOOL
GL_GENERATE_STDBOOL_H_FALSE
GL_GENERATE_STDBOOL_H_TRUE
STDBOOL_H
REPLACE_UTIMENSAT
REPLACE_STAT
REPLACE_MKNOD
@ -714,19 +727,6 @@ GNULIB_FUTIMENS
GNULIB_FSTATAT
GNULIB_FSTAT
GNULIB_FCHMODAT
NEXT_AS_FIRST_DIRECTIVE_STRING_H
NEXT_STRING_H
NEXT_AS_FIRST_DIRECTIVE_STDDEF_H
NEXT_STDDEF_H
GL_GENERATE_STDDEF_H_FALSE
GL_GENERATE_STDDEF_H_TRUE
STDDEF_H
HAVE_WCHAR_T
REPLACE_NULL
HAVE__BOOL
GL_GENERATE_STDBOOL_H_FALSE
GL_GENERATE_STDBOOL_H_TRUE
STDBOOL_H
UNDEFINE_STRTOK_R
REPLACE_STRTOK_R
REPLACE_STRSIGNAL
@ -1446,6 +1446,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_maintainer_mode
enable_largefile
enable_dependency_tracking
'
ac_precious_vars='build_alias
@ -2077,6 +2078,7 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
--disable-largefile omit support for large files
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
@ -3094,6 +3096,8 @@ as_fn_append ac_func_list " mbrtowc"
as_fn_append ac_header_list " sys/mman.h"
as_fn_append ac_func_list " mprotect"
as_fn_append ac_header_list " sys/param.h"
as_fn_append ac_func_list " readlink"
as_fn_append ac_func_list " lstat"
as_fn_append ac_header_list " sys/stat.h"
as_fn_append ac_header_list " sys/time.h"
as_fn_append ac_header_list " features.h"
@ -4798,6 +4802,206 @@ fi
;;
esac
# Check whether --enable-largefile was given.
if test "${enable_largefile+set}" = set; then :
enableval=$enable_largefile;
fi
if test "$enable_largefile" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
if test "${ac_cv_sys_largefile_CC+set}" = set; then :
$as_echo_n "(cached) " >&6
else
ac_cv_sys_largefile_CC=no
if test "$GCC" != yes; then
ac_save_CC=$CC
while :; do
# IRIX 6.2 and later do not support large files by default,
# so use the C compiler's -n32 option if that helps.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
break
fi
rm -f core conftest.err conftest.$ac_objext
CC="$CC -n32"
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_largefile_CC=' -n32'; break
fi
rm -f core conftest.err conftest.$ac_objext
break
done
CC=$ac_save_CC
rm -f conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
$as_echo "$ac_cv_sys_largefile_CC" >&6; }
if test "$ac_cv_sys_largefile_CC" != no; then
CC=$CC$ac_cv_sys_largefile_CC
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
if test "${ac_cv_sys_file_offset_bits+set}" = set; then :
$as_echo_n "(cached) " >&6
else
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_file_offset_bits=no; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_file_offset_bits=64; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_sys_file_offset_bits=unknown
break
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
case $ac_cv_sys_file_offset_bits in #(
no | unknown) ;;
*)
cat >>confdefs.h <<_ACEOF
#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
_ACEOF
;;
esac
rm -rf conftest*
if test $ac_cv_sys_file_offset_bits = unknown; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
if test "${ac_cv_sys_large_files+set}" = set; then :
$as_echo_n "(cached) " >&6
else
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_large_files=no; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _LARGE_FILES 1
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_large_files=1; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_sys_large_files=unknown
break
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
$as_echo "$ac_cv_sys_large_files" >&6; }
case $ac_cv_sys_large_files in #(
no | unknown) ;;
*)
cat >>confdefs.h <<_ACEOF
#define _LARGE_FILES $ac_cv_sys_large_files
_ACEOF
;;
esac
rm -rf conftest*
fi
fi
# Code from module alloca:
@ -4805,6 +5009,7 @@ fi
# Code from module configmake:
# Code from module dirent:
# Code from module dirfd:
# Code from module dosname:
# Code from module errno:
# Code from module extensions:
@ -4822,6 +5027,8 @@ fi
# Code from module inttypes-incomplete:
# Code from module isnand-nolibm:
# Code from module isnanl-nolibm:
# Code from module largefile:
# Code from module localcharset:
# Code from module math:
# Code from module mbrtowc:
@ -4832,10 +5039,12 @@ fi
# Code from module memmem-simple:
# Code from module multiarch:
# Code from module pathmax:
# Code from module readlink:
# Code from module snippet/arg-nonnull:
# Code from module snippet/c++defs:
# Code from module snippet/warn-on-use:
# Code from module ssize_t:
# Code from module stat:
# Code from module stdbool:
# Code from module stddef:
# Code from module stdint:
@ -8389,6 +8598,51 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
case "$host_os" in
mingw*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit off_t" >&5
$as_echo_n "checking for 64-bit off_t... " >&6; }
if test "${gl_cv_type_off_t_64+set}" = set; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1];
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
gl_cv_type_off_t_64=yes
else
gl_cv_type_off_t_64=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_off_t_64" >&5
$as_echo "$gl_cv_type_off_t_64" >&6; }
if test $gl_cv_type_off_t_64 = no; then
WINDOWS_64_BIT_OFF_T=1
else
WINDOWS_64_BIT_OFF_T=0
fi
WINDOWS_64_BIT_ST_SIZE=1
;;
*)
WINDOWS_64_BIT_OFF_T=0
WINDOWS_64_BIT_ST_SIZE=0
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5
$as_echo_n "checking for nl_langinfo and CODESET... " >&6; }
if test "${am_cv_langinfo_codeset+set}" = set; then :
@ -9613,6 +9867,45 @@ $as_echo "$gl_cv_func_memmem_works_always" >&6; }
GNULIB_FCHMODAT=0;
GNULIB_FSTAT=0;
GNULIB_FSTATAT=0;
GNULIB_FUTIMENS=0;
GNULIB_LCHMOD=0;
GNULIB_LSTAT=0;
GNULIB_MKDIRAT=0;
GNULIB_MKFIFO=0;
GNULIB_MKFIFOAT=0;
GNULIB_MKNOD=0;
GNULIB_MKNODAT=0;
GNULIB_STAT=0;
GNULIB_UTIMENSAT=0;
HAVE_FCHMODAT=1;
HAVE_FSTATAT=1;
HAVE_FUTIMENS=1;
HAVE_LCHMOD=1;
HAVE_LSTAT=1;
HAVE_MKDIRAT=1;
HAVE_MKFIFO=1;
HAVE_MKFIFOAT=1;
HAVE_MKNOD=1;
HAVE_MKNODAT=1;
HAVE_UTIMENSAT=1;
REPLACE_FSTAT=0;
REPLACE_FSTATAT=0;
REPLACE_FUTIMENS=0;
REPLACE_LSTAT=0;
REPLACE_MKDIR=0;
REPLACE_MKFIFO=0;
REPLACE_MKNOD=0;
REPLACE_STAT=0;
REPLACE_UTIMENSAT=0;
{ $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 test "${ac_cv_header_stdbool_h+set}" = set; then :
@ -9975,41 +10268,6 @@ $as_echo "$gl_cv_func_strstr_works_always" >&6; }
esac
fi
GNULIB_FCHMODAT=0;
GNULIB_FSTAT=0;
GNULIB_FSTATAT=0;
GNULIB_FUTIMENS=0;
GNULIB_LCHMOD=0;
GNULIB_LSTAT=0;
GNULIB_MKDIRAT=0;
GNULIB_MKFIFO=0;
GNULIB_MKFIFOAT=0;
GNULIB_MKNOD=0;
GNULIB_MKNODAT=0;
GNULIB_STAT=0;
GNULIB_UTIMENSAT=0;
HAVE_FCHMODAT=1;
HAVE_FSTATAT=1;
HAVE_FUTIMENS=1;
HAVE_LCHMOD=1;
HAVE_LSTAT=1;
HAVE_MKDIRAT=1;
HAVE_MKFIFO=1;
HAVE_MKFIFOAT=1;
HAVE_MKNOD=1;
HAVE_MKNODAT=1;
HAVE_UTIMENSAT=1;
REPLACE_FSTAT=0;
REPLACE_FSTATAT=0;
REPLACE_FUTIMENS=0;
REPLACE_LSTAT=0;
REPLACE_MKDIR=0;
REPLACE_MKFIFO=0;
REPLACE_MKNOD=0;
REPLACE_STAT=0;
REPLACE_UTIMENSAT=0;
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5
$as_echo_n "checking whether stat file-mode macros are broken... " >&6; }
if test "${ac_cv_header_stat_broken+set}" = set; then :
@ -10122,7 +10380,7 @@ fi
WINDOWS_64_BIT_OFF_T=0
@ -12376,6 +12634,7 @@ _ACEOF
LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\""
@ -14015,6 +14274,127 @@ $as_echo "#define GNULIB_TEST_MEMMEM 1" >>confdefs.h
if test $ac_cv_func_readlink = no; then
HAVE_READLINK=0
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether readlink signature is correct" >&5
$as_echo_n "checking whether readlink signature is correct... " >&6; }
if test "${gl_cv_decl_readlink_works+set}" = set; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <unistd.h>
/* Cause compilation failure if original declaration has wrong type. */
ssize_t readlink (const char *, char *, size_t);
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
gl_cv_decl_readlink_works=yes
else
gl_cv_decl_readlink_works=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_readlink_works" >&5
$as_echo "$gl_cv_decl_readlink_works" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether readlink handles trailing slash correctly" >&5
$as_echo_n "checking whether readlink handles trailing slash correctly... " >&6; }
if test "${gl_cv_func_readlink_works+set}" = set; then :
$as_echo_n "(cached) " >&6
else
# We have readlink, so assume ln -s works.
ln -s conftest.no-such conftest.link
ln -s conftest.link conftest.lnk2
if test "$cross_compiling" = yes; then :
case "$host_os" in
# Guess yes on glibc systems.
*-gnu*) gl_cv_func_readlink_works="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_readlink_works="guessing no" ;;
esac
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <unistd.h>
int
main ()
{
char buf[20];
return readlink ("conftest.lnk2/", buf, sizeof buf) != -1;
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
gl_cv_func_readlink_works=yes
else
gl_cv_func_readlink_works=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
rm -f conftest.link conftest.lnk2
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_readlink_works" >&5
$as_echo "$gl_cv_func_readlink_works" >&6; }
case "$gl_cv_func_readlink_works" in
*yes)
if test "$gl_cv_decl_readlink_works" != yes; then
REPLACE_READLINK=1
fi
;;
*)
$as_echo "#define READLINK_TRAILING_SLASH_BUG 1" >>confdefs.h
REPLACE_READLINK=1
;;
esac
fi
if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
gl_LIBOBJS="$gl_LIBOBJS readlink.$ac_objext"
:
fi
GNULIB_READLINK=1
$as_echo "#define GNULIB_TEST_READLINK 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssize_t" >&5
$as_echo_n "checking for ssize_t... " >&6; }
if test "${gt_cv_ssize_t+set}" = set; then :
@ -14050,6 +14430,138 @@ $as_echo "#define ssize_t int" >>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 test "${gl_cv_func_stat_dir_slash+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
case $host_os in
mingw*) gl_cv_func_stat_dir_slash="guessing no";;
*) gl_cv_func_stat_dir_slash="guessing yes";;
esac
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/stat.h>
int
main ()
{
struct stat st; return stat (".", &st) != stat ("./", &st);
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
gl_cv_func_stat_dir_slash=yes
else
gl_cv_func_stat_dir_slash=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_stat_dir_slash" >&5
$as_echo "$gl_cv_func_stat_dir_slash" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on files" >&5
$as_echo_n "checking whether stat handles trailing slashes on files... " >&6; }
if test "${gl_cv_func_stat_file_slash+set}" = set; then :
$as_echo_n "(cached) " >&6
else
touch conftest.tmp
# Assume that if we have lstat, we can also check symlinks.
if test $ac_cv_func_lstat = yes; then
ln -s conftest.tmp conftest.lnk
fi
if test "$cross_compiling" = yes; then :
case "$host_os" in
# Guess yes on glibc systems.
*-gnu*) gl_cv_func_stat_file_slash="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_stat_file_slash="guessing no" ;;
esac
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/stat.h>
int
main ()
{
int result = 0;
struct stat st;
if (!stat ("conftest.tmp/", &st))
result |= 1;
#if HAVE_LSTAT
if (!stat ("conftest.lnk/", &st))
result |= 2;
#endif
return result;
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
gl_cv_func_stat_file_slash=yes
else
gl_cv_func_stat_file_slash=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
rm -f conftest.tmp conftest.lnk
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_stat_file_slash" >&5
$as_echo "$gl_cv_func_stat_file_slash" >&6; }
case $gl_cv_func_stat_dir_slash in
*no) REPLACE_STAT=1
$as_echo "#define REPLACE_FUNC_STAT_DIR 1" >>confdefs.h
;;
esac
case $gl_cv_func_stat_file_slash in
*no) REPLACE_STAT=1
$as_echo "#define REPLACE_FUNC_STAT_FILE 1" >>confdefs.h
;;
esac
if test $REPLACE_STAT = 1; then
gl_LIBOBJS="$gl_LIBOBJS stat.$ac_objext"
:
fi
GNULIB_STAT=1
$as_echo "#define GNULIB_TEST_STAT 1" >>confdefs.h
# Define two additional variables used in the Makefile substitution.
if test "$ac_cv_header_stdbool_h" = yes; then
@ -14495,7 +15007,7 @@ $as_echo "$gl_cv_next_sys_stat_h" >&6; }
WINDOWS_64_BIT_ST_SIZE=0
if test $WINDOWS_64_BIT_ST_SIZE = 1; then

View File

@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax readlink strstr sys_stat unistd update-copyright wchar wctype-h
AUTOMAKE_OPTIONS = 1.5 gnits
@ -184,6 +184,13 @@ EXTRA_libgnu_a_SOURCES += dirfd.c
## end gnulib module dirfd
## begin gnulib module dosname
EXTRA_DIST += dosname.h
## end gnulib module dosname
## begin gnulib module errno
BUILT_SOURCES += $(ERRNO_H)
@ -772,6 +779,15 @@ EXTRA_DIST += pathmax.h
## end gnulib module pathmax
## begin gnulib module readlink
EXTRA_DIST += readlink.c
EXTRA_libgnu_a_SOURCES += readlink.c
## end gnulib module readlink
## begin gnulib module snippet/arg-nonnull
# The BUILT_SOURCES created by this Makefile snippet are not used via #include
@ -841,6 +857,15 @@ EXTRA_DIST += $(top_srcdir)/import/extra/snippet/warn-on-use.h
## end gnulib module snippet/warn-on-use
## begin gnulib module stat
EXTRA_DIST += stat.c
EXTRA_libgnu_a_SOURCES += stat.c
## end gnulib module stat
## begin gnulib module stdbool
BUILT_SOURCES += $(STDBOOL_H)

View File

@ -36,7 +36,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax readlink strstr sys_stat unistd update-copyright wchar wctype-h
@ -88,6 +88,7 @@ am__aclocal_m4_deps = $(top_srcdir)/import/m4/00gnulib.m4 \
$(top_srcdir)/import/m4/inttypes.m4 \
$(top_srcdir)/import/m4/isnand.m4 \
$(top_srcdir)/import/m4/isnanl.m4 \
$(top_srcdir)/import/m4/largefile.m4 \
$(top_srcdir)/import/m4/localcharset.m4 \
$(top_srcdir)/import/m4/locale-fr.m4 \
$(top_srcdir)/import/m4/locale-ja.m4 \
@ -104,7 +105,9 @@ am__aclocal_m4_deps = $(top_srcdir)/import/m4/00gnulib.m4 \
$(top_srcdir)/import/m4/multiarch.m4 \
$(top_srcdir)/import/m4/off_t.m4 \
$(top_srcdir)/import/m4/pathmax.m4 \
$(top_srcdir)/import/m4/readlink.m4 \
$(top_srcdir)/import/m4/ssize_t.m4 \
$(top_srcdir)/import/m4/stat.m4 \
$(top_srcdir)/import/m4/stdbool.m4 \
$(top_srcdir)/import/m4/stddef_h.m4 \
$(top_srcdir)/import/m4/stdint.m4 \
@ -1025,20 +1028,20 @@ noinst_HEADERS =
noinst_LIBRARIES = libgnu.a
noinst_LTLIBRARIES =
EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h dirent.in.h \
dirfd.c errno.in.h float.c float.in.h itold.c fnmatch.c \
fnmatch.in.h fnmatch_loop.c fpucw.h frexp.c frexp.c frexpl.c \
inttypes.in.h float+.h isnan.c isnand-nolibm.h isnand.c \
float+.h isnan.c isnanl-nolibm.h isnanl.c config.charset \
ref-add.sin ref-del.sin math.in.h mbrtowc.c mbsinit.c \
mbsrtowcs-impl.h mbsrtowcs-state.c mbsrtowcs.c memchr.c \
memchr.valgrind memmem.c str-two-way.h pathmax.h \
$(top_srcdir)/import/extra/snippet/arg-nonnull.h \
dirfd.c dosname.h errno.in.h float.c float.in.h itold.c \
fnmatch.c fnmatch.in.h fnmatch_loop.c fpucw.h frexp.c frexp.c \
frexpl.c inttypes.in.h float+.h isnan.c isnand-nolibm.h \
isnand.c float+.h isnan.c isnanl-nolibm.h isnanl.c \
config.charset ref-add.sin ref-del.sin math.in.h mbrtowc.c \
mbsinit.c mbsrtowcs-impl.h mbsrtowcs-state.c mbsrtowcs.c \
memchr.c memchr.valgrind memmem.c str-two-way.h pathmax.h \
readlink.c $(top_srcdir)/import/extra/snippet/arg-nonnull.h \
$(top_srcdir)/import/extra/snippet/c++defs.h \
$(top_srcdir)/import/extra/snippet/warn-on-use.h stdbool.in.h \
stddef.in.h stdint.in.h streq.h string.in.h str-two-way.h \
strstr.c sys_stat.in.h sys_types.in.h time.in.h unistd.in.h \
$(top_srcdir)/import/extra/update-copyright verify.h \
wchar.in.h wctype.in.h
$(top_srcdir)/import/extra/snippet/warn-on-use.h stat.c \
stdbool.in.h stddef.in.h stdint.in.h streq.h string.in.h \
str-two-way.h strstr.c sys_stat.in.h sys_types.in.h time.in.h \
unistd.in.h $(top_srcdir)/import/extra/update-copyright \
verify.h wchar.in.h wctype.in.h
# The BUILT_SOURCES created by this Makefile snippet are not used via #include
# statements but through direct file reference. Therefore this snippet must be
@ -1077,7 +1080,7 @@ libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) @ALLOCA@
EXTRA_libgnu_a_SOURCES = alloca.c dirfd.c float.c itold.c fnmatch.c \
fnmatch_loop.c frexp.c frexp.c frexpl.c isnan.c isnand.c \
isnan.c isnanl.c mbrtowc.c mbsinit.c mbsrtowcs-state.c \
mbsrtowcs.c memchr.c memmem.c strstr.c
mbsrtowcs.c memchr.c memmem.c readlink.c stat.c strstr.c
charset_alias = $(DESTDIR)$(libdir)/charset.alias
charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
ARG_NONNULL_H = arg-nonnull.h
@ -1161,6 +1164,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbsrtowcs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memchr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memmem.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readlink.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strstr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unistd.Po@am__quote@

View File

@ -0,0 +1,53 @@
/* File names on MS-DOS/Windows systems.
Copyright (C) 2000-2001, 2004-2006, 2009-2012 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

@ -27,7 +27,7 @@
# Specification in the form of a command-line invocation:
# gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax strstr sys_stat unistd update-copyright wchar wctype-h
# gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca dirent dirfd errno fnmatch-gnu frexpl inttypes memchr memmem pathmax readlink strstr sys_stat unistd update-copyright wchar wctype-h
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
@ -42,6 +42,7 @@ gl_MODULES([
memchr
memmem
pathmax
readlink
strstr
sys_stat
unistd

View File

@ -43,6 +43,7 @@ AC_DEFUN([gl_EARLY],
# Code from module configmake:
# Code from module dirent:
# Code from module dirfd:
# Code from module dosname:
# Code from module errno:
# Code from module extensions:
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
@ -60,6 +61,8 @@ AC_DEFUN([gl_EARLY],
# Code from module inttypes-incomplete:
# Code from module isnand-nolibm:
# Code from module isnanl-nolibm:
# Code from module largefile:
AC_REQUIRE([AC_SYS_LARGEFILE])
# Code from module localcharset:
# Code from module math:
# Code from module mbrtowc:
@ -70,10 +73,12 @@ AC_DEFUN([gl_EARLY],
# Code from module memmem-simple:
# Code from module multiarch:
# Code from module pathmax:
# Code from module readlink:
# Code from module snippet/arg-nonnull:
# Code from module snippet/c++defs:
# Code from module snippet/warn-on-use:
# Code from module ssize_t:
# Code from module stat:
# Code from module stdbool:
# Code from module stddef:
# Code from module stdint:
@ -158,6 +163,7 @@ AC_DEFUN([gl_INIT],
AC_LIBOBJ([isnanl])
gl_PREREQ_ISNANL
fi
AC_REQUIRE([gl_LARGEFILE])
gl_LOCALCHARSET
LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\""
AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
@ -198,7 +204,19 @@ AC_DEFUN([gl_INIT],
gl_STRING_MODULE_INDICATOR([memmem])
gl_MULTIARCH
gl_PATHMAX
gl_FUNC_READLINK
if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
AC_LIBOBJ([readlink])
gl_PREREQ_READLINK
fi
gl_UNISTD_MODULE_INDICATOR([readlink])
gt_TYPE_SSIZE_T
gl_FUNC_STAT
if test $REPLACE_STAT = 1; then
AC_LIBOBJ([stat])
gl_PREREQ_STAT
fi
gl_SYS_STAT_MODULE_INDICATOR([stat])
AM_STDBOOL_H
gl_STDDEF_H
gl_STDINT_H
@ -369,6 +387,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/config.charset
lib/dirent.in.h
lib/dirfd.c
lib/dosname.h
lib/errno.in.h
lib/float+.h
lib/float.c
@ -399,8 +418,10 @@ AC_DEFUN([gl_FILE_LIST], [
lib/memchr.valgrind
lib/memmem.c
lib/pathmax.h
lib/readlink.c
lib/ref-add.sin
lib/ref-del.sin
lib/stat.c
lib/stdbool.in.h
lib/stddef.in.h
lib/stdint.in.h
@ -443,6 +464,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/inttypes.m4
m4/isnand.m4
m4/isnanl.m4
m4/largefile.m4
m4/localcharset.m4
m4/locale-fr.m4
m4/locale-ja.m4
@ -459,7 +481,9 @@ AC_DEFUN([gl_FILE_LIST], [
m4/multiarch.m4
m4/off_t.m4
m4/pathmax.m4
m4/readlink.m4
m4/ssize_t.m4
m4/stat.m4
m4/stdbool.m4
m4/stddef_h.m4
m4/stdint.m4

View File

@ -0,0 +1,149 @@
# Enable large files on systems where this is not the default.
# Copyright 1992-1996, 1998-2012 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.
# The following implementation works around a problem in autoconf <= 2.68;
# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5.
m4_version_prereq([2.69], [] ,[
# _AC_SYS_LARGEFILE_TEST_INCLUDES
# -------------------------------
m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
[@%:@include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
@%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1]];[]dnl
])
# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
# CACHE-VAR,
# DESCRIPTION,
# PROLOGUE, [FUNCTION-BODY])
# --------------------------------------------------------
m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
[while :; do
m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
[AC_LANG_PROGRAM([$5], [$6])],
[$3=no; break])
m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
[AC_LANG_PROGRAM([@%:@define $1 $2
$5], [$6])],
[$3=$2; break])
$3=unknown
break
done])
case $$3 in #(
no | unknown) ;;
*) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);;
esac
rm -rf conftest*[]dnl
])# _AC_SYS_LARGEFILE_MACRO_VALUE
# AC_SYS_LARGEFILE
# ----------------
# By default, many hosts won't let programs access large files;
# one must use special compiler options to get large-file access to work.
# For more details about this brain damage please see:
# http://www.unix-systems.org/version2/whatsnew/lfs20mar.html
AC_DEFUN([AC_SYS_LARGEFILE],
[AC_ARG_ENABLE(largefile,
[ --disable-largefile omit support for large files])
if test "$enable_largefile" != no; then
AC_CACHE_CHECK([for special C compiler options needed for large files],
ac_cv_sys_largefile_CC,
[ac_cv_sys_largefile_CC=no
if test "$GCC" != yes; then
ac_save_CC=$CC
while :; do
# IRIX 6.2 and later do not support large files by default,
# so use the C compiler's -n32 option if that helps.
AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
AC_COMPILE_IFELSE([], [break])
CC="$CC -n32"
AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
break
done
CC=$ac_save_CC
rm -f conftest.$ac_ext
fi])
if test "$ac_cv_sys_largefile_CC" != no; then
CC=$CC$ac_cv_sys_largefile_CC
fi
_AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
ac_cv_sys_file_offset_bits,
[Number of bits in a file offset, on hosts where this is settable.],
[_AC_SYS_LARGEFILE_TEST_INCLUDES])
if test $ac_cv_sys_file_offset_bits = unknown; then
_AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
ac_cv_sys_large_files,
[Define for large files, on AIX-style hosts.],
[_AC_SYS_LARGEFILE_TEST_INCLUDES])
fi
AH_VERBATIM([_DARWIN_USE_64_BIT_INODE],
[/* Enable large inode numbers on Mac OS X. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif])
fi
])# AC_SYS_LARGEFILE
])# m4_version_prereq 2.69
# Enable large files on systems where this is implemented by Gnulib, not by the
# system headers.
# Set the variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE if Gnulib
# overrides ensure that off_t or 'struct size.st_size' are 64-bit, respectively.
AC_DEFUN([gl_LARGEFILE],
[
AC_REQUIRE([AC_CANONICAL_HOST])
case "$host_os" in
mingw*)
dnl Native Windows.
dnl mingw64 defines off_t to a 64-bit type already, if
dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE.
AC_CACHE_CHECK([for 64-bit off_t], [gl_cv_type_off_t_64],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/types.h>
int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1];
]],
[[]])],
[gl_cv_type_off_t_64=yes], [gl_cv_type_off_t_64=no])
])
if test $gl_cv_type_off_t_64 = no; then
WINDOWS_64_BIT_OFF_T=1
else
WINDOWS_64_BIT_OFF_T=0
fi
dnl But all native Windows platforms (including mingw64) have a 32-bit
dnl st_size member in 'struct stat'.
WINDOWS_64_BIT_ST_SIZE=1
;;
*)
dnl Nothing to do on gnulib's side.
dnl A 64-bit off_t is
dnl - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX,
dnl OSF/1, Cygwin,
dnl - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on
dnl glibc, HP-UX, Solaris,
dnl - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX,
dnl - impossible to achieve on Minix 3.1.8.
WINDOWS_64_BIT_OFF_T=0
WINDOWS_64_BIT_ST_SIZE=0
;;
esac
])

View File

@ -0,0 +1,71 @@
# readlink.m4 serial 12
dnl Copyright (C) 2003, 2007, 2009-2012 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_READLINK],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CHECK_FUNCS_ONCE([readlink])
if test $ac_cv_func_readlink = no; then
HAVE_READLINK=0
else
AC_CACHE_CHECK([whether readlink signature is correct],
[gl_cv_decl_readlink_works],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <unistd.h>
/* Cause compilation failure if original declaration has wrong type. */
ssize_t readlink (const char *, char *, size_t);]])],
[gl_cv_decl_readlink_works=yes], [gl_cv_decl_readlink_works=no])])
dnl Solaris 9 ignores trailing slash.
dnl FreeBSD 7.2 dereferences only one level of links with trailing slash.
AC_CACHE_CHECK([whether readlink handles trailing slash correctly],
[gl_cv_func_readlink_works],
[# We have readlink, so assume ln -s works.
ln -s conftest.no-such conftest.link
ln -s conftest.link conftest.lnk2
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <unistd.h>
]], [[char buf[20];
return readlink ("conftest.lnk2/", buf, sizeof buf) != -1;]])],
[gl_cv_func_readlink_works=yes], [gl_cv_func_readlink_works=no],
[case "$host_os" in
# Guess yes on glibc systems.
*-gnu*) gl_cv_func_readlink_works="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_readlink_works="guessing no" ;;
esac
])
rm -f conftest.link conftest.lnk2])
case "$gl_cv_func_readlink_works" in
*yes)
if test "$gl_cv_decl_readlink_works" != yes; then
REPLACE_READLINK=1
fi
;;
*)
AC_DEFINE([READLINK_TRAILING_SLASH_BUG], [1], [Define to 1 if readlink
fails to recognize a trailing slash.])
REPLACE_READLINK=1
;;
esac
fi
])
# Like gl_FUNC_READLINK, except prepare for separate compilation
# (no REPLACE_READLINK, no AC_LIBOBJ).
AC_DEFUN([gl_FUNC_READLINK_SEPARATE],
[
AC_CHECK_FUNCS_ONCE([readlink])
gl_PREREQ_READLINK
])
# Prerequisites of lib/readlink.c.
AC_DEFUN([gl_PREREQ_READLINK],
[
:
])

View File

@ -0,0 +1,71 @@
# serial 11
# Copyright (C) 2009-2012 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.
AC_DEFUN([gl_FUNC_STAT],
[
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
AC_CHECK_FUNCS_ONCE([lstat])
dnl mingw is the only known platform where stat(".") and stat("./") differ
AC_CACHE_CHECK([whether stat handles trailing slashes on directories],
[gl_cv_func_stat_dir_slash],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/stat.h>
]], [[struct stat st; return stat (".", &st) != stat ("./", &st);]])],
[gl_cv_func_stat_dir_slash=yes], [gl_cv_func_stat_dir_slash=no],
[case $host_os in
mingw*) gl_cv_func_stat_dir_slash="guessing no";;
*) gl_cv_func_stat_dir_slash="guessing yes";;
esac])])
dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/").
dnl (For mingw, this is due to a broken stat() override in libmingwex.a.)
dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/").
AC_CACHE_CHECK([whether stat handles trailing slashes on files],
[gl_cv_func_stat_file_slash],
[touch conftest.tmp
# Assume that if we have lstat, we can also check symlinks.
if test $ac_cv_func_lstat = yes; then
ln -s conftest.tmp conftest.lnk
fi
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/stat.h>
]], [[int result = 0;
struct stat st;
if (!stat ("conftest.tmp/", &st))
result |= 1;
#if HAVE_LSTAT
if (!stat ("conftest.lnk/", &st))
result |= 2;
#endif
return result;
]])],
[gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no],
[case "$host_os" in
# Guess yes on glibc systems.
*-gnu*) gl_cv_func_stat_file_slash="guessing yes" ;;
# If we don't know, assume the worst.
*) gl_cv_func_stat_file_slash="guessing no" ;;
esac
])
rm -f conftest.tmp conftest.lnk])
case $gl_cv_func_stat_dir_slash in
*no) REPLACE_STAT=1
AC_DEFINE([REPLACE_FUNC_STAT_DIR], [1], [Define to 1 if stat needs
help when passed a directory name with a trailing slash]);;
esac
case $gl_cv_func_stat_file_slash in
*no) REPLACE_STAT=1
AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs
help when passed a file name with a trailing slash]);;
esac
])
# Prerequisites of lib/stat.c.
AC_DEFUN([gl_PREREQ_STAT], [:])

View File

@ -0,0 +1,74 @@
/* Stub for readlink().
Copyright (C) 2003-2007, 2009-2012 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/>. */
#include <config.h>
/* Specification. */
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#if !HAVE_READLINK
/* readlink() substitute for systems that don't have a readlink() function,
such as DJGPP 2.03 and mingw32. */
ssize_t
readlink (const char *name, char *buf _GL_UNUSED,
size_t bufsize _GL_UNUSED)
{
struct stat statbuf;
/* In general we should use lstat() here, not stat(). But on platforms
without symbolic links, lstat() - if it exists - would be equivalent to
stat(), therefore we can use stat(). This saves us a configure check. */
if (stat (name, &statbuf) >= 0)
errno = EINVAL;
return -1;
}
#else /* HAVE_READLINK */
# undef readlink
/* readlink() wrapper that uses correct types, for systems like cygwin
1.5.x where readlink returns int, and which rejects trailing slash,
for Solaris 9. */
ssize_t
rpl_readlink (const char *name, char *buf, size_t bufsize)
{
# if READLINK_TRAILING_SLASH_BUG
size_t len = strlen (name);
if (len && name[len - 1] == '/')
{
/* Even if name without the slash is a symlink to a directory,
both lstat() and stat() must resolve the trailing slash to
the directory rather than the symlink. We can therefore
safely use stat() to distinguish between EINVAL and
ENOTDIR/ENOENT, avoiding extra overhead of rpl_lstat(). */
struct stat st;
if (stat (name, &st) == 0)
errno = EINVAL;
return -1;
}
# endif /* READLINK_TRAILING_SLASH_BUG */
return readlink (name, buf, bufsize);
}
#endif /* HAVE_READLINK */

138
gdb/gnulib/import/stat.c Normal file
View File

@ -0,0 +1,138 @@
/* Work around platform bugs in stat.
Copyright (C) 2009-2012 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/>. */
/* written by Eric Blake */
/* If the user's config.h happens to include <sys/stat.h>, let it include only
the system's <sys/stat.h> here, so that orig_stat doesn't recurse to
rpl_stat. */
#define __need_system_sys_stat_h
#include <config.h>
/* Get the original definition of stat. It might be defined as a macro. */
#include <sys/types.h>
#include <sys/stat.h>
#undef __need_system_sys_stat_h
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# if _GL_WINDOWS_64_BIT_ST_SIZE
# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
# define stat _stati64
# define REPLACE_FUNC_STAT_DIR 1
# undef REPLACE_FUNC_STAT_FILE
# elif REPLACE_FUNC_STAT_FILE
/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a.
Bypass it. */
# define stat _stat
# define REPLACE_FUNC_STAT_DIR 1
# undef REPLACE_FUNC_STAT_FILE
# endif
#endif
static int
orig_stat (const char *filename, struct stat *buf)
{
return stat (filename, buf);
}
/* Specification. */
/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
eliminates this include because of the preliminary #include <sys/stat.h>
above. */
#include "sys/stat.h"
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <string.h>
#include "dosname.h"
#include "verify.h"
#if REPLACE_FUNC_STAT_DIR
# include "pathmax.h"
/* The only known systems where REPLACE_FUNC_STAT_DIR is needed also
have a constant PATH_MAX. */
# ifndef PATH_MAX
# error "Please port this replacement to your platform"
# endif
#endif
/* Store information about NAME into ST. Work around bugs with
trailing slashes. Mingw has other bugs (such as st_ino always
being 0 on success) which this wrapper does not work around. But
at least this implementation provides the ability to emulate fchdir
correctly. */
int
rpl_stat (char const *name, struct stat *st)
{
int result = orig_stat (name, st);
#if REPLACE_FUNC_STAT_FILE
/* Solaris 9 mistakenly succeeds when given a non-directory with a
trailing slash. */
if (result == 0 && !S_ISDIR (st->st_mode))
{
size_t len = strlen (name);
if (ISSLASH (name[len - 1]))
{
errno = ENOTDIR;
return -1;
}
}
#endif /* REPLACE_FUNC_STAT_FILE */
#if REPLACE_FUNC_STAT_DIR
if (result == -1 && errno == ENOENT)
{
/* Due to mingw's oddities, there are some directories (like
c:\) where stat() only succeeds with a trailing slash, and
other directories (like c:\windows) where stat() only
succeeds without a trailing slash. But we want the two to be
synonymous, since chdir() manages either style. Likewise, Mingw also
reports ENOENT for names longer than PATH_MAX, when we want
ENAMETOOLONG, and for stat("file/"), when we want ENOTDIR.
Fortunately, mingw PATH_MAX is small enough for stack
allocation. */
char fixed_name[PATH_MAX + 1] = {0};
size_t len = strlen (name);
bool check_dir = false;
verify (PATH_MAX <= 4096);
if (PATH_MAX <= len)
errno = ENAMETOOLONG;
else if (len)
{
strcpy (fixed_name, name);
if (ISSLASH (fixed_name[len - 1]))
{
check_dir = true;
while (len && ISSLASH (fixed_name[len - 1]))
fixed_name[--len] = '\0';
if (!len)
fixed_name[0] = '/';
}
else
fixed_name[len++] = '/';
result = orig_stat (fixed_name, st);
if (result == 0 && check_dir && !S_ISDIR (st->st_mode))
{
result = -1;
errno = ENOTDIR;
}
}
}
#endif /* REPLACE_FUNC_STAT_DIR */
return result;
}

View File

@ -40,6 +40,7 @@ IMPORTED_GNULIB_MODULES="\
memchr \
memmem \
pathmax \
readlink \
strstr \
sys_stat \
unistd \