Port to older Solaris 10 versions (Bug#10677).

Bug reported by Chong Yidong for SunOS 5.10 Generic_127111-11 sparc.
I cannot reproduce it on SunOS 5.10 Generic_141444-09 sparc but
possibly this is because Sun fixed the 'stat' bug in my version.
* Makefile.in (GNULIB_TOOL_FLAGS): Do not avoid the pathmax module.
* lib/pathmax.h, m4/pathmax.m4: New files, from gnulib.
* lib/gnulib.mk, m4/gl-comp.m4: Regenerate.
These changes are based on gnulib version
4f11d6bebc3098c64ffde27079ab0d0cecfd0cdc dated 2011-10-07 20:59:10,
because Emacs is in feature freeze and we do not want to merge any
more-recent changes from gnulib.
This commit is contained in:
Paul Eggert 2012-01-31 22:04:34 -08:00
parent 781acb9f3a
commit 6df372680c
6 changed files with 166 additions and 2 deletions

View file

@ -1,3 +1,17 @@
2012-02-01 Paul Eggert <eggert@cs.ucla.edu>
Port to older Solaris 10 versions (Bug#10677).
Bug reported by Chong Yidong for SunOS 5.10 Generic_127111-11 sparc.
I cannot reproduce it on SunOS 5.10 Generic_141444-09 sparc but
possibly this is because Sun fixed the 'stat' bug in my version.
* Makefile.in (GNULIB_TOOL_FLAGS): Do not avoid the pathmax module.
* lib/pathmax.h, m4/pathmax.m4: New files, from gnulib.
* lib/gnulib.mk, m4/gl-comp.m4: Regenerate.
These changes are based on gnulib version
4f11d6bebc3098c64ffde27079ab0d0cecfd0cdc dated 2011-10-07 20:59:10,
because Emacs is in feature freeze and we do not want to merge any
more-recent changes from gnulib.
2012-01-31 Glenn Morris <rgm@gnu.org>
* configure.in: Throw an explicit error if Motif toolkit was

View file

@ -341,7 +341,7 @@ GNULIB_MODULES = \
mktime pthread_sigmask readlink \
socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat
GNULIB_TOOL_FLAGS = \
--avoid=msvc-inval --avoid=msvc-nothrow --avoid=pathmax \
--avoid=msvc-inval --avoid=msvc-nothrow \
--avoid=raise --avoid=threadlib \
--conditional-dependencies --import --no-changelog --no-vc-files \
--makefile-name=gnulib.mk

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=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=msvc-inval --avoid=msvc-nothrow --avoid=pathmax --avoid=raise --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dup2 filemode getloadavg getopt-gnu ignore-value intprops lstat mktime pthread_sigmask readlink socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dup2 filemode getloadavg getopt-gnu ignore-value intprops lstat mktime pthread_sigmask readlink socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat
MOSTLYCLEANFILES += core *.stackdump
@ -258,6 +258,15 @@ EXTRA_libgnu_a_SOURCES += mktime.c
## end gnulib module mktime
## begin gnulib module pathmax
if gl_GNULIB_ENABLED_pathmax
endif
EXTRA_DIST += pathmax.h
## end gnulib module pathmax
## begin gnulib module pthread_sigmask

84
lib/pathmax.h Normal file
View file

@ -0,0 +1,84 @@
/* Define PATH_MAX somehow. Requires sys/types.h.
Copyright (C) 1992, 1999, 2001, 2003, 2005, 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, 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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _PATHMAX_H
# define _PATHMAX_H
/* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename,
including the terminating NUL byte.
<http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html>
PATH_MAX is not defined on systems which have no limit on filename length,
such as GNU/Hurd.
This file does *not* define PATH_MAX always. Programs that use this file
can handle the GNU/Hurd case in several ways:
- Either with a package-wide handling, or with a per-file handling,
- Either through a
#ifdef PATH_MAX
or through a fallback like
#ifndef PATH_MAX
# define PATH_MAX 8192
#endif
or through a fallback like
#ifndef PATH_MAX
# define PATH_MAX pathconf ("/", _PC_PATH_MAX)
#endif
*/
# include <unistd.h>
# include <limits.h>
# ifndef _POSIX_PATH_MAX
# define _POSIX_PATH_MAX 256
# endif
/* Don't include sys/param.h if it already has been. */
# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
# include <sys/param.h>
# endif
# if !defined PATH_MAX && defined MAXPATHLEN
# define PATH_MAX MAXPATHLEN
# endif
# ifdef __hpux
/* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename,
*not* including the terminating NUL byte, and is set to 1023.
Additionally, when _XOPEN_SOURCE is defined to 500 or more, PATH_MAX is
not defined at all any more. */
# undef PATH_MAX
# define PATH_MAX 1024
# endif
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com,
section "Maximum Path Length Limitation",
<http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#maxpath>
explains that the maximum size of a filename, including the terminating
NUL byte, is 260 = 3 + 256 + 1.
This is the same value as
- FILENAME_MAX in <stdio.h>,
- _MAX_PATH in <stdlib.h>,
- MAX_PATH in <windef.h>.
Undefine the original value, because mingw's <limits.h> gets it wrong. */
# undef PATH_MAX
# define PATH_MAX 260
# endif
#endif /* _PATHMAX_H */

View file

@ -65,6 +65,7 @@ AC_DEFUN([gl_EARLY],
# Code from module mktime:
# Code from module multiarch:
# Code from module nocrash:
# Code from module pathmax:
# Code from module pthread_sigmask:
# Code from module readlink:
# Code from module signal-h:
@ -217,6 +218,7 @@ AC_REQUIRE([AC_C_INLINE])
gl_UNISTD_H
gl_gnulib_enabled_dosname=false
gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false
gl_gnulib_enabled_pathmax=false
gl_gnulib_enabled_sigprocmask=false
gl_gnulib_enabled_stat=false
gl_gnulib_enabled_strtoll=false
@ -236,6 +238,13 @@ AC_SUBST([LTLIBINTL])
gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=true
fi
}
func_gl_gnulib_m4code_pathmax ()
{
if ! $gl_gnulib_enabled_pathmax; then
gl_PATHMAX
gl_gnulib_enabled_pathmax=true
fi
}
func_gl_gnulib_m4code_sigprocmask ()
{
if ! $gl_gnulib_enabled_sigprocmask; then
@ -261,6 +270,9 @@ gl_SYS_STAT_MODULE_INDICATOR([stat])
if test $REPLACE_STAT = 1; then
func_gl_gnulib_m4code_dosname
fi
if test $REPLACE_STAT = 1; then
func_gl_gnulib_m4code_pathmax
fi
if test $REPLACE_STAT = 1; then
func_gl_gnulib_m4code_verify
fi
@ -326,6 +338,7 @@ gl_STDLIB_MODULE_INDICATOR([strtoull])
m4_pattern_allow([^gl_GNULIB_ENABLED_])
AM_CONDITIONAL([gl_GNULIB_ENABLED_dosname], [$gl_gnulib_enabled_dosname])
AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36])
AM_CONDITIONAL([gl_GNULIB_ENABLED_pathmax], [$gl_gnulib_enabled_pathmax])
AM_CONDITIONAL([gl_GNULIB_ENABLED_sigprocmask], [$gl_gnulib_enabled_sigprocmask])
AM_CONDITIONAL([gl_GNULIB_ENABLED_stat], [$gl_gnulib_enabled_stat])
AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll])
@ -502,6 +515,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/md5.h
lib/mktime-internal.h
lib/mktime.c
lib/pathmax.h
lib/pthread_sigmask.c
lib/readlink.c
lib/sha1.c
@ -552,6 +566,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/mktime.m4
m4/multiarch.m4
m4/nocrash.m4
m4/pathmax.m4
m4/pthread_sigmask.m4
m4/readlink.m4
m4/sha1.m4

42
m4/pathmax.m4 Normal file
View file

@ -0,0 +1,42 @@
# pathmax.m4 serial 10
dnl Copyright (C) 2002-2003, 2005-2006, 2009-2011 Free Software Foundation,
dnl 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_PATHMAX],
[
dnl Prerequisites of lib/pathmax.h.
AC_CHECK_HEADERS_ONCE([sys/param.h])
])
# Expands to a piece of C program that defines PATH_MAX in the same way as
# "pathmax.h" will do.
AC_DEFUN([gl_PATHMAX_SNIPPET], [[
/* Arrange to define PATH_MAX, like "pathmax.h" does. */
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <limits.h>
#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
# include <sys/param.h>
#endif
#if !defined PATH_MAX && defined MAXPATHLEN
# define PATH_MAX MAXPATHLEN
#endif
#ifdef __hpux
# undef PATH_MAX
# define PATH_MAX 1024
#endif
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# undef PATH_MAX
# define PATH_MAX 260
#endif
]])
# Prerequisites of gl_PATHMAX_SNIPPET.
AC_DEFUN([gl_PATHMAX_SNIPPET_PREREQ],
[
AC_CHECK_HEADERS_ONCE([unistd.h sys/param.h])
])