aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--Makefile.in3
-rw-r--r--doc/misc/texinfo.tex314
-rw-r--r--lib/dup2.c71
-rw-r--r--lib/gnulib.mk40
-rw-r--r--lib/signal.in.h23
-rw-r--r--lib/sigprocmask.c27
-rw-r--r--lib/stat.c14
-rw-r--r--lib/stdio.in.h38
-rw-r--r--lib/sys_stat.in.h32
-rw-r--r--lib/unistd.in.h137
-rw-r--r--m4/dup2.m45
-rw-r--r--m4/getloadavg.m410
-rw-r--r--m4/gl-comp.m438
-rw-r--r--m4/include_next.m410
-rw-r--r--m4/signal_h.m45
-rw-r--r--m4/signalblocking.m46
-rw-r--r--m4/stdint.m48
-rw-r--r--m4/stdio_h.m49
-rw-r--r--m4/sys_stat_h.m48
-rw-r--r--m4/time_h.m45
-rw-r--r--m4/unistd_h.m416
22 files changed, 682 insertions, 154 deletions
diff --git a/ChangeLog b/ChangeLog
index 75d0ef6a5e9..63b0097856f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
12011-09-26 Paul Eggert <eggert@cs.ucla.edu>
2
3 Merge from gnulib, improving some licensing wording.
4 This clarifies and fixes some licensing issues raised by Glenn Morris
5 <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00397.html>.
6 It also merges the latest version of texinfo.tex and has some
7 MSVC-related changes that don't affect Emacs.
8 * Makefile.in (GNULIB_TOOL_FLAGS): Avoid msvc-inval, msvc-nothrow,
9 pathmax, and raise, since these are needed only to address
10 MSVC-related issues that Emacs doesn't have.
11 * doc/misc/texinfo.tex, lib/dup2.c, lib/gnulib.mk, lib/signal.in.h:
12 * lib/sigprocmask.c, lib/stat.c, lib/stdio.in.h, lib/sys_stat.in.h:
13 * lib/unistd.in.h, m4/dup2.m4, m4/getloadavg.m4, m4/gl-comp.m4:
14 * m4/include_next.m4, m4/signal_h.m4, m4/signalblocking.m4:
15 * m4/stdint.m4, m4/stdio_h.m4, m4/sys_stat_h.m4, m4/time_h.m4:
16 * m4/unistd_h.m4: Merge from gnulib.
17
12011-09-26 Glenn Morris <rgm@gnu.org> 182011-09-26 Glenn Morris <rgm@gnu.org>
2 19
3 * make-dist: Add lib/makefile.w32-in. 20 * make-dist: Add lib/makefile.w32-in.
diff --git a/Makefile.in b/Makefile.in
index 29e20298daf..f5bc0ce7015 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -339,7 +339,8 @@ GNULIB_MODULES = \
339 mktime pthread_sigmask readlink \ 339 mktime pthread_sigmask readlink \
340 socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat 340 socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat
341GNULIB_TOOL_FLAGS = \ 341GNULIB_TOOL_FLAGS = \
342 --avoid=threadlib \ 342 --avoid=msvc-inval --avoid=msvc-nothrow --avoid=pathmax \
343 --avoid=raise --avoid=threadlib \
343 --conditional-dependencies --import --no-changelog --no-vc-files \ 344 --conditional-dependencies --import --no-changelog --no-vc-files \
344 --makefile-name=gnulib.mk 345 --makefile-name=gnulib.mk
345sync-from-gnulib: $(gnulib_srcdir) 346sync-from-gnulib: $(gnulib_srcdir)
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index a7f94f96daa..3298298bb9d 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{2011-08-14.17} 6\def\texinfoversion{2011-09-23.09}
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,
@@ -3955,13 +3955,13 @@ end
3955% If so, set to same dimension as multitablelinespace. 3955% If so, set to same dimension as multitablelinespace.
3956\ifdim\multitableparskip>\multitablelinespace 3956\ifdim\multitableparskip>\multitablelinespace
3957\global\multitableparskip=\multitablelinespace 3957\global\multitableparskip=\multitablelinespace
3958\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller 3958\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
3959 %% than skip between lines in the table. 3959 % than skip between lines in the table.
3960\fi% 3960\fi%
3961\ifdim\multitableparskip=0pt 3961\ifdim\multitableparskip=0pt
3962\global\multitableparskip=\multitablelinespace 3962\global\multitableparskip=\multitablelinespace
3963\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller 3963\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
3964 %% than skip between lines in the table. 3964 % than skip between lines in the table.
3965\fi} 3965\fi}
3966 3966
3967 3967
@@ -7247,9 +7247,15 @@ end
7247\def\macroxxx#1{% 7247\def\macroxxx#1{%
7248 \getargs{#1}% now \macname is the macname and \argl the arglist 7248 \getargs{#1}% now \macname is the macname and \argl the arglist
7249 \ifx\argl\empty % no arguments 7249 \ifx\argl\empty % no arguments
7250 \paramno=0 7250 \paramno=0\relax
7251 \else 7251 \else
7252 \expandafter\parsemargdef \argl;% 7252 \expandafter\parsemargdef \argl;%
7253 \if\paramno>256\relax
7254 \ifx\eTeXversion\thisisundefined
7255 \errhelp = \EMsimple
7256 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
7257 \fi
7258 \fi
7253 \fi 7259 \fi
7254 \if1\csname ismacro.\the\macname\endcsname 7260 \if1\csname ismacro.\the\macname\endcsname
7255 \message{Warning: redefining \the\macname}% 7261 \message{Warning: redefining \the\macname}%
@@ -7299,9 +7305,17 @@ end
7299\def\getmacname#1 #2\relax{\macname={#1}} 7305\def\getmacname#1 #2\relax{\macname={#1}}
7300\def\getmacargs#1{\def\argl{#1}} 7306\def\getmacargs#1{\def\argl{#1}}
7301 7307
7308% For macro processing make @ a letter so that we can make Texinfo private macro names.
7309\edef\texiatcatcode{\the\catcode`\@}
7310\catcode `@=11\relax
7311
7302% Parse the optional {params} list. Set up \paramno and \paramlist 7312% Parse the optional {params} list. Set up \paramno and \paramlist
7303% so \defmacro knows what to do. Define \macarg.blah for each blah 7313% so \defmacro knows what to do. Define \macarg.BLAH for each BLAH
7304% in the params list to be ##N where N is the position in that list. 7314% in the params list to some hook where the argument si to be expanded. If
7315% there are less than 10 arguments that hook is to be replaced by ##N where N
7316% is the position in that list, that is to say the macro arguments are to be
7317% defined `a la TeX in the macro body.
7318%
7305% That gets used by \mbodybackslash (above). 7319% That gets used by \mbodybackslash (above).
7306% 7320%
7307% We need to get `macro parameter char #' into several definitions. 7321% We need to get `macro parameter char #' into several definitions.
@@ -7311,12 +7325,33 @@ end
7311% 7325%
7312% The same technique is used to protect \eatspaces till just before 7326% The same technique is used to protect \eatspaces till just before
7313% the macro is used. 7327% the macro is used.
7314 7328%
7329% If there are 10 or more arguments, a different technique is used, where the
7330% hook remains in the body, and when macro is to be expanded the body is
7331% processed again to replace the arguments.
7332%
7333% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
7334% argument N value and then \edef the body (nothing else will expand because of
7335% the catcode regime underwhich the body was input).
7336%
7337% If you compile with TeX (not eTeX), and you have macros with 10 or more
7338% arguments, you need that no macro has more than 256 arguments, otherwise an
7339% error is produced.
7315\def\parsemargdef#1;{% 7340\def\parsemargdef#1;{%
7316 \paramno=0\def\paramlist{}% 7341 \paramno=0\def\paramlist{}%
7317 \let\hash\relax 7342 \let\hash\relax
7318 \let\xeatspaces\relax 7343 \let\xeatspaces\relax
7319 \parsemargdefxxx#1,;,% 7344 \parsemargdefxxx#1,;,%
7345 % In case that there are 10 or more arguments we parse again the arguments
7346 % list to set new definitions for the \macarg.BLAH macros corresponding to
7347 % each BLAH argument. It was anyhow needed to parse already once this list
7348 % in order to count the arguments, and as macros with at most 9 arguments
7349 % are by far more frequent than macro with 10 or more arguments, defining
7350 % twice the \macarg.BLAH macros does not cost too much processing power.
7351 \ifnum\paramno<10\relax\else
7352 \paramno0\relax
7353 \parsemmanyargdef@@#1,;,% 10 or more arguments
7354 \fi
7320} 7355}
7321\def\parsemargdefxxx#1,{% 7356\def\parsemargdefxxx#1,{%
7322 \if#1;\let\next=\relax 7357 \if#1;\let\next=\relax
@@ -7327,16 +7362,205 @@ end
7327 \edef\paramlist{\paramlist\hash\the\paramno,}% 7362 \edef\paramlist{\paramlist\hash\the\paramno,}%
7328 \fi\next} 7363 \fi\next}
7329 7364
7365\def\parsemmanyargdef@@#1,{%
7366 \if#1;\let\next=\relax
7367 \else
7368 \let\next=\parsemmanyargdef@@
7369 \edef\tempb{\eatspaces{#1}}%
7370 \expandafter\def\expandafter\tempa
7371 \expandafter{\csname macarg.\tempb\endcsname}%
7372 % Note that we need some extra \noexpand\noexpand, this is because we
7373 % don't want \the to be expanded in the \parsermacbody as it uses an
7374 % \xdef .
7375 \expandafter\edef\tempa
7376 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
7377 \advance\paramno by 1\relax
7378 \fi\next}
7379
7330% These two commands read recursive and nonrecursive macro bodies. 7380% These two commands read recursive and nonrecursive macro bodies.
7331% (They're different since rec and nonrec macros end differently.) 7381% (They're different since rec and nonrec macros end differently.)
7332% 7382%
7383
7384\catcode `\@\texiatcatcode
7333\long\def\parsemacbody#1@end macro% 7385\long\def\parsemacbody#1@end macro%
7334{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% 7386{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
7335\long\def\parsermacbody#1@end rmacro% 7387\long\def\parsermacbody#1@end rmacro%
7336{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% 7388{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
7389\catcode `\@=11\relax
7390
7391\let\endargs@\relax
7392\let\nil@\relax
7393\def\nilm@{\nil@}%
7394\long\def\nillm@{\nil@}%
7395
7396% This macro is expanded during the Texinfo macro expansion, not during its
7397% definition. It gets all the arguments values and assigns them to macros
7398% macarg.ARGNAME
7399%
7400% #1 is the macro name
7401% #2 is the list of argument names
7402% #3 is the list of argument values
7403\def\getargvals@#1#2#3{%
7404 \def\macargdeflist@{}%
7405 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
7406 \def\paramlist{#2,\nil@}%
7407 \def\macroname{#1}%
7408 \begingroup
7409 \macroargctxt
7410 \def\argvaluelist{#3,\nil@}%
7411 \def\@tempa{#3}%
7412 \ifx\@tempa\empty
7413 \setemptyargvalues@
7414 \else
7415 \getargvals@@
7416 \fi
7417}
7337 7418
7338% This defines the macro itself. There are six cases: recursive and 7419%
7339% nonrecursive macros of zero, one, and many arguments. 7420\def\getargvals@@{%
7421 \ifx\paramlist\nilm@
7422 % Some sanity check needed here that \argvaluelist is also empty.
7423 \ifx\argvaluelist\nillm@
7424 \else
7425 \errhelp = \EMsimple
7426 \errmessage{Too many arguments in macro `\macroname'!}%
7427 \fi
7428 \let\next\macargexpandinbody@
7429 \else
7430 \ifx\argvaluelist\nillm@
7431 % No more arguments values passed to macro. Set remaining named-arg
7432 % macros to empty.
7433 \let\next\setemptyargvalues@
7434 \else
7435 % pop current arg name into \@tempb
7436 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
7437 \expandafter\@tempa\expandafter{\paramlist}%
7438 % pop current argument value into \@tempc
7439 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
7440 \expandafter\@tempa\expandafter{\argvaluelist}%
7441 % Here \@tempb is the current arg name and \@tempc is the current arg value.
7442 % First place the new argument macro definition into \@tempd
7443 \expandafter\macname\expandafter{\@tempc}%
7444 \expandafter\let\csname macarg.\@tempb\endcsname\relax
7445 \expandafter\def\expandafter\@tempe\expandafter{%
7446 \csname macarg.\@tempb\endcsname}%
7447 \edef\@tempd{\long\def\@tempe{\the\macname}}%
7448 \push@\@tempd\macargdeflist@
7449 \let\next\getargvals@@
7450 \fi
7451 \fi
7452 \next
7453}
7454
7455\def\push@#1#2{%
7456 \expandafter\expandafter\expandafter\def
7457 \expandafter\expandafter\expandafter#2%
7458 \expandafter\expandafter\expandafter{%
7459 \expandafter#1#2}%
7460}
7461
7462% Replace arguments by their values in the macro body, and place the result
7463% in macro \@tempa
7464\def\macvalstoargs@{%
7465 % To do this we use the property that token registers that are \the'ed
7466 % within an \edef expand only once. So we are going to place all argument
7467 % values into respective token registers.
7468 %
7469 % First we save the token context, and initialize argument numbering.
7470 \begingroup
7471 \paramno0\relax
7472 % Then, for each argument number #N, we place the corresponding argument
7473 % value into a new token list register \toks#N
7474 \expandafter\putargsintokens@\saveparamlist@,;,%
7475 % Then, we expand the body so that argument are replaced by their
7476 % values. The trick for values not to be expanded themselves is that they
7477 % are within tokens and that tokens expand only once in an \edef .
7478 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
7479 % Now we restore the token stack pointer to free the token list registers
7480 % which we have used, but we make sure that expanded body is saved after
7481 % group.
7482 \expandafter
7483 \endgroup
7484 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
7485 }
7486
7487\def\macargexpandinbody@{%
7488 %% Define the named-macro outside of this group and then close this group.
7489 \expandafter
7490 \endgroup
7491 \macargdeflist@
7492 % First the replace in body the macro arguments by their values, the result
7493 % is in \@tempa .
7494 \macvalstoargs@
7495 % Then we point at the \norecurse or \gobble (for recursive) macro value
7496 % with \@tempb .
7497 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
7498 % Depending on whether it is recursive or not, we need some tailing
7499 % \egroup .
7500 \ifx\@tempb\gobble
7501 \let\@tempc\relax
7502 \else
7503 \let\@tempc\egroup
7504 \fi
7505 % And now we do the real job:
7506 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
7507 \@tempd
7508}
7509
7510\def\putargsintokens@#1,{%
7511 \if#1;\let\next\relax
7512 \else
7513 \let\next\putargsintokens@
7514 % First we allocate the new token list register, and give it a temporary
7515 % alias \@tempb .
7516 \toksdef\@tempb\the\paramno
7517 % Then we place the argument value into that token list register.
7518 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
7519 \expandafter\@tempb\expandafter{\@tempa}%
7520 \advance\paramno by 1\relax
7521 \fi
7522 \next
7523}
7524
7525% Save the token stack pointer into macro #1
7526\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}}
7527% Restore the token stack pointer from number in macro #1
7528\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax}
7529% newtoks that can be used non \outer .
7530\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi}
7531
7532% Tailing missing arguments are set to empty
7533\def\setemptyargvalues@{%
7534 \ifx\paramlist\nilm@
7535 \let\next\macargexpandinbody@
7536 \else
7537 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
7538 \let\next\setemptyargvalues@
7539 \fi
7540 \next
7541}
7542
7543\def\setemptyargvaluesparser@#1,#2\endargs@{%
7544 \expandafter\def\expandafter\@tempa\expandafter{%
7545 \expandafter\def\csname macarg.#1\endcsname{}}%
7546 \push@\@tempa\macargdeflist@
7547 \def\paramlist{#2}%
7548}
7549
7550% #1 is the element target macro
7551% #2 is the list macro
7552% #3,#4\endargs@ is the list value
7553\def\pop@#1#2#3,#4\endargs@{%
7554 \def#1{#3}%
7555 \def#2{#4}%
7556}
7557\long\def\longpop@#1#2#3,#4\endargs@{%
7558 \long\def#1{#3}%
7559 \long\def#2{#4}%
7560}
7561
7562% This defines a Texinfo @macro. There are eight cases: recursive and
7563% nonrecursive macros of zero, one, up to nine, and many arguments.
7340% Much magic with \expandafter here. 7564% Much magic with \expandafter here.
7341% \xdef is used so that macro definitions will survive the file 7565% \xdef is used so that macro definitions will survive the file
7342% they're defined in; @include reads the file inside a group. 7566% they're defined in; @include reads the file inside a group.
@@ -7355,17 +7579,25 @@ end
7355 \expandafter\noexpand\csname\the\macname xxx\endcsname}% 7579 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
7356 \expandafter\xdef\csname\the\macname xxx\endcsname##1{% 7580 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
7357 \egroup\noexpand\scanmacro{\temp}}% 7581 \egroup\noexpand\scanmacro{\temp}}%
7358 \else % many 7582 \else
7359 \expandafter\xdef\csname\the\macname\endcsname{% 7583 \ifnum\paramno<10\relax % at most 9
7360 \bgroup\noexpand\macroargctxt 7584 \expandafter\xdef\csname\the\macname\endcsname{%
7361 \noexpand\csname\the\macname xx\endcsname}% 7585 \bgroup\noexpand\macroargctxt
7362 \expandafter\xdef\csname\the\macname xx\endcsname##1{% 7586 \noexpand\csname\the\macname xx\endcsname}%
7363 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% 7587 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
7364 \expandafter\expandafter 7588 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
7365 \expandafter\xdef 7589 \expandafter\expandafter
7366 \expandafter\expandafter 7590 \expandafter\xdef
7367 \csname\the\macname xxx\endcsname 7591 \expandafter\expandafter
7368 \paramlist{\egroup\noexpand\scanmacro{\temp}}% 7592 \csname\the\macname xxx\endcsname
7593 \paramlist{\egroup\noexpand\scanmacro{\temp}}%
7594 \else % 10 or more
7595 \expandafter\xdef\csname\the\macname\endcsname{%
7596 \noexpand\getargvals@{\the\macname}{\argl}%
7597 }%
7598 \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
7599 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
7600 \fi
7369 \fi 7601 \fi
7370 \else 7602 \else
7371 \ifcase\paramno 7603 \ifcase\paramno
@@ -7382,23 +7614,33 @@ end
7382 \egroup 7614 \egroup
7383 \noexpand\norecurse{\the\macname}% 7615 \noexpand\norecurse{\the\macname}%
7384 \noexpand\scanmacro{\temp}\egroup}% 7616 \noexpand\scanmacro{\temp}\egroup}%
7385 \else % many 7617 \else % at most 9
7386 \expandafter\xdef\csname\the\macname\endcsname{% 7618 \ifnum\paramno<10\relax
7387 \bgroup\noexpand\macroargctxt 7619 \expandafter\xdef\csname\the\macname\endcsname{%
7388 \expandafter\noexpand\csname\the\macname xx\endcsname}% 7620 \bgroup\noexpand\macroargctxt
7389 \expandafter\xdef\csname\the\macname xx\endcsname##1{% 7621 \expandafter\noexpand\csname\the\macname xx\endcsname}%
7390 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% 7622 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
7391 \expandafter\expandafter 7623 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
7392 \expandafter\xdef 7624 \expandafter\expandafter
7393 \expandafter\expandafter 7625 \expandafter\xdef
7394 \csname\the\macname xxx\endcsname 7626 \expandafter\expandafter
7395 \paramlist{% 7627 \csname\the\macname xxx\endcsname
7396 \egroup 7628 \paramlist{%
7397 \noexpand\norecurse{\the\macname}% 7629 \egroup
7398 \noexpand\scanmacro{\temp}\egroup}% 7630 \noexpand\norecurse{\the\macname}%
7631 \noexpand\scanmacro{\temp}\egroup}%
7632 \else % 10 or more:
7633 \expandafter\xdef\csname\the\macname\endcsname{%
7634 \noexpand\getargvals@{\the\macname}{\argl}%
7635 }%
7636 \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
7637 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
7638 \fi
7399 \fi 7639 \fi
7400 \fi} 7640 \fi}
7401 7641
7642\catcode `\@\texiatcatcode\relax
7643
7402\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} 7644\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
7403 7645
7404% \braceorline decides whether the next nonwhitespace character is a 7646% \braceorline decides whether the next nonwhitespace character is a
diff --git a/lib/dup2.c b/lib/dup2.c
index e00dc7b2e3c..790c98a2e84 100644
--- a/lib/dup2.c
+++ b/lib/dup2.c
@@ -25,21 +25,26 @@
25#include <errno.h> 25#include <errno.h>
26#include <fcntl.h> 26#include <fcntl.h>
27 27
28#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
29/* Get declarations of the Win32 API functions. */
30# define WIN32_LEAN_AND_MEAN
31# include <windows.h>
32#endif
33
34#if HAVE_DUP2 28#if HAVE_DUP2
35 29
36# undef dup2 30# undef dup2
37 31
38int 32# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
39rpl_dup2 (int fd, int desired_fd) 33
34/* Get declarations of the Win32 API functions. */
35# define WIN32_LEAN_AND_MEAN
36# include <windows.h>
37
38# include "msvc-inval.h"
39
40/* Get _get_osfhandle. */
41# include "msvc-nothrow.h"
42
43static int
44ms_windows_dup2 (int fd, int desired_fd)
40{ 45{
41 int result; 46 int result;
42# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 47
43 /* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open, 48 /* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open,
44 dup2 (fd, fd) returns 0, but all further attempts to use fd in 49 dup2 (fd, fd) returns 0, but all further attempts to use fd in
45 future dup2 calls will hang. */ 50 future dup2 calls will hang. */
@@ -52,6 +57,7 @@ rpl_dup2 (int fd, int desired_fd)
52 } 57 }
53 return fd; 58 return fd;
54 } 59 }
60
55 /* Wine 1.0.1 return 0 when desired_fd is negative but not -1: 61 /* Wine 1.0.1 return 0 when desired_fd is negative but not -1:
56 http://bugs.winehq.org/show_bug.cgi?id=21289 */ 62 http://bugs.winehq.org/show_bug.cgi?id=21289 */
57 if (desired_fd < 0) 63 if (desired_fd < 0)
@@ -59,26 +65,45 @@ rpl_dup2 (int fd, int desired_fd)
59 errno = EBADF; 65 errno = EBADF;
60 return -1; 66 return -1;
61 } 67 }
62# elif !defined __linux__ 68
63 /* On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */ 69 TRY_MSVC_INVAL
64 if (fd == desired_fd) 70 {
65 return fcntl (fd, F_GETFL) == -1 ? -1 : fd; 71 result = dup2 (fd, desired_fd);
66# endif 72 }
67 result = dup2 (fd, desired_fd); 73 CATCH_MSVC_INVAL
68# ifdef __linux__
69 /* Correct a Linux return value.
70 <http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.30.y.git;a=commitdiff;h=2b79bc4f7ebbd5af3c8b867968f9f15602d5f802>
71 */
72 if (fd == desired_fd && result == (unsigned int) -EBADF)
73 { 74 {
74 errno = EBADF; 75 errno = EBADF;
75 result = -1; 76 result = -1;
76 } 77 }
77# endif 78 DONE_MSVC_INVAL;
79
78 if (result == 0) 80 if (result == 0)
79 result = desired_fd; 81 result = desired_fd;
80 /* Correct a cygwin 1.5.x errno value. */ 82
81 else if (result == -1 && errno == EMFILE) 83 return result;
84}
85
86# define dup2 ms_windows_dup2
87
88# endif
89
90int
91rpl_dup2 (int fd, int desired_fd)
92{
93 int result;
94
95# ifdef F_GETFL
96 /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
97 On Cygwin 1.5.x, dup2 (1, 1) returns 0.
98 On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */
99 if (fd == desired_fd)
100 return fcntl (fd, F_GETFL) == -1 ? -1 : fd;
101# endif
102
103 result = dup2 (fd, desired_fd);
104
105 /* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x. */
106 if (result == -1 && errno == EMFILE)
82 errno = EBADF; 107 errno = EBADF;
83# if REPLACE_FCHDIR 108# if REPLACE_FCHDIR
84 if (fd != desired_fd && result != -1) 109 if (fd != desired_fd && result != -1)
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 5163269db41..14010feb04b 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -2,14 +2,26 @@
2## Process this file with automake to produce Makefile.in. 2## Process this file with automake to produce Makefile.in.
3# Copyright (C) 2002-2011 Free Software Foundation, Inc. 3# Copyright (C) 2002-2011 Free Software Foundation, Inc.
4# 4#
5# This file is free software, distributed under the terms of the GNU 5# This file is free software; you can redistribute it and/or modify
6# General Public License. As a special exception to the GNU General 6# it under the terms of the GNU General Public License as published by
7# Public License, this file may be distributed as part of a program 7# the Free Software Foundation; either version 3 of the License, or
8# that contains a configuration script generated by Autoconf, under 8# (at your option) any later version.
9#
10# This file is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this file. If not, see <http://www.gnu.org/licenses/>.
17#
18# As a special exception to the GNU General Public License,
19# this file may be distributed as part of a program that
20# contains a configuration script generated by Autoconf, under
9# the same distribution terms as the rest of that program. 21# the same distribution terms as the rest of that program.
10# 22#
11# Generated by gnulib-tool. 23# Generated by gnulib-tool.
12# 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=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 24# 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
13 25
14 26
15MOSTLYCLEANFILES += core *.stackdump 27MOSTLYCLEANFILES += core *.stackdump
@@ -264,7 +276,7 @@ EXTRA_libgnu_a_SOURCES += readlink.c
264 276
265## end gnulib module readlink 277## end gnulib module readlink
266 278
267## begin gnulib module signal 279## begin gnulib module signal-h
268 280
269BUILT_SOURCES += signal.h 281BUILT_SOURCES += signal.h
270 282
@@ -279,11 +291,13 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
279 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 291 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
280 -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ 292 -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \
281 -e 's|@''GNULIB_PTHREAD_SIGMASK''@|$(GNULIB_PTHREAD_SIGMASK)|g' \ 293 -e 's|@''GNULIB_PTHREAD_SIGMASK''@|$(GNULIB_PTHREAD_SIGMASK)|g' \
294 -e 's|@''GNULIB_RAISE''@|$(GNULIB_RAISE)|g' \
282 -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \ 295 -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \
283 -e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \ 296 -e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \
284 -e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \ 297 -e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \
285 -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ 298 -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \
286 -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \ 299 -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \
300 -e 's|@''HAVE_RAISE''@|$(HAVE_RAISE)|g' \
287 -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ 301 -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \
288 -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \ 302 -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \
289 -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \ 303 -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \
@@ -291,6 +305,7 @@ signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
291 -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \ 305 -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \
292 -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \ 306 -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \
293 -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \ 307 -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \
308 -e 's|@''REPLACE_RAISE''@|$(REPLACE_RAISE)|g' \
294 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ 309 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
295 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ 310 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
296 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ 311 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
@@ -301,7 +316,7 @@ MOSTLYCLEANFILES += signal.h signal.h-t
301 316
302EXTRA_DIST += signal.in.h 317EXTRA_DIST += signal.in.h
303 318
304## end gnulib module signal 319## end gnulib module signal-h
305 320
306## begin gnulib module sigprocmask 321## begin gnulib module sigprocmask
307 322
@@ -553,6 +568,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
553 -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ 568 -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
554 -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \ 569 -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \
555 -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \ 570 -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \
571 -e 's/@''GNULIB_FDOPEN''@/$(GNULIB_FDOPEN)/g' \
556 -e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \ 572 -e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \
557 -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \ 573 -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \
558 -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \ 574 -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \
@@ -577,6 +593,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
577 -e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \ 593 -e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \
578 -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \ 594 -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \
579 -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \ 595 -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \
596 -e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \
580 -e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \ 597 -e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \
581 -e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \ 598 -e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \
582 -e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \ 599 -e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \
@@ -615,11 +632,14 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
615 -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ 632 -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \
616 -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \ 633 -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \
617 -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \ 634 -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \
635 -e 's|@''HAVE_PCLOSE''@|$(HAVE_PCLOSE)|g' \
636 -e 's|@''HAVE_POPEN''@|$(HAVE_POPEN)|g' \
618 -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ 637 -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \
619 -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ 638 -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
620 -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ 639 -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \
621 -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ 640 -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \
622 -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ 641 -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \
642 -e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \
623 -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ 643 -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
624 -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ 644 -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
625 -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ 645 -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
@@ -826,6 +846,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
826 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 846 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
827 -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ 847 -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
828 -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ 848 -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
849 -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \
829 -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ 850 -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
830 -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \ 851 -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \
831 -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \ 852 -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \
@@ -943,8 +964,10 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
943 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ 964 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
944 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 965 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
945 -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ 966 -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
967 -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \
946 -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ 968 -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
947 -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ 969 -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
970 -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \
948 -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ 971 -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \
949 -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ 972 -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \
950 -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \ 973 -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \
@@ -952,6 +975,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
952 -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \ 975 -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \
953 -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \ 976 -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \
954 -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \ 977 -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \
978 -e 's/@''GNULIB_FDATASYNC''@/$(GNULIB_FDATASYNC)/g' \
955 -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \ 979 -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \
956 -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \ 980 -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \
957 -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \ 981 -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \
@@ -995,6 +1019,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
995 -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ 1019 -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \
996 -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ 1020 -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \
997 -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ 1021 -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \
1022 -e 's|@''HAVE_FDATASYNC''@|$(HAVE_FDATASYNC)|g' \
998 -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ 1023 -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
999 -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ 1024 -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
1000 -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ 1025 -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
@@ -1019,6 +1044,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
1019 -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ 1044 -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
1020 -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ 1045 -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
1021 -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ 1046 -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \
1047 -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \
1022 -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ 1048 -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \
1023 -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ 1049 -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
1024 -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ 1050 -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
diff --git a/lib/signal.in.h b/lib/signal.in.h
index 93787f753fa..b0e192feeae 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -152,6 +152,29 @@ _GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - "
152#endif 152#endif
153 153
154 154
155#if @GNULIB_RAISE@
156# if @REPLACE_RAISE@
157# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
158# undef raise
159# define raise rpl_raise
160# endif
161_GL_FUNCDECL_RPL (raise, int, (int sig));
162_GL_CXXALIAS_RPL (raise, int, (int sig));
163# else
164# if !@HAVE_RAISE@
165_GL_FUNCDECL_SYS (raise, int, (int sig));
166# endif
167_GL_CXXALIAS_SYS (raise, int, (int sig));
168# endif
169_GL_CXXALIASWARN (raise);
170#elif defined GNULIB_POSIXCHECK
171# undef raise
172/* Assume raise is always declared. */
173_GL_WARN_ON_USE (raise, "raise can crash on native Windows - "
174 "use gnulib module raise for portability");
175#endif
176
177
155#if @GNULIB_SIGPROCMASK@ 178#if @GNULIB_SIGPROCMASK@
156# if !@HAVE_POSIX_SIGNALBLOCKING@ 179# if !@HAVE_POSIX_SIGNALBLOCKING@
157 180
diff --git a/lib/sigprocmask.c b/lib/sigprocmask.c
index 6780a37b14f..6ccac5a8343 100644
--- a/lib/sigprocmask.c
+++ b/lib/sigprocmask.c
@@ -24,6 +24,10 @@
24#include <stdint.h> 24#include <stdint.h>
25#include <stdlib.h> 25#include <stdlib.h>
26 26
27#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
28# include "msvc-inval.h"
29#endif
30
27/* We assume that a platform without POSIX signal blocking functions 31/* We assume that a platform without POSIX signal blocking functions
28 also does not have the POSIX sigaction() function, only the 32 also does not have the POSIX sigaction() function, only the
29 signal() function. We also assume signal() has SysV semantics, 33 signal() function. We also assume signal() has SysV semantics,
@@ -58,6 +62,28 @@
58 62
59typedef void (*handler_t) (int); 63typedef void (*handler_t) (int);
60 64
65#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
66static inline handler_t
67signal_nothrow (int sig, handler_t handler)
68{
69 handler_t result;
70
71 TRY_MSVC_INVAL
72 {
73 result = signal (sig, handler);
74 }
75 CATCH_MSVC_INVAL
76 {
77 result = SIG_ERR;
78 errno = EINVAL;
79 }
80 DONE_MSVC_INVAL;
81
82 return result;
83}
84# define signal signal_nothrow
85#endif
86
61/* Handling of gnulib defined signals. */ 87/* Handling of gnulib defined signals. */
62 88
63#if GNULIB_defined_SIGPIPE 89#if GNULIB_defined_SIGPIPE
@@ -80,6 +106,7 @@ ext_signal (int sig, handler_t handler)
80 return signal (sig, handler); 106 return signal (sig, handler);
81 } 107 }
82} 108}
109# undef signal
83# define signal ext_signal 110# define signal ext_signal
84#endif 111#endif
85 112
diff --git a/lib/stat.c b/lib/stat.c
index 1002f161bfa..1397aa93290 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -46,6 +46,15 @@ orig_stat (const char *filename, struct stat *buf)
46#include "dosname.h" 46#include "dosname.h"
47#include "verify.h" 47#include "verify.h"
48 48
49#if REPLACE_FUNC_STAT_DIR
50# include "pathmax.h"
51 /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also
52 have a constant PATH_MAX. */
53# ifndef PATH_MAX
54# error "Please port this replacement to your platform"
55# endif
56#endif
57
49/* Store information about NAME into ST. Work around bugs with 58/* Store information about NAME into ST. Work around bugs with
50 trailing slashes. Mingw has other bugs (such as st_ino always 59 trailing slashes. Mingw has other bugs (such as st_ino always
51 being 0 on success) which this wrapper does not work around. But 60 being 0 on success) which this wrapper does not work around. But
@@ -70,11 +79,6 @@ rpl_stat (char const *name, struct stat *st)
70 } 79 }
71#endif /* REPLACE_FUNC_STAT_FILE */ 80#endif /* REPLACE_FUNC_STAT_FILE */
72#if REPLACE_FUNC_STAT_DIR 81#if REPLACE_FUNC_STAT_DIR
73 /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also
74 have a constant PATH_MAX. */
75# ifndef PATH_MAX
76# error "Please port this replacement to your platform"
77# endif
78 82
79 if (result == -1 && errno == ENOENT) 83 if (result == -1 && errno == ENOENT)
80 { 84 {
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 473c84ce3e4..ce00af574a8 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -170,6 +170,26 @@ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
170 "use gnulib module fclose for portable POSIX compliance"); 170 "use gnulib module fclose for portable POSIX compliance");
171#endif 171#endif
172 172
173#if @GNULIB_FDOPEN@
174# if @REPLACE_FDOPEN@
175# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
176# undef fdopen
177# define fdopen rpl_fdopen
178# endif
179_GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode)
180 _GL_ARG_NONNULL ((2)));
181_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
182# else
183_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
184# endif
185_GL_CXXALIASWARN (fdopen);
186#elif defined GNULIB_POSIXCHECK
187# undef fdopen
188/* Assume fdopen is always declared. */
189_GL_WARN_ON_USE (fdopen, "fdopen on Win32 platforms is not POSIX compatible - "
190 "use gnulib module fdopen for portability");
191#endif
192
173#if @GNULIB_FFLUSH@ 193#if @GNULIB_FFLUSH@
174/* Flush all pending data on STREAM according to POSIX rules. Both 194/* Flush all pending data on STREAM according to POSIX rules. Both
175 output and seekable input streams are supported. 195 output and seekable input streams are supported.
@@ -750,6 +770,20 @@ _GL_CXXALIAS_SYS (obstack_vprintf, int,
750_GL_CXXALIASWARN (obstack_vprintf); 770_GL_CXXALIASWARN (obstack_vprintf);
751#endif 771#endif
752 772
773#if @GNULIB_PCLOSE@
774# if !@HAVE_PCLOSE@
775_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
776# endif
777_GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
778_GL_CXXALIASWARN (pclose);
779#elif defined GNULIB_POSIXCHECK
780# undef pclose
781# if HAVE_RAW_DECL_PCLOSE
782_GL_WARN_ON_USE (pclose, "popen is unportable - "
783 "use gnulib module pclose for more portability");
784# endif
785#endif
786
753#if @GNULIB_PERROR@ 787#if @GNULIB_PERROR@
754/* Print a message to standard error, describing the value of ERRNO, 788/* Print a message to standard error, describing the value of ERRNO,
755 (if STRING is not NULL and not empty) prefixed with STRING and ": ", 789 (if STRING is not NULL and not empty) prefixed with STRING and ": ",
@@ -781,6 +815,10 @@ _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
781 _GL_ARG_NONNULL ((1, 2))); 815 _GL_ARG_NONNULL ((1, 2)));
782_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); 816_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
783# else 817# else
818# if !@HAVE_POPEN@
819_GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode)
820 _GL_ARG_NONNULL ((1, 2)));
821# endif
784_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); 822_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
785# endif 823# endif
786_GL_CXXALIASWARN (popen); 824_GL_CXXALIASWARN (popen);
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 5acee705f8a..77a7177ca64 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -55,10 +55,17 @@
55/* The definition of _GL_WARN_ON_USE is copied here. */ 55/* The definition of _GL_WARN_ON_USE is copied here. */
56 56
57/* Before doing "#define mkdir rpl_mkdir" below, we need to include all 57/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
58 headers that may declare mkdir(). */ 58 headers that may declare mkdir(). Native Windows platforms declare mkdir
59 in <io.h> and/or <direct.h>, not in <unistd.h>. */
59#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 60#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
60# include <io.h> /* mingw32, mingw64 */ 61# include <io.h> /* mingw32, mingw64 */
61# include <direct.h> /* mingw64 */ 62# include <direct.h> /* mingw64, MSVC 9 */
63#endif
64
65#ifndef S_IFIFO
66# ifdef _S_IFIFO
67# define S_IFIFO _S_IFIFO
68# endif
62#endif 69#endif
63 70
64#ifndef S_IFMT 71#ifndef S_IFMT
@@ -312,16 +319,25 @@ _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
312#endif 319#endif
313 320
314 321
315#if @REPLACE_FSTAT@ 322#if @GNULIB_FSTAT@
316# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 323# if @REPLACE_FSTAT@
317# define fstat rpl_fstat 324# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
318# endif 325# undef fstat
326# define fstat rpl_fstat
327# endif
319_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); 328_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
320_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); 329_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
321#else 330# else
322_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); 331_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
323#endif 332# endif
324_GL_CXXALIASWARN (fstat); 333_GL_CXXALIASWARN (fstat);
334#elif defined GNULIB_POSIXCHECK
335# undef fstat
336# if HAVE_RAW_DECL_FSTAT
337_GL_WARN_ON_USE (fstat, "fstat has portability problems - "
338 "use gnulib module fstat for portability");
339# endif
340#endif
325 341
326 342
327#if @GNULIB_FSTATAT@ 343#if @GNULIB_FSTATAT@
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 119cd142f43..77e5675aad2 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -75,18 +75,21 @@
75#endif 75#endif
76 76
77/* mingw fails to declare _exit in <unistd.h>. */ 77/* mingw fails to declare _exit in <unistd.h>. */
78/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */ 78/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
79 <unistd.h>. */
79/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ 80/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
80/* But avoid namespace pollution on glibc systems. */ 81/* But avoid namespace pollution on glibc systems. */
81#ifndef __GLIBC__ 82#ifndef __GLIBC__
82# include <stdlib.h> 83# include <stdlib.h>
83#endif 84#endif
84 85
85/* mingw declares getcwd in <io.h>, not in <unistd.h>. */ 86/* Native Windows platforms declare chdir, getcwd, rmdir in
86#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \ 87 <io.h> and/or <direct.h>, not in <unistd.h>. */
88#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
89 || defined GNULIB_POSIXCHECK) \
87 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) 90 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
88# include <io.h> /* mingw32, mingw64 */ 91# include <io.h> /* mingw32, mingw64 */
89# include <direct.h> /* mingw64 */ 92# include <direct.h> /* mingw64, MSVC 9 */
90#endif 93#endif
91 94
92/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. 95/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
@@ -98,6 +101,12 @@
98# include <netdb.h> 101# include <netdb.h>
99#endif 102#endif
100 103
104/* MSVC defines off_t in <sys/types.h>. */
105#if !@HAVE_UNISTD_H@
106/* Get off_t. */
107# include <sys/types.h>
108#endif
109
101#if (@GNULIB_READ@ || @GNULIB_WRITE@ \ 110#if (@GNULIB_READ@ || @GNULIB_WRITE@ \
102 || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ 111 || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
103 || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) 112 || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
@@ -224,12 +233,24 @@ _GL_WARN_ON_USE (access, "the access function is a security risk - "
224#endif 233#endif
225 234
226 235
236#if @GNULIB_CHDIR@
237_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
238_GL_CXXALIASWARN (chdir);
239#elif defined GNULIB_POSIXCHECK
240# undef chdir
241# if HAVE_RAW_DECL_CHDIR
242_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
243 "use gnulib module chdir for portability");
244# endif
245#endif
246
247
227#if @GNULIB_CHOWN@ 248#if @GNULIB_CHOWN@
228/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE 249/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
229 to GID (if GID is not -1). Follow symbolic links. 250 to GID (if GID is not -1). Follow symbolic links.
230 Return 0 if successful, otherwise -1 and errno set. 251 Return 0 if successful, otherwise -1 and errno set.
231 See the POSIX:2001 specification 252 See the POSIX:2008 specification
232 <http://www.opengroup.org/susv3xsh/chown.html>. */ 253 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
233# if @REPLACE_CHOWN@ 254# if @REPLACE_CHOWN@
234# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 255# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
235# undef chown 256# undef chown
@@ -280,24 +301,32 @@ _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
280#endif 301#endif
281 302
282 303
283#if @REPLACE_DUP@ 304#if @GNULIB_DUP@
284# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 305# if @REPLACE_DUP@
285# define dup rpl_dup 306# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
286# endif 307# define dup rpl_dup
308# endif
287_GL_FUNCDECL_RPL (dup, int, (int oldfd)); 309_GL_FUNCDECL_RPL (dup, int, (int oldfd));
288_GL_CXXALIAS_RPL (dup, int, (int oldfd)); 310_GL_CXXALIAS_RPL (dup, int, (int oldfd));
289#else 311# else
290_GL_CXXALIAS_SYS (dup, int, (int oldfd)); 312_GL_CXXALIAS_SYS (dup, int, (int oldfd));
291#endif 313# endif
292_GL_CXXALIASWARN (dup); 314_GL_CXXALIASWARN (dup);
315#elif defined GNULIB_POSIXCHECK
316# undef dup
317# if HAVE_RAW_DECL_DUP
318_GL_WARN_ON_USE (dup, "dup is unportable - "
319 "use gnulib module dup for portability");
320# endif
321#endif
293 322
294 323
295#if @GNULIB_DUP2@ 324#if @GNULIB_DUP2@
296/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if 325/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
297 NEWFD = OLDFD, otherwise close NEWFD first if it is open. 326 NEWFD = OLDFD, otherwise close NEWFD first if it is open.
298 Return newfd if successful, otherwise -1 and errno set. 327 Return newfd if successful, otherwise -1 and errno set.
299 See the POSIX:2001 specification 328 See the POSIX:2008 specification
300 <http://www.opengroup.org/susv3xsh/dup2.html>. */ 329 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
301# if @REPLACE_DUP2@ 330# if @REPLACE_DUP2@
302# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 331# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
303# define dup2 rpl_dup2 332# define dup2 rpl_dup2
@@ -426,8 +455,8 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
426/* Change the process' current working directory to the directory on which 455/* Change the process' current working directory to the directory on which
427 the given file descriptor is open. 456 the given file descriptor is open.
428 Return 0 if successful, otherwise -1 and errno set. 457 Return 0 if successful, otherwise -1 and errno set.
429 See the POSIX:2001 specification 458 See the POSIX:2008 specification
430 <http://www.opengroup.org/susv3xsh/fchdir.html>. */ 459 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
431# if ! @HAVE_FCHDIR@ 460# if ! @HAVE_FCHDIR@
432_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 461_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
433 462
@@ -484,11 +513,30 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
484#endif 513#endif
485 514
486 515
487#if @GNULIB_FSYNC@ 516#if @GNULIB_FDATASYNC@
488/* Synchronize changes to a file. 517/* Synchronize changes to a file.
489 Return 0 if successful, otherwise -1 and errno set. 518 Return 0 if successful, otherwise -1 and errno set.
490 See POSIX:2001 specification 519 See POSIX:2008 specification
491 <http://www.opengroup.org/susv3xsh/fsync.html>. */ 520 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
521# if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
522_GL_FUNCDECL_SYS (fdatasync, int, (int fd));
523# endif
524_GL_CXXALIAS_SYS (fdatasync, int, (int fd));
525_GL_CXXALIASWARN (fdatasync);
526#elif defined GNULIB_POSIXCHECK
527# undef fdatasync
528# if HAVE_RAW_DECL_FDATASYNC
529_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
530 "use gnulib module fdatasync for portability");
531# endif
532#endif
533
534
535#if @GNULIB_FSYNC@
536/* Synchronize changes, including metadata, to a file.
537 Return 0 if successful, otherwise -1 and errno set.
538 See POSIX:2008 specification
539 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
492# if !@HAVE_FSYNC@ 540# if !@HAVE_FSYNC@
493_GL_FUNCDECL_SYS (fsync, int, (int fd)); 541_GL_FUNCDECL_SYS (fsync, int, (int fd));
494# endif 542# endif
@@ -506,8 +554,8 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
506#if @GNULIB_FTRUNCATE@ 554#if @GNULIB_FTRUNCATE@
507/* Change the size of the file to which FD is opened to become equal to LENGTH. 555/* Change the size of the file to which FD is opened to become equal to LENGTH.
508 Return 0 if successful, otherwise -1 and errno set. 556 Return 0 if successful, otherwise -1 and errno set.
509 See the POSIX:2001 specification 557 See the POSIX:2008 specification
510 <http://www.opengroup.org/susv3xsh/ftruncate.html>. */ 558 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
511# if !@HAVE_FTRUNCATE@ 559# if !@HAVE_FTRUNCATE@
512_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); 560_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
513# endif 561# endif
@@ -527,8 +575,8 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
527 of BUF. 575 of BUF.
528 Return BUF if successful, or NULL if the directory couldn't be determined 576 Return BUF if successful, or NULL if the directory couldn't be determined
529 or SIZE was too small. 577 or SIZE was too small.
530 See the POSIX:2001 specification 578 See the POSIX:2008 specification
531 <http://www.opengroup.org/susv3xsh/getcwd.html>. 579 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
532 Additionally, the gnulib module 'getcwd' guarantees the following GNU 580 Additionally, the gnulib module 'getcwd' guarantees the following GNU
533 extension: If BUF is NULL, an array is allocated with 'malloc'; the array 581 extension: If BUF is NULL, an array is allocated with 'malloc'; the array
534 is SIZE bytes long, unless SIZE == 0, in which case it is as big as 582 is SIZE bytes long, unless SIZE == 0, in which case it is as big as
@@ -891,8 +939,8 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - "
891/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE 939/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
892 to GID (if GID is not -1). Do not follow symbolic links. 940 to GID (if GID is not -1). Do not follow symbolic links.
893 Return 0 if successful, otherwise -1 and errno set. 941 Return 0 if successful, otherwise -1 and errno set.
894 See the POSIX:2001 specification 942 See the POSIX:2008 specification
895 <http://www.opengroup.org/susv3xsh/lchown.html>. */ 943 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
896# if @REPLACE_LCHOWN@ 944# if @REPLACE_LCHOWN@
897# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 945# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
898# undef lchown 946# undef lchown
@@ -921,8 +969,8 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
921#if @GNULIB_LINK@ 969#if @GNULIB_LINK@
922/* Create a new hard link for an existing file. 970/* Create a new hard link for an existing file.
923 Return 0 if successful, otherwise -1 and errno set. 971 Return 0 if successful, otherwise -1 and errno set.
924 See POSIX:2001 specification 972 See POSIX:2008 specification
925 <http://www.opengroup.org/susv3xsh/link.html>. */ 973 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
926# if @REPLACE_LINK@ 974# if @REPLACE_LINK@
927# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 975# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
928# define link rpl_link 976# define link rpl_link
@@ -987,8 +1035,8 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - "
987#if @GNULIB_LSEEK@ 1035#if @GNULIB_LSEEK@
988/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. 1036/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
989 Return the new offset if successful, otherwise -1 and errno set. 1037 Return the new offset if successful, otherwise -1 and errno set.
990 See the POSIX:2001 specification 1038 See the POSIX:2008 specification
991 <http://www.opengroup.org/susv3xsh/lseek.html>. */ 1039 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
992# if @REPLACE_LSEEK@ 1040# if @REPLACE_LSEEK@
993# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1041# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
994# define lseek rpl_lseek 1042# define lseek rpl_lseek
@@ -1058,8 +1106,9 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1058#if @GNULIB_PREAD@ 1106#if @GNULIB_PREAD@
1059/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. 1107/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
1060 Return the number of bytes placed into BUF if successful, otherwise 1108 Return the number of bytes placed into BUF if successful, otherwise
1061 set errno and return -1. 0 indicates EOF. See the POSIX:2001 1109 set errno and return -1. 0 indicates EOF.
1062 specification <http://www.opengroup.org/susv3xsh/pread.html>. */ 1110 See the POSIX:2008 specification
1111 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
1063# if @REPLACE_PREAD@ 1112# if @REPLACE_PREAD@
1064# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1113# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1065# undef pread 1114# undef pread
@@ -1093,8 +1142,8 @@ _GL_WARN_ON_USE (pread, "pread is unportable - "
1093/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. 1142/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1094 Return the number of bytes written if successful, otherwise 1143 Return the number of bytes written if successful, otherwise
1095 set errno and return -1. 0 indicates nothing written. See the 1144 set errno and return -1. 0 indicates nothing written. See the
1096 POSIX:2001 specification 1145 POSIX:2008 specification
1097 <http://www.opengroup.org/susv3xsh/pwrite.html>. */ 1146 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
1098# if @REPLACE_PWRITE@ 1147# if @REPLACE_PWRITE@
1099# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1148# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1100# undef pwrite 1149# undef pwrite
@@ -1126,9 +1175,9 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1126 1175
1127#if @GNULIB_READ@ 1176#if @GNULIB_READ@
1128/* Read up to COUNT bytes from file descriptor FD into the buffer starting 1177/* Read up to COUNT bytes from file descriptor FD into the buffer starting
1129 at BUF. See the POSIX:2001 specification 1178 at BUF. See the POSIX:2008 specification
1130 <http://www.opengroup.org/susv3xsh/read.html>. */ 1179 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
1131# if @REPLACE_READ@ && @GNULIB_UNISTD_H_NONBLOCKING@ 1180# if @REPLACE_READ@
1132# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1181# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1133# undef read 1182# undef read
1134# define read rpl_read 1183# define read rpl_read
@@ -1150,8 +1199,8 @@ _GL_CXXALIASWARN (read);
1150/* Read the contents of the symbolic link FILE and place the first BUFSIZE 1199/* Read the contents of the symbolic link FILE and place the first BUFSIZE
1151 bytes of it into BUF. Return the number of bytes placed into BUF if 1200 bytes of it into BUF. Return the number of bytes placed into BUF if
1152 successful, otherwise -1 and errno set. 1201 successful, otherwise -1 and errno set.
1153 See the POSIX:2001 specification 1202 See the POSIX:2008 specification
1154 <http://www.opengroup.org/susv3xsh/readlink.html>. */ 1203 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
1155# if @REPLACE_READLINK@ 1204# if @REPLACE_READLINK@
1156# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1205# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1157# define readlink rpl_readlink 1206# define readlink rpl_readlink
@@ -1222,8 +1271,8 @@ _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1222#if @GNULIB_SLEEP@ 1271#if @GNULIB_SLEEP@
1223/* Pause the execution of the current thread for N seconds. 1272/* Pause the execution of the current thread for N seconds.
1224 Returns the number of seconds left to sleep. 1273 Returns the number of seconds left to sleep.
1225 See the POSIX:2001 specification 1274 See the POSIX:2008 specification
1226 <http://www.opengroup.org/susv3xsh/sleep.html>. */ 1275 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
1227# if @REPLACE_SLEEP@ 1276# if @REPLACE_SLEEP@
1228# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1277# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1229# undef sleep 1278# undef sleep
@@ -1372,7 +1421,7 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1372/* Pause the execution of the current thread for N microseconds. 1421/* Pause the execution of the current thread for N microseconds.
1373 Returns 0 on completion, or -1 on range error. 1422 Returns 0 on completion, or -1 on range error.
1374 See the POSIX:2001 specification 1423 See the POSIX:2001 specification
1375 <http://www.opengroup.org/susv3xsh/sleep.html>. */ 1424 <http://www.opengroup.org/susv3xsh/usleep.html>. */
1376# if @REPLACE_USLEEP@ 1425# if @REPLACE_USLEEP@
1377# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1426# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1378# undef usleep 1427# undef usleep
@@ -1398,9 +1447,9 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
1398 1447
1399#if @GNULIB_WRITE@ 1448#if @GNULIB_WRITE@
1400/* Write up to COUNT bytes starting at BUF to file descriptor FD. 1449/* Write up to COUNT bytes starting at BUF to file descriptor FD.
1401 See the POSIX:2001 specification 1450 See the POSIX:2008 specification
1402 <http://www.opengroup.org/susv3xsh/write.html>. */ 1451 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
1403# if @REPLACE_WRITE@ && (@GNULIB_UNISTD_H_NONBLOCKING@ || @GNULIB_UNISTD_H_SIGPIPE@) 1452# if @REPLACE_WRITE@
1404# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1453# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1405# undef write 1454# undef write
1406# define write rpl_write 1455# define write rpl_write
diff --git a/m4/dup2.m4 b/m4/dup2.m4
index 5c2cc9674c1..cd9d254b440 100644
--- a/m4/dup2.m4
+++ b/m4/dup2.m4
@@ -1,4 +1,4 @@
1#serial 14 1#serial 16
2dnl Copyright (C) 2002, 2005, 2007, 2009-2011 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2005, 2007, 2009-2011 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,
@@ -71,3 +71,6 @@ AC_DEFUN([gl_FUNC_DUP2],
71 fi 71 fi
72 ]) 72 ])
73]) 73])
74
75# Prerequisites of lib/dup2.c.
76AC_DEFUN([gl_PREREQ_DUP2], [])
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index b75e05fa056..b16f40de0aa 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -7,7 +7,7 @@
7# gives unlimited permission to copy and/or distribute it, 7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved. 8# with or without modifications, as long as this notice is preserved.
9 9
10#serial 4 10#serial 5
11 11
12# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent. 12# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
13# New applications should use gl_GETLOADAVG instead. 13# New applications should use gl_GETLOADAVG instead.
@@ -91,10 +91,10 @@ else
91 HAVE_SYS_LOADAVG_H=0 91 HAVE_SYS_LOADAVG_H=0
92fi 92fi
93AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0], 93AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0],
94 [#if HAVE_SYS_LOADAVG_H 94 [[#if HAVE_SYS_LOADAVG_H
95 # include <sys/loadavg.h> 95 # include <sys/loadavg.h>
96 #endif 96 #endif
97 #include <stdlib.h>]) 97 #include <stdlib.h>]])
98])# gl_GETLOADAVG 98])# gl_GETLOADAVG
99 99
100 100
diff --git a/m4/gl-comp.m4 b/m4/gl-comp.m4
index f7d99ca6f44..04234bb6ef3 100644
--- a/m4/gl-comp.m4
+++ b/m4/gl-comp.m4
@@ -1,10 +1,22 @@
1# DO NOT EDIT! GENERATED AUTOMATICALLY! 1# DO NOT EDIT! GENERATED AUTOMATICALLY!
2# Copyright (C) 2002-2011 Free Software Foundation, Inc. 2# Copyright (C) 2002-2011 Free Software Foundation, Inc.
3# 3#
4# This file is free software, distributed under the terms of the GNU 4# This file is free software; you can redistribute it and/or modify
5# General Public License. As a special exception to the GNU General 5# it under the terms of the GNU General Public License as published by
6# Public License, this file may be distributed as part of a program 6# the Free Software Foundation; either version 3 of the License, or
7# that contains a configuration script generated by Autoconf, under 7# (at your option) any later version.
8#
9# This file is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this file. If not, see <http://www.gnu.org/licenses/>.
16#
17# As a special exception to the GNU General Public License,
18# this file may be distributed as part of a program that
19# contains a configuration script generated by Autoconf, under
8# the same distribution terms as the rest of that program. 20# the same distribution terms as the rest of that program.
9# 21#
10# Generated by gnulib-tool. 22# Generated by gnulib-tool.
@@ -55,7 +67,7 @@ AC_DEFUN([gl_EARLY],
55 # Code from module nocrash: 67 # Code from module nocrash:
56 # Code from module pthread_sigmask: 68 # Code from module pthread_sigmask:
57 # Code from module readlink: 69 # Code from module readlink:
58 # Code from module signal: 70 # Code from module signal-h:
59 # Code from module sigprocmask: 71 # Code from module sigprocmask:
60 # Code from module snippet/_Noreturn: 72 # Code from module snippet/_Noreturn:
61 # Code from module snippet/arg-nonnull: 73 # Code from module snippet/arg-nonnull:
@@ -115,6 +127,7 @@ AC_REQUIRE([gl_C99_STRTOLD])
115gl_FUNC_DUP2 127gl_FUNC_DUP2
116if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then 128if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
117 AC_LIBOBJ([dup2]) 129 AC_LIBOBJ([dup2])
130 gl_PREREQ_DUP2
118fi 131fi
119gl_UNISTD_MODULE_INDICATOR([dup2]) 132gl_UNISTD_MODULE_INDICATOR([dup2])
120gl_FILEMODE 133gl_FILEMODE
@@ -233,6 +246,12 @@ if test $HAVE_POSIX_SIGNALBLOCKING = 0; then
233fi 246fi
234gl_SIGNAL_MODULE_INDICATOR([sigprocmask]) 247gl_SIGNAL_MODULE_INDICATOR([sigprocmask])
235 gl_gnulib_enabled_sigprocmask=true 248 gl_gnulib_enabled_sigprocmask=true
249 if $condition; then
250 func_gl_gnulib_m4code_raise
251 fi
252 if $condition; then
253 func_gl_gnulib_m4code_f691f076f650964c9f5598c3ee487616
254 fi
236 fi 255 fi
237 } 256 }
238 func_gl_gnulib_m4code_stat () 257 func_gl_gnulib_m4code_stat ()
@@ -249,6 +268,9 @@ gl_SYS_STAT_MODULE_INDICATOR([stat])
249 func_gl_gnulib_m4code_dosname 268 func_gl_gnulib_m4code_dosname
250 fi 269 fi
251 if $condition; then 270 if $condition; then
271 func_gl_gnulib_m4code_pathmax
272 fi
273 if $condition; then
252 func_gl_gnulib_m4code_verify 274 func_gl_gnulib_m4code_verify
253 fi 275 fi
254 fi 276 fi
@@ -283,6 +305,12 @@ gl_STDLIB_MODULE_INDICATOR([strtoull])
283 gl_gnulib_enabled_verify=true 305 gl_gnulib_enabled_verify=true
284 fi 306 fi
285 } 307 }
308 if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
309 func_gl_gnulib_m4code_f691f076f650964c9f5598c3ee487616
310 fi
311 if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
312 func_gl_gnulib_m4code_676220fa4366efa9bdbfccf11a857c07
313 fi
286 if test $REPLACE_GETOPT = 1; then 314 if test $REPLACE_GETOPT = 1; then
287 func_gl_gnulib_m4code_be453cec5eecf5731a274f2de7f2db36 315 func_gl_gnulib_m4code_be453cec5eecf5731a274f2de7f2db36
288 fi 316 fi
diff --git a/m4/include_next.m4 b/m4/include_next.m4
index 14a1009b5d4..d5230ced8de 100644
--- a/m4/include_next.m4
+++ b/m4/include_next.m4
@@ -1,4 +1,4 @@
1# include_next.m4 serial 21 1# include_next.m4 serial 22
2dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2011 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,
@@ -223,9 +223,11 @@ changequote(,)
223 ;; 223 ;;
224 esac 224 esac
225changequote([,]) 225changequote([,])
226 gl_absolute_header_sed='\#'"${gl_dirsep_regex}"']m4_defn([gl_HEADER_NAME])[#{ 226 gl_absolute_header_sed='\|'"${gl_dirsep_regex}"']m4_defn([gl_HEADER_NAME])[|{
227 s#.*"\(.*'"${gl_dirsep_regex}"']m4_defn([gl_HEADER_NAME])[\)".*#\1# 227 s|.*"\(.*'"${gl_dirsep_regex}"']m4_defn([gl_HEADER_NAME])[\)".*|\1|
228 s#^/[^/]#//&# 228changequote(,)dnl
229 s|^/[^/]|//&|
230changequote([,])dnl
229 p 231 p
230 q 232 q
231 }' 233 }'
diff --git a/m4/signal_h.m4 b/m4/signal_h.m4
index c3f25386ca2..5cf54a062fc 100644
--- a/m4/signal_h.m4
+++ b/m4/signal_h.m4
@@ -1,4 +1,4 @@
1# signal_h.m4 serial 17 1# signal_h.m4 serial 18
2dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2011 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,
@@ -62,12 +62,14 @@ AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR],
62AC_DEFUN([gl_SIGNAL_H_DEFAULTS], 62AC_DEFUN([gl_SIGNAL_H_DEFAULTS],
63[ 63[
64 GNULIB_PTHREAD_SIGMASK=0; AC_SUBST([GNULIB_PTHREAD_SIGMASK]) 64 GNULIB_PTHREAD_SIGMASK=0; AC_SUBST([GNULIB_PTHREAD_SIGMASK])
65 GNULIB_RAISE=0; AC_SUBST([GNULIB_RAISE])
65 GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE]) 66 GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE])
66 GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK]) 67 GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK])
67 GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION]) 68 GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION])
68 dnl Assume proper GNU behavior unless another module says otherwise. 69 dnl Assume proper GNU behavior unless another module says otherwise.
69 HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING]) 70 HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING])
70 HAVE_PTHREAD_SIGMASK=1; AC_SUBST([HAVE_PTHREAD_SIGMASK]) 71 HAVE_PTHREAD_SIGMASK=1; AC_SUBST([HAVE_PTHREAD_SIGMASK])
72 HAVE_RAISE=1; AC_SUBST([HAVE_RAISE])
71 HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T]) 73 HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T])
72 HAVE_SIGINFO_T=1; AC_SUBST([HAVE_SIGINFO_T]) 74 HAVE_SIGINFO_T=1; AC_SUBST([HAVE_SIGINFO_T])
73 HAVE_SIGACTION=1; AC_SUBST([HAVE_SIGACTION]) 75 HAVE_SIGACTION=1; AC_SUBST([HAVE_SIGACTION])
@@ -77,4 +79,5 @@ AC_DEFUN([gl_SIGNAL_H_DEFAULTS],
77 AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T]) 79 AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T])
78 HAVE_SIGHANDLER_T=1; AC_SUBST([HAVE_SIGHANDLER_T]) 80 HAVE_SIGHANDLER_T=1; AC_SUBST([HAVE_SIGHANDLER_T])
79 REPLACE_PTHREAD_SIGMASK=0; AC_SUBST([REPLACE_PTHREAD_SIGMASK]) 81 REPLACE_PTHREAD_SIGMASK=0; AC_SUBST([REPLACE_PTHREAD_SIGMASK])
82 REPLACE_RAISE=0; AC_SUBST([REPLACE_RAISE])
80]) 83])
diff --git a/m4/signalblocking.m4 b/m4/signalblocking.m4
index 15b74253ba6..eda856d04f9 100644
--- a/m4/signalblocking.m4
+++ b/m4/signalblocking.m4
@@ -1,4 +1,4 @@
1# signalblocking.m4 serial 12 1# signalblocking.m4 serial 13
2dnl Copyright (C) 2001-2002, 2006-2011 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2002, 2006-2011 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,4 +22,6 @@ AC_DEFUN([gl_SIGNALBLOCKING],
22]) 22])
23 23
24# Prerequisites of lib/sigprocmask.c. 24# Prerequisites of lib/sigprocmask.c.
25AC_DEFUN([gl_PREREQ_SIGPROCMASK], [:]) 25AC_DEFUN([gl_PREREQ_SIGPROCMASK], [
26 AC_REQUIRE([AC_C_INLINE])
27])
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index c75e95722a5..092161c9968 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -466,6 +466,14 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
466 fi 466 fi
467 gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], 467 gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t],
468 [gl_STDINT_INCLUDES]) 468 [gl_STDINT_INCLUDES])
469
470 dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99
471 dnl requirement that wint_t is "unchanged by default argument promotions".
472 dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t.
473 dnl Set the variable BITSIZEOF_WINT_T accordingly.
474 if test $BITSIZEOF_WINT_T -lt 32; then
475 BITSIZEOF_WINT_T=32
476 fi
469]) 477])
470 478
471dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. 479dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index a8326f3c349..39bf80e2ac9 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,4 +1,4 @@
1# stdio_h.m4 serial 37 1# stdio_h.m4 serial 40
2dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2011 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,
@@ -74,7 +74,7 @@ AC_DEFUN([gl_STDIO_H],
74 dnl corresponding gnulib module is not in use, and which is not 74 dnl corresponding gnulib module is not in use, and which is not
75 dnl guaranteed by C89. 75 dnl guaranteed by C89.
76 gl_WARN_ON_USE_PREPARE([[#include <stdio.h> 76 gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
77 ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat 77 ]], [dprintf fpurge fseeko ftello getdelim getline pclose popen renameat
78 snprintf tmpfile vdprintf vsnprintf]) 78 snprintf tmpfile vdprintf vsnprintf])
79]) 79])
80 80
@@ -91,6 +91,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
91[ 91[
92 GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) 92 GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF])
93 GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) 93 GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE])
94 GNULIB_FDOPEN=0; AC_SUBST([GNULIB_FDOPEN])
94 GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) 95 GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
95 GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC]) 96 GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC])
96 GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS]) 97 GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS])
@@ -115,6 +116,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
115 GNULIB_GETS=0; AC_SUBST([GNULIB_GETS]) 116 GNULIB_GETS=0; AC_SUBST([GNULIB_GETS])
116 GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) 117 GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF])
117 GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) 118 GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
119 GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE])
118 GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) 120 GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR])
119 GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN]) 121 GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN])
120 GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) 122 GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF])
@@ -153,11 +155,14 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
153 HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) 155 HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF])
154 HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) 156 HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
155 HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) 157 HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
158 HAVE_PCLOSE=1; AC_SUBST([HAVE_PCLOSE])
159 HAVE_POPEN=1; AC_SUBST([HAVE_POPEN])
156 HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT]) 160 HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT])
157 HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) 161 HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
158 HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) 162 HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF])
159 REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF]) 163 REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF])
160 REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE]) 164 REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE])
165 REPLACE_FDOPEN=0; AC_SUBST([REPLACE_FDOPEN])
161 REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) 166 REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
162 REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) 167 REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN])
163 REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) 168 REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF])
diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4
index fc419129e98..83ebac613b7 100644
--- a/m4/sys_stat_h.m4
+++ b/m4/sys_stat_h.m4
@@ -1,4 +1,4 @@
1# sys_stat_h.m4 serial 24 -*- Autoconf -*- 1# sys_stat_h.m4 serial 26 -*- Autoconf -*-
2dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2011 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,
@@ -19,6 +19,9 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
19 19
20 gl_CHECK_NEXT_HEADERS([sys/stat.h]) 20 gl_CHECK_NEXT_HEADERS([sys/stat.h])
21 21
22 dnl Ensure the type mode_t gets defined.
23 AC_REQUIRE([AC_TYPE_MODE_T])
24
22 dnl Define types that are supposed to be defined in <sys/types.h> or 25 dnl Define types that are supposed to be defined in <sys/types.h> or
23 dnl <sys/stat.h>. 26 dnl <sys/stat.h>.
24 AC_CHECK_TYPE([nlink_t], [], 27 AC_CHECK_TYPE([nlink_t], [],
@@ -30,7 +33,7 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
30 dnl Check for declarations of anything we want to poison if the 33 dnl Check for declarations of anything we want to poison if the
31 dnl corresponding gnulib module is not in use. 34 dnl corresponding gnulib module is not in use.
32 gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h> 35 gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
33 ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat 36 ]], [fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
34 mknod mknodat stat utimensat]) 37 mknod mknodat stat utimensat])
35]) # gl_HEADER_SYS_STAT_H 38]) # gl_HEADER_SYS_STAT_H
36 39
@@ -47,6 +50,7 @@ AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
47[ 50[
48 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR 51 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
49 GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT]) 52 GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT])
53 GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT])
50 GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT]) 54 GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT])
51 GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS]) 55 GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS])
52 GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD]) 56 GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
diff --git a/m4/time_h.m4 b/m4/time_h.m4
index 6e6394fdc90..3454b23fa0c 100644
--- a/m4/time_h.m4
+++ b/m4/time_h.m4
@@ -2,7 +2,7 @@
2 2
3# Copyright (C) 2000-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc. 3# Copyright (C) 2000-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc.
4 4
5# serial 5 5# serial 6
6 6
7# This file is free software; the Free Software Foundation 7# This file is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it, 8# gives unlimited permission to copy and/or distribute it,
@@ -23,9 +23,6 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY],
23 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) 23 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
24 gl_NEXT_HEADERS([time.h]) 24 gl_NEXT_HEADERS([time.h])
25 AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) 25 AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
26
27 dnl Ensure the type pid_t gets defined.
28 AC_REQUIRE([AC_TYPE_PID_T])
29]) 26])
30 27
31dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared 28dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index 6483b815d60..57c8094e42c 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,4 +1,4 @@
1# unistd_h.m4 serial 57 1# unistd_h.m4 serial 61
2dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2011 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,
@@ -26,7 +26,10 @@ AC_DEFUN([gl_UNISTD_H],
26 26
27 dnl Check for declarations of anything we want to poison if the 27 dnl Check for declarations of anything we want to poison if the
28 dnl corresponding gnulib module is not in use. 28 dnl corresponding gnulib module is not in use.
29 gl_WARN_ON_USE_PREPARE([[#include <unistd.h> 29 gl_WARN_ON_USE_PREPARE([[
30#if HAVE_UNISTD_H
31# include <unistd.h>
32#endif
30/* Some systems declare various items in the wrong headers. */ 33/* Some systems declare various items in the wrong headers. */
31#if !(defined __GLIBC__ && !defined __UCLIBC__) 34#if !(defined __GLIBC__ && !defined __UCLIBC__)
32# include <fcntl.h> 35# include <fcntl.h>
@@ -36,8 +39,8 @@ AC_DEFUN([gl_UNISTD_H],
36# include <io.h> 39# include <io.h>
37# endif 40# endif
38#endif 41#endif
39 ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat 42 ]], [chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir fchownat
40 fsync ftruncate getcwd getdomainname getdtablesize getgroups 43 fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups
41 gethostname getlogin getlogin_r getpagesize getusershell setusershell 44 gethostname getlogin getlogin_r getpagesize getusershell setusershell
42 endusershell group_member lchown link linkat lseek pipe pipe2 pread pwrite 45 endusershell group_member lchown link linkat lseek pipe pipe2 pread pwrite
43 readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat 46 readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat
@@ -55,8 +58,10 @@ AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
55 58
56AC_DEFUN([gl_UNISTD_H_DEFAULTS], 59AC_DEFUN([gl_UNISTD_H_DEFAULTS],
57[ 60[
61 GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR])
58 GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) 62 GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN])
59 GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) 63 GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE])
64 GNULIB_DUP=0; AC_SUBST([GNULIB_DUP])
60 GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) 65 GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2])
61 GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) 66 GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3])
62 GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) 67 GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON])
@@ -64,6 +69,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
64 GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) 69 GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT])
65 GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) 70 GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR])
66 GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) 71 GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT])
72 GNULIB_FDATASYNC=0; AC_SUBST([GNULIB_FDATASYNC])
67 GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) 73 GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC])
68 GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) 74 GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
69 GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) 75 GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
@@ -107,6 +113,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
107 HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) 113 HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT])
108 HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) 114 HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR])
109 HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) 115 HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT])
116 HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC])
110 HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) 117 HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC])
111 HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) 118 HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE])
112 HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) 119 HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE])
@@ -131,6 +138,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
131 HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) 138 HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP])
132 HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) 139 HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON])
133 HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR]) 140 HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR])
141 HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC])
134 HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME]) 142 HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME])
135 HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) 143 HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
136 HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) 144 HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE])