diff options
author | Yao Qi <yao@codesourcery.com> | 2014-11-23 21:49:20 +0800 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2014-11-28 18:37:47 +0800 |
commit | 2196f55f0140f3e278ed4002040f32acc5a6aaf1 (patch) | |
tree | 6bd039ca439dc4078b8b908ca0628b2e9390f427 /gdb/gnulib/import/m4 | |
parent | 7014e923da3a3b95a99c3fb5f17e109864bd1113 (diff) | |
download | gdb-2196f55f0140f3e278ed4002040f32acc5a6aaf1.zip gdb-2196f55f0140f3e278ed4002040f32acc5a6aaf1.tar.gz gdb-2196f55f0140f3e278ed4002040f32acc5a6aaf1.tar.bz2 |
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.
Diffstat (limited to 'gdb/gnulib/import/m4')
-rw-r--r-- | gdb/gnulib/import/m4/gnulib-cache.m4 | 3 | ||||
-rw-r--r-- | gdb/gnulib/import/m4/gnulib-comp.m4 | 24 | ||||
-rw-r--r-- | gdb/gnulib/import/m4/largefile.m4 | 149 | ||||
-rw-r--r-- | gdb/gnulib/import/m4/readlink.m4 | 71 | ||||
-rw-r--r-- | gdb/gnulib/import/m4/stat.m4 | 71 |
5 files changed, 317 insertions, 1 deletions
diff --git a/gdb/gnulib/import/m4/gnulib-cache.m4 b/gdb/gnulib/import/m4/gnulib-cache.m4 index 8dd2a5c..a8451ec 100644 --- a/gdb/gnulib/import/m4/gnulib-cache.m4 +++ b/gdb/gnulib/import/m4/gnulib-cache.m4 @@ -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 diff --git a/gdb/gnulib/import/m4/gnulib-comp.m4 b/gdb/gnulib/import/m4/gnulib-comp.m4 index a56c214..525485a 100644 --- a/gdb/gnulib/import/m4/gnulib-comp.m4 +++ b/gdb/gnulib/import/m4/gnulib-comp.m4 @@ -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 diff --git a/gdb/gnulib/import/m4/largefile.m4 b/gdb/gnulib/import/m4/largefile.m4 new file mode 100644 index 0000000..a88850a --- /dev/null +++ b/gdb/gnulib/import/m4/largefile.m4 @@ -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 +]) diff --git a/gdb/gnulib/import/m4/readlink.m4 b/gdb/gnulib/import/m4/readlink.m4 new file mode 100644 index 0000000..ccf5141 --- /dev/null +++ b/gdb/gnulib/import/m4/readlink.m4 @@ -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], +[ + : +]) diff --git a/gdb/gnulib/import/m4/stat.m4 b/gdb/gnulib/import/m4/stat.m4 new file mode 100644 index 0000000..0fd117e --- /dev/null +++ b/gdb/gnulib/import/m4/stat.m4 @@ -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], [:]) |