aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2013-02-08 15:37:17 -0800
committerPaul Eggert2013-02-08 15:37:17 -0800
commit8376d87efcbfa648b297c5b03b93e5c02386887d (patch)
tree1ceabd5ebd8843023616625f85639b52c5ac1039
parente70e5000f0a6a945b7aad4cccea5bdfdb43a80f5 (diff)
downloademacs-8376d87efcbfa648b297c5b03b93e5c02386887d.tar.gz
emacs-8376d87efcbfa648b297c5b03b93e5c02386887d.zip
Merge from gnulib.
-rw-r--r--ChangeLog11
-rw-r--r--doc/misc/texinfo.tex50
-rw-r--r--lib/careadlinkat.c1
-rw-r--r--lib/careadlinkat.h7
-rw-r--r--lib/gnulib.mk2
-rw-r--r--lib/stdlib.in.h16
-rw-r--r--lib/sys_select.in.h17
-rw-r--r--lib/sys_time.in.h188
-rw-r--r--lib/unistd.in.h1
-rw-r--r--m4/extensions.m447
-rw-r--r--m4/stdlib_h.m46
11 files changed, 202 insertions, 144 deletions
diff --git a/ChangeLog b/ChangeLog
index c510360e30f..93c3c333725 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
12013-02-08 Paul Eggert <eggert@cs.ucla.edu>
2
3 Merge from gnulib, incorporating:
4 2013-02-08 careadlinkat: stop exporting careadlinkatcwd
5 The MS-Windows port can remove careadlinkatcwd at its convenience.
6 2013-02-08 extensions: port better to HP-UX
7 2013-02-06 extensions: port better to MINIX 3, HP-UX, autoheader 2.62
8 2013-02-06 unistd: avoid namespace pollution on non-glibc systems
9 2013-02-04 secure_getenv: new module [module not used by Emacs]
10 2013-01-30 sys_time: port to Solaris 2.6
11
12013-02-01 Paul Eggert <eggert@cs.ucla.edu> 122013-02-01 Paul Eggert <eggert@cs.ucla.edu>
2 13
3 Use fdopendir, fstatat and readlinkat, for efficiency (Bug#13539). 14 Use fdopendir, fstatat and readlinkat, for efficiency (Bug#13539).
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index d64f45bbee9..85f184cc4cb 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
3% Load plain if necessary, i.e., if running under initex. 3% Load plain if necessary, i.e., if running under initex.
4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi 4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5% 5%
6\def\texinfoversion{2013-01-01.15} 6\def\texinfoversion{2013-02-01.11}
7% 7%
8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -2496,7 +2496,7 @@ end
2496 \let-\codedash 2496 \let-\codedash
2497 \let_\codeunder 2497 \let_\codeunder
2498 \else 2498 \else
2499 \let-\realdash 2499 \let-\normaldash
2500 \let_\realunder 2500 \let_\realunder
2501 \fi 2501 \fi
2502 \codex 2502 \codex
@@ -2505,7 +2505,7 @@ end
2505 2505
2506\def\codex #1{\tclose{#1}\endgroup} 2506\def\codex #1{\tclose{#1}\endgroup}
2507 2507
2508\def\realdash{-} 2508\def\normaldash{-}
2509\def\codedash{-\discretionary{}{}{}} 2509\def\codedash{-\discretionary{}{}{}}
2510\def\codeunder{% 2510\def\codeunder{%
2511 % this is all so @math{@code{var_name}+1} can work. In math mode, _ 2511 % this is all so @math{@code{var_name}+1} can work. In math mode, _
@@ -2520,9 +2520,9 @@ end
2520} 2520}
2521 2521
2522% An additional complication: the above will allow breaks after, e.g., 2522% An additional complication: the above will allow breaks after, e.g.,
2523% each of the four underscores in __typeof__. This is undesirable in 2523% each of the four underscores in __typeof__. This is bad.
2524% some manuals, especially if they don't have long identifiers in 2524% @allowcodebreaks provides a document-level way to turn breaking at -
2525% general. @allowcodebreaks provides a way to control this. 2525% and _ on and off.
2526% 2526%
2527\newif\ifallowcodebreaks \allowcodebreakstrue 2527\newif\ifallowcodebreaks \allowcodebreakstrue
2528 2528
@@ -4188,7 +4188,7 @@ end
4188 % ..., but we might end up with active ones in the argument if 4188 % ..., but we might end up with active ones in the argument if
4189 % we're called from @code, as @code{@value{foo-bar_}}, though. 4189 % we're called from @code, as @code{@value{foo-bar_}}, though.
4190 % So \let them to their normal equivalents. 4190 % So \let them to their normal equivalents.
4191 \let-\realdash \let_\normalunderscore 4191 \let-\normaldash \let_\normalunderscore
4192 } 4192 }
4193} 4193}
4194 4194
@@ -9993,22 +9993,26 @@ directory should work if nowhere else does.}
9993@gdef@otherbackslash{@let\=@realbackslash} 9993@gdef@otherbackslash{@let\=@realbackslash}
9994 9994
9995% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of 9995% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
9996% the literal character `\'. 9996% the literal character `\'. Also revert - to its normal character, in
9997% 9997% case the active - from code has slipped in.
9998@def@normalturnoffactive{% 9998%
9999 @let"=@normaldoublequote 9999{@catcode`- = @active
10000 @let$=@normaldollar %$ font-lock fix 10000 @gdef@normalturnoffactive{%
10001 @let+=@normalplus 10001 @let-=@normaldash
10002 @let<=@normalless 10002 @let"=@normaldoublequote
10003 @let>=@normalgreater 10003 @let$=@normaldollar %$ font-lock fix
10004 @let\=@normalbackslash 10004 @let+=@normalplus
10005 @let^=@normalcaret 10005 @let<=@normalless
10006 @let_=@normalunderscore 10006 @let>=@normalgreater
10007 @let|=@normalverticalbar 10007 @let\=@normalbackslash
10008 @let~=@normaltilde 10008 @let^=@normalcaret
10009 @markupsetuplqdefault 10009 @let_=@normalunderscore
10010 @markupsetuprqdefault 10010 @let|=@normalverticalbar
10011 @unsepspaces 10011 @let~=@normaltilde
10012 @markupsetuplqdefault
10013 @markupsetuprqdefault
10014 @unsepspaces
10015 }
10012} 10016}
10013 10017
10014% Make _ and + \other characters, temporarily. 10018% Make _ and + \other characters, temporarily.
diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c
index d242ffaac7d..e2c19d1c1f1 100644
--- a/lib/careadlinkat.c
+++ b/lib/careadlinkat.c
@@ -25,6 +25,7 @@
25#include <errno.h> 25#include <errno.h>
26#include <limits.h> 26#include <limits.h>
27#include <string.h> 27#include <string.h>
28#include <unistd.h>
28 29
29/* Define this independently so that stdint.h is not a prerequisite. */ 30/* Define this independently so that stdint.h is not a prerequisite. */
30#ifndef SIZE_MAX 31#ifndef SIZE_MAX
diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h
index 965573bef3a..46f88ae288a 100644
--- a/lib/careadlinkat.h
+++ b/lib/careadlinkat.h
@@ -52,15 +52,12 @@ char *careadlinkat (int fd, char const *filename,
52 ssize_t (*preadlinkat) (int, char const *, 52 ssize_t (*preadlinkat) (int, char const *,
53 char *, size_t)); 53 char *, size_t));
54 54
55/* Suitable value for careadlinkat's FD argument, 55/* Suitable value for careadlinkat's FD argument. */
56 when doing a plain readlink:
57 Pass FD = AT_FDCWD. */
58#if HAVE_READLINKAT 56#if HAVE_READLINKAT
59/* AT_FDCWD is declared in <fcntl.h>. */ 57/* AT_FDCWD is declared in <fcntl.h>. */
60#else 58#else
61/* Define AT_FDCWD independently, so that the careadlinkat module does 59/* Define AT_FDCWD independently, so that the careadlinkat module does
62 not depend on the fcntl-h module. The value does not matter, since 60 not depend on the fcntl-h module. We might as well use the same value
63 careadlinkatcwd ignores it, but we might as well use the same value
64 as fcntl-h. */ 61 as fcntl-h. */
65# ifndef AT_FDCWD 62# ifndef AT_FDCWD
66# define AT_FDCWD (-3041965) 63# define AT_FDCWD (-3041965)
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 89317fd2088..8103eec88a0 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -1032,6 +1032,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
1032 -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ 1032 -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
1033 -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ 1033 -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
1034 -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ 1034 -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \
1035 -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \
1035 -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ 1036 -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \
1036 -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ 1037 -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \
1037 -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ 1038 -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \
@@ -1060,6 +1061,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
1060 -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ 1061 -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
1061 -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ 1062 -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
1062 -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ 1063 -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
1064 -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \
1063 -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ 1065 -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
1064 -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ 1066 -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
1065 -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ 1067 -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 422ad714c32..e054c520ebe 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -767,6 +767,22 @@ _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
767# endif 767# endif
768#endif 768#endif
769 769
770#if @GNULIB_SECURE_GETENV@
771/* Look up NAME in the environment, returning 0 in insecure situations. */
772# if !@HAVE_SECURE_GETENV@
773_GL_FUNCDECL_SYS (secure_getenv, char *,
774 (char const *name) _GL_ARG_NONNULL ((1)));
775# endif
776_GL_CXXALIAS_SYS (secure_getenv, int, (char const *name));
777_GL_CXXALIASWARN (secure_getenv);
778#elif defined GNULIB_POSIXCHECK
779# undef secure_getenv
780# if HAVE_RAW_DECL_SECURE_GETENV
781_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
782 "use gnulib module secure_getenv for portability");
783# endif
784#endif
785
770#if @GNULIB_SETENV@ 786#if @GNULIB_SETENV@
771/* Set NAME to VALUE in the environment. 787/* Set NAME to VALUE in the environment.
772 If REPLACE is nonzero, overwrite an existing value. */ 788 If REPLACE is nonzero, overwrite an existing value. */
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index edff088a125..521ccef321d 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -19,14 +19,25 @@
19# endif 19# endif
20@PRAGMA_COLUMNS@ 20@PRAGMA_COLUMNS@
21 21
22/* On OSF/1, <sys/types.h> and <sys/time.h> include <sys/select.h>. 22/* On OSF/1 and Solaris 2.6, <sys/types.h> and <sys/time.h>
23 both include <sys/select.h>.
23 Simply delegate to the system's header in this case. */ 24 Simply delegate to the system's header in this case. */
24#if @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TYPES_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H) && defined _OSF_SOURCE 25#if (@HAVE_SYS_SELECT_H@ \
26 && ((defined __osf__ && defined _SYS_TYPES_H_ && defined _OSF_SOURCE) \
27 || (defined __sun && defined _SYS_TYPES_H \
28 && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
29 || defined __EXTENSIONS__))) \
30 && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H)
25 31
26# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H 32# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H
27# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ 33# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
28 34
29#elif @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TIME_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H) && defined _OSF_SOURCE 35#elif (@HAVE_SYS_SELECT_H@ \
36 && ((defined __osf__ && defined _SYS_TIME_H_ && defined _OSF_SOURCE) \
37 || (defined __sun && defined _SYS_TIME_H \
38 && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
39 || defined __EXTENSIONS__))) \
40 && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H)
30 41
31# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H 42# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
32# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ 43# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index 1b7736bee02..656c3f13ad2 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -17,37 +17,34 @@
17 17
18/* Written by Paul Eggert. */ 18/* Written by Paul Eggert. */
19 19
20#ifndef _@GUARD_PREFIX@_SYS_TIME_H
21
20#if __GNUC__ >= 3 22#if __GNUC__ >= 3
21@PRAGMA_SYSTEM_HEADER@ 23@PRAGMA_SYSTEM_HEADER@
22#endif 24#endif
23@PRAGMA_COLUMNS@ 25@PRAGMA_COLUMNS@
24 26
25#if defined _@GUARD_PREFIX@_SYS_TIME_H 27/* The include_next requires a split double-inclusion guard. */
26 28#if @HAVE_SYS_TIME_H@
27/* Simply delegate to the system's header, without adding anything. */ 29# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
28# if @HAVE_SYS_TIME_H@ 30#endif
29# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
30# endif
31
32#else
33 31
34# define _@GUARD_PREFIX@_SYS_TIME_H 32#ifndef _@GUARD_PREFIX@_SYS_TIME_H
33#define _@GUARD_PREFIX@_SYS_TIME_H
35 34
36# if @HAVE_SYS_TIME_H@ 35#if ! @HAVE_SYS_TIME_H@
37# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ 36# include <time.h>
38# else 37#endif
39# include <time.h>
40# endif
41 38
42/* On native Windows with MSVC, get the 'struct timeval' type. 39/* On native Windows with MSVC, get the 'struct timeval' type.
43 Also, on native Windows with a 64-bit time_t, where we are overriding the 40 Also, on native Windows with a 64-bit time_t, where we are overriding the
44 'struct timeval' type, get all declarations of system functions whose 41 'struct timeval' type, get all declarations of system functions whose
45 signature contains 'struct timeval'. */ 42 signature contains 'struct timeval'. */
46# if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H 43#if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
47# define _GL_INCLUDING_WINSOCK2_H 44# define _GL_INCLUDING_WINSOCK2_H
48# include <winsock2.h> 45# include <winsock2.h>
49# undef _GL_INCLUDING_WINSOCK2_H 46# undef _GL_INCLUDING_WINSOCK2_H
50# endif 47#endif
51 48
52/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 49/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
53 50
@@ -55,112 +52,112 @@
55 52
56/* The definition of _GL_WARN_ON_USE is copied here. */ 53/* The definition of _GL_WARN_ON_USE is copied here. */
57 54
58# ifdef __cplusplus 55#ifdef __cplusplus
59extern "C" { 56extern "C" {
60# endif 57#endif
61 58
62# if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@ 59#if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@
63 60
64# if @REPLACE_STRUCT_TIMEVAL@ 61# if @REPLACE_STRUCT_TIMEVAL@
65# define timeval rpl_timeval 62# define timeval rpl_timeval
66# endif 63# endif
67 64
68# if !GNULIB_defined_struct_timeval 65# if !GNULIB_defined_struct_timeval
69struct timeval 66struct timeval
70{ 67{
71 time_t tv_sec; 68 time_t tv_sec;
72 long int tv_usec; 69 long int tv_usec;
73}; 70};
74# define GNULIB_defined_struct_timeval 1 71# define GNULIB_defined_struct_timeval 1
75# endif
76
77# endif 72# endif
78 73
79# ifdef __cplusplus 74#endif
75
76#ifdef __cplusplus
80} 77}
81# endif 78#endif
82 79
83# if @GNULIB_GETTIMEOFDAY@ 80#if @GNULIB_GETTIMEOFDAY@
84# if @REPLACE_GETTIMEOFDAY@ 81# if @REPLACE_GETTIMEOFDAY@
85# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 82# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
86# undef gettimeofday 83# undef gettimeofday
87# define gettimeofday rpl_gettimeofday 84# define gettimeofday rpl_gettimeofday
88# endif 85# endif
89_GL_FUNCDECL_RPL (gettimeofday, int, 86_GL_FUNCDECL_RPL (gettimeofday, int,
90 (struct timeval *restrict, void *restrict) 87 (struct timeval *restrict, void *restrict)
91 _GL_ARG_NONNULL ((1))); 88 _GL_ARG_NONNULL ((1)));
92_GL_CXXALIAS_RPL (gettimeofday, int, 89_GL_CXXALIAS_RPL (gettimeofday, int,
93 (struct timeval *restrict, void *restrict)); 90 (struct timeval *restrict, void *restrict));
94# else 91# else
95# if !@HAVE_GETTIMEOFDAY@ 92# if !@HAVE_GETTIMEOFDAY@
96_GL_FUNCDECL_SYS (gettimeofday, int, 93_GL_FUNCDECL_SYS (gettimeofday, int,
97 (struct timeval *restrict, void *restrict) 94 (struct timeval *restrict, void *restrict)
98 _GL_ARG_NONNULL ((1))); 95 _GL_ARG_NONNULL ((1)));
99# endif 96# endif
100/* Need to cast, because on glibc systems, by default, the second argument is 97/* Need to cast, because on glibc systems, by default, the second argument is
101 struct timezone *. */ 98 struct timezone *. */
102_GL_CXXALIAS_SYS_CAST (gettimeofday, int, 99_GL_CXXALIAS_SYS_CAST (gettimeofday, int,
103 (struct timeval *restrict, void *restrict)); 100 (struct timeval *restrict, void *restrict));
104# endif 101# endif
105_GL_CXXALIASWARN (gettimeofday); 102_GL_CXXALIASWARN (gettimeofday);
106# elif defined GNULIB_POSIXCHECK 103#elif defined GNULIB_POSIXCHECK
107# undef gettimeofday 104# undef gettimeofday
108# if HAVE_RAW_DECL_GETTIMEOFDAY 105# if HAVE_RAW_DECL_GETTIMEOFDAY
109_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - " 106_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
110 "use gnulib module gettimeofday for portability"); 107 "use gnulib module gettimeofday for portability");
111# endif
112# endif 108# endif
109#endif
113 110
114/* Hide some function declarations from <winsock2.h>. */ 111/* Hide some function declarations from <winsock2.h>. */
115 112
116# if defined _MSC_VER && @HAVE_WINSOCK2_H@ 113#if defined _MSC_VER && @HAVE_WINSOCK2_H@
117# if !defined _@GUARD_PREFIX@_UNISTD_H 114# if !defined _@GUARD_PREFIX@_UNISTD_H
118# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 115# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
119# undef close 116# undef close
120# define close close_used_without_including_unistd_h 117# define close close_used_without_including_unistd_h
121# else 118# else
122 _GL_WARN_ON_USE (close, 119 _GL_WARN_ON_USE (close,
123 "close() used without including <unistd.h>"); 120 "close() used without including <unistd.h>");
124# endif 121# endif
125# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 122# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
126# undef gethostname 123# undef gethostname
127# define gethostname gethostname_used_without_including_unistd_h 124# define gethostname gethostname_used_without_including_unistd_h
128# else 125# else
129 _GL_WARN_ON_USE (gethostname, 126 _GL_WARN_ON_USE (gethostname,
130 "gethostname() used without including <unistd.h>"); 127 "gethostname() used without including <unistd.h>");
131# endif
132# endif 128# endif
133# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H 129# endif
134# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 130# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
135# undef socket 131# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
136# define socket socket_used_without_including_sys_socket_h 132# undef socket
137# undef connect 133# define socket socket_used_without_including_sys_socket_h
138# define connect connect_used_without_including_sys_socket_h 134# undef connect
139# undef accept 135# define connect connect_used_without_including_sys_socket_h
140# define accept accept_used_without_including_sys_socket_h 136# undef accept
141# undef bind 137# define accept accept_used_without_including_sys_socket_h
142# define bind bind_used_without_including_sys_socket_h 138# undef bind
143# undef getpeername 139# define bind bind_used_without_including_sys_socket_h
144# define getpeername getpeername_used_without_including_sys_socket_h 140# undef getpeername
145# undef getsockname 141# define getpeername getpeername_used_without_including_sys_socket_h
146# define getsockname getsockname_used_without_including_sys_socket_h 142# undef getsockname
147# undef getsockopt 143# define getsockname getsockname_used_without_including_sys_socket_h
148# define getsockopt getsockopt_used_without_including_sys_socket_h 144# undef getsockopt
149# undef listen 145# define getsockopt getsockopt_used_without_including_sys_socket_h
150# define listen listen_used_without_including_sys_socket_h 146# undef listen
151# undef recv 147# define listen listen_used_without_including_sys_socket_h
152# define recv recv_used_without_including_sys_socket_h 148# undef recv
153# undef send 149# define recv recv_used_without_including_sys_socket_h
154# define send send_used_without_including_sys_socket_h 150# undef send
155# undef recvfrom 151# define send send_used_without_including_sys_socket_h
156# define recvfrom recvfrom_used_without_including_sys_socket_h 152# undef recvfrom
157# undef sendto 153# define recvfrom recvfrom_used_without_including_sys_socket_h
158# define sendto sendto_used_without_including_sys_socket_h 154# undef sendto
159# undef setsockopt 155# define sendto sendto_used_without_including_sys_socket_h
160# define setsockopt setsockopt_used_without_including_sys_socket_h 156# undef setsockopt
161# undef shutdown 157# define setsockopt setsockopt_used_without_including_sys_socket_h
162# define shutdown shutdown_used_without_including_sys_socket_h 158# undef shutdown
163# else 159# define shutdown shutdown_used_without_including_sys_socket_h
160# else
164 _GL_WARN_ON_USE (socket, 161 _GL_WARN_ON_USE (socket,
165 "socket() used without including <sys/socket.h>"); 162 "socket() used without including <sys/socket.h>");
166 _GL_WARN_ON_USE (connect, 163 _GL_WARN_ON_USE (connect,
@@ -189,17 +186,18 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
189 "setsockopt() used without including <sys/socket.h>"); 186 "setsockopt() used without including <sys/socket.h>");
190 _GL_WARN_ON_USE (shutdown, 187 _GL_WARN_ON_USE (shutdown,
191 "shutdown() used without including <sys/socket.h>"); 188 "shutdown() used without including <sys/socket.h>");
192# endif
193# endif 189# endif
194# if !defined _@GUARD_PREFIX@_SYS_SELECT_H 190# endif
195# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 191# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
196# undef select 192# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
197# define select select_used_without_including_sys_select_h 193# undef select
198# else 194# define select select_used_without_including_sys_select_h
195# else
199 _GL_WARN_ON_USE (select, 196 _GL_WARN_ON_USE (select,
200 "select() used without including <sys/select.h>"); 197 "select() used without including <sys/select.h>");
201# endif
202# endif 198# endif
203# endif 199# endif
200#endif
204 201
205#endif /* _@GUARD_PREFIX@_SYS_TIME_H */ 202#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
203#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index a870fe7b4a3..675c7e6a552 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -110,6 +110,7 @@
110/* Get getopt(), optarg, optind, opterr, optopt. 110/* Get getopt(), optarg, optind, opterr, optopt.
111 But avoid namespace pollution on glibc systems. */ 111 But avoid namespace pollution on glibc systems. */
112#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT 112#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
113# define __need_getopt
113# include <getopt.h> 114# include <getopt.h>
114#endif 115#endif
115 116
diff --git a/m4/extensions.m4 b/m4/extensions.m4
index 617323b244c..07ba376c0e7 100644
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -1,4 +1,4 @@
1# serial 12 -*- Autoconf -*- 1# serial 13 -*- Autoconf -*-
2# Enable extensions on systems that normally disable them. 2# Enable extensions on systems that normally disable them.
3 3
4# Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc. 4# Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc.
@@ -8,7 +8,7 @@
8 8
9# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS 9# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
10# Autoconf. Perhaps we can remove this once we can assume Autoconf 10# Autoconf. Perhaps we can remove this once we can assume Autoconf
11# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly 11# 2.70 or later everywhere, but since Autoconf mutates rapidly
12# enough in this area it's likely we'll need to redefine 12# enough in this area it's likely we'll need to redefine
13# AC_USE_SYSTEM_EXTENSIONS for quite some time. 13# AC_USE_SYSTEM_EXTENSIONS for quite some time.
14 14
@@ -30,6 +30,7 @@
30# ------------------------ 30# ------------------------
31# Enable extensions on systems that normally disable them, 31# Enable extensions on systems that normally disable them,
32# typically due to standards-conformance issues. 32# typically due to standards-conformance issues.
33#
33# Remember that #undef in AH_VERBATIM gets replaced with #define by 34# Remember that #undef in AH_VERBATIM gets replaced with #define by
34# AC_DEFINE. The goal here is to define all known feature-enabling 35# AC_DEFINE. The goal here is to define all known feature-enabling
35# macros, then, if reports of conflicts are made, disable macros that 36# macros, then, if reports of conflicts are made, disable macros that
@@ -38,8 +39,6 @@ AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
38[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl 39[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
39AC_BEFORE([$0], [AC_RUN_IFELSE])dnl 40AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
40 41
41 AC_REQUIRE([AC_CANONICAL_HOST])
42
43 AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) 42 AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
44 if test "$MINIX" = yes; then 43 if test "$MINIX" = yes; then
45 AC_DEFINE([_POSIX_SOURCE], [1], 44 AC_DEFINE([_POSIX_SOURCE], [1],
@@ -50,24 +49,18 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
50 except with this defined.]) 49 except with this defined.])
51 AC_DEFINE([_MINIX], [1], 50 AC_DEFINE([_MINIX], [1],
52 [Define to 1 if on MINIX.]) 51 [Define to 1 if on MINIX.])
52 AC_DEFINE([_NETBSD_SOURCE], [1],
53 [Define to 1 to make NetBSD features available. MINIX 3 needs this.])
53 fi 54 fi
54 55
55 dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, 56dnl Use a different key than __EXTENSIONS__, as that name broke existing
56 dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already 57dnl configure.ac when using autoheader 2.62.
57 dnl provided. 58 AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
58 case "$host_os" in
59 hpux*)
60 AC_DEFINE([_XOPEN_SOURCE], [500],
61 [Define to 500 only on HP-UX.])
62 ;;
63 esac
64
65 AH_VERBATIM([__EXTENSIONS__],
66[/* Enable extensions on AIX 3, Interix. */ 59[/* Enable extensions on AIX 3, Interix. */
67#ifndef _ALL_SOURCE 60#ifndef _ALL_SOURCE
68# undef _ALL_SOURCE 61# undef _ALL_SOURCE
69#endif 62#endif
70/* Enable general extensions on Mac OS X. */ 63/* Enable general extensions on OS X. */
71#ifndef _DARWIN_C_SOURCE 64#ifndef _DARWIN_C_SOURCE
72# undef _DARWIN_C_SOURCE 65# undef _DARWIN_C_SOURCE
73#endif 66#endif
@@ -83,6 +76,12 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
83#ifndef _TANDEM_SOURCE 76#ifndef _TANDEM_SOURCE
84# undef _TANDEM_SOURCE 77# undef _TANDEM_SOURCE
85#endif 78#endif
79/* Enable X/Open extensions if necessary. HP-UX 11.11 defines
80 mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
81 whether compiling with -Ae or -D_HPUX_SOURCE=1. */
82#ifndef _XOPEN_SOURCE
83# undef _XOPEN_SOURCE
84#endif
86/* Enable general extensions on Solaris. */ 85/* Enable general extensions on Solaris. */
87#ifndef __EXTENSIONS__ 86#ifndef __EXTENSIONS__
88# undef __EXTENSIONS__ 87# undef __EXTENSIONS__
@@ -103,6 +102,22 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
103 AC_DEFINE([_GNU_SOURCE]) 102 AC_DEFINE([_GNU_SOURCE])
104 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) 103 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
105 AC_DEFINE([_TANDEM_SOURCE]) 104 AC_DEFINE([_TANDEM_SOURCE])
105 AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
106 [ac_cv_should_define__xopen_source],
107 [ac_cv_should_define__xopen_source=no
108 AC_COMPILE_IFELSE(
109 [AC_LANG_PROGRAM([[
110 #include <wchar.h>
111 mbstate_t x;]])],
112 [],
113 [AC_COMPILE_IFELSE(
114 [AC_LANG_PROGRAM([[
115 #define _XOPEN_SOURCE 500
116 #include <wchar.h>
117 mbstate_t x;]])],
118 [ac_cv_should_define__xopen_source=yes])])])
119 test $ac_cv_should_define__xopen_source = yes &&
120 AC_DEFINE([_XOPEN_SOURCE], [500])
106])# AC_USE_SYSTEM_EXTENSIONS 121])# AC_USE_SYSTEM_EXTENSIONS
107 122
108# gl_USE_SYSTEM_EXTENSIONS 123# gl_USE_SYSTEM_EXTENSIONS
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index 79103bc7eb5..2027ab3c1d0 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
1# stdlib_h.m4 serial 41 1# stdlib_h.m4 serial 42
2dnl Copyright (C) 2007-2013 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -22,7 +22,7 @@ AC_DEFUN([gl_STDLIB_H],
22 ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt 22 ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
23 initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps 23 initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps
24 posix_openpt ptsname ptsname_r random random_r realpath rpmatch 24 posix_openpt ptsname ptsname_r random random_r realpath rpmatch
25 setenv setstate setstate_r srandom srandom_r 25 secure_getenv setenv setstate setstate_r srandom srandom_r
26 strtod strtoll strtoull unlockpt unsetenv]) 26 strtod strtoll strtoull unlockpt unsetenv])
27]) 27])
28 28
@@ -60,6 +60,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
60 GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) 60 GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
61 GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) 61 GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH])
62 GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) 62 GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH])
63 GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV])
63 GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) 64 GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV])
64 GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) 65 GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
65 GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) 66 GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL])
@@ -88,6 +89,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
88 HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) 89 HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
89 HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) 90 HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH])
90 HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH]) 91 HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH])
92 HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV])
91 HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) 93 HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
92 HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV]) 94 HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV])
93 HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) 95 HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD])