Subject: gnulib import for MacOS, Irix, Solaris, etc.

From: Paul Eggert <[email-masked]>
Date: Mon, 25 Jul 2011 10:10:01 -0700

Here's a patch to the Emacs trunk to bring it up to date with gnulib.
I plan to test it a bit more before installing.

This fixes some portability issues with MacOS X 10.5 and later (large
filesystems), Irix, and Solaris (signal mask handling), and some crash
problems with 'configure'.  Since gnulib has revamped where it puts
some of the files, this patch also moves some files around in Emacs,
using a new build-aux directory to remove some of the clutter; this
affects the Windows builds too so I've made the obvious minor changes
to the Windows files.  I considered trying to leave the file locations
alone, but judged that that the extra complexity in importation of
changes would be more likely to cause problems than to cure them.

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: [email-masked]
# target_branch: bzr+ssh://[email-masked]/emacs/trunk
# testament_sha1: 40b72f5ebfcd921d4490257c7a6e5345e2babaca
# timestamp: 2011-07-25 09:57:36 -0700
# base_revision_id: [email-masked]
# 
# Begin patch
=== modified file '.bzrignore'
--- .bzrignore	2011-07-06 17:58:37 +0000
+++ .bzrignore	2011-07-24 22:15:47 +0000
@@ -15,23 +15,17 @@
 *.exe
 ./aclocal.m4
 autom4te.cache
-./compile
 confdefs.h
-./config.guess
-./config.sub
 ./configure
 configure.lineno
 conftest*
 core
-./depcomp
 DOC
 DOC-*
 emacs-*/
-./install-sh
 makefile
 Makefile
 Makefile.c
-./missing
 stamp-h1
 stamp_BLD
 subdirs.el
@@ -40,6 +34,12 @@
 cxxdefs.h
 info/*
 admin/unidata/unidata.txt
+build-aux/compile
+build-aux/config.guess
+build-aux/config.sub
+build-aux/depcomp
+build-aux/install-sh
+build-aux/missing
 leim/leim-list.el
 leim/quail/*.el
 leim/changed.misc

=== modified file 'ChangeLog'
--- ChangeLog	2011-07-13 10:36:12 +0000
+++ ChangeLog	2011-07-25 16:26:30 +0000
@@ -1,3 +1,35 @@
+2011-07-25  Paul Eggert  <[email-masked]>
+
+	Merge from gnulib, using build-aux to remove clutter.
+	* m4/largefile.m4: New file, so that Emacs does not mess up when
+	accessing files with large inode numbers in MacOS X 10.5 and later.
+	* m4/nocrash.m4: New file, to avoid triggering background debugger
+	and/or create core dumps during 'configure'.
+	* build-aux/move-if-change: Renamed from move-if-change.
+	* build-aux/snippet/arg-nonnull.h: Renamed from arg-nonnull.h.
+	* build-aux/snippet/c++defs.h: Renamed from c++defs.h.
+	* build-aux/snippet/warn-on-use.h: Renamed from warn-on-use.h.
+	* build-aux/snippet/_Noreturn.h: New file, for draft C1X _Noreturn.
+	* .bzrignore: The autogenerated files compile, config.guess,
+	config.sub, depcomp, install-sh, and missing are now in build-aux.
+	* Makefile.in (epaths-force, sync-from-gnulib):
+	move-if-change is now in build-aux.
+	(GNULIB_TOOL_FLAGS): Avoid threadlib; this is now a prerequisite
+	of gnulib's pthread_sigmask module, but Emacs doesn't need it.
+	(mkdir): install-sh is now in build-aux.
+	* config.bat: c++defs.h is now in build-aux/snippets.
+	* configure.in: Specify AC_CONFIG_AUX_DIR with build-aux (the
+	usual parameter).
+	* lib/gnulib.mk, m4/gl-comp.m4: Regenerate.
+	* lib/makefile.w32-in (ARG_NONNULL_H): arg-nonnull.h moved
+	to build-aux/snippet.
+	* lib/pthread_sigmask.c, lib/stdlib.in.h, m4/extensions.m4:
+	* m4/getopt.m4, m4/gnulib-common.m4, m4/pthread_sigmask.m4:
+	Merge from gnuilib.  This fixes porting bugs on Cygwin, Irix, and
+	Solaris, enables MacOS extensions, and enables nocrash during
+	'configure'.
+	* make-dist: Adjust to new build-aux and build-aux/snippit dirs.
+
 2011-07-13  Jan Djärv  <[email-masked]>
 
 	* configure.in (GSETTINGS): Check for gio-2.0 >= 2.26.

=== modified file 'Makefile.in'
--- Makefile.in	2011-07-09 00:18:49 +0000
+++ Makefile.in	2011-07-24 22:15:47 +0000
@@ -300,7 +300,7 @@
 	  -e 's;\(#.*PATH_X_DEFAULTS\).*$$;\1 "${x_default_search_path}";' \
 	  -e 's;\(#.*PATH_GAME\).*$$;\1 "${gamedir}";' \
 	  -e 's;\(#.*PATH_DOC\).*$$;\1 "${docdir}";') &&		\
-	${srcdir}/move-if-change epaths.h.$$$$ src/epaths.h
+	${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h
 
 # For parallel make, src should be built before leim.
 # "export PARALLEL=0" is for SGI's Make, to prevent it from
@@ -339,6 +339,7 @@
   mktime pthread_sigmask readlink \
   socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat
 GNULIB_TOOL_FLAGS = \
+ --avoid=threadlib \
  --conditional-dependencies --import --no-changelog --no-vc-files \
  --makefile-name=gnulib.mk
 sync-from-gnulib: $(gnulib_srcdir)
@@ -350,7 +351,7 @@
 	cp $(gnulib_srcdir)/build-aux/texinfo.tex $(srcdir)/doc/misc
 	cp \
 	  $(gnulib_srcdir)/build-aux/move-if-change \
-	  $(srcdir)
+	  $(srcdir)/build-aux
 	cd $(srcdir) && autoreconf -i -I m4
 .PHONY: sync-from-gnulib
 
@@ -688,7 +689,7 @@
 	done ; \
 	icondirs=`echo "$${icondirs}" | sed 's,$(srcdir)/etc/images/icons,$(DESTDIR)${icondir},g'` ; \
 	umask 022 ; \
-	$(srcdir)/install-sh -d $(DESTDIR)${datadir} ${COPYDESTS} \
+	$(srcdir)/build-aux/install-sh -d $(DESTDIR)${datadir} ${COPYDESTS} \
 	  $(DESTDIR)${infodir} $(DESTDIR)${man1dir} \
 	  $(DESTDIR)${bindir} $(DESTDIR)${docdir} $(DESTDIR)${libexecdir} \
 	  $(DESTDIR)${datadir}/emacs/site-lisp \

=== modified file 'admin/ChangeLog'
--- admin/ChangeLog	2011-07-07 13:55:12 +0000
+++ admin/ChangeLog	2011-07-25 16:26:30 +0000
@@ -1,3 +1,12 @@
+2011-07-25  Paul Eggert  <[email-masked]>
+
+	Merge from gnulib.
+	* notes/copyright: The files compile, config.guess, config.sub,
+	depcomp, install-sh, missing, and move-if-change are now in the
+	new build-aux subdirectory.  The files arg-nonnull.h, c++defs.h,
+	and warn-on-use.h are now in build-aux/snippets.  New file
+	build-aux/snippets/_Noreturn.h.
+
 2011-07-07  Juanma Barranquero  <[email-masked]>
 
 	* unidata/makefile.w32-in (charprop-SH, charprop-CMD):

=== modified file 'admin/notes/copyright'
--- admin/notes/copyright	2011-03-25 07:00:36 +0000
+++ admin/notes/copyright	2011-07-24 22:15:47 +0000
@@ -143,7 +143,7 @@
 lib/Makefile.in
  - copyright FSF, with MIT-like license
 
-install-sh
+build-aux/install-sh
  - this file is copyright MIT, which is OK. Leave the copyright alone.
 
 etc/refcards/*.tex
@@ -545,16 +545,17 @@
 alone (may import them from Gnulib again). These are:
 
     Gnulib:
-    arg-nonnull.h
-    c++defs.h
-    compile
-    config.guess
-    config.sub
-    depcomp
+    build-aux/compile
+    build-aux/config.guess
+    build-aux/config.sub
+    build-aux/depcomp
+    build-aux/missing
+    build-aux/move-if-change
+    build-aux/snippet/_Noreturn.h
+    build-aux/snippet/arg-nonnull.h
+    build-aux/snippet/c++defs.h
+    build-aux/snippet/warn-on-use.h
     doc/man/texinfo.tex
-    missing
-    move-if-change
-    warn-on-use.h
     lib/*.[ch]
     lib/gnulib.mk
     src/gmalloc.c

=== added directory 'build-aux'
=== renamed file 'move-if-change' => 'build-aux/move-if-change'
=== added directory 'build-aux/snippet'
=== added file 'build-aux/snippet/_Noreturn.h'
--- build-aux/snippet/_Noreturn.h	1970-01-01 00:00:00 +0000
+++ build-aux/snippet/_Noreturn.h	2011-07-24 22:15:47 +0000
@@ -0,0 +1,10 @@
+#ifndef _Noreturn
+# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
+      || 0x5110 <= __SUNPRO_C)
+#  define _Noreturn __attribute__ ((__noreturn__))
+# elif 1200 <= _MSC_VER
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn
+# endif
+#endif

=== renamed file 'arg-nonnull.h' => 'build-aux/snippet/arg-nonnull.h'
=== renamed file 'c++defs.h' => 'build-aux/snippet/c++defs.h'
=== renamed file 'warn-on-use.h' => 'build-aux/snippet/warn-on-use.h'
=== modified file 'config.bat'
--- config.bat	2011-05-20 09:47:59 +0000
+++ config.bat	2011-07-24 22:15:47 +0000
@@ -275,10 +275,10 @@
 cd ..

 rem   ----------------------------------------------------------------------

 Echo Configuring the lib directory...

-If Exist c++defs.h update c++defs.h cxxdefs.h

+If Exist build-aux/snippet/c++defs.h update build-aux/snippet/c++defs.h build-aux/snippet/cxxdefs.h

 cd lib

 Rem Rename files like djtar on plain DOS filesystem would.

-If Exist c++defs.h update c++defs.h cxxdefs.h

+If Exist build-aux/snippet/c++defs.h update build-aux/snippet/c++defs.h build-aux/snippet/cxxdefs.h

 If Exist getopt.in.h update getopt.in.h getopt.in-h

 If Exist stdbool.in.h update stdbool.in.h stdbool.in-h

 If Exist stddef.in.h update stddef.in.h  stddef.in-h

=== modified file 'configure.in'
--- configure.in	2011-07-13 10:36:12 +0000
+++ configure.in	2011-07-24 22:15:47 +0000
@@ -25,6 +25,7 @@
 AC_INIT(emacs, 24.0.50)
 AC_CONFIG_HEADER(src/config.h:src/config.in)
 AC_CONFIG_SRCDIR(src/lisp.h)
+AC_CONFIG_AUX_DIR(build-aux)
 AM_INIT_AUTOMAKE
 
 dnl Support for --program-prefix, --program-suffix and

=== modified file 'leim/ChangeLog'
--- leim/ChangeLog	2011-07-23 17:29:42 +0000
+++ leim/ChangeLog	2011-07-25 16:26:30 +0000
@@ -1,3 +1,7 @@
+2011-07-25  Paul Eggert  <[email-masked]>
+
+	* Makefile.in (install): install-sh is now in build-aux.
+
 2011-07-23  Yair F  <[email-masked]>
 
 	* quail/hebrew.el ("hebrew"): Additional key mappings.

=== modified file 'leim/Makefile.in'
--- leim/Makefile.in	2011-06-12 09:01:24 +0000
+++ leim/Makefile.in	2011-07-24 22:15:47 +0000
@@ -221,7 +221,7 @@
 
 install: all
 	if [ ! -d ${INSTALLDIR} ] ; then \
-          umask 022; ${srcdir}/../install-sh -d ${INSTALLDIR}; \
+          umask 022; ${srcdir}/../build-aux/install-sh -d ${INSTALLDIR}; \
 	else true; fi
 	if [ x`(cd ${INSTALLDIR} && /bin/pwd)` != x`(/bin/pwd)` ] ; then \
 	  rm -f ${INSTALLDIR}/leim-list.el; \

=== modified file 'lib-src/ChangeLog'
--- lib-src/ChangeLog	2011-07-09 10:32:42 +0000
+++ lib-src/ChangeLog	2011-07-25 16:26:30 +0000
@@ -1,3 +1,8 @@
+2011-07-25  Paul Eggert  <[email-masked]>
+
+	* Makefile.in ($(DESTDIR)${archlibdir}): install-sh moved
+	to build-aux.
+
 2011-07-09  Andreas Schwab  <[email-masked]>
 
 	* update-game-score.c (usage): Update usage line.

=== modified file 'lib-src/Makefile.in'
--- lib-src/Makefile.in	2011-05-25 07:13:57 +0000
+++ lib-src/Makefile.in	2011-07-24 22:15:47 +0000
@@ -229,13 +229,13 @@
 $(DESTDIR)${archlibdir}: all
 	@echo
 	@echo "Installing utilities run internally by Emacs."
-	umask 022; $(top_srcdir)/install-sh -d $(DESTDIR)${archlibdir}
+	umask 022; $(top_srcdir)/build-aux/install-sh -d $(DESTDIR)${archlibdir}
 	if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
 	  for file in ${UTILITIES}; do \
 	    $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
 	  done ; \
         fi
-	umask 022; $(top_srcdir)/install-sh -d $(DESTDIR)${gamedir}; \
+	umask 022; $(top_srcdir)/build-aux/install-sh -d $(DESTDIR)${gamedir}; \
 	touch $(DESTDIR)${gamedir}/snake-scores; \
 	touch $(DESTDIR)${gamedir}/tetris-scores
 	-if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \

=== modified file 'lib/gnulib.mk'
--- lib/gnulib.mk	2011-07-09 00:18:49 +0000
+++ lib/gnulib.mk	2011-07-24 22:15:47 +0000
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dup2 filemode getloadavg getopt-gnu ignore-value intprops lstat mktime pthread_sigmask readlink socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dup2 filemode getloadavg getopt-gnu ignore-value intprops lstat mktime pthread_sigmask readlink socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat

 MOSTLYCLEANFILES += core *.stackdump
@@ -52,54 +52,6 @@
 
 ## end   gnulib module allocator
 
-## begin gnulib module arg-nonnull
-
-# The BUILT_SOURCES created by this Makefile snippet are not used via #include
-# statements but through direct file reference. Therefore this snippet must be
-# present in all Makefile.am that need it. This is ensured by the applicability
-# 'all' defined above.
-
-BUILT_SOURCES += arg-nonnull.h
-# The arg-nonnull.h that gets inserted into generated .h files is the same as
-# build-aux/arg-nonnull.h, except that it has the copyright header cut off.
-arg-nonnull.h: $(top_srcdir)/./arg-nonnull.h
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	sed -n -e '/GL_ARG_NONNULL/,$$p' \
-	  < $(top_srcdir)/./arg-nonnull.h \
-	  > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
-
-ARG_NONNULL_H=arg-nonnull.h
-
-EXTRA_DIST += $(top_srcdir)/./arg-nonnull.h
-
-## end   gnulib module arg-nonnull
-
-## begin gnulib module c++defs
-
-# The BUILT_SOURCES created by this Makefile snippet are not used via #include
-# statements but through direct file reference. Therefore this snippet must be
-# present in all Makefile.am that need it. This is ensured by the applicability
-# 'all' defined above.
-
-BUILT_SOURCES += c++defs.h
-# The c++defs.h that gets inserted into generated .h files is the same as
-# build-aux/c++defs.h, except that it has the copyright header cut off.
-c++defs.h: $(top_srcdir)/./c++defs.h
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	sed -n -e '/_GL_CXXDEFS/,$$p' \
-	  < $(top_srcdir)/./c++defs.h \
-	  > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += c++defs.h c++defs.h-t
-
-CXXDEFS_H=c++defs.h
-
-EXTRA_DIST += $(top_srcdir)/./c++defs.h
-
-## end   gnulib module c++defs
-
 ## begin gnulib module careadlinkat
 
 libgnu_a_SOURCES += careadlinkat.c
@@ -362,6 +314,87 @@
 
 ## end   gnulib module sigprocmask
 
+## begin gnulib module snippet/_Noreturn
+
+# Because this Makefile snippet defines a variable used by other
+# gnulib Makefile snippets, it must be present in all Makefile.am that
+# need it. This is ensured by the applicability 'all' defined above.
+
+_NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h
+
+## end   gnulib module snippet/_Noreturn
+
+## begin gnulib module snippet/arg-nonnull
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += arg-nonnull.h
+# The arg-nonnull.h that gets inserted into generated .h files is the same as
+# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut
+# off.
+arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	sed -n -e '/GL_ARG_NONNULL/,$$p' \
+	  < $(top_srcdir)/build-aux/snippet/arg-nonnull.h \
+	  > $@-t && \
+	mv $@-t $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/arg-nonnull.h
+
+## end   gnulib module snippet/arg-nonnull
+
+## begin gnulib module snippet/c++defs
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += c++defs.h
+# The c++defs.h that gets inserted into generated .h files is the same as
+# build-aux/snippet/c++defs.h, except that it has the copyright header cut off.
+c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	sed -n -e '/_GL_CXXDEFS/,$$p' \
+	  < $(top_srcdir)/build-aux/snippet/c++defs.h \
+	  > $@-t && \
+	mv $@-t $@
+MOSTLYCLEANFILES += c++defs.h c++defs.h-t
+
+CXXDEFS_H=c++defs.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/c++defs.h
+
+## end   gnulib module snippet/c++defs
+
+## begin gnulib module snippet/warn-on-use
+
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut
+# off.
+warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	sed -n -e '/^.ifndef/,$$p' \
+	  < $(top_srcdir)/build-aux/snippet/warn-on-use.h \
+	  > $@-t && \
+	mv $@-t $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h
+
+## end   gnulib module snippet/warn-on-use
+
 ## begin gnulib module stat
 
 if gl_GNULIB_ENABLED_stat
@@ -634,7 +667,8 @@
 
 # We need the following in order to create <stdlib.h> when the system
 # doesn't have one that works with the given compiler.
-stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
+  $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''GUARD_PREFIX''@|GL|g' \
@@ -708,6 +742,7 @@
 	      -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
 	      -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
 	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+	      -e '/definition of _Noreturn/r $(_NORETURN_H)' \
 	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
 	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
 	} > $@-t && \
@@ -1040,25 +1075,6 @@
 
 ## end   gnulib module verify
 
-## begin gnulib module warn-on-use
-
-BUILT_SOURCES += warn-on-use.h
-# The warn-on-use.h that gets inserted into generated .h files is the same as
-# build-aux/warn-on-use.h, except that it has the copyright header cut off.
-warn-on-use.h: $(top_srcdir)/./warn-on-use.h
-	$(AM_V_GEN)rm -f $@-t $@ && \
-	sed -n -e '/^.ifndef/,$$p' \
-	  < $(top_srcdir)/./warn-on-use.h \
-	  > $@-t && \
-	mv $@-t $@
-MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
-
-WARN_ON_USE_H=warn-on-use.h
-
-EXTRA_DIST += $(top_srcdir)/./warn-on-use.h
-
-## end   gnulib module warn-on-use
-
 
 mostlyclean-local: mostlyclean-generic
 	@for dir in '' $(MOSTLYCLEANDIRS); do \

=== modified file 'lib/makefile.w32-in'
--- lib/makefile.w32-in	2011-06-21 08:45:39 +0000
+++ lib/makefile.w32-in	2011-07-24 22:15:47 +0000
@@ -213,7 +213,7 @@
 PRAGMA_SYSTEM_HEADER = \#pragma GCC system_header
 PRAGMA_COLUMNS =
 NEXT_GETOPT_H = <getopt.h>
-ARG_NONNULL_H = ../arg-nonnull.h
+ARG_NONNULL_H = ../build-aux/snippet/arg-nonnull.h
 
 getopt_h:
 	- $(DEL) getopt_.h-t getopt_.h

=== modified file 'lib/pthread_sigmask.c'
--- lib/pthread_sigmask.c	2011-07-08 20:20:19 +0000
+++ lib/pthread_sigmask.c	2011-07-24 22:15:47 +0000
@@ -20,10 +20,50 @@
 #include <signal.h>
 
 #include <errno.h>
+#include <stddef.h>
+
+#if PTHREAD_SIGMASK_UNBLOCK_BUG
+# include <unistd.h>
+#endif
 
 int
 pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
+#undef pthread_sigmask
 {
+#if HAVE_PTHREAD_SIGMASK
+  int ret = pthread_sigmask (how, new_mask, old_mask);
+# if PTHREAD_SIGMASK_INEFFECTIVE
+  if (ret == 0)
+    {
+      /* Detect whether pthread_sigmask is currently ineffective.
+         Don't cache the information: libpthread.so could be dynamically
+         loaded after the program started and after pthread_sigmask was
+         called for the first time.  */
+      if (pthread_sigmask (1729, NULL, NULL) == 0)
+        {
+          /* pthread_sigmask is currently ineffective.  The program is not
+             linked to -lpthread.  So use sigprocmask instead.  */
+          return (sigprocmask (how, new_mask, old_mask) < 0 ? errno : 0);
+        }
+    }
+# endif
+# if PTHREAD_SIGMASK_FAILS_WITH_ERRNO
+  if (ret == -1)
+    return errno;
+# endif
+# if PTHREAD_SIGMASK_UNBLOCK_BUG
+  if (ret == 0
+      && new_mask != NULL
+      && (how == SIG_UNBLOCK || how == SIG_SETMASK))
+    {
+      /* Give the OS the opportunity to raise signals that were pending before
+         the pthread_sigmask call and have now been unblocked.  */
+      usleep (1);
+    }
+# endif
+  return ret;
+#else
   int ret = sigprocmask (how, new_mask, old_mask);
   return (ret < 0 ? errno : 0);
+#endif
 }

=== modified file 'lib/stdlib.in.h'
--- lib/stdlib.in.h	2011-05-29 21:52:18 +0000
+++ lib/stdlib.in.h	2011-07-24 22:15:47 +0000
@@ -89,11 +89,7 @@
 # include <unistd.h>
 #endif
 
-#if 3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__
-# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
-#else
-# define _GL_ATTRIBUTE_NORETURN
-#endif
+/* The definition of _Noreturn is copied here.  */
 
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
@@ -120,7 +116,7 @@
 /* Terminate the current process with the given return code, without running
    the 'atexit' handlers.  */
 # if !@HAVE__EXIT@
-_GL_FUNCDECL_SYS (_Exit, void, (int status) _GL_ATTRIBUTE_NORETURN);
+_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
 # endif
 _GL_CXXALIAS_SYS (_Exit, void, (int status));
 _GL_CXXALIASWARN (_Exit);

=== modified file 'm4/extensions.m4'
--- m4/extensions.m4	2011-01-09 06:57:07 +0000
+++ m4/extensions.m4	2011-07-24 22:15:47 +0000
@@ -1,4 +1,4 @@
-# serial 9  -*- Autoconf -*-
+# serial 10  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
 # Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc.
@@ -67,6 +67,10 @@
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
 #endif
+/* Enable general extensions on MacOS X.  */
+#ifndef _DARWIN_C_SOURCE
+# undef _DARWIN_C_SOURCE
+#endif
 /* Enable GNU extensions on systems that have them.  */
 #ifndef _GNU_SOURCE
 # undef _GNU_SOURCE
@@ -95,6 +99,7 @@
   test $ac_cv_safe_to_define___extensions__ = yes &&
     AC_DEFINE([__EXTENSIONS__])
   AC_DEFINE([_ALL_SOURCE])
+  AC_DEFINE([_DARWIN_C_SOURCE])
   AC_DEFINE([_GNU_SOURCE])
   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
   AC_DEFINE([_TANDEM_SOURCE])

=== modified file 'm4/getopt.m4'
--- m4/getopt.m4	2011-07-08 20:22:17 +0000
+++ m4/getopt.m4	2011-07-24 22:15:47 +0000
@@ -231,8 +231,12 @@
         [AC_LANG_PROGRAM([[#include <getopt.h>
                            #include <stddef.h>
                            #include <string.h>
+           ]GL_NOCRASH[
            ]], [[
              int result = 0;
+
+             nocrash_init();
+
              /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw,
                 and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5,
                 OSF/1 5.1, Solaris 10.  */

=== modified file 'm4/gl-comp.m4'
--- m4/gl-comp.m4	2011-07-09 00:18:49 +0000
+++ m4/gl-comp.m4	2011-07-24 22:15:47 +0000
@@ -28,8 +28,6 @@
   AC_REQUIRE([AC_PROG_RANLIB])
   # Code from module alloca-opt:
   # Code from module allocator:
-  # Code from module arg-nonnull:
-  # Code from module c++defs:
   # Code from module careadlinkat:
   # Code from module crypto/md5:
   # Code from module crypto/sha1:
@@ -52,10 +50,15 @@
   # Code from module lstat:
   # Code from module mktime:
   # Code from module multiarch:
+  # Code from module nocrash:
   # Code from module pthread_sigmask:
   # Code from module readlink:
   # Code from module signal:
   # Code from module sigprocmask:
+  # Code from module snippet/_Noreturn:
+  # Code from module snippet/arg-nonnull:
+  # Code from module snippet/c++defs:
+  # Code from module snippet/warn-on-use:
   # Code from module socklen:
   # Code from module ssize_t:
   # Code from module stat:
@@ -82,7 +85,6 @@
   # Code from module u64:
   # Code from module unistd:
   # Code from module verify:
-  # Code from module warn-on-use:
 ])
 
 # This macro should be invoked from ./configure.in, in the section
@@ -148,6 +150,7 @@
 gl_FUNC_PTHREAD_SIGMASK
 if test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1; then
   AC_LIBOBJ([pthread_sigmask])
+  gl_PREREQ_PTHREAD_SIGMASK
 fi
 gl_SIGNAL_MODULE_INDICATOR([pthread_sigmask])
 gl_FUNC_READLINK
@@ -451,9 +454,10 @@
 # This macro records the list of files which have been installed by
 # gnulib-tool and may be removed by future gnulib-tool invocations.
 AC_DEFUN([gl_FILE_LIST], [
-  build-aux/arg-nonnull.h
-  build-aux/c++defs.h
-  build-aux/warn-on-use.h
+  build-aux/snippet/_Noreturn.h
+  build-aux/snippet/arg-nonnull.h
+  build-aux/snippet/c++defs.h
+  build-aux/snippet/warn-on-use.h
   lib/alloca.in.h
   lib/allocator.c
   lib/allocator.h
@@ -528,6 +532,7 @@
   m4/md5.m4
   m4/mktime.m4
   m4/multiarch.m4
+  m4/nocrash.m4
   m4/pthread_sigmask.m4
   m4/readlink.m4
   m4/sha1.m4

=== modified file 'm4/gnulib-common.m4'
--- m4/gnulib-common.m4	2011-06-08 16:26:45 +0000
+++ m4/gnulib-common.m4	2011-07-24 22:15:47 +0000
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 26
+# gnulib-common.m4 serial 28
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,6 +12,19 @@
   AC_REQUIRE([gl_COMMON_BODY])
 ])
 AC_DEFUN([gl_COMMON_BODY], [
+  AH_VERBATIM([_Noreturn],
+[/* The _Noreturn keyword of draft C1X.  */
+#ifndef _Noreturn
+# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
+      || 0x5110 <= __SUNPRO_C)
+#  define _Noreturn __attribute__ ((__noreturn__))
+# elif 1200 <= _MSC_VER
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn
+# endif
+#endif
+])
   AH_VERBATIM([isoc99_inline],
 [/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
    the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of

=== added file 'm4/largefile.m4'
--- m4/largefile.m4	1970-01-01 00:00:00 +0000
+++ m4/largefile.m4	2011-07-24 22:15:47 +0000
@@ -0,0 +1,104 @@
+# Enable large files on systems where this is not the default.
+
+# Copyright 1992-1996, 1998-2011 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# The following implementation works around a problem in autoconf <= 2.68;
+# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5.
+m4_version_prereq([2.69], [] ,[
+
+# _AC_SYS_LARGEFILE_TEST_INCLUDES
+# -------------------------------
+m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
+[@%:@include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+@%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1]];[]dnl
+])
+
+
+# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
+#				CACHE-VAR,
+#				DESCRIPTION,
+#				PROLOGUE, [FUNCTION-BODY])
+# --------------------------------------------------------
+m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
+[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
+[while :; do
+  m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
+    [AC_LANG_PROGRAM([$5], [$6])],
+    [$3=no; break])
+  m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
+    [AC_LANG_PROGRAM([@%:@define $1 $2
+$5], [$6])],
+    [$3=$2; break])
+  $3=unknown
+  break
+done])
+case $$3 in #(
+  no | unknown) ;;
+  *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);;
+esac
+rm -rf conftest*[]dnl
+])# _AC_SYS_LARGEFILE_MACRO_VALUE
+
+
+# AC_SYS_LARGEFILE
+# ----------------
+# By default, many hosts won't let programs access large files;
+# one must use special compiler options to get large-file access to work.
+# For more details about this brain damage please see:
+# http://www.unix-systems.org/version2/whatsnew/lfs20mar.html
+AC_DEFUN([AC_SYS_LARGEFILE],
+[AC_ARG_ENABLE(largefile,
+	       [  --disable-largefile     omit support for large files])
+if test "$enable_largefile" != no; then
+
+  AC_CACHE_CHECK([for special C compiler options needed for large files],
+    ac_cv_sys_largefile_CC,
+    [ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+	 # IRIX 6.2 and later do not support large files by default,
+	 # so use the C compiler's -n32 option if that helps.
+	 AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
+	 AC_COMPILE_IFELSE([], [break])
+	 CC="$CC -n32"
+	 AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
+	 break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi])
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
+
+  _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
+    ac_cv_sys_file_offset_bits,
+    [Number of bits in a file offset, on hosts where this is settable.],
+    [_AC_SYS_LARGEFILE_TEST_INCLUDES])
+  if test $ac_cv_sys_file_offset_bits = unknown; then
+    _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
+      ac_cv_sys_large_files,
+      [Define for large files, on AIX-style hosts.],
+      [_AC_SYS_LARGEFILE_TEST_INCLUDES])
+  fi
+
+  AH_VERBATIM([_DARWIN_USE_64_BIT_INODE],
+[/* Enable large inode numbers on Mac OS X.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif])
+fi
+])# AC_SYS_LARGEFILE
+
+])# m4_version_prereq 2.69

=== added file 'm4/nocrash.m4'
--- m4/nocrash.m4	1970-01-01 00:00:00 +0000
+++ m4/nocrash.m4	2011-07-24 22:15:47 +0000
@@ -0,0 +1,102 @@
+# nocrash.m4 serial 2
+dnl Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini.
+
+AC_PREREQ([2.13])
+
+dnl Expands to some code for use in .c programs that will cause the configure
+dnl test to exit instead of crashing. This is useful to avoid triggering
+dnl action from a background debugger and to avoid core dumps.
+dnl Usage:   ...
+dnl          ]GL_NOCRASH[
+dnl          ...
+dnl          int main() { nocrash_init(); ... }
+AC_DEFUN([GL_NOCRASH],[[
+#include <stdlib.h>
+#if defined __MACH__ && defined __APPLE__
+/* Avoid a crash on MacOS X.  */
+#include <mach/mach.h>
+#include <mach/mach_error.h>
+#include <mach/thread_status.h>
+#include <mach/exception.h>
+#include <mach/task.h>
+#include <pthread.h>
+/* The exception port on which our thread listens.  */
+static mach_port_t our_exception_port;
+/* The main function of the thread listening for exceptions of type
+   EXC_BAD_ACCESS.  */
+static void *
+mach_exception_thread (void *arg)
+{
+  /* Buffer for a message to be received.  */
+  struct {
+    mach_msg_header_t head;
+    mach_msg_body_t msgh_body;
+    char data[1024];
+  } msg;
+  mach_msg_return_t retval;
+  /* Wait for a message on the exception port.  */
+  retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg),
+                     our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+  if (retval != MACH_MSG_SUCCESS)
+    abort ();
+  exit (1);
+}
+static void
+nocrash_init (void)
+{
+  mach_port_t self = mach_task_self ();
+  /* Allocate a port on which the thread shall listen for exceptions.  */
+  if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port)
+      == KERN_SUCCESS) {
+    /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html.  */
+    if (mach_port_insert_right (self, our_exception_port, our_exception_port,
+                                MACH_MSG_TYPE_MAKE_SEND)
+        == KERN_SUCCESS) {
+      /* The exceptions we want to catch.  Only EXC_BAD_ACCESS is interesting
+         for us.  */
+      exception_mask_t mask = EXC_MASK_BAD_ACCESS;
+      /* Create the thread listening on the exception port.  */
+      pthread_attr_t attr;
+      pthread_t thread;
+      if (pthread_attr_init (&attr) == 0
+          && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0
+          && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) {
+        pthread_attr_destroy (&attr);
+        /* Replace the exception port info for these exceptions with our own.
+           Note that we replace the exception port for the entire task, not only
+           for a particular thread.  This has the effect that when our exception
+           port gets the message, the thread specific exception port has already
+           been asked, and we don't need to bother about it.
+           See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html.  */
+        task_set_exception_ports (self, mask, our_exception_port,
+                                  EXCEPTION_DEFAULT, MACHINE_THREAD_STATE);
+      }
+    }
+  }
+}
+#else
+/* Avoid a crash on POSIX systems.  */
+#include <signal.h>
+/* A POSIX signal handler.  */
+static void
+exception_handler (int sig)
+{
+  exit (1);
+}
+static void
+nocrash_init (void)
+{
+#ifdef SIGSEGV
+  signal (SIGSEGV, exception_handler);
+#endif
+#ifdef SIGBUS
+  signal (SIGBUS, exception_handler);
+#endif
+}
+#endif
+]])

=== modified file 'm4/pthread_sigmask.m4'
--- m4/pthread_sigmask.m4	2011-07-09 08:56:25 +0000
+++ m4/pthread_sigmask.m4	2011-07-24 22:15:47 +0000
@@ -1,4 +1,4 @@
-# pthread_sigmask.m4 serial 7-emacs1
+# pthread_sigmask.m4 serial 11
 dnl Copyright (C) 2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,20 +8,240 @@
 [
   AC_CHECK_FUNCS_ONCE([pthread_sigmask])
   LIB_PTHREAD_SIGMASK=
-    dnl gl_THREADLIB is not in use.  Assume the application wants
-    dnl POSIX semantics.
-    if test $ac_cv_func_pthread_sigmask != yes; then
-      gl_save_LIBS=$LIBS
-      AC_SEARCH_LIBS([pthread_sigmask], [pthread c_r])
-      LIBS=$gl_save_LIBS
-      if test "$ac_cv_search_pthread_sigmask" = no; then
+
+  dnl Test whether the gnulib module 'threadlib' is in use.
+  dnl Some packages like Emacs use --avoid=threadlib.
+  dnl Write the symbol in such a way that it does not cause 'aclocal' to pick
+  dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/.
+  m4_ifdef([gl_[]THREADLIB], [
+    AC_REQUIRE([gl_[]THREADLIB])
+
+    if test "$gl_threads_api" = posix; then
+      if test $ac_cv_func_pthread_sigmask = yes; then
+        dnl pthread_sigmask is available without -lpthread.
+        :
+      else
+        if test -n "$LIBMULTITHREAD"; then
+          AC_CACHE_CHECK([for pthread_sigmask in $LIBMULTITHREAD],
+            [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD],
+            [gl_save_LIBS="$LIBS"
+             LIBS="$LIBS $LIBMULTITHREAD"
+             AC_LINK_IFELSE(
+               [AC_LANG_PROGRAM(
+                  [[#include <pthread.h>
+                    #include <signal.h>
+                  ]],
+                  [[return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);]])
+               ],
+               [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=yes],
+               [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no])
+             LIBS="$gl_save_LIBS"
+            ])
+          if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
+            dnl pthread_sigmask is available with -lpthread.
+            LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD"
+          else
+            dnl pthread_sigmask is not available at all.
+            HAVE_PTHREAD_SIGMASK=0
+          fi
+        else
+          dnl pthread_sigmask is not available at all.
+          HAVE_PTHREAD_SIGMASK=0
+        fi
+      fi
+    else
+      dnl pthread_sigmask may exist but does not interoperate with the chosen
+      dnl multithreading facility.
+      dnl If "$gl_threads_api" = pth, we could use the function pth_sigmask,
+      dnl but it is equivalent to sigprocmask, so we choose to emulate
+      dnl pthread_sigmask with sigprocmask also in this case. This yields fewer
+      dnl link dependencies.
+      if test $ac_cv_func_pthread_sigmask = yes; then
+        REPLACE_PTHREAD_SIGMASK=1
+      else
         HAVE_PTHREAD_SIGMASK=0
-      elif test "$ac_cv_search_pthread_sigmask" != 'none required'; then
-        LIB_PTHREAD_SIGMASK=$ac_cv_search_pthread_sigmask
       fi
     fi
+  ], [
+    dnl The module 'threadlib' is not in use, due to --avoid=threadlib being
+    dnl specified.
+    dnl The package either has prepared CPPFLAGS and LIBS for use of POSIX:2008
+    dnl threads, or wants to build single-threaded programs.
+    if test $ac_cv_func_pthread_sigmask = yes; then
+      dnl pthread_sigmask exists and does not require extra libraries.
+      dnl Assume that it is declared.
+      :
+    else
+      dnl pthread_sigmask either does not exist or needs extra libraries.
+      HAVE_PTHREAD_SIGMASK=0
+      dnl Define the symbol rpl_pthread_sigmask, not pthread_sigmask,
+      dnl so as to not accidentally override the system's pthread_sigmask
+      dnl symbol from libpthread. This is necessary on IRIX 6.5.
+      REPLACE_PTHREAD_SIGMASK=1
+    fi
+  ])
+
   AC_SUBST([LIB_PTHREAD_SIGMASK])
   dnl We don't need a variable LTLIB_PTHREAD_SIGMASK, because when
   dnl "$gl_threads_api" = posix, $LTLIBMULTITHREAD and $LIBMULTITHREAD are the
   dnl same: either both empty or both "-lpthread".
+
+  dnl Now test for some bugs in the system function.
+  if test $HAVE_PTHREAD_SIGMASK = 1; then
+    AC_REQUIRE([AC_PROG_CC])
+    AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+    dnl On FreeBSD 6.4, HP-UX 11.31, Solaris 9, in programs that are not linked
+    dnl with -lpthread, the pthread_sigmask() function always returns 0 and has
+    dnl no effect.
+    if test -z "$LIB_PTHREAD_SIGMASK"; then
+      AC_CACHE_CHECK([whether pthread_sigmask works without -lpthread],
+        [gl_cv_func_pthread_sigmask_in_libc_works],
+        [
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
+#include <pthread.h>
+#include <signal.h>
+#include <stddef.h>
+int main ()
+{
+  sigset_t set;
+  sigemptyset (&set);
+  return pthread_sigmask (1729, &set, NULL) != 0;
+}]])],
+            [gl_cv_func_pthread_sigmask_in_libc_works=no],
+            [gl_cv_func_pthread_sigmask_in_libc_works=yes],
+            [
+changequote(,)dnl
+             case "$host_os" in
+               freebsd* | hpux* | solaris | solaris2.[2-9]*)
+                 gl_cv_func_pthread_sigmask_in_libc_works="guessing no";;
+               *)
+                 gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";;
+             esac
+changequote([,])dnl
+            ])
+        ])
+      case "$gl_cv_func_pthread_sigmask_in_libc_works" in
+        *no)
+          REPLACE_PTHREAD_SIGMASK=1
+          AC_DEFINE([PTHREAD_SIGMASK_INEFFECTIVE], [1],
+            [Define to 1 if pthread_sigmask() may returns 0 and have no effect.])
+          ;;
+      esac
+    fi
+
+    dnl On Cygwin 1.7.5, the pthread_sigmask() has a wrong return value
+    dnl convention: Upon failure, it returns -1 and sets errno.
+    AC_CACHE_CHECK([whether pthread_sigmask returns error numbers],
+      [gl_cv_func_pthread_sigmask_return_works],
+      [
+        gl_save_LIBS="$LIBS"
+        LIBS="$LIBS $LIB_PTHREAD_SIGMASK"
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <pthread.h>
+#include <signal.h>
+#include <stddef.h>
+int main ()
+{
+  sigset_t set;
+  sigemptyset (&set);
+  if (pthread_sigmask (1729, &set, NULL) == -1)
+    return 1;
+  return 0;
+}]])],
+          [gl_cv_func_pthread_sigmask_return_works=yes],
+          [gl_cv_func_pthread_sigmask_return_works=no],
+          [case "$host_os" in
+             cygwin*)
+               gl_cv_func_pthread_sigmask_return_works="guessing no";;
+             *)
+               gl_cv_func_pthread_sigmask_return_works="guessing yes";;
+           esac
+          ])
+        LIBS="$gl_save_LIBS"
+      ])
+    case "$gl_cv_func_pthread_sigmask_return_works" in
+      *no)
+        REPLACE_PTHREAD_SIGMASK=1
+        AC_DEFINE([PTHREAD_SIGMASK_FAILS_WITH_ERRNO], [1],
+          [Define to 1 if pthread_sigmask(), when it fails, returns -1 and sets errno.])
+        ;;
+    esac
+
+    dnl On IRIX 6.5, in a single-threaded program, pending signals are not
+    dnl immediately delivered when they are unblocked through pthread_sigmask,
+    dnl only a little while later.
+    AC_CACHE_CHECK([whether pthread_sigmask unblocks signals correctly],
+      [gl_cv_func_pthread_sigmask_unblock_works],
+      [
+        case "$host_os" in
+          irix*)
+            gl_cv_func_pthread_sigmask_unblock_works="guessing no";;
+          *)
+            gl_cv_func_pthread_sigmask_unblock_works="guessing yes";;
+        esac
+        dnl Here we link against $LIBMULTITHREAD, not only $LIB_PTHREAD_SIGMASK,
+        dnl otherwise we get a false positive on those platforms where
+        dnl $gl_cv_func_pthread_sigmask_in_libc_works is "no".
+        gl_save_LIBS="$LIBS"
+        LIBS="$LIBS $LIBMULTITHREAD"
+        AC_RUN_IFELSE(
+          [AC_LANG_SOURCE([[
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+static volatile int sigint_occurred;
+static void
+sigint_handler (int sig)
+{
+  sigint_occurred++;
+}
+int main ()
+{
+  sigset_t set;
+  int pid = getpid ();
+  char command[80];
+  signal (SIGINT, sigint_handler);
+  sigemptyset (&set);
+  sigaddset (&set, SIGINT);
+  if (!(pthread_sigmask (SIG_BLOCK, &set, NULL) == 0))
+    return 1;
+  sprintf (command, "sh -c 'sleep 1; kill -%d %d' &", SIGINT, pid);
+  if (!(system (command) == 0))
+    return 2;
+  sleep (2);
+  if (!(sigint_occurred == 0))
+    return 3;
+  if (!(pthread_sigmask (SIG_UNBLOCK, &set, NULL) == 0))
+    return 4;
+  if (!(sigint_occurred == 1)) /* This fails on IRIX.  */
+    return 5;
+  return 0;
+}]])],
+          [:],
+          [gl_cv_func_pthread_sigmask_unblock_works=no],
+          [:])
+        LIBS="$gl_save_LIBS"
+      ])
+    case "$gl_cv_func_pthread_sigmask_unblock_works" in
+      *no)
+        REPLACE_PTHREAD_SIGMASK=1
+        AC_DEFINE([PTHREAD_SIGMASK_UNBLOCK_BUG], [1],
+          [Define to 1 if pthread_sigmask() unblocks signals incorrectly.])
+        ;;
+    esac
+  fi
+])
+
+# Prerequisite of lib/pthread_sigmask.c.
+AC_DEFUN([gl_PREREQ_PTHREAD_SIGMASK],
+[
+  if test $HAVE_PTHREAD_SIGMASK = 1; then
+    AC_DEFINE([HAVE_PTHREAD_SIGMASK], [1],
+      [Define to 1 if the pthread_sigmask function can be used (despite bugs).])
+  fi
 ])

=== modified file 'make-dist'
--- make-dist	2011-05-24 04:00:56 +0000
+++ make-dist	2011-07-24 22:15:47 +0000
@@ -283,18 +283,16 @@
 ### tar file; this means that people can start reading the INSTALL and
 ### README while the rest of the tar file is still unpacking.  Whoopee.
 echo "Making links to top-level files"
-ln INSTALL README BUGS move-if-change ${tempdir}
+ln INSTALL README BUGS ${tempdir}
 ln ChangeLog Makefile.in configure configure.in ${tempdir}
 ln config.bat make-dist update-subdirs vpath.sed .dir-locals.el ${tempdir}
-ln config.sub config.guess install-sh ${tempdir}
 ln aclocal.m4 ${tempdir}
-ln compile depcomp missing ${tempdir}
-ln arg-nonnull.h c++defs.h warn-on-use.h ${tempdir}
 
 echo "Creating subdirectories"
 for subdir in site-lisp \
 	      leim leim/CXTERM-DIC leim/MISC-DIC \
 	      leim/SKK-DIC leim/ja-dic leim/quail \
+	      build-aux build-aux/snippet \
 	      src src/m src/s src/bitmaps lib lib-src oldXMenu lwlib \
 	      nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \
 	      `find etc lisp -type d` \
@@ -346,6 +344,15 @@
  rm -f ../${tempdir}/leim/quail/tsang-b5.*
  rm -f ../${tempdir}/leim/quail/tsang-cns.*)
 
+echo "Making links to \`build-aux'"
+(cd build-aux
+ ln compile config.guess config.sub depcomp ../${tempdir}/build-aux
+ ln install-sh missing move-if-change ../${tempdir}/build-aux)
+
+echo "Making links to \`build-aux/snippet'"
+(cd build-aux/snippet
+ ln *.h ../../${tempdir}/build-aux/snippet)
+
 echo "Making links to \`src'"
 ### Don't distribute the configured versions of
 ### config.in, paths.in, buildobj.h, or Makefile.in.
@@ -373,12 +380,13 @@
  ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s)
 
 echo "Making links to \`lib'"
-(build_aux_h=`(ls *.h)`
+(snippet_h=`(cd build-aux/snippet && ls *.h)`
  cd lib
  ln [a-zA-Z]*.[ch] ../${tempdir}/lib
  ln gnulib.mk Makefile.am Makefile.in ../${tempdir}/lib
  cd ../${tempdir}/lib
- rm -f `(echo "$build_aux_h"; ls *.in.h) | sed '/[*]/d; s/.in.h$/.h/'`)
+ script='/[*]/d; s/\.in\.h$/.h/'
+ rm -f `(echo "$snippet_h"; ls *.in.h) | sed "$script"`)
 
 echo "Making links to \`lib-src'"
 (cd lib-src

=== modified file 'msdos/ChangeLog'
--- msdos/ChangeLog	2011-06-07 13:55:22 +0000
+++ msdos/ChangeLog	2011-07-25 16:26:30 +0000
@@ -1,3 +1,8 @@
+2011-07-25  Paul Eggert  <[email-masked]>
+
+	* sedlibmk.inp (CONFIG_CLEAN_VPATH_FILES): Adjust to snippet moves
+	from top level to build-aux/snippet.
+
 2011-06-07  Eli Zaretskii  <[email-masked]>
 
 	* sedlibmk.inp (PTRDIFF_T_SUFFIX): Edit to nothing.

=== modified file 'msdos/sedlibmk.inp'
--- msdos/sedlibmk.inp	2011-06-07 13:55:22 +0000
+++ msdos/sedlibmk.inp	2011-07-24 22:15:47 +0000
@@ -569,11 +569,11 @@
 s/^@GL_GENERATE_STDINT_H_TRUE@//
 s/^@GL_GENERATE_STDINT_H_FALSE@/\#/
 /^arg-nonnull\.h:/,/^[ 	][ 	]*mv /c\
-arg-nonnull.h: $(top_srcdir)/./arg-nonnull.h\
-	sed -n -e '/GL_ARG_NONNULL/,$$p' < $(top_srcdir)/./arg-nonnull.h > $@
+arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h\
+	sed -n -e '/GL_ARG_NONNULL/,$$p' < $(top_srcdir)/build-aux/snippet/arg-nonnull.h > $@
 /^cxxdefs\.h:/,/^[ 	][ 	]*mv /c\
-cxxdefs.h: $(top_srcdir)/./cxxdefs.h\
-	sed -n -e '/_GL_CXXDEFS/,$$p' < $(top_srcdir)/./cxxdefs.h > $@
+cxxdefs.h: $(top_srcdir)/build-aux/snippet/cxxdefs.h\
+	sed -n -e '/_GL_CXXDEFS/,$$p' < $(top_srcdir)/build-aux/snippet/cxxdefs.h > $@
 s/^	[ 	]*{ echo \(.*\); \\/	 djecho \1 > $@-t/
 s/^	[ 	]*{ echo \(.*\) && \\/	 djecho \1 > $@-t/
 s/ \&\& \\ *$//

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2011-07-25 16:39:39 +0000
+++ src/ChangeLog	2011-07-25 16:41:39 +0000
@@ -1,5 +1,9 @@
 2011-07-25  Paul Eggert  <[email-masked]>
 
+	* Makefile.in (gl-stamp): move-if-change is now in build-aux.
+
+2011-07-25  Paul Eggert  <[email-masked]>
+
 	* bidi.c (bidi_dump_cached_states): Fix printf format mismatch.
 	Found by GCC static checking and --with-wide-int on a 32-bit host.

=== modified file 'src/Makefile.in'
--- src/Makefile.in	2011-07-08 20:20:19 +0000
+++ src/Makefile.in	2011-07-24 22:15:47 +0000
@@ -439,7 +439,7 @@
 gl-stamp: $(libsrc)/make-docfile$(EXEEXT) $(GLOBAL_SOURCES)
 	@rm -f gl-tmp
 	$(libsrc)/make-docfile -d $(srcdir) -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp
-	$(srcdir)/../move-if-change gl-tmp globals.h
+	$(srcdir)/../build-aux/move-if-change gl-tmp globals.h
 	echo timestamp > $@
 
 $(obj) $(otherobj): globals.h

# Begin bundle