Auto-commit of generated files.
[bpt/emacs.git] / autogen / configure
index e2bbe20..163bbaf 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for emacs 24.1.50.
+# Generated by GNU Autoconf 2.65 for emacs 24.2.50.
 #
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -549,8 +549,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='emacs'
 PACKAGE_TARNAME='emacs'
-PACKAGE_VERSION='24.1.50'
-PACKAGE_STRING='emacs 24.1.50'
+PACKAGE_VERSION='24.2.50'
+PACKAGE_STRING='emacs 24.2.50'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -604,6 +604,7 @@ am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
 SUBDIR_MAKEFILES_IN
+WINDOW_SYSTEM_OBJ
 LIB_GCC
 LD_FIRSTFLAG
 LD_SWITCH_SYSTEM_TEMACS
@@ -618,8 +619,6 @@ gl_GNULIB_ENABLED_strtoll_FALSE
 gl_GNULIB_ENABLED_strtoll_TRUE
 gl_GNULIB_ENABLED_stat_FALSE
 gl_GNULIB_ENABLED_stat_TRUE
-gl_GNULIB_ENABLED_sigprocmask_FALSE
-gl_GNULIB_ENABLED_sigprocmask_TRUE
 gl_GNULIB_ENABLED_pathmax_FALSE
 gl_GNULIB_ENABLED_pathmax_TRUE
 gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36_FALSE
@@ -628,17 +627,16 @@ gl_GNULIB_ENABLED_dosname_FALSE
 gl_GNULIB_ENABLED_dosname_TRUE
 LTLIBINTL
 LIBINTL
+WINDOWS_64_BIT_OFF_T
 HAVE_UNISTD_H
 NEXT_AS_FIRST_DIRECTIVE_UNISTD_H
 NEXT_UNISTD_H
+LIB_TIMER_TIME
 PTHREAD_H_DEFINES_STRUCT_TIMESPEC
 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC
 TIME_H_DEFINES_STRUCT_TIMESPEC
 NEXT_AS_FIRST_DIRECTIVE_TIME_H
 NEXT_TIME_H
-WINDOWS_64_BIT_OFF_T
-NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H
-NEXT_SYS_TYPES_H
 WINDOWS_64_BIT_ST_SIZE
 NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H
 NEXT_SYS_STAT_H
@@ -785,6 +783,14 @@ GNULIB_SIGPROCMASK
 GNULIB_SIGNAL_H_SIGPIPE
 GNULIB_RAISE
 GNULIB_PTHREAD_SIGMASK
+HAVE_SYS_SELECT_H
+NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H
+NEXT_SYS_SELECT_H
+REPLACE_SELECT
+REPLACE_PSELECT
+HAVE_PSELECT
+GNULIB_SELECT
+GNULIB_PSELECT
 REPLACE_TIMEGM
 REPLACE_NANOSLEEP
 REPLACE_MKTIME
@@ -875,6 +881,15 @@ HAVE_INTTYPES_H
 HAVE_WCHAR_H
 HAVE_UNSIGNED_LONG_LONG_INT
 HAVE_LONG_LONG_INT
+HAVE_WINSOCK2_H
+NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H
+NEXT_SYS_TIME_H
+REPLACE_STRUCT_TIMEVAL
+REPLACE_GETTIMEOFDAY
+HAVE_SYS_TIME_H
+HAVE_STRUCT_TIMEVAL
+HAVE_GETTIMEOFDAY
+GNULIB_GETTIMEOFDAY
 GNULIB_GL_UNISTD_H_GETOPT
 GETOPT_H
 HAVE_GETOPT_H
@@ -894,6 +909,7 @@ REPLACE_REALLOC
 REPLACE_RANDOM_R
 REPLACE_PUTENV
 REPLACE_PTSNAME_R
+REPLACE_PTSNAME
 REPLACE_MKSTEMP
 REPLACE_MBTOWC
 REPLACE_MALLOC
@@ -958,6 +974,10 @@ GNULIB_CANONICALIZE_FILE_NAME
 GNULIB_CALLOC_POSIX
 GNULIB_ATOLL
 GNULIB__EXIT
+GL_GENERATE_EXECINFO_H_FALSE
+GL_GENERATE_EXECINFO_H_TRUE
+LIB_EXECINFO
+EXECINFO_H
 UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS
 UNISTD_H_HAVE_WINSOCK2_H
 REPLACE_WRITE
@@ -1078,6 +1098,7 @@ GNULIB_DUP
 GNULIB_CLOSE
 GNULIB_CHOWN
 GNULIB_CHDIR
+LIB_CLOCK_GETTIME
 GL_GENERATE_ALLOCA_H_FALSE
 GL_GENERATE_ALLOCA_H_TRUE
 ALLOCA_H
@@ -1105,7 +1126,6 @@ ns_appsrc
 ns_appresdir
 ns_appbindir
 ns_appdir
-S_FILE
 X_TOOLKIT_TYPE
 GNUSTEP_CFLAGS
 C_SWITCH_X_SITE
@@ -1118,12 +1138,14 @@ etcdir
 x_default_search_path
 lisppath
 locallisppath
+standardlisppath
 leimdir
 lispdir
 srcdir
 canonical
 configuration
 version
+copyright
 KRB4LIB
 DESLIB
 KRB5LIB
@@ -1162,6 +1184,8 @@ LIBGNUTLS_CFLAGS
 LIBSELINUX_LIBS
 SETTINGS_LIBS
 SETTINGS_CFLAGS
+GOBJECT_LIBS
+GOBJECT_CFLAGS
 GCONF_LIBS
 GCONF_CFLAGS
 GSETTINGS_LIBS
@@ -1180,6 +1204,8 @@ LIB_PTHREAD
 VMLIMIT_OBJ
 GMALLOC_OBJ
 HAVE_XSERVER
+W32_LIBS
+W32_OBJ
 LIB_STANDARD
 NS_OBJC_OBJ
 NS_OBJ
@@ -1207,8 +1233,10 @@ CANNOT_DUMP
 INFO_OPTS
 INFO_EXT
 HAVE_MAKEINFO
+PAXCTL
 GZIP_PROG
 INSTALL_INFO
+LN_S
 GNULIB_WARN_CFLAGS
 WARN_CFLAGS
 WERROR_CFLAGS
@@ -1307,10 +1335,10 @@ PACKAGE_NAME
 PATH_SEPARATOR
 SHELL'
 ac_subst_files='deps_frag
-lisp_frag
-ns_frag'
+lisp_frag'
 ac_user_opts='
 enable_option_checking
+with_all
 with_pop
 with_kerberos
 with_kerberos5
@@ -1319,7 +1347,6 @@ with_mmdf
 with_mail_unlink
 with_mailhost
 with_sound
-with_sync_input
 with_x_toolkit
 with_wide_int
 with_xpm
@@ -1337,6 +1364,7 @@ with_toolkit_scroll_bars
 with_xaw3d
 with_xim
 with_ns
+with_w32
 with_gpm
 with_dbus
 with_gconf
@@ -1350,15 +1378,15 @@ with_crt_dir
 with_gameuser
 with_gnustep_conf
 enable_ns_self_contained
-enable_asserts
 enable_locallisppath
 enable_checking
-enable_use_lisp_union_type
+enable_check_lisp_object_type
 enable_profiling
 enable_autodepend
 enable_dependency_tracking
 enable_largefile
 enable_gcc_warnings
+enable_link_time_optimization
 with_x
 '
       ac_precious_vars='build_alias
@@ -1912,7 +1940,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures emacs 24.1.50 to adapt to many kinds of systems.
+\`configure' configures emacs 24.2.50 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1986,7 +2014,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of emacs 24.1.50:";;
+     short | recursive ) echo "Configuration of emacs 24.2.50:";;
    esac
   cat <<\_ACEOF
 
@@ -1996,7 +2024,6 @@ Optional Features:
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --disable-ns-self-contained
                           disable self contained build under NeXTstep
-  --enable-asserts        compile code with asserts enabled
   --enable-locallisppath=PATH
                           directories Emacs should search for lisp files
                           specific to this site
@@ -2004,11 +2031,11 @@ Optional Features:
                           enable expensive run-time checks. With LIST, enable
                           only specific categories of checks. Categories are:
                           all,yes,no. Flags are: stringbytes, stringoverrun,
-                          stringfreelist, xmallocoverrun, conslist
-  --enable-use-lisp-union-type
-                          use a union for the Lisp_Object data type. This is
-                          only useful for development for catching certain
-                          types of bugs.
+                          stringfreelist, xmallocoverrun, conslist, glyphs
+  --enable-check-lisp-object-type
+                          enable compile time checks for the Lisp_Object data
+                          type. This is useful for development for catching
+                          certain types of bugs.
   --enable-profiling      build emacs with profiling support. This might not
                           work on all platforms
   --enable-autodepend     automatically generate dependencies to .h-files.
@@ -2017,11 +2044,18 @@ Optional Features:
   --disable-dependency-tracking  speeds up one-time build
   --enable-dependency-tracking   do not reject slow dependency extractors
   --disable-largefile     omit support for large files
-  --enable-gcc-warnings   turn on lots of GCC warnings (for developers)
+  --enable-gcc-warnings   turn on lots of GCC warnings. This is intended for
+                          developers, and may generate false alarms when used
+                          with older or non-GNU development tools.
+  --enable-link-time-optimization
+                          build emacs with link-time optimization. This is
+                          supported only for GCC since 4.5.0.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --without-all           omit almost all features and build small executable
+                          with minimal dependencies
   --without-pop           don't support POP mail retrieval with movemail
   --with-kerberos         support Kerberos-authenticated POP
   --with-kerberos5        support Kerberos version 5 authenticated POP
@@ -2031,9 +2065,8 @@ Optional Packages:
   --with-mailhost=HOSTNAME
                           string giving default POP mail host
   --without-sound         don't compile with sound support
-  --without-sync-input    process async input synchronously
-  --with-x-toolkit=KIT    use an X toolkit (KIT one of: yes or gtk, gtk3,
-                          lucid or athena, motif, no)
+  --with-x-toolkit=KIT    use an X toolkit (KIT one of: yes or gtk, gtk2,
+                          gtk3, lucid or athena, motif, no)
   --with-wide-int         prefer wide Emacs integers (typically 62-bit)
   --without-xpm           don't compile with XPM image support
   --without-jpeg          don't compile with JPEG image support
@@ -2051,6 +2084,7 @@ Optional Packages:
   --without-xaw3d         don't use Xaw3d
   --without-xim           don't use X11 XIM
   --with-ns               use NeXTstep (Cocoa or GNUstep) windowing system
+  --with-w32              use native Windows GUI
   --without-gpm           don't use -lgpm for mouse support on a GNU/Linux
                           console
   --without-dbus          don't compile with D-Bus support
@@ -2147,7 +2181,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-emacs configure 24.1.50
+emacs configure 24.2.50
 generated by GNU Autoconf 2.65
 
 Copyright (C) 2009 Free Software Foundation, Inc.
@@ -2510,6 +2544,63 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_header_preproc
 
+# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
+# ----------------------------------------------------
+# Tries to find if the field MEMBER exists in type AGGR, after including
+# INCLUDES, setting cache variable VAR accordingly.
+ac_fn_c_check_member ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
+$as_echo_n "checking for $2.$3... " >&6; }
+if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (sizeof ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  eval "$4=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$4
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_member
+
 # ac_fn_c_check_func LINENO FUNC VAR
 # ----------------------------------
 # Tests whether FUNC exists, setting the cache variable VAR accordingly
@@ -2577,63 +2668,6 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_func
 
-# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
-# ----------------------------------------------------
-# Tries to find if the field MEMBER exists in type AGGR, after including
-# INCLUDES, setting cache variable VAR accordingly.
-ac_fn_c_check_member ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
-$as_echo_n "checking for $2.$3... " >&6; }
-if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$5
-int
-main ()
-{
-static $2 ac_aggr;
-if (ac_aggr.$3)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$4=yes"
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$5
-int
-main ()
-{
-static $2 ac_aggr;
-if (sizeof ac_aggr.$3)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$4=yes"
-else
-  eval "$4=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$4
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-
-} # ac_fn_c_check_member
-
 # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
 # -------------------------------------------
 # Tests whether TYPE exists after having included INCLUDES, setting cache
@@ -2869,7 +2903,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by emacs $as_me 24.1.50, which was
+It was created by emacs $as_me 24.2.50, which was
 generated by GNU Autoconf 2.65.  Invocation command line was
 
   $ $0 $@
@@ -3148,9 +3182,6 @@ $as_echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
 
-as_fn_append ac_header_list " sys/select.h"
-as_fn_append ac_header_list " sys/time.h"
-as_fn_append ac_header_list " utime.h"
 as_fn_append ac_header_list " linux/version.h"
 as_fn_append ac_header_list " sys/systeminfo.h"
 as_fn_append ac_header_list " stdio_ext.h"
@@ -3174,13 +3205,19 @@ as_fn_append ac_header_list " maillock.h"
 as_fn_append ac_header_list " sys/un.h"
 as_fn_append ac_func_list " tzset"
 as_fn_append ac_func_list " readlinkat"
+as_fn_append ac_header_list " execinfo.h"
 gl_getopt_required=GNU
 as_fn_append ac_header_list " getopt.h"
+as_fn_append ac_func_list " gettimeofday"
+as_fn_append ac_func_list " nanotime"
+as_fn_append ac_header_list " sys/time.h"
 as_fn_append ac_header_list " wchar.h"
 as_fn_append ac_header_list " stdint.h"
 as_fn_append ac_header_list " inttypes.h"
 as_fn_append ac_func_list " lstat"
 as_fn_append ac_func_list " alarm"
+as_fn_append ac_header_list " sys/select.h"
+as_fn_append ac_func_list " pselect"
 as_fn_append ac_func_list " pthread_sigmask"
 as_fn_append ac_func_list " readlink"
 as_fn_append ac_func_list " strtoimax"
@@ -3188,6 +3225,12 @@ as_fn_append ac_func_list " strtoumax"
 as_fn_append ac_func_list " symlink"
 as_fn_append ac_header_list " sys/stat.h"
 as_fn_append ac_func_list " localtime_r"
+as_fn_append ac_header_list " utime.h"
+as_fn_append ac_func_list " futimes"
+as_fn_append ac_func_list " futimesat"
+as_fn_append ac_func_list " futimens"
+as_fn_append ac_func_list " utimensat"
+as_fn_append ac_func_list " lutimes"
 # Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
@@ -3721,7 +3764,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='emacs'
- VERSION='24.1.50'
+ VERSION='24.2.50'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3766,22 +3809,32 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
 
 lispdir='${datadir}/emacs/${version}/lisp'
 leimdir='${datadir}/emacs/${version}/leim'
+standardlisppath='${lispdir}:${leimdir}'
 locallisppath='${datadir}/emacs/${version}/site-lisp:'\
 '${datadir}/emacs/site-lisp'
-lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim'
+lisppath='${locallisppath}:${standardlisppath}'
 etcdir='${datadir}/emacs/${version}/etc'
 archlibdir='${libexecdir}/emacs/${version}/${configuration}'
 docdir='${datadir}/emacs/${version}/etc'
 gamedir='${localstatedir}/games/emacs'
 
 
+# Check whether --with-all was given.
+if test "${with_all+set}" = set; then :
+  withval=$with_all; with_features=$withval
+else
+  with_features=yes
+fi
+
+
+
 
 
 # Check whether --with-pop was given.
 if test "${with_pop+set}" = set; then :
   withval=$with_pop;
 else
-     with_pop=yes
+     with_pop=$with_features
 fi
 
 if test "$with_pop" = yes; then
@@ -3879,23 +3932,9 @@ fi
 if test "${with_sound+set}" = set; then :
   withval=$with_sound;
 else
-     with_sound=yes
-fi
-
-
-
-# Check whether --with-sync-input was given.
-if test "${with_sync_input+set}" = set; then :
-  withval=$with_sync_input;
-else
-     with_sync_input=yes
+     with_sound=$with_features
 fi
 
-if test "$with_sync_input" = yes; then
-
-$as_echo "#define SYNC_INPUT 1" >>confdefs.h
-
-fi
 
 
 # Check whether --with-x-toolkit was given.
@@ -3907,11 +3946,13 @@ if test "${with_x_toolkit+set}" = set; then :
            a | at | ath | athe | athen | athena )      val=athena ;;
            m | mo | mot | moti | motif )       val=motif ;;
            g | gt | gtk  )     val=gtk ;;
+           gtk2  )     val=gtk2 ;;
            gtk3  )     val=gtk3 ;;
            * )
 as_fn_error "\`--with-x-toolkit=$withval' is invalid;
-this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif', \`gtk' or
-\`gtk3'.  \`yes' and \`gtk' are synonyms. \`athena' and \`lucid' are synonyms." "$LINENO" 5
+this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif', \`gtk',
+\`gtk2' or \`gtk3'.  \`yes' and \`gtk' are synonyms.
+\`athena' and \`lucid' are synonyms." "$LINENO" 5
            ;;
          esac
          with_x_toolkit=$val
@@ -3938,7 +3979,7 @@ fi
 if test "${with_xpm+set}" = set; then :
   withval=$with_xpm;
 else
-     with_xpm=yes
+     with_xpm=$with_features
 fi
 
 
@@ -3946,7 +3987,7 @@ fi
 if test "${with_jpeg+set}" = set; then :
   withval=$with_jpeg;
 else
-     with_jpeg=yes
+     with_jpeg=$with_features
 fi
 
 
@@ -3954,7 +3995,7 @@ fi
 if test "${with_tiff+set}" = set; then :
   withval=$with_tiff;
 else
-     with_tiff=yes
+     with_tiff=$with_features
 fi
 
 
@@ -3962,7 +4003,7 @@ fi
 if test "${with_gif+set}" = set; then :
   withval=$with_gif;
 else
-     with_gif=yes
+     with_gif=$with_features
 fi
 
 
@@ -3970,7 +4011,7 @@ fi
 if test "${with_png+set}" = set; then :
   withval=$with_png;
 else
-     with_png=yes
+     with_png=$with_features
 fi
 
 
@@ -3978,7 +4019,7 @@ fi
 if test "${with_rsvg+set}" = set; then :
   withval=$with_rsvg;
 else
-     with_rsvg=yes
+     with_rsvg=$with_features
 fi
 
 
@@ -3986,7 +4027,7 @@ fi
 if test "${with_xml2+set}" = set; then :
   withval=$with_xml2;
 else
-     with_xml2=yes
+     with_xml2=$with_features
 fi
 
 
@@ -3994,7 +4035,7 @@ fi
 if test "${with_imagemagick+set}" = set; then :
   withval=$with_imagemagick;
 else
-     with_imagemagick=yes
+     with_imagemagick=$with_features
 fi
 
 
@@ -4003,7 +4044,7 @@ fi
 if test "${with_xft+set}" = set; then :
   withval=$with_xft;
 else
-     with_xft=yes
+     with_xft=$with_features
 fi
 
 
@@ -4011,7 +4052,7 @@ fi
 if test "${with_libotf+set}" = set; then :
   withval=$with_libotf;
 else
-     with_libotf=yes
+     with_libotf=$with_features
 fi
 
 
@@ -4019,7 +4060,7 @@ fi
 if test "${with_m17n_flt+set}" = set; then :
   withval=$with_m17n_flt;
 else
-     with_m17n_flt=yes
+     with_m17n_flt=$with_features
 fi
 
 
@@ -4028,7 +4069,7 @@ fi
 if test "${with_toolkit_scroll_bars+set}" = set; then :
   withval=$with_toolkit_scroll_bars;
 else
-     with_toolkit_scroll_bars=yes
+     with_toolkit_scroll_bars=$with_features
 fi
 
 
@@ -4036,7 +4077,7 @@ fi
 if test "${with_xaw3d+set}" = set; then :
   withval=$with_xaw3d;
 else
-     with_xaw3d=yes
+     with_xaw3d=$with_features
 fi
 
 
@@ -4044,7 +4085,7 @@ fi
 if test "${with_xim+set}" = set; then :
   withval=$with_xim;
 else
-     with_xim=yes
+     with_xim=$with_features
 fi
 
 
@@ -4056,12 +4097,20 @@ else
 fi
 
 
+# Check whether --with-w32 was given.
+if test "${with_w32+set}" = set; then :
+  withval=$with_w32;
+else
+      with_w32=no
+fi
+
+
 
 # Check whether --with-gpm was given.
 if test "${with_gpm+set}" = set; then :
   withval=$with_gpm;
 else
-     with_gpm=yes
+     with_gpm=$with_features
 fi
 
 
@@ -4069,7 +4118,7 @@ fi
 if test "${with_dbus+set}" = set; then :
   withval=$with_dbus;
 else
-     with_dbus=yes
+     with_dbus=$with_features
 fi
 
 
@@ -4077,7 +4126,7 @@ fi
 if test "${with_gconf+set}" = set; then :
   withval=$with_gconf;
 else
-     with_gconf=yes
+     with_gconf=$with_features
 fi
 
 
@@ -4085,7 +4134,7 @@ fi
 if test "${with_gsettings+set}" = set; then :
   withval=$with_gsettings;
 else
-     with_gsettings=yes
+     with_gsettings=$with_features
 fi
 
 
@@ -4093,7 +4142,7 @@ fi
 if test "${with_selinux+set}" = set; then :
   withval=$with_selinux;
 else
-     with_selinux=yes
+     with_selinux=$with_features
 fi
 
 
@@ -4101,7 +4150,7 @@ fi
 if test "${with_gnutls+set}" = set; then :
   withval=$with_gnutls;
 else
-     with_gnutls=yes
+     with_gnutls=$with_features
 fi
 
 
@@ -4112,7 +4161,7 @@ fi
 if test "${with_makeinfo+set}" = set; then :
   withval=$with_makeinfo;
 else
-     with_makeinfo=yes
+     with_makeinfo=$with_features
 fi
 
 
@@ -4126,7 +4175,7 @@ fi
 if test "${with_compress_info+set}" = set; then :
   withval=$with_compress_info;
 else
-     with_compress_info=yes
+     with_compress_info=$with_features
 fi
 
 if test $with_compress_info = yes; then
@@ -4186,14 +4235,6 @@ else
 fi
 
 
-# Check whether --enable-asserts was given.
-if test "${enable_asserts+set}" = set; then :
-  enableval=$enable_asserts; USE_XASSERTS=$enableval
-else
-  USE_XASSERTS=no
-fi
-
-
 # Check whether --enable-locallisppath was given.
 if test "${enable_locallisppath+set}" = set; then :
   enableval=$enable_locallisppath; if test "${enableval}" = "no"; then
@@ -4220,19 +4261,22 @@ do
                        ac_gc_check_string_overrun= ;
                        ac_gc_check_string_free_list= ;
                        ac_xmalloc_overrun= ;
-                       ac_gc_check_cons_list= ;;
+                       ac_gc_check_cons_list= ;
+                       ac_glyphs_debug= ;;
        all)            ac_enable_checking=1 ;
                        ac_gc_check_stringbytes=1 ;
                        ac_gc_check_string_overrun=1 ;
                        ac_gc_check_string_free_list=1 ;
                        ac_xmalloc_overrun=1 ;
-                       ac_gc_check_cons_list=1 ;;
+                       ac_gc_check_cons_list=1 ;
+                       ac_glyphs_debug=1 ;;
        # these enable particular checks
        stringbytes)    ac_gc_check_stringbytes=1 ;;
        stringoverrun)  ac_gc_check_string_overrun=1 ;;
        stringfreelist) ac_gc_check_string_free_list=1 ;;
        xmallocoverrun) ac_xmalloc_overrun=1 ;;
        conslist)       ac_gc_check_cons_list=1 ;;
+       glyphs)         ac_glyphs_debug=1 ;;
        *)      as_fn_error "unknown check category $check" "$LINENO" 5 ;;
        esac
 done
@@ -4267,13 +4311,18 @@ if test x$ac_gc_check_cons_list != x ; then
 
 $as_echo "#define GC_CHECK_CONS_LIST 1" >>confdefs.h
 
+fi
+if test x$ac_glyphs_debug != x ; then
+
+$as_echo "#define GLYPH_DEBUG 1" >>confdefs.h
+
 fi
 
-# Check whether --enable-use-lisp-union-type was given.
-if test "${enable_use_lisp_union_type+set}" = set; then :
-  enableval=$enable_use_lisp_union_type; if test "${enableval}" != "no"; then
+# Check whether --enable-check-lisp-object-type was given.
+if test "${enable_check_lisp_object_type+set}" = set; then :
+  enableval=$enable_check_lisp_object_type; if test "${enableval}" != "no"; then
 
-$as_echo "#define USE_LISP_UNION_TYPE 1" >>confdefs.h
+$as_echo "#define CHECK_LISP_OBJECT_TYPE 1" >>confdefs.h
 
 fi
 fi
@@ -4324,9 +4373,6 @@ case "${srcdir}" in
   *  ) srcdir="`(cd ${srcdir}; pwd)`" ;;
 esac
 
-#### Given the configuration name, set opsysfile to the
-#### name of s/*.h file we should use.
-
 ### Canonicalize the configuration name.
 
 # Make sure we can run config.sub.
@@ -4575,8 +4621,6 @@ if test $unported = yes; then
 Check \`etc/MACHINES' for recognized configuration names." "$LINENO" 5
 fi
 
-opsysfile="s/${opsys}.h"
-
 
 #### Choose a compiler.
 
@@ -5693,6 +5737,9 @@ else
   test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
 fi
 
+# Avoid gnulib's threadlib module, as we do threads our own way.
+
+
 # Initialize gnulib right after choosing the compiler.
 
 ac_ext=c
@@ -6907,21 +6954,30 @@ esac
 
   # Code from module alloca-opt:
   # Code from module allocator:
+  # Code from module c-ctype:
+  # Code from module c-strcase:
   # Code from module careadlinkat:
+  # Code from module clock-time:
   # Code from module crypto/md5:
   # Code from module crypto/sha1:
   # Code from module crypto/sha256:
   # Code from module crypto/sha512:
   # Code from module dosname:
   # Code from module dtoastr:
+  # Code from module dtotimespec:
   # Code from module dup2:
+  # Code from module environ:
+  # Code from module execinfo:
   # Code from module extensions:
 
+  # Code from module extern-inline:
   # Code from module filemode:
   # Code from module getloadavg:
   # Code from module getopt-gnu:
   # Code from module getopt-posix:
   # Code from module gettext-h:
+  # Code from module gettime:
+  # Code from module gettimeofday:
   # Code from module ignore-value:
   # Code from module include_next:
   # Code from module intprops:
@@ -6934,10 +6990,10 @@ esac
   # Code from module multiarch:
   # Code from module nocrash:
   # Code from module pathmax:
+  # Code from module pselect:
   # Code from module pthread_sigmask:
   # Code from module readlink:
   # Code from module signal-h:
-  # Code from module sigprocmask:
   # Code from module snippet/_Noreturn:
   # Code from module snippet/arg-nonnull:
   # Code from module snippet/c++defs:
@@ -6945,6 +7001,7 @@ esac
   # Code from module socklen:
   # Code from module ssize_t:
   # Code from module stat:
+  # Code from module stat-time:
   # Code from module stdalign:
   # Code from module stdarg:
 
@@ -6961,16 +7018,71 @@ esac
   # Code from module strtoull:
   # Code from module strtoumax:
   # Code from module symlink:
+  # Code from module sys_select:
   # Code from module sys_stat:
-  # Code from module sys_types:
+  # Code from module sys_time:
   # Code from module time:
   # Code from module time_r:
+  # Code from module timer-time:
+  # Code from module timespec:
+  # Code from module timespec-add:
+  # Code from module timespec-sub:
   # Code from module u64:
   # Code from module unistd:
+  # Code from module utimens:
   # Code from module verify:
   # Code from module warnings:
 
 
+# It's helpful to have C macros available to GDB, so prefer -g3 to -g
+# if -g3 works and the user does not specify CFLAGS.
+# This test must follow gl_EARLY; otherwise AC_LINK_IFELSE complains.
+if test "$ac_test_CFLAGS" != set; then
+  case $CFLAGS in
+    '-g')
+      emacs_g3_CFLAGS='-g3';;
+    '-g -O2')
+      emacs_g3_CFLAGS='-g3 -O2';;
+    *)
+      emacs_g3_CFLAGS='';;
+  esac
+  if test -n "$emacs_g3_CFLAGS"; then
+    emacs_save_CFLAGS=$CFLAGS
+    CFLAGS=$emacs_g3_CFLAGS
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts $emacs_g3_CFLAGS" >&5
+$as_echo_n "checking whether $CC accepts $emacs_g3_CFLAGS... " >&6; }
+if test "${emacs_cv_prog_cc_g3+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_cv_prog_cc_g3=yes
+else
+  emacs_cv_prog_cc_g3=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_prog_cc_g3" >&5
+$as_echo "$emacs_cv_prog_cc_g3" >&6; }
+    if test $emacs_cv_prog_cc_g3 = yes; then
+      CFLAGS=$emacs_g3_CFLAGS
+    else
+      CFLAGS=$emacs_save_CFLAGS
+    fi
+  fi
+fi
+
 # Check whether --enable-gcc-warnings was given.
 if test "${enable_gcc_warnings+set}" = set; then :
   enableval=$enable_gcc_warnings; case $enableval in
@@ -6984,6 +7096,49 @@ else
 fi
 
 
+# Check whether --enable-link-time-optimization was given.
+if test "${enable_link_time_optimization+set}" = set; then :
+  enableval=$enable_link_time_optimization; if test "${enableval}" != "no"; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether link-time optimization is supported" >&5
+$as_echo_n "checking whether link-time optimization is supported... " >&6; }
+   ac_lto_supported=no
+   if test x$GCC = xyes; then
+      CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
+      if test x$CPUS != x; then
+        LTO="-flto=$CPUS"
+      else
+        LTO="-flto"
+      fi
+      old_CFLAGS=$CFLAGS
+      CFLAGS="$CFLAGS $LTO"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lto_supported=yes
+else
+  ac_lto_supported=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      CFLAGS="$old_CFLAGS"
+   fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_lto_supported" >&5
+$as_echo "$ac_lto_supported" >&6; }
+   if test "$ac_lto_supported" = "yes"; then
+      CFLAGS="$CFLAGS $LTO"
+   fi
+fi
+fi
+
+
 # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
 # ------------------------------------------------
 # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
@@ -7056,16 +7211,20 @@ fi
   nw="$nw -Wsign-conversion"        # Too many warnings for now
   nw="$nw -Woverlength-strings"     # Not a problem these days
   nw="$nw -Wtraditional-conversion" # Too many warnings for now
+  nw="$nw -Wunreachable-code"       # so buggy that it's now silently ignored
   nw="$nw -Wpadded"                 # Our structs are not padded
-  nw="$nw -Wredundant-decls"        # We regularly (re)declare getenv etc.
+  nw="$nw -Wredundant-decls"        # we regularly (re)declare functions
   nw="$nw -Wlogical-op"             # any use of fwrite provokes this
-  nw="$nw -Wformat-nonliteral"      # Emacs does this a lot
+  nw="$nw -Wformat-nonliteral"      # we do this a lot
   nw="$nw -Wvla"                    # warnings in gettext.h
   nw="$nw -Wnested-externs"         # use of XARGMATCH/verify_function__
   nw="$nw -Wswitch-enum"            # Too many warnings for now
   nw="$nw -Wswitch-default"         # Too many warnings for now
-  nw="$nw -Wfloat-equal"            # e.g., ftoastr.c
-  nw="$nw -Winline"                 # e.g., dispnew.c's inlining of row_equal_p
+  nw="$nw -Wfloat-equal"            # warns about high-quality code
+  nw="$nw -Winline"                 # OK to ignore 'inline'
+  nw="$nw -Wjump-misses-init"       # We sometimes safely jump over init.
+  nw="$nw -Wsync-nand"              # irrelevant here, and provokes ObjC warning
+  nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
 
   # Emacs doesn't care about shadowing; see
   # <http://lists.gnu.org/archive/html/emacs-diffs/2011-11/msg00265.html>.
@@ -7074,7 +7233,6 @@ fi
   # The following lines should be removable at some point.
   nw="$nw -Wstack-protector"
   nw="$nw -Wstrict-overflow"
-  nw="$nw -Wsuggest-attribute=const"
   nw="$nw -Wsuggest-attribute=pure"
 
 
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_nomfi_needed" >&5
 $as_echo "$gl_cv_cc_nomfi_needed" >&6; }
     fi
+
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Wuninitialized is supported" >&5
+$as_echo_n "checking whether -Wuninitialized is supported... " >&6; }
+    if test "${gl_cv_cc_uninitialized_supported+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -Werror -Wuninitialized"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_cc_uninitialized_supported=yes
+else
+  gl_cv_cc_uninitialized_supported=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      CFLAGS="$gl_save_CFLAGS"
+fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_uninitialized_supported" >&5
+$as_echo "$gl_cv_cc_uninitialized_supported" >&6; }
+
   fi
 
+  # List all gcc warning categories.
   gl_manywarn_set=
   for gl_manywarn_item in \
-    -Wall \
     -W \
-    -Wformat-y2k \
+    -Wabi \
+    -Waddress \
+    -Wall \
+    -Warray-bounds \
+    -Wattributes \
+    -Wbad-function-cast \
+    -Wbuiltin-macro-redefined \
+    -Wcast-align \
+    -Wchar-subscripts \
+    -Wclobbered \
+    -Wcomment \
+    -Wcomments \
+    -Wcoverage-mismatch \
+    -Wcpp \
+    -Wdeprecated \
+    -Wdeprecated-declarations \
+    -Wdisabled-optimization \
+    -Wdiv-by-zero \
+    -Wdouble-promotion \
+    -Wempty-body \
+    -Wendif-labels \
+    -Wenum-compare \
+    -Wextra \
+    -Wformat-contains-nul \
+    -Wformat-extra-args \
     -Wformat-nonliteral \
     -Wformat-security \
+    -Wformat-y2k \
+    -Wformat-zero-length \
+    -Wformat=2 \
+    -Wfree-nonheap-object \
+    -Wignored-qualifiers \
+    -Wimplicit \
+    -Wimplicit-function-declaration \
+    -Wimplicit-int \
     -Winit-self \
+    -Winline \
+    -Wint-to-pointer-cast \
+    -Winvalid-memory-model \
+    -Winvalid-pch \
+    -Wjump-misses-init \
+    -Wlogical-op \
+    -Wmain \
+    -Wmaybe-uninitialized \
+    -Wmissing-braces \
+    -Wmissing-declarations \
+    -Wmissing-field-initializers \
+    -Wmissing-format-attribute \
     -Wmissing-include-dirs \
-    -Wswitch-default \
-    -Wswitch-enum \
-    -Wunused \
-    -Wunknown-pragmas \
-    -Wstrict-aliasing \
-    -Wstrict-overflow \
-    -Wsystem-headers \
-    -Wfloat-equal \
-    -Wtraditional \
-    -Wtraditional-conversion \
-    -Wdeclaration-after-statement \
-    -Wundef \
-    -Wshadow \
-    -Wunsafe-loop-optimizations \
-    -Wpointer-arith \
-    -Wbad-function-cast \
-    -Wc++-compat \
-    -Wcast-qual \
-    -Wcast-align \
-    -Wwrite-strings \
-    -Wconversion \
-    -Wsign-conversion \
-    -Wlogical-op \
-    -Waggregate-return \
-    -Wstrict-prototypes \
-    -Wold-style-definition \
-    -Wmissing-prototypes \
-    -Wmissing-declarations \
     -Wmissing-noreturn \
-    -Wmissing-format-attribute \
-    -Wpacked \
-    -Wpadded \
-    -Wredundant-decls \
-    -Wnested-externs \
-    -Wunreachable-code \
-    -Winline \
-    -Winvalid-pch \
-    -Wlong-long \
-    -Wvla \
-    -Wvolatile-register-var \
-    -Wdisabled-optimization \
-    -Wstack-protector \
-    -Woverlength-strings \
-    -Wbuiltin-macro-redefined \
+    -Wmissing-parameter-type \
+    -Wmissing-prototypes \
     -Wmudflap \
-    -Wpacked-bitfield-compat \
-    -Wsync-nand \
-    ; do
-    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
-  done
-  # The following are not documented in the manual but are included in
-  # output from gcc --help=warnings.
-  for gl_manywarn_item in \
-    -Wattributes \
-    -Wcoverage-mismatch \
-    -Wunused-macros \
-    ; do
-    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
-  done
-  # More warnings from gcc 4.6.2 --help=warnings.
-  for gl_manywarn_item in \
-    -Wabi \
-    -Wcpp \
-    -Wdeprecated \
-    -Wdeprecated-declarations \
-    -Wdiv-by-zero \
-    -Wdouble-promotion \
-    -Wendif-labels \
-    -Wextra \
-    -Wformat-contains-nul \
-    -Wformat-extra-args \
-    -Wformat-zero-length \
-    -Wformat=2 \
     -Wmultichar \
+    -Wnarrowing \
+    -Wnested-externs \
+    -Wnonnull \
     -Wnormalized=nfc \
+    -Wold-style-declaration \
+    -Wold-style-definition \
     -Woverflow \
+    -Woverlength-strings \
+    -Woverride-init \
+    -Wpacked \
+    -Wpacked-bitfield-compat \
+    -Wparentheses \
+    -Wpointer-arith \
+    -Wpointer-sign \
     -Wpointer-to-int-cast \
     -Wpragmas \
+    -Wreturn-type \
+    -Wsequence-point \
+    -Wshadow \
+    -Wsizeof-pointer-memaccess \
+    -Wstack-protector \
+    -Wstrict-aliasing \
+    -Wstrict-overflow \
+    -Wstrict-prototypes \
     -Wsuggest-attribute=const \
+    -Wsuggest-attribute=format \
     -Wsuggest-attribute=noreturn \
     -Wsuggest-attribute=pure \
+    -Wswitch \
+    -Wswitch-default \
+    -Wsync-nand \
+    -Wsystem-headers \
     -Wtrampolines \
+    -Wtrigraphs \
+    -Wtype-limits \
+    -Wuninitialized \
+    -Wunknown-pragmas \
+    -Wunreachable-code \
+    -Wunsafe-loop-optimizations \
+    -Wunused \
+    -Wunused-but-set-parameter \
+    -Wunused-but-set-variable \
+    -Wunused-function \
+    -Wunused-label \
+    -Wunused-local-typedefs \
+    -Wunused-macros \
+    -Wunused-parameter \
+    -Wunused-result \
+    -Wunused-value \
+    -Wunused-variable \
+    -Wvarargs \
+    -Wvariadic-macros \
+    -Wvector-operation-performance \
+    -Wvla \
+    -Wvolatile-register-var \
+    -Wwrite-strings \
+    \
     ; do
     gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
   done
 
-  # Disable the missing-field-initializers warning if needed
+  # Disable specific options as needed.
   if test "$gl_cv_cc_nomfi_needed" = yes; then
     gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
   fi
 
+  if test "$gl_cv_cc_uninitialized_supported" = no; then
+    gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized"
+  fi
+
   ws=$gl_manywarn_set
 
 
@@ -7633,8 +7851,6 @@ fi
 $as_echo "#define lint 1" >>confdefs.h
 
 
-$as_echo "#define _FORTIFY_SOURCE 2" >>confdefs.h
-
 
 $as_echo "#define GNULIB_PORTCHECK 1" >>confdefs.h
 
@@ -7664,6 +7880,17 @@ fi
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
 
 # Extract the first word of "install-info", so it can be a program name with args.
 set dummy install-info; ac_word=$2
@@ -7747,6 +7974,71 @@ fi
 
 
 
+if test $opsys = gnu-linux; then
+  # Extract the first word of "paxctl", so it can be a program name with args.
+set dummy paxctl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PAXCTL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PAXCTL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PAXCTL="$PAXCTL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PAXCTL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PAXCTL=$ac_cv_path_PAXCTL
+if test -n "$PAXCTL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PAXCTL" >&5
+$as_echo "$PAXCTL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  if test "X$PAXCTL" != X; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether binaries have a PT_PAX_FLAGS header" >&5
+$as_echo_n "checking whether binaries have a PT_PAX_FLAGS header... " >&6; }
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  if $PAXCTL -v conftest$EXEEXT >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+      else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }; PAXCTL=""; fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  fi
+fi
 
 ## Need makeinfo >= 4.7 (?) to build the manuals.
 # Extract the first word of "makeinfo", so it can be a program name with args.
@@ -8032,6 +8324,7 @@ fi
 LIB_MATH=-lm
 LIB_STANDARD=
 START_FILES=
+SYSTEM_TYPE=`echo $opsys | sed -e 's/[0-9].*//' -e 's|-|/|'`
 
 case $opsys in
   cygwin )
@@ -8044,8 +8337,9 @@ case $opsys in
     START_FILES='pre-crt0.o'
     ;;
   freebsd )
-    LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
-    START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
+    LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
+    START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
+    SYSTEM_TYPE=berkeley-unix
     ;;
   gnu-linux | gnu-kfreebsd )
     LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
@@ -8058,12 +8352,23 @@ case $opsys in
     netbsd | openbsd )
     LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
     START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
+    SYSTEM_TYPE=berkeley-unix
     ;;
+
+  sol2* | unixware )
+    SYSTEM_TYPE=usg-unix-v
+    ;;
+
 esac
 
 
 
 
+cat >>confdefs.h <<_ACEOF
+#define SYSTEM_TYPE "$SYSTEM_TYPE"
+_ACEOF
+
+
 crt_files=
 
 for file in x $LIB_STANDARD $START_FILES; do
@@ -8170,6 +8475,9 @@ case $opsys in
 esac
 
 
+pre_PKG_CONFIG_CFLAGS=$CFLAGS
+pre_PKG_CONFIG_LIBS=$LIBS
+
 # Extract the first word of "pkg-config", so it can be a program name with args.
 set dummy pkg-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -8309,8 +8617,9 @@ $as_echo "no" >&6; }
             ALSA_CFLAGS=""
             ALSA_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            ALSA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$ALSA_MODULES"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           ALSA_PKG_ERRORS=`($PKG_CONFIG --print-errors "$ALSA_MODULES") 2>&1`
 
         fi
 
@@ -8435,12 +8744,6 @@ done
 
 
 
-
-
-
-
-
-
 
 
 
@@ -8523,7 +8826,9 @@ $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
 
 fi
 
-ac_fn_c_check_decl "$LINENO" "sys_siglist" "ac_cv_have_decl_sys_siglist" "$ac_includes_default"
+ac_fn_c_check_decl "$LINENO" "sys_siglist" "ac_cv_have_decl_sys_siglist" "#include <signal.h>
+
+"
 if test "x$ac_cv_have_decl_sys_siglist" = x""yes; then :
   ac_have_decl=1
 else
@@ -8536,7 +8841,9 @@ _ACEOF
 
 if test $ac_cv_have_decl_sys_siglist != yes; then
   # For Tru64, at least:
-  ac_fn_c_check_decl "$LINENO" "__sys_siglist" "ac_cv_have_decl___sys_siglist" "$ac_includes_default"
+  ac_fn_c_check_decl "$LINENO" "__sys_siglist" "ac_cv_have_decl___sys_siglist" "#include <signal.h>
+
+"
 if test "x$ac_cv_have_decl___sys_siglist" = x""yes; then :
   ac_have_decl=1
 else
@@ -8595,49 +8902,6 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
 fi
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct utimbuf" >&5
-$as_echo_n "checking for struct utimbuf... " >&6; }
-if test "${emacs_cv_struct_utimbuf+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#endif
-int
-main ()
-{
-static struct utimbuf x; x.actime = x.modtime;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  emacs_cv_struct_utimbuf=yes
-else
-  emacs_cv_struct_utimbuf=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_struct_utimbuf" >&5
-$as_echo "$emacs_cv_struct_utimbuf" >&6; }
-if test $emacs_cv_struct_utimbuf = yes; then
-
-$as_echo "#define HAVE_STRUCT_UTIMBUF 1" >>confdefs.h
-
-fi
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for speed_t" >&5
 $as_echo_n "checking for speed_t... " >&6; }
 if test "${emacs_cv_speed_t+set}" = set; then :
@@ -8669,79 +8933,6 @@ $as_echo "#define HAVE_SPEED_T 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timeval" >&5
-$as_echo_n "checking for struct timeval... " >&6; }
-if test "${emacs_cv_struct_timeval+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif
-int
-main ()
-{
-static struct timeval x; x.tv_sec = x.tv_usec;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  emacs_cv_struct_timeval=yes
-else
-  emacs_cv_struct_timeval=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_struct_timeval" >&5
-$as_echo "$emacs_cv_struct_timeval" >&6; }
-HAVE_TIMEVAL=$emacs_cv_struct_timeval
-if test $emacs_cv_struct_timeval = yes; then
-
-$as_echo "#define HAVE_TIMEVAL 1" >>confdefs.h
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct exception" >&5
-$as_echo_n "checking for struct exception... " >&6; }
-if test "${emacs_cv_struct_exception+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <math.h>
-int
-main ()
-{
-static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  emacs_cv_struct_exception=yes
-else
-  emacs_cv_struct_exception=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_struct_exception" >&5
-$as_echo "$emacs_cv_struct_exception" >&6; }
-HAVE_EXCEPTION=$emacs_cv_struct_exception
-if test $emacs_cv_struct_exception != yes; then
-
-$as_echo "#define NO_MATHERR 1" >>confdefs.h
-
-fi
-
 
 
 
@@ -8793,19 +8984,6 @@ fi
 
 done
 
-for ac_func in getifaddrs freeifaddrs
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
 
 ac_fn_c_check_member "$LINENO" "struct ifreq" "ifr_flags" "ac_cv_member_struct_ifreq_ifr_flags" "$ac_includes_default
 #if HAVE_SYS_SOCKET_H
@@ -8906,37 +9084,6 @@ fi
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for  __attribute__ ((__aligned__ (expr)))" >&5
-$as_echo_n "checking for  __attribute__ ((__aligned__ (expr)))... " >&6; }
-if test "${emacs_cv_attribute_aligned+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-char __attribute__ ((__aligned__ (1 << 3))) c;
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  emacs_cv_attribute_aligned=yes
-else
-  emacs_cv_attribute_aligned=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_attribute_aligned" >&5
-$as_echo "$emacs_cv_attribute_aligned" >&6; }
-if test $emacs_cv_attribute_aligned = yes; then
-
-$as_echo "#define HAVE_ATTRIBUTE_ALIGNED 1" >>confdefs.h
-
-fi
-
 
 DEPFLAGS=
 MKDEPDIR=":"
@@ -9041,6 +9188,12 @@ fi
 
 #### Choose a window system.
 
+## We leave window_system equal to none if
+## we end up building without one.  Any new window system should
+## set window_system to an appropriate value and add objects to
+## window-system-specific substs.
+
+window_system=none
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5
 $as_echo_n "checking for X... " >&6; }
 
@@ -9234,9 +9387,7 @@ else
 $as_echo "libraries $x_libraries, headers $x_includes" >&6; }
 fi
 
-if test "$no_x" = yes; then
-  window_system=none
-else
+if test "$no_x" != yes; then
   window_system=x11
 fi
 
@@ -9306,13 +9457,13 @@ if test "${with_ns}" != no; then
      ns_appdir=`pwd`/nextstep/Emacs.app
      ns_appbindir=${ns_appdir}/Contents/MacOS
      ns_appresdir=${ns_appdir}/Contents/Resources
-     ns_appsrc=${srcdir}/nextstep/Cocoa/Emacs.base
+     ns_appsrc=Cocoa/Emacs.base
   elif test -f $GNUSTEP_CONFIG_FILE; then
      NS_IMPL_GNUSTEP=yes
      ns_appdir=`pwd`/nextstep/Emacs.app
      ns_appbindir=${ns_appdir}
      ns_appresdir=${ns_appdir}/Resources
-     ns_appsrc=${srcdir}/nextstep/GNUstep/Emacs.base
+     ns_appsrc=GNUstep/Emacs.base
           GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)"
      GNUSTEP_SYSTEM_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_LIBRARIES)"
           GNUSTEP_LOCAL_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_LOCAL_HEADERS)"
@@ -9375,6 +9526,32 @@ else
 fi
 
 
+
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <AppKit/AppKit.h>
+int
+main ()
+{
+
+#ifdef MAC_OS_X_VERSION_MAX_ALLOWED
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+ ; /* OK */
+#else
+#error "OSX 10.4 or newer required"
+#endif
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ns_osx_have_104=yes
+else
+  ns_osx_have_104=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <Foundation/NSObjCRuntime.h>
@@ -9392,6 +9569,9 @@ else
   ns_have_nsinteger=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  if test $ns_osx_have_104 = no; then
+     as_fn_error "\`OSX 10.4 or newer is required'" "$LINENO" 5;
+  fi
   if test $ns_have_nsinteger = yes; then
 
 $as_echo "#define NS_HAVE_NSINTEGER 1" >>confdefs.h
@@ -9400,9 +9580,9 @@ $as_echo "#define NS_HAVE_NSINTEGER 1" >>confdefs.h
 fi
 
 
+
 INSTALL_ARCH_INDEP_EXTRA=install-etc
 ns_self_contained=no
-ns_frag=/dev/null
 NS_OBJ=
 NS_OBJC_OBJ=
 if test "${HAVE_NS}" = yes; then
@@ -9411,7 +9591,6 @@ if test "${HAVE_NS}" = yes; then
   fi
 
   window_system=nextstep
-  with_xft=no
   # set up packaging dirs
   if test "${EN_NS_SELF_CONTAINED}" = yes; then
      ns_self_contained=yes
@@ -9427,8 +9606,6 @@ if test "${HAVE_NS}" = yes; then
      leimdir="\${ns_appresdir}/leim"
      INSTALL_ARCH_INDEP_EXTRA=
   fi
-  ns_frag=$srcdir/src/ns.mk
-  NS_OBJ="fontset.o fringe.o image.o"
   NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o"
 fi
 CFLAGS="$tmp_CFLAGS"
@@ -9439,29 +9616,83 @@ CPPFLAGS="$tmp_CPPFLAGS"
 
 
 
+HAVE_W32=no
+W32_OBJ=
+W32_LIBS=
+if test "${with_w32}" != no; then
+  if test "${opsys}" != "cygwin"; then
+    as_fn_error "Using w32 with an autotools build is only supported for Cygwin." "$LINENO" 5
+  fi
+  ac_fn_c_check_header_mongrel "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default"
+if test "x$ac_cv_header_windows_h" = x""yes; then :
+  HAVE_W32=yes
+else
+  as_fn_error "\`--with-w32' was specified, but windows.h
+                  cannot be found." "$LINENO" 5
+fi
+
+
+
+$as_echo "#define HAVE_NTGUI 1" >>confdefs.h
+
+  W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o"
+  W32_OBJ="$W32_OBJ w32xfns.o w32select.o w32uniscribe.o"
+  W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32"
+  W32_LIBS="$W32_LIBS -lusp10 -lcomctl32 -lwinspool"
+fi
+
+
+
+if test "${HAVE_W32}" = "yes"; then
+  window_system=w32
+  with_xft=no
+fi
+
+## $window_system is now set to the window system we will
+## ultimately use.
+
+term_header=
+HAVE_X_WINDOWS=no
+HAVE_X11=no
+USE_X_TOOLKIT=none
 
 case "${window_system}" in
   x11 )
     HAVE_X_WINDOWS=yes
     HAVE_X11=yes
+    term_header=xterm.h
     case "${with_x_toolkit}" in
       athena | lucid ) USE_X_TOOLKIT=LUCID ;;
       motif ) USE_X_TOOLKIT=MOTIF ;;
       gtk ) with_gtk=yes
+            term_header=gtkutil.h
             USE_X_TOOLKIT=none ;;
+      gtk2 ) with_gtk2=yes
+             term_header=gtkutil.h
+             USE_X_TOOLKIT=none ;;
       gtk3 ) with_gtk3=yes
+             term_header=gtkutil.h
              USE_X_TOOLKIT=none ;;
       no ) USE_X_TOOLKIT=none ;;
       * ) USE_X_TOOLKIT=maybe ;;
     esac
   ;;
-  nextstep | none )
-    HAVE_X_WINDOWS=no
-    HAVE_X11=no
-    USE_X_TOOLKIT=none
+  nextstep )
+    term_header=nsterm.h
+  ;;
+  w32 )
+    term_header=w32term.h
   ;;
 esac
 
+if test -n "${term_header}"; then
+
+cat >>confdefs.h <<_ACEOF
+#define TERM_HEADER "${term_header}"
+_ACEOF
+
+fi
+
 if test "$window_system" = none && test "X$with_x" != "Xno"; then
    # Extract the first word of "X", so it can be a program name with args.
 set dummy X; ac_word=$2
@@ -10273,8 +10504,9 @@ $as_echo "no" >&6; }
             RSVG_CFLAGS=""
             RSVG_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            RSVG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$RSVG_MODULE"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           RSVG_PKG_ERRORS=`($PKG_CONFIG --print-errors "$RSVG_MODULE") 2>&1`
 
         fi
 
@@ -10343,8 +10575,9 @@ $as_echo "no" >&6; }
             IMAGEMAGICK_CFLAGS=""
             IMAGEMAGICK_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            IMAGEMAGICK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$IMAGEMAGICK_MODULE"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           IMAGEMAGICK_PKG_ERRORS=`($PKG_CONFIG --print-errors "$IMAGEMAGICK_MODULE") 2>&1`
 
         fi
 
@@ -10371,12 +10604,14 @@ $as_echo "#define HAVE_IMAGEMAGICK 1" >>confdefs.h
 
       CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS"
       LIBS="$IMAGEMAGICK_LIBS $LIBS"
-      for ac_func in MagickExportImagePixels
+      for ac_func in MagickExportImagePixels MagickMergeImageLayers
 do :
-  ac_fn_c_check_func "$LINENO" "MagickExportImagePixels" "ac_cv_func_MagickExportImagePixels"
-if test "x$ac_cv_func_MagickExportImagePixels" = x""yes; then :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_MAGICKEXPORTIMAGEPIXELS 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -10389,7 +10624,9 @@ fi
 
 HAVE_GTK=no
 GTK_OBJ=
-if test "${with_gtk3}" = "yes"; then
+check_gtk2=no
+gtk3_pkg_errors=
+if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
   GLIB_REQUIRED=2.28
   GTK_REQUIRED=3.0
   GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
@@ -10425,8 +10662,9 @@ $as_echo "no" >&6; }
             GTK_CFLAGS=""
             GTK_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$GTK_MODULES"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           GTK_PKG_ERRORS=`($PKG_CONFIG --print-errors "$GTK_MODULES") 2>&1`
 
         fi
 
@@ -10444,18 +10682,23 @@ $as_echo "no" >&6; }
      pkg_check_gtk=no
   fi
 
-  if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
+  if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then
      as_fn_error "$GTK_PKG_ERRORS" "$LINENO" 5
   fi
+  if test "$pkg_check_gtk" = "yes"; then
 
 $as_echo "#define HAVE_GTK3 1" >>confdefs.h
 
-  GTK_OBJ=emacsgtkfixed.o
+     GTK_OBJ=emacsgtkfixed.o
+     term_header=gtkutil.h
+     USE_GTK_TOOLKIT="GTK3"
+  else
+     check_gtk2=yes
+     gtk3_pkg_errors="$GTK_PKG_ERRORS "
+  fi
 fi
 
-if test "$pkg_check_gtk" != "yes"; then
-  HAVE_GTK=no
-if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
+if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
   GLIB_REQUIRED=2.10
   GTK_REQUIRED=2.10
   GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
@@ -10491,8 +10734,9 @@ $as_echo "no" >&6; }
             GTK_CFLAGS=""
             GTK_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$GTK_MODULES"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           GTK_PKG_ERRORS=`($PKG_CONFIG --print-errors "$GTK_MODULES") 2>&1`
 
         fi
 
@@ -10510,10 +10754,12 @@ $as_echo "no" >&6; }
      pkg_check_gtk=no
   fi
 
-  if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
-     as_fn_error "$GTK_PKG_ERRORS" "$LINENO" 5
+  if test "$pkg_check_gtk" = "no" &&
+     { test "$with_gtk" = yes || test "$with_gtk2" = "yes"; }
+  then
+    as_fn_error "$gtk3_pkg_errors$GTK_PKG_ERRORS" "$LINENO" 5
   fi
-fi
+  test "$pkg_check_gtk" = "yes" && USE_GTK_TOOLKIT="GTK2"
 fi
 
 if test x"$pkg_check_gtk" = xyes; then
@@ -10613,6 +10859,8 @@ _ACEOF
 fi
 done
 
+
+ term_header=gtkutil.h
 fi
 
 HAVE_DBUS=no
@@ -10649,8 +10897,9 @@ $as_echo "no" >&6; }
             DBUS_CFLAGS=""
             DBUS_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            DBUS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "dbus-1 >= 1.0"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           DBUS_PKG_ERRORS=`($PKG_CONFIG --print-errors "dbus-1 >= 1.0") 2>&1`
 
         fi
 
@@ -10673,7 +10922,8 @@ $as_echo "no" >&6; }
 
 $as_echo "#define HAVE_DBUS 1" >>confdefs.h
 
-               for ac_func in dbus_watch_get_unix_fd \
+                    for ac_func in dbus_watch_get_unix_fd \
+                   dbus_type_is_valid \
                    dbus_validate_bus_name \
                     dbus_validate_path \
                    dbus_validate_interface \
@@ -10728,8 +10978,9 @@ $as_echo "no" >&6; }
             GSETTINGS_CFLAGS=""
             GSETTINGS_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            GSETTINGS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gio-2.0 >= 2.26"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           GSETTINGS_PKG_ERRORS=`($PKG_CONFIG --print-errors "gio-2.0 >= 2.26") 2>&1`
 
         fi
 
@@ -10789,8 +11040,9 @@ $as_echo "no" >&6; }
             GCONF_CFLAGS=""
             GCONF_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            GCONF_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gconf-2.0 >= 2.13"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           GCONF_PKG_ERRORS=`($PKG_CONFIG --print-errors "gconf-2.0 >= 2.13") 2>&1`
 
         fi
 
@@ -10818,6 +11070,61 @@ $as_echo "#define HAVE_GCONF 1" >>confdefs.h
 fi
 
 if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then
+
+  succeeded=no
+
+  if test "$PKG_CONFIG" = "no" ; then
+     HAVE_GOBJECT=no
+  else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gobject-2.0 >= 2.0" >&5
+$as_echo_n "checking for gobject-2.0 >= 2.0... " >&6; }
+
+        if $PKG_CONFIG --exists "gobject-2.0 >= 2.0" 2>&5 &&
+          GOBJECT_CFLAGS=`$PKG_CONFIG --cflags "gobject-2.0 >= 2.0" 2>&5` &&
+          GOBJECT_LIBS=`$PKG_CONFIG --libs "gobject-2.0 >= 2.0" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           GOBJECT_CFLAGS=`$as_echo "$GOBJECT_CFLAGS" | sed -e "$edit_cflags"`
+           GOBJECT_LIBS=`$as_echo "$GOBJECT_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$GOBJECT_CFLAGS' LIBS='$GOBJECT_LIBS'" >&5
+$as_echo "yes CFLAGS='$GOBJECT_CFLAGS' LIBS='$GOBJECT_LIBS'" >&6; }
+            succeeded=yes
+        else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+            GOBJECT_CFLAGS=""
+            GOBJECT_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           GOBJECT_PKG_ERRORS=`($PKG_CONFIG --print-errors "gobject-2.0 >= 2.0") 2>&1`
+
+        fi
+
+
+
+     else
+        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig"
+     fi
+  fi
+
+  if test $succeeded = yes; then
+     HAVE_GOBJECT=yes
+  else
+     HAVE_GOBJECT=no
+  fi
+
+    if test "$HAVE_GOBJECT" = "yes"; then
+       SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS"
+       SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS"
+    fi
     SAVE_CFLAGS="$CFLAGS"
     SAVE_LIBS="$LIBS"
     CFLAGS="$SETTINGS_CFLAGS $CFLAGS"
@@ -10928,8 +11235,9 @@ $as_echo "no" >&6; }
             LIBGNUTLS_CFLAGS=""
             LIBGNUTLS_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            LIBGNUTLS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gnutls >= 2.6.6"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           LIBGNUTLS_PKG_ERRORS=`($PKG_CONFIG --print-errors "gnutls >= 2.6.6") 2>&1`
 
         fi
 
@@ -10981,8 +11289,6 @@ HAVE_XAW3D=no
 LUCID_LIBW=
 if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
   if test "$with_xaw3d" != no; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xaw3d" >&5
-$as_echo_n "checking for xaw3d... " >&6; }
     if test "${emacs_cv_xaw3d+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
@@ -11053,6 +11359,8 @@ fi
     emacs_cv_xaw3d=no
   fi
   if test $emacs_cv_xaw3d = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xaw3d" >&5
+$as_echo_n "checking for xaw3d... " >&6; }
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes; using Lucid toolkit" >&5
 $as_echo "yes; using Lucid toolkit" >&6; }
     USE_X_TOOLKIT=LUCID
@@ -11062,6 +11370,8 @@ $as_echo "yes; using Lucid toolkit" >&6; }
 $as_echo "#define HAVE_XAW3D 1" >>confdefs.h
 
   else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xaw3d" >&5
+$as_echo_n "checking for xaw3d... " >&6; }
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libXaw" >&5
@@ -11209,7 +11519,7 @@ _ACEOF
 fi
 
   test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS"
-fi
+  fi
 
 
 LIBXMU=-lXmu
 
 LIBXP=
 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Motif version 2.1" >&5
-$as_echo_n "checking for Motif version 2.1... " >&6; }
+  # OpenMotif may be installed in such a way on some GNU/Linux systems.
+  if test -d /usr/include/openmotif; then
+    CPPFLAGS="-I/usr/include/openmotif $CPPFLAGS"
+    emacs_cv_openmotif=yes
+    case "$canonical" in
+      x86_64-*-linux-gnu* | powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*)
+      test -d /usr/lib64/openmotif && LDFLAGS="-L/usr/lib64/openmotif $LDFLAGS"
+      ;;
+      *)
+      test -d /usr/lib/openmotif && LDFLAGS="-L/usr/lib/openmotif $LDFLAGS"
+    esac
+  else
+    emacs_cv_openmotif=no
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for (Open)Motif version 2.1" >&5
+$as_echo_n "checking for (Open)Motif version 2.1... " >&6; }
 if test "${emacs_cv_motif_version_2_1+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
@@ -11344,6 +11668,9 @@ if test "x$ac_cv_lib_Xp_XpCreateContext" = x""yes; then :
   LIBXP=-lXp
 fi
 
+    if test x$emacs_cv_openmotif = xyes; then
+      REAL_CPPFLAGS="-I/usr/include/openmotif $REAL_CPPFLAGS"
+    fi
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LessTif where some systems put it" >&5
 $as_echo_n "checking for LessTif where some systems put it... " >&6; }
@@ -11421,6 +11748,10 @@ if test "${with_toolkit_scroll_bars}" != "no"; then
   elif test "${HAVE_NS}" = "yes"; then
     $as_echo "#define USE_TOOLKIT_SCROLL_BARS 1" >>confdefs.h
 
+    USE_TOOLKIT_SCROLL_BARS=yes
+  elif test "${HAVE_W32}" = "yes"; then
+    $as_echo "#define USE_TOOLKIT_SCROLL_BARS 1" >>confdefs.h
+
     USE_TOOLKIT_SCROLL_BARS=yes
   fi
 fi
@@ -11538,8 +11869,9 @@ $as_echo "no" >&6; }
             FONTCONFIG_CFLAGS=""
             FONTCONFIG_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            FONTCONFIG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fontconfig >= 2.2.0"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           FONTCONFIG_PKG_ERRORS=`($PKG_CONFIG --print-errors "fontconfig >= 2.2.0") 2>&1`
 
         fi
 
@@ -11596,8 +11928,9 @@ $as_echo "no" >&6; }
             XFT_CFLAGS=""
             XFT_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            XFT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xft >= 0.13.0"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           XFT_PKG_ERRORS=`($PKG_CONFIG --print-errors "xft >= 0.13.0") 2>&1`
 
         fi
 
@@ -11763,8 +12096,9 @@ $as_echo "no" >&6; }
             FREETYPE_CFLAGS=""
             FREETYPE_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            FREETYPE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "freetype2"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           FREETYPE_PKG_ERRORS=`($PKG_CONFIG --print-errors "freetype2") 2>&1`
 
         fi
 
@@ -11823,8 +12157,9 @@ $as_echo "no" >&6; }
             LIBOTF_CFLAGS=""
             LIBOTF_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            LIBOTF_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libotf"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           LIBOTF_PKG_ERRORS=`($PKG_CONFIG --print-errors "libotf") 2>&1`
 
         fi
 
@@ -11931,8 +12266,9 @@ $as_echo "no" >&6; }
             M17N_FLT_CFLAGS=""
             M17N_FLT_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            M17N_FLT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "m17n-flt"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           M17N_FLT_PKG_ERRORS=`($PKG_CONFIG --print-errors "m17n-flt") 2>&1`
 
         fi
 
 ### Use -lXpm if available, unless `--with-xpm=no'.
 HAVE_XPM=no
 LIBXPM=
+
+if test "${HAVE_W32}" = "yes"; then
+  if test "${with_xpm}" != "no"; then
+    SAVE_CPPFLAGS="$CPPFLAGS"
+    SAVE_LDFLAGS="$LDFLAGS"
+    CPPFLAGS="$CPPFLAGS -I/usr/include/noX"
+    LDFLAGS="$LDFLAGS -L/usr/lib/noX"
+    ac_fn_c_check_header_mongrel "$LINENO" "X11/xpm.h" "ac_cv_header_X11_xpm_h" "$ac_includes_default"
+if test "x$ac_cv_header_X11_xpm_h" = x""yes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpmReadFileToImage in -lXpm" >&5
+$as_echo_n "checking for XpmReadFileToImage in -lXpm... " >&6; }
+if test "${ac_cv_lib_Xpm_XpmReadFileToImage+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXpm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char XpmReadFileToImage ();
+int
+main ()
+{
+return XpmReadFileToImage ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xpm_XpmReadFileToImage=yes
+else
+  ac_cv_lib_Xpm_XpmReadFileToImage=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xpm_XpmReadFileToImage" >&5
+$as_echo "$ac_cv_lib_Xpm_XpmReadFileToImage" >&6; }
+if test "x$ac_cv_lib_Xpm_XpmReadFileToImage" = x""yes; then :
+  HAVE_XPM=yes
+fi
+
+fi
+
+
+    if test "${HAVE_XPM}" = "yes"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpmReturnAllocPixels preprocessor define" >&5
+$as_echo_n "checking for XpmReturnAllocPixels preprocessor define... " >&6; }
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include "X11/xpm.h"
+#ifndef XpmReturnAllocPixels
+no_return_alloc_pixels
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "no_return_alloc_pixels" >/dev/null 2>&1; then :
+  HAVE_XPM=no
+else
+  HAVE_XPM=yes
+fi
+rm -f conftest*
+
+
+      if test "${HAVE_XPM}" = "yes"; then
+        REAL_CPPFLAGS="$REAL_CPPFLAGS -I/usr/include/noX"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+      else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+        CPPFLAGS="$SAVE_CPPFLAGS"
+        LDFLAGS="$SAVE_LDFLAGS"
+      fi
+    fi
+  fi
+
+  if test "${HAVE_XPM}" = "yes"; then
+
+$as_echo "#define HAVE_XPM 1" >>confdefs.h
+
+    LIBXPM=-lXpm
+  fi
+fi
+
 if test "${HAVE_X11}" = "yes"; then
   if test "${with_xpm}" != "no"; then
     ac_fn_c_check_header_mongrel "$LINENO" "X11/xpm.h" "ac_cv_header_X11_xpm_h" "$ac_includes_default"
@@ -12064,10 +12493,11 @@ $as_echo "#define HAVE_XPM 1" >>confdefs.h
 fi
 
 
+
 ### Use -ljpeg if available, unless `--with-jpeg=no'.
 HAVE_JPEG=no
 LIBJPEG=
-if test "${HAVE_X11}" = "yes"; then
+if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
   if test "${with_jpeg}" != "no"; then
             ac_fn_c_check_header_mongrel "$LINENO" "jerror.h" "ac_cv_header_jerror_h" "$ac_includes_default"
 if test "x$ac_cv_header_jerror_h" = x""yes; then :
@@ -12146,7 +12576,7 @@ fi
 ### Use -lpng if available, unless `--with-png=no'.
 HAVE_PNG=no
 LIBPNG=
-if test "${HAVE_X11}" = "yes"; then
+if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
   if test "${with_png}" != "no"; then
     # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
     # in /usr/include/libpng.
@@ -12159,7 +12589,7 @@ eval as_val=\$$as_ac_Header
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
-
+ break
 fi
 
 done
 $as_echo "#define HAVE_PNG 1" >>confdefs.h
 
     LIBPNG="-lpng -lz -lm"
+
+    ac_fn_c_check_decl "$LINENO" "png_longjmp" "ac_cv_have_decl_png_longjmp" "#ifdef HAVE_LIBPNG_PNG_H
+       # include <libpng/png.h>
+       #else
+       # include <png.h>
+       #endif
+
+"
+if test "x$ac_cv_have_decl_png_longjmp" = x""yes; then :
+
+else
+
+$as_echo "#define PNG_DEPSTRUCT /**/" >>confdefs.h
+
+fi
+
   fi
 fi
 
@@ -12220,7 +12666,7 @@ fi
 ### Use -ltiff if available, unless `--with-tiff=no'.
 HAVE_TIFF=no
 LIBTIFF=
-if test "${HAVE_X11}" = "yes"; then
+if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
   if test "${with_tiff}" != "no"; then
     ac_fn_c_check_header_mongrel "$LINENO" "tiffio.h" "ac_cv_header_tiffio_h" "$ac_includes_default"
 if test "x$ac_cv_header_tiffio_h" = x""yes; then :
@@ -12284,7 +12730,8 @@ fi
 ### Use -lgif or -lungif if available, unless `--with-gif=no'.
 HAVE_GIF=no
 LIBGIF=
-if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then
+if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \
+        || test "${HAVE_W32}" = "yes"; then
   ac_fn_c_check_header_mongrel "$LINENO" "gif_lib.h" "ac_cv_header_gif_lib_h" "$ac_includes_default"
 if test "x$ac_cv_header_gif_lib_h" = x""yes; then :
   # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
@@ -12505,6 +12952,9 @@ $as_echo "#define NS_IMPL_GNUSTEP 1" >>confdefs.h
   OTHER_FILES=ns-app
 fi
 
+if test "${HAVE_W32}" = "yes"; then
+  HAVE_MENUS=yes
+fi
 
 ### Use session management (-lSM -lICE) if available
 HAVE_X_SM=no
@@ -12604,8 +13054,9 @@ $as_echo "no" >&6; }
             LIBXML2_CFLAGS=""
             LIBXML2_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            LIBXML2_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libxml-2.0 > 2.6.17"`
+           ## do set a variable so people can do so.  Do it in a subshell
+           ## to capture any diagnostics in invoking pkg-config.
+           LIBXML2_PKG_ERRORS=`($PKG_CONFIG --print-errors "libxml-2.0 > 2.6.17") 2>&1`
 
         fi
 
@@ -12713,8 +13164,8 @@ $as_echo "#define HAVE_H_ERRNO 1" >>confdefs.h
 
 fi
 
-# fmod, logb, and frexp are found in -lm on most systems.
-# On HPUX 9.01, -lm does not contain logb, so check for sqrt.
+# sqrt and other floating-point functions such as fmod and frexp
+# are found in -lm on most systems.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5
 $as_echo_n "checking for sqrt in -lm... " >&6; }
 if test "${ac_cv_lib_m_sqrt+set}" = set; then :
@@ -12911,17 +13362,6 @@ This probably means that movemail could lose mail.
 There may be a \`development' package to install containing liblockfile." "$LINENO" 5
   fi
 fi
-for ac_func in touchlock
-do :
-  ac_fn_c_check_func "$LINENO" "touchlock" "ac_cv_func_touchlock"
-if test "x$ac_cv_func_touchlock" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_TOUCHLOCK 1
-_ACEOF
-
-fi
-done
-
 
 
 
@@ -12974,15 +13414,16 @@ esac
 
 
 for ac_func in gethostname \
-rename closedir mkdir rmdir getrusage get_current_dir_name \
-random lrand48 logb frexp fmod rint cbrt setsid \
-strerror fpathconf select euidaccess getpagesize setlocale \
-utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
+closedir getrusage get_current_dir_name \
+lrand48 setsid \
+fpathconf select euidaccess getpagesize setlocale \
+utimes getrlimit setrlimit setpgid getcwd shutdown getaddrinfo \
 __fpending strsignal setitimer \
-sendto recvfrom getsockname getpeername \
+sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \
 gai_strerror mkstemp getline getdelim fsync sync \
 difftime posix_memalign \
 getpwent endpwent getgrent endgrent \
+touchlock \
 cfmakeraw cfsetspeed copysign __executable_start
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 done
 
 
+if test $opsys = unixware; then
+
+$as_echo "#define BROKEN_GETWD 1" >>confdefs.h
+
+else
+  for ac_func in getwd
+do :
+  ac_fn_c_check_func "$LINENO" "getwd" "ac_cv_func_getwd"
+if test "x$ac_cv_func_getwd" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GETWD 1
+_ACEOF
+
+fi
+done
+
+fi
+
+## Eric Backus <ericb@lsid.hp.com> says, HP-UX 9.x on HP 700 machines
+## has a broken `rint' in some library versions including math library
+## version number A.09.05.
+## You can fix the math library by installing patch number PHSS_4630.
+## But we can fix it more reliably for Emacs by just not using rint.
+## We also skip HAVE_RANDOM - see comments in src/conf_post.h.
+case $opsys in
+   hpux*) : ;;
+   *) for ac_func in random rint
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+ ;;
+esac
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_unwind_init" >&5
 $as_echo_n "checking for __builtin_unwind_init... " >&6; }
 if test "${emacs_cv_func___builtin_unwind_init+set}" = set; then :
@@ -13150,12 +13632,14 @@ done
 
 
 # PTY-related GNU extensions.
-for ac_func in getpt
+for ac_func in getpt posix_openpt
 do :
-  ac_fn_c_check_func "$LINENO" "getpt" "ac_cv_func_getpt"
-if test "x$ac_cv_func_getpt" = x""yes; then :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_GETPT 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 
 
 # Do we have res_init, for detecting changes in /etc/resolv.conf?
+# On Darwin, res_init appears not to be useful: see bug#562 and
+# http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01467.html
 resolv=no
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+if test $opsys != darwin; then
+
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <netinet/in.h>
 #include <arpa/nameser.h>
@@ -13353,12 +13842,12 @@ else
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-if test "$have_res_init" = no; then
-  OLIBS="$LIBS"
-  LIBS="$LIBS -lresolv"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_init with -lresolv" >&5
+  if test "$have_res_init" = no; then
+    OLIBS="$LIBS"
+    LIBS="$LIBS -lresolv"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_init with -lresolv" >&5
 $as_echo_n "checking for res_init with -lresolv... " >&6; }
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <netinet/in.h>
 #include <arpa/nameser.h>
@@ -13378,20 +13867,20 @@ else
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_res_init" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_res_init" >&5
 $as_echo "$have_res_init" >&6; }
-  if test "$have_res_init" = yes ; then
-    resolv=yes
+    if test "$have_res_init" = yes ; then
+      resolv=yes
+    fi
+    LIBS="$OLIBS"
   fi
-  LIBS="$OLIBS"
-fi
 
-if test "$have_res_init" = yes; then
+  if test "$have_res_init" = yes; then
 
 $as_echo "#define HAVE_RES_INIT 1" >>confdefs.h
 
+  fi
 fi
-
 # Do we need the Hesiod library to provide the support routines?
 LIBHESIOD=
 if test "$with_hesiod" != no ; then
@@ -13553,7 +14042,7 @@ fi
 
 
 # Do we need libresolv (due to res_init or Hesiod)?
-if test "$resolv" = yes ; then
+if test "$resolv" = yes && test $opsys != darwin; then
 
 $as_echo "#define HAVE_LIBRESOLV 1" >>confdefs.h
 
@@ -14175,63 +14664,6 @@ $as_echo "#define LOCALTIME_CACHE 1" >>confdefs.h
 
 fi
 
-if test "x$HAVE_TIMEVAL" = xyes; then
-  for ac_func in gettimeofday
-do :
-  ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday"
-if test "x$ac_cv_func_gettimeofday" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_GETTIMEOFDAY 1
-_ACEOF
-
-fi
-done
-
-  if test $ac_cv_func_gettimeofday = yes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gettimeofday can accept two arguments" >&5
-$as_echo_n "checking whether gettimeofday can accept two arguments... " >&6; }
-if test "${emacs_cv_gettimeofday_two_arguments+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif
-int
-main ()
-{
-struct timeval time;
-       gettimeofday (&time, 0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  emacs_cv_gettimeofday_two_arguments=yes
-else
-  emacs_cv_gettimeofday_two_arguments=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_gettimeofday_two_arguments" >&5
-$as_echo "$emacs_cv_gettimeofday_two_arguments" >&6; }
-    if test $emacs_cv_gettimeofday_two_arguments = no; then
-
-$as_echo "#define GETTIMEOFDAY_ONE_ARGUMENT 1" >>confdefs.h
-
-    fi
-  fi
-fi
-
 ok_so_far=yes
 ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket"
 if test "x$ac_cv_func_socket" = x""yes; then :
@@ -14285,6 +14717,11 @@ else
 $as_echo "no" >&6; }
 fi
 
+case $canonical in
+  *-solaris2.4 | *-solaris2.4.*)
+        : ${ac_cv_func_vfork_works=no};;
+esac
+
 ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
 if test "x$ac_cv_type_pid_t" = x""yes; then :
 
@@ -14624,296 +15061,1258 @@ $as_echo "#define __restrict_arr __restrict" >>confdefs.h
 fi
 
 
-# Set up the CFLAGS for real compilation, so we can substitute it.
-CFLAGS="$REAL_CFLAGS"
-CPPFLAGS="$REAL_CPPFLAGS"
 
-## Hack to detect a buggy GCC version.
-if test "x$GCC" = xyes \
-   && test x"`$CC --version 2> /dev/null | grep 'gcc.* 4.5.0'`" != x \
-   && test x"`echo $CFLAGS | grep '\-O[23]'`" != x \
-   && test x"`echo $CFLAGS | grep '\-fno-optimize-sibling-calls'`" = x; then
-   as_fn_error "GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'." "$LINENO" 5
-fi
+$as_echo "#define AMPERSAND_FULL_NAME 1" >>confdefs.h
 
-version=$PACKAGE_VERSION
 
-### Specify what sort of things we'll be editing into Makefile and config.h.
-### Use configuration here uncanonicalized to avoid exceeding size limits.
 
+$as_echo "#define CLASH_DETECTION 1" >>confdefs.h
 
-## Unused?
 
+## Note: PTYs are broken on darwin <6.  Use at your own risk.
 
+$as_echo "#define HAVE_PTYS 1" >>confdefs.h
 
 
 
+$as_echo "#define HAVE_SOCKETS 1" >>confdefs.h
 
 
 
 
 
+$as_echo "#define NULL_DEVICE \"/dev/null\"" >>confdefs.h
 
 
 
+$as_echo "#define SEPCHAR ':'" >>confdefs.h
 
 
 
+$as_echo "#define subprocesses 1" >>confdefs.h
 
 
 
+$as_echo "#define USER_FULL_NAME pw->pw_gecos" >>confdefs.h
 
 
-## FIXME? Nothing uses @LD_SWITCH_X_SITE@.
-## src/Makefile.in did add LD_SWITCH_X_SITE (as a cpp define) to the
-## end of LIBX_BASE, but nothing ever set it.
 
 
+$as_echo "#define DIRECTORY_SEP '/'" >>confdefs.h
 
 
-## Used in lwlib/Makefile.in.
 
-S_FILE="\$(srcdir)/${opsysfile}"
 
 
+$as_echo "#define IS_DEVICE_SEP(_c_) 0" >>confdefs.h
 
 
 
+$as_echo "#define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)" >>confdefs.h
 
 
 
+$as_echo "#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_))" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define EMACS_CONFIGURATION "${canonical}"
-_ACEOF
 
 
-cat >>confdefs.h <<_ACEOF
-#define EMACS_CONFIG_OPTIONS "${ac_configure_args}"
-_ACEOF
 
 
-cat >>confdefs.h <<_ACEOF
-#define config_opsysfile "${opsysfile}"
-_ACEOF
+case $opsys in
+  aix4-2)
+        if test x$ac_cv_lib_Xmu_XmuConvertStandardSelection != xyes; then
+      $as_echo "#define NO_EDITRES 1" >>confdefs.h
 
+    fi
+    ;;
 
-XMENU_OBJ=
-XOBJ=
-FONT_OBJ=
-if test "${HAVE_X_WINDOWS}" = "yes" ; then
+  hpux*)
+            $as_echo "#define NO_EDITRES 1" >>confdefs.h
 
-$as_echo "#define HAVE_X_WINDOWS 1" >>confdefs.h
+    ;;
+esac
 
-  XMENU_OBJ=xmenu.o
-  XOBJ="xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o"
-  FONT_OBJ=xfont.o
-  if test "$HAVE_XFT" = "yes"; then
-    FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o"
-  elif test "$HAVE_FREETYPE" = "yes"; then
-    FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o"
-  fi
 
-fi
+case $opsys in
+  irix6-5 | sol2* | unixware )
 
+$as_echo "#define NSIG_MINIMUM 32" >>confdefs.h
 
+    ;;
+esac
 
+emacs_broken_SIGIO=no
 
-WIDGET_OBJ=
-MOTIF_LIBW=
-if test "${USE_X_TOOLKIT}" != "none" ; then
-  WIDGET_OBJ=widget.o
+case $opsys in
+      hpux* | irix6-5 | openbsd | sol2* | unixware )
+    emacs_broken_SIGIO=yes
+    ;;
 
-$as_echo "#define USE_X_TOOLKIT 1" >>confdefs.h
+  aix4-2)
 
-  if test "${USE_X_TOOLKIT}" = "LUCID"; then
+$as_echo "#define BROKEN_GET_CURRENT_DIR_NAME 1" >>confdefs.h
 
-$as_echo "#define USE_LUCID 1" >>confdefs.h
+    ;;
 
-  elif test "${USE_X_TOOLKIT}" = "MOTIF"; then
+  freebsd)
 
-$as_echo "#define USE_MOTIF 1" >>confdefs.h
+$as_echo "#define BROKEN_PTY_READ_AFTER_EAGAIN 1" >>confdefs.h
 
-    MOTIF_LIBW=-lXm
-    case "$opsys" in
-      gnu-linux)
-        ## Paul Abrahams <abrahams at equinox.shaysnet.com> says this is needed.
-        MOTIF_LIBW="$MOTIF_LIBW -lXpm"
-        ;;
+    ;;
+esac
 
-      unixware)
-        ## Richard Anthony Ryan <ryanr at ellingtn.ftc.nrcs.usda.gov>
-        ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2.
-        MOTIF_LIBW="MOTIF_LIBW -lXimp"
-        ;;
+case $opsys in
+  gnu-* | sol2-10 )
 
-      aix4-2)
-        ## olson@mcs.anl.gov says -li18n is needed by -lXm.
-        MOTIF_LIBW="$MOTIF_LIBW -li18n"
-        ;;
-    esac
-    MOTIF_LIBW="$MOTIF_LIBW $LIBXP"
-  fi
-fi
+$as_echo "#define HAVE_PROCFS 1" >>confdefs.h
 
+  ;;
+esac
 
-TOOLKIT_LIBW=
-case "$USE_X_TOOLKIT" in
-  MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;;
-  LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;;
-  none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;;
+case $opsys in
+  darwin | freebsd | netbsd | openbsd )
+
+$as_echo "#define DONT_REOPEN_PTY 1" >>confdefs.h
+
+  ;;
 esac
 
+case $opsys in
+  netbsd | openbsd) sound_device="/dev/audio" ;;
+  *) sound_device="/dev/dsp" ;;
+esac
 
-if test "$USE_X_TOOLKIT" = "none"; then
-  LIBXT_OTHER="\$(LIBXSM)"
-  OLDXMENU_TARGET="really-oldXMenu"
-else
-  LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
-  OLDXMENU_TARGET="really-lwlib"
-fi
 
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_SOUND_DEVICE "$sound_device"
+_ACEOF
 
-## The X Menu stuff is present in the X10 distribution, but missing
-## from X11.  If we have X10, just use the installed library;
-## otherwise, use our own copy.
-if test "${HAVE_X11}" = "yes" ; then
 
-$as_echo "#define HAVE_X11 1" >>confdefs.h
 
+case $opsys in
+  darwin | gnu-linux | gnu-kfreebsd )
 
-  if test "$USE_X_TOOLKIT" = "none"; then
-    OLDXMENU="\${oldXMenudir}/libXMenu11.a"
-  else
-    OLDXMENU="\${lwlibdir}/liblw.a"
-  fi
-  LIBXMENU="\$(OLDXMENU)"
-  LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
-  OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}"
-else
-  ## For a syntactically valid Makefile; not actually used for anything.
-  ## See comments in src/Makefile.in.
-  OLDXMENU=nothing
-  ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?).
-  if test "${HAVE_X_WINDOWS}" = "yes"; then
-    LIBXMENU="-lXMenu"
-  else
-    LIBXMENU=
-  fi
-  LIBX_OTHER=
-  OLDXMENU_DEPS=
-fi
+$as_echo "#define INTERRUPT_INPUT 1" >>confdefs.h
 
-if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then
-  OLDXMENU_TARGET=
-  OLDXMENU=nothing
-  LIBXMENU=
-  OLDXMENU_DEPS=
-fi
+  ;;
+esac
 
 
+case $opsys in
+  cygwin|gnu|gnu-linux|gnu-kfreebsd|irix6-5|freebsd|netbsd|openbsd)
 
+$as_echo "#define NARROWPROTO 1" >>confdefs.h
 
+  ;;
+esac
 
 
 
-if test "${HAVE_MENUS}" = "yes" ; then
 
-$as_echo "#define HAVE_MENUS 1" >>confdefs.h
 
-fi
 
-if test "${GNU_MALLOC}" = "yes" ; then
 
-$as_echo "#define GNU_MALLOC 1" >>confdefs.h
 
-fi
+case $opsys in
+  aix4-2 )
+    $as_echo "#define PTY_ITERATION int c; for (c = 0; !c ; c++)" >>confdefs.h
 
-RALLOC_OBJ=
-if test "${REL_ALLOC}" = "yes" ; then
+            $as_echo "#define PTY_NAME_SPRINTF strcpy (pty_name, \"/dev/ptc\");" >>confdefs.h
 
-$as_echo "#define REL_ALLOC 1" >>confdefs.h
+    $as_echo "#define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd));" >>confdefs.h
 
+    ;;
 
-  test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
-fi
+  cygwin )
+    $as_echo "#define PTY_ITERATION int i; for (i = 0; i < 1; i++)" >>confdefs.h
 
+        $as_echo "#define PTY_OPEN  do { int dummy; sigset_t blocked, procmask; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; pthread_sigmask (SIG_SETMASK, &procmask, 0); if (fd >= 0) emacs_close (dummy); } while (0)" >>confdefs.h
 
-if test "$opsys" = "cygwin"; then
-  CYGWIN_OBJ="sheap.o"
-  ## Cygwin differs because of its unexec().
-  PRE_ALLOC_OBJ=
-  POST_ALLOC_OBJ=lastfile.o
-else
-  CYGWIN_OBJ=
-  PRE_ALLOC_OBJ=lastfile.o
-  POST_ALLOC_OBJ=
-fi
+    $as_echo "#define PTY_NAME_SPRINTF /**/" >>confdefs.h
 
+    $as_echo "#define PTY_TTY_NAME_SPRINTF /**/" >>confdefs.h
 
+    ;;
 
+    darwin )
+    $as_echo "#define PTY_ITERATION int i; for (i = 0; i < 1; i++)" >>confdefs.h
 
-# Configure gnulib here, now that we know LIBS.
+        $as_echo "#define FIRST_PTY_LETTER 'p'" >>confdefs.h
 
+                $as_echo "#define PTY_OPEN  do { int slave; if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1) fd = -1; else emacs_close (slave); } while (0)" >>confdefs.h
 
+    $as_echo "#define PTY_NAME_SPRINTF /**/" >>confdefs.h
 
+    $as_echo "#define PTY_TTY_NAME_SPRINTF /**/" >>confdefs.h
 
+    ;;
 
+  gnu | openbsd )
+    $as_echo "#define FIRST_PTY_LETTER 'p'" >>confdefs.h
 
+    ;;
 
+  gnu-linux | gnu-kfreebsd | freebsd | netbsd )
+        if test "x$ac_cv_func_grantpt" = xyes; then
 
+$as_echo "#define UNIX98_PTYS 1" >>confdefs.h
 
+      $as_echo "#define PTY_ITERATION int i; for (i = 0; i < 1; i++)" >>confdefs.h
 
+                  $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { close (fd); return -1; } snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); }" >>confdefs.h
 
-          LIBC_FATAL_STDERR_=1
-  export LIBC_FATAL_STDERR_
+            if test "x$ac_cv_func_posix_openpt" = xyes; then
+        $as_echo "#define PTY_OPEN fd = posix_openpt (O_RDWR | O_NOCTTY)" >>confdefs.h
 
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments.  Useless!
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
-$as_echo_n "checking for working alloca.h... " >&6; }
-if test "${ac_cv_working_alloca_h+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <alloca.h>
-int
-main ()
-{
-char *p = (char *) alloca (2 * sizeof (int));
-                         if (p) return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_working_alloca_h=yes
-else
-  ac_cv_working_alloca_h=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
-$as_echo "$ac_cv_working_alloca_h" >&6; }
-if test $ac_cv_working_alloca_h = yes; then
+        $as_echo "#define PTY_NAME_SPRINTF /**/" >>confdefs.h
 
-$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
+            elif test "x$ac_cv_func_getpt" = xyes; then
+        $as_echo "#define PTY_OPEN fd = getpt ()" >>confdefs.h
 
-fi
+        $as_echo "#define PTY_NAME_SPRINTF /**/" >>confdefs.h
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
-$as_echo_n "checking for alloca... " >&6; }
-if test "${ac_cv_func_alloca_works+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
+      else
+        $as_echo "#define PTY_NAME_SPRINTF strcpy (pty_name, \"/dev/ptmx\");" >>confdefs.h
+
+      fi
+    else
+      $as_echo "#define FIRST_PTY_LETTER 'p'" >>confdefs.h
+
+    fi
+    ;;
+
+  hpux*)
+    $as_echo "#define FIRST_PTY_LETTER 'p'" >>confdefs.h
+
+    $as_echo "#define PTY_NAME_SPRINTF sprintf (pty_name, \"/dev/ptym/pty%c%x\", c, i);" >>confdefs.h
+
+    $as_echo "#define PTY_TTY_NAME_SPRINTF sprintf (pty_name, \"/dev/pty/tty%c%x\", c, i);" >>confdefs.h
+
+    ;;
+
+  irix6-5 )
+                                            $as_echo "#define PTY_ITERATION /**/" >>confdefs.h
+
+        $as_echo "#define FIRST_PTY_LETTER 'q'" >>confdefs.h
+
+    $as_echo "#define PTY_OPEN  { struct sigaction ocstat, cstat; struct stat stb; char * name; sigemptyset(&cstat.sa_mask); cstat.sa_handler = SIG_DFL; cstat.sa_flags = 0; sigaction(SIGCLD, &cstat, &ocstat); name = _getpty (&fd, O_RDWR | O_NDELAY, 0600, 0); sigaction(SIGCLD, &ocstat, (struct sigaction *)0); if (name == 0) return -1; if (fd < 0) return -1; if (fstat (fd, &stb) < 0) return -1; strcpy (pty_name, name); }" >>confdefs.h
+
+        $as_echo "#define PTY_NAME_SPRINTF /**/" >>confdefs.h
+
+        $as_echo "#define PTY_TTY_NAME_SPRINTF /**/" >>confdefs.h
+
+    ;;
+
+  sol2* )
+                $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); }" >>confdefs.h
+
+    ;;
+
+  unixware )
+        $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1) fatal(\"could not grant slave pty\"); if (unlockpt(fd) == -1) fatal(\"could not unlock slave pty\"); if (!(ptyname = ptsname(fd))) fatal (\"could not enable slave pty\"); snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); }" >>confdefs.h
+
+    ;;
+esac
+
+
+case $opsys in
+  sol2* | unixware )
+            $as_echo "#define FIRST_PTY_LETTER 'z'" >>confdefs.h
+
+    $as_echo "#define PTY_NAME_SPRINTF strcpy (pty_name, \"/dev/ptmx\");" >>confdefs.h
+
+
+$as_echo "#define SETUP_SLAVE_PTY if (ioctl (xforkin, I_PUSH, \"ptem\") == -1) fatal (\"ioctl I_PUSH ptem\"); if (ioctl (xforkin, I_PUSH, \"ldterm\") == -1) fatal (\"ioctl I_PUSH ldterm\"); if (ioctl (xforkin, I_PUSH, \"ttcompat\") == -1) fatal (\"ioctl I_PUSH ttcompat\");" >>confdefs.h
+
+    ;;
+esac
+
+
+
+
+case $opsys in
+      aix4-2 | cygwin | gnu | irix6-5 | freebsd | netbsd | openbsd )
+    $as_echo "#define SIGNALS_VIA_CHARACTERS 1" >>confdefs.h
+
+    ;;
+
+      gnu-linux | gnu-kfreebsd )
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for signals via characters" >&5
+$as_echo_n "checking for signals via characters... " >&6; }
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < 0x20400
+# error "Linux version too old"
+#endif
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  emacs_signals_via_chars=yes
+else
+  emacs_signals_via_chars=no
+fi
+rm -f conftest.err conftest.$ac_ext
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_signals_via_chars" >&5
+$as_echo "$emacs_signals_via_chars" >&6; }
+    test $emacs_signals_via_chars = yes && $as_echo "#define SIGNALS_VIA_CHARACTERS 1" >>confdefs.h
+
+    ;;
+esac
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C library" >&5
+$as_echo_n "checking whether we are using the GNU C library... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <features.h>
+#ifndef __GNU_LIBRARY__
+# error "this is not the GNU C library"
+#endif
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  emacs_glibc=yes
+else
+  emacs_glibc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_glibc" >&5
+$as_echo "$emacs_glibc" >&6; }
+
+if test $emacs_glibc = yes; then
+
+  emacs_pending_output=unknown
+
+  case $opsys in
+    gnu | gnu-linux | gnu-kfreebsd )
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of pending output formalism" >&5
+$as_echo_n "checking for style of pending output formalism... " >&6; }
+                  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdio.h>
+#if !defined (_IO_STDIO_H) && !defined (_STDIO_USES_IOSTREAM)
+# error "stdio definitions not found"
+#endif
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  emacs_pending_output=new
+fi
+rm -f conftest.err conftest.$ac_ext
+
+      if test $emacs_pending_output = unknown; then
+        case $opsys in
+          gnu-linux | gnu-kfreebsd)
+            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdio.h>
+#ifndef __UCLIBC__
+# error "not using uclibc"
+#endif
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  emacs_pending_output=uclibc
+else
+  emacs_pending_output=old
+fi
+rm -f conftest.err conftest.$ac_ext
+            ;;
+        esac
+      fi
+
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_pending_output" >&5
+$as_echo "$emacs_pending_output" >&6; }
+
+      case $emacs_pending_output in
+        new)
+                    $as_echo "#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)" >>confdefs.h
+
+          ;;
+        uclibc)
+                    $as_echo "#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__bufpos - (FILE)->__bufstart)" >>confdefs.h
+
+          ;;
+        old)
+                    $as_echo "#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_pptr - (FILE)->_pbase)" >>confdefs.h
+
+          ;;
+      esac
+    ;;
+  esac
+  if test $emacs_pending_output = unknown; then
+    $as_echo "#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__bufp - (FILE)->__buffer)" >>confdefs.h
+
+  fi
+
+else
+  case $opsys in
+    cygwin | darwin | freebsd | netbsd | openbsd )
+      $as_echo "#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)" >>confdefs.h
+
+      ;;
+
+    unixware)
+      $as_echo "#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base)" >>confdefs.h
+
+      ;;
+
+    *)
+            if test x$ac_cv_header_stdio_ext_h = xyes && \
+        test x$ac_cv_func___fpending = xyes; then
+        $as_echo "#define PENDING_OUTPUT_COUNT(FILE) __fpending (FILE)" >>confdefs.h
+
+
+$as_echo "#define DISPNEW_NEEDS_STDIO_EXT 1" >>confdefs.h
+
+      else
+        $as_echo "#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_ptr - (FILE)->_base)" >>confdefs.h
+
+      fi
+      ;;
+  esac
+fi
+
+
+
+
+case $opsys in
+  gnu)
+        $as_echo "#define DATA_START ({ extern int data_start; (char *) &data_start; })" >>confdefs.h
+
+    ;;
+
+  hpux*)
+        $as_echo "#define DATA_START 0x40000000" >>confdefs.h
+
+    $as_echo "#define DATA_SEG_BITS 0x40000000" >>confdefs.h
+
+    ;;
+  irix6-5)
+    $as_echo "#define DATA_START 0x10000000" >>confdefs.h
+
+    $as_echo "#define DATA_SEG_BITS 0x10000000" >>confdefs.h
+
+    ;;
+esac
+
+
+
+
+
+case $opsys in
+  darwin) $as_echo "#define TAB3 OXTABS" >>confdefs.h
+ ;;
+
+  gnu | freebsd | netbsd | openbsd )
+
+$as_echo "#define TABDLY OXTABS" >>confdefs.h
+
+    $as_echo "#define TAB3 OXTABS" >>confdefs.h
+
+    ;;
+
+  gnu-linux | gnu-kfreebsd )
+            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifndef __i386__
+# error "not i386"
+#endif
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  $as_echo "#define ULIMIT_BREAK_VALUE (32*1024*1024)" >>confdefs.h
+
+fi
+rm -f conftest.err conftest.$ac_ext
+
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifndef __ia64__
+# error "not ia64"
+#endif
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+$as_echo "#define GC_MARK_SECONDARY_STACK() do { extern void *__libc_ia64_register_backing_store_base; __builtin_ia64_flushrs (); mark_memory (__libc_ia64_register_backing_store_base, __builtin_ia64_bsp ());} while (0)" >>confdefs.h
+
+fi
+rm -f conftest.err conftest.$ac_ext
+    ;;
+
+  hpux*)
+
+$as_echo "#define RUN_TIME_REMAP 1" >>confdefs.h
+
+    ;;
+
+  irix6-5)
+        $as_echo "#define ULIMIT_BREAK_VALUE 0x14000000" >>confdefs.h
+
+    ;;
+esac
+
+
+
+
+
+
+
+case $opsys in
+  aix4-2 | hpux* | unixware)
+            $as_echo "#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE" >>confdefs.h
+
+    ;;
+
+          gnu-linux | gnu-kfreebsd )
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#if defined __i386__ || defined __sparc__ || defined __mc68000__ \
+  || defined __alpha__ || defined __mips__ || defined __s390__ \
+  || defined __arm__ || defined __powerpc__ || defined __amd64__ \
+  || defined __ia64__ || defined __sh__
+/* ok */
+#else
+# error "setjmp not known to work on this arch"
+#endif
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  $as_echo "#define GC_SETJMP_WORKS 1" >>confdefs.h
+
+else
+  $as_echo "#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE" >>confdefs.h
+
+fi
+rm -f conftest.err conftest.$ac_ext
+    ;;
+esac
+
+
+if test x$GCC = xyes; then
+      $as_echo "#define GC_SETJMP_WORKS 1" >>confdefs.h
+
+else
+  case $opsys in
+        freebsd | netbsd | openbsd | irix6-5 | sol2* )
+      $as_echo "#define GC_SETJMP_WORKS 1" >>confdefs.h
+
+      ;;
+  esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _setjmp" >&5
+$as_echo_n "checking for _setjmp... " >&6; }
+if test "${emacs_cv_func__setjmp+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <setjmp.h>
+
+int
+main ()
+{
+jmp_buf j;
+        if (! _setjmp (j))
+          _longjmp (j, 1);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_cv_func__setjmp=yes
+else
+  emacs_cv_func__setjmp=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_func__setjmp" >&5
+$as_echo "$emacs_cv_func__setjmp" >&6; }
+if test $emacs_cv_func__setjmp = yes; then
+
+$as_echo "#define HAVE__SETJMP 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigsetjmp" >&5
+$as_echo_n "checking for sigsetjmp... " >&6; }
+if test "${emacs_cv_func_sigsetjmp+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <setjmp.h>
+
+int
+main ()
+{
+sigjmp_buf j;
+          if (! sigsetjmp (j, 1))
+            siglongjmp (j, 1);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_cv_func_sigsetjmp=yes
+else
+  emacs_cv_func_sigsetjmp=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_func_sigsetjmp" >&5
+$as_echo "$emacs_cv_func_sigsetjmp" >&6; }
+  if test $emacs_cv_func_sigsetjmp = yes; then
+
+$as_echo "#define HAVE_SIGSETJMP 1" >>confdefs.h
+
+  fi
+fi
+
+case $opsys in
+  sol2* | unixware )
+
+$as_echo "#define TIOCSIGSEND TIOCSIGNAL" >>confdefs.h
+
+    ;;
+esac
+
+
+case $opsys in
+  hpux* | sol2* )
+
+$as_echo "#define XOS_NEEDS_TIME_H 1" >>confdefs.h
+
+    ;;
+esac
+
+
+
+
+
+
+
+
+
+
+case $opsys in
+  aix4-2)
+    $as_echo "#define USG /**/" >>confdefs.h
+
+    $as_echo "#define USG5 /**/" >>confdefs.h
+
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifndef _AIX
+# error "_AIX not defined"
+#endif
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+
+$as_echo "#define _AIX /**/" >>confdefs.h
+
+fi
+rm -f conftest.err conftest.$ac_ext
+    ;;
+
+  cygwin)
+
+$as_echo "#define CYGWIN 1" >>confdefs.h
+
+    ;;
+
+  darwin)
+        $as_echo "#define BSD4_2 /**/" >>confdefs.h
+
+    $as_echo "#define BSD_SYSTEM /**/" >>confdefs.h
+
+
+$as_echo "#define DARWIN_OS /**/" >>confdefs.h
+
+    ;;
+
+  freebsd)
+    $as_echo "#define BSD4_2 /**/" >>confdefs.h
+
+
+$as_echo "#define BSD_SYSTEM_AHB 1" >>confdefs.h
+
+    ;;
+
+  gnu | netbsd | openbsd )
+    $as_echo "#define BSD4_2 /**/" >>confdefs.h
+
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifndef BSD_SYSTEM
+# error "BSD_SYSTEM not defined"
+#endif
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  $as_echo "#define BSD_SYSTEM 43" >>confdefs.h
+
+fi
+rm -f conftest.err conftest.$ac_ext
+    ;;
+
+  gnu-linux | gnu-kfreebsd )
+    $as_echo "#define USG /**/" >>confdefs.h
+
+
+$as_echo "#define GNU_LINUX /**/" >>confdefs.h
+
+    ;;
+
+  hpux*)
+    $as_echo "#define USG /**/" >>confdefs.h
+
+    $as_echo "#define USG5 /**/" >>confdefs.h
+
+
+$as_echo "#define HPUX /**/" >>confdefs.h
+
+    ;;
+
+  irix6-5)
+    $as_echo "#define USG /**/" >>confdefs.h
+
+    $as_echo "#define USG5 /**/" >>confdefs.h
+
+    $as_echo "#define USG5_4 /**/" >>confdefs.h
+
+
+$as_echo "#define IRIX6_5 /**/" >>confdefs.h
+
+    ;;
+
+  sol2*)
+    $as_echo "#define USG /**/" >>confdefs.h
+
+    $as_echo "#define USG5 /**/" >>confdefs.h
+
+    $as_echo "#define USG5_4 /**/" >>confdefs.h
+
+
+$as_echo "#define SOLARIS2 /**/" >>confdefs.h
+
+    ;;
+
+  unixware)
+    $as_echo "#define USG /**/" >>confdefs.h
+
+    $as_echo "#define USG5 /**/" >>confdefs.h
+
+    $as_echo "#define USG5_4 /**/" >>confdefs.h
+
+    ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable FIONREAD" >&5
+$as_echo_n "checking for usable FIONREAD... " >&6; }
+if test "${emacs_cv_usable_FIONREAD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $opsys in
+     aix4-2)
+              emacs_cv_usable_FIONREAD=no
+       ;;
+
+     *)
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+                           #include <sys/ioctl.h>
+                           #ifdef USG5_4
+                           # include <sys/filio.h>
+                           #endif
+
+int
+main ()
+{
+int foo = ioctl (0, FIONREAD, &foo);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  emacs_cv_usable_FIONREAD=yes
+else
+  emacs_cv_usable_FIONREAD=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       ;;
+   esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_usable_FIONREAD" >&5
+$as_echo "$emacs_cv_usable_FIONREAD" >&6; }
+if test $emacs_cv_usable_FIONREAD = yes; then
+
+$as_echo "#define USABLE_FIONREAD 1" >>confdefs.h
+
+
+  if test $emacs_broken_SIGIO = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable SIGIO" >&5
+$as_echo_n "checking for usable SIGIO... " >&6; }
+if test "${emacs_cv_usable_SIGIO+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <fcntl.h>
+                           #include <signal.h>
+
+int
+main ()
+{
+int foo = SIGIO | F_SETFL | FASYNC;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  emacs_cv_usable_SIGIO=yes
+else
+  emacs_cv_usable_SIGIO=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_usable_SIGIO" >&5
+$as_echo "$emacs_cv_usable_SIGIO" >&6; }
+    if test $emacs_cv_usable_SIGIO = yes; then
+
+$as_echo "#define USABLE_SIGIO 1" >>confdefs.h
+
+    fi
+  fi
+fi
+
+
+case $opsys in
+          cygwin)
+
+$as_echo "#define G_SLICE_ALWAYS_MALLOC 1" >>confdefs.h
+
+    ;;
+
+  hpux11)
+
+$as_echo "#define USG_SUBTTY_WORKS 1" >>confdefs.h
+
+    ;;
+
+  irix6-5)
+
+$as_echo "#define PREFER_VSUSP 1" >>confdefs.h
+
+
+$as_echo "#define SETPGRP_RELEASES_CTTY 1" >>confdefs.h
+
+    ;;
+
+  sol2-10)
+
+$as_echo "#define _STRUCTURED_PROC 1" >>confdefs.h
+
+    ;;
+esac
+
+# Set up the CFLAGS for real compilation, so we can substitute it.
+CFLAGS="$REAL_CFLAGS"
+CPPFLAGS="$REAL_CPPFLAGS"
+
+## Hack to detect a buggy GCC version.
+if test "x$GCC" = xyes \
+   && test x"`$CC --version 2> /dev/null | grep 'gcc.* 4.5.0'`" != x \
+   && test x"`echo $CFLAGS | grep '\-O[23]'`" != x \
+   && test x"`echo $CFLAGS | grep '\-fno-optimize-sibling-calls'`" = x; then
+   as_fn_error "GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'." "$LINENO" 5
+fi
+
+version=$PACKAGE_VERSION
+
+copyright="Copyright (C) 2012 Free Software Foundation, Inc."
+
+cat >>confdefs.h <<_ACEOF
+#define COPYRIGHT "$copyright"
+_ACEOF
+
+
+
+### Specify what sort of things we'll be editing into Makefile and config.h.
+### Use configuration here uncanonicalized to avoid exceeding size limits.
+
+
+## Unused?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## FIXME? Nothing uses @LD_SWITCH_X_SITE@.
+## src/Makefile.in did add LD_SWITCH_X_SITE (as a cpp define) to the
+## end of LIBX_BASE, but nothing ever set it.
+
+
+
+
+## Used in lwlib/Makefile.in.
+
+
+
+
+
+
+
+
+if test -n "${term_header}"; then
+
+cat >>confdefs.h <<_ACEOF
+#define TERM_HEADER "${term_header}"
+_ACEOF
+
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define EMACS_CONFIGURATION "${canonical}"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define EMACS_CONFIG_OPTIONS "${ac_configure_args}"
+_ACEOF
+
+
+
+XMENU_OBJ=
+XOBJ=
+FONT_OBJ=
+if test "${HAVE_X_WINDOWS}" = "yes" ; then
+
+$as_echo "#define HAVE_X_WINDOWS 1" >>confdefs.h
+
+  XMENU_OBJ=xmenu.o
+  XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o"
+  FONT_OBJ=xfont.o
+  if test "$HAVE_XFT" = "yes"; then
+    FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o"
+  elif test "$HAVE_FREETYPE" = "yes"; then
+    FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o"
+  fi
+
+fi
+
+
+
+
+WIDGET_OBJ=
+MOTIF_LIBW=
+if test "${USE_X_TOOLKIT}" != "none" ; then
+  WIDGET_OBJ=widget.o
+
+$as_echo "#define USE_X_TOOLKIT 1" >>confdefs.h
+
+  if test "${USE_X_TOOLKIT}" = "LUCID"; then
+
+$as_echo "#define USE_LUCID 1" >>confdefs.h
+
+  elif test "${USE_X_TOOLKIT}" = "MOTIF"; then
+
+$as_echo "#define USE_MOTIF 1" >>confdefs.h
+
+    MOTIF_LIBW=-lXm
+    case "$opsys" in
+      gnu-linux)
+        ## Paul Abrahams <abrahams at equinox.shaysnet.com> says this is needed.
+        MOTIF_LIBW="$MOTIF_LIBW -lXpm"
+        ;;
+
+      unixware)
+        ## Richard Anthony Ryan <ryanr at ellingtn.ftc.nrcs.usda.gov>
+        ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2.
+        MOTIF_LIBW="MOTIF_LIBW -lXimp"
+        ;;
+
+      aix4-2)
+        ## olson@mcs.anl.gov says -li18n is needed by -lXm.
+        MOTIF_LIBW="$MOTIF_LIBW -li18n"
+        ;;
+    esac
+    MOTIF_LIBW="$MOTIF_LIBW $LIBXP"
+  fi
+fi
+
+
+TOOLKIT_LIBW=
+case "$USE_X_TOOLKIT" in
+  MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;;
+  LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;;
+  none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;;
+esac
+
+
+if test "$USE_X_TOOLKIT" = "none"; then
+  LIBXT_OTHER="\$(LIBXSM)"
+  OLDXMENU_TARGET="really-oldXMenu"
+else
+  LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
+  OLDXMENU_TARGET="really-lwlib"
+fi
+
+
+## The X Menu stuff is present in the X10 distribution, but missing
+## from X11.  If we have X10, just use the installed library;
+## otherwise, use our own copy.
+if test "${HAVE_X11}" = "yes" ; then
+
+$as_echo "#define HAVE_X11 1" >>confdefs.h
+
+
+  if test "$USE_X_TOOLKIT" = "none"; then
+    OLDXMENU="\${oldXMenudir}/libXMenu11.a"
+  else
+    OLDXMENU="\${lwlibdir}/liblw.a"
+  fi
+  LIBXMENU="\$(OLDXMENU)"
+  LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
+  OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}"
+else
+  ## For a syntactically valid Makefile; not actually used for anything.
+  ## See comments in src/Makefile.in.
+  OLDXMENU=nothing
+  ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?).
+  if test "${HAVE_X_WINDOWS}" = "yes"; then
+    LIBXMENU="-lXMenu"
+  else
+    LIBXMENU=
+  fi
+  LIBX_OTHER=
+  OLDXMENU_DEPS=
+fi
+
+if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then
+  OLDXMENU_TARGET=
+  OLDXMENU=nothing
+  LIBXMENU=
+  OLDXMENU_DEPS=
+fi
+
+
+
+
+
+
+
+if test "${HAVE_MENUS}" = "yes" ; then
+
+$as_echo "#define HAVE_MENUS 1" >>confdefs.h
+
+fi
+
+if test "${GNU_MALLOC}" = "yes" ; then
+
+$as_echo "#define GNU_MALLOC 1" >>confdefs.h
+
+fi
+
+RALLOC_OBJ=
+if test "${REL_ALLOC}" = "yes" ; then
+
+$as_echo "#define REL_ALLOC 1" >>confdefs.h
+
+
+  test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
+fi
+
+
+if test "$opsys" = "cygwin"; then
+  CYGWIN_OBJ="sheap.o cygw32.o"
+  ## Cygwin differs because of its unexec().
+  PRE_ALLOC_OBJ=
+  POST_ALLOC_OBJ=lastfile.o
+else
+  CYGWIN_OBJ=
+  PRE_ALLOC_OBJ=lastfile.o
+  POST_ALLOC_OBJ=
+fi
+
+
+
+
+# Configure gnulib.  Although this does not affect CFLAGS or LIBS permanently.
+# it temporarily reverts them to their pre-pkg-config values,
+# because gnulib needs to work with both src (which uses the
+# pkg-config stuff) and lib-src (which does not).  For example, gnulib
+# may need to determine whether LIB_CLOCK_GETTIME should contain -lrt,
+# and it therefore needs to run in an environment where LIBS does not
+# already contain -lrt merely because 'pkg-config --libs' printed '-lrt'
+# for some package unrelated to lib-src.
+SAVE_CFLAGS=$CFLAGS
+SAVE_LIBS=$LIBS
+CFLAGS=$pre_PKG_CONFIG_CFLAGS
+LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS"
+
+
+
+
+
+
+
+
+
+
+
+          LIBC_FATAL_STDERR_=1
+  export LIBC_FATAL_STDERR_
+
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
+$as_echo_n "checking for working alloca.h... " >&6; }
+if test "${ac_cv_working_alloca_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <alloca.h>
+int
+main ()
+{
+char *p = (char *) alloca (2 * sizeof (int));
+                         if (p) return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_working_alloca_h=yes
+else
+  ac_cv_working_alloca_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
+$as_echo "$ac_cv_working_alloca_h" >&6; }
+if test $ac_cv_working_alloca_h = yes; then
+
+$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
+$as_echo_n "checking for alloca... " >&6; }
+if test "${ac_cv_func_alloca_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
 #  include <malloc.h>
 #  define alloca _alloca
 # else
@@ -15496,6 +16895,63 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h
   UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
 
 
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if environ is properly declared" >&5
+$as_echo_n "checking if environ is properly declared... " >&6; }
+  if test "${gt_cv_var_environ_declaration+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#if HAVE_UNISTD_H
+     #include <unistd.h>
+     #endif
+     /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
+     #include <stdlib.h>
+
+           extern struct { int foo; } environ;
+int
+main ()
+{
+environ.foo = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gt_cv_var_environ_declaration=no
+else
+  gt_cv_var_environ_declaration=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_var_environ_declaration" >&5
+$as_echo "$gt_cv_var_environ_declaration" >&6; }
+  if test $gt_cv_var_environ_declaration = yes; then
+
+$as_echo "#define HAVE_ENVIRON_DECL 1" >>confdefs.h
+
+  fi
+
+
+  if test $gt_cv_var_environ_declaration != yes; then
+    HAVE_DECL_ENVIRON=0
+  fi
+
+
+
+
+
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for st_dm_mode in struct stat" >&5
 $as_echo_n "checking for st_dm_mode in struct stat... " >&6; }
 if test "${ac_cv_struct_st_dm_mode+set}" = set; then :
@@ -15607,6 +17063,7 @@ _ACEOF
   REPLACE_MALLOC=0;
   REPLACE_MBTOWC=0;
   REPLACE_MKSTEMP=0;
+  REPLACE_PTSNAME=0;
   REPLACE_PTSNAME_R=0;
   REPLACE_PUTENV=0;
   REPLACE_RANDOM_R=0;
@@ -15853,57 +17310,124 @@ done
 
   fi
 
-                    if test -z "$gl_replace_getopt"; then
+          if test -z "$gl_replace_getopt"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getopt is POSIX compatible" >&5
 $as_echo_n "checking whether getopt is POSIX compatible... " >&6; }
 if test "${gl_cv_func_getopt_posix+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
-                                                                        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+                                                if test $cross_compiling = no; then
+                              if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+
 #include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
 int
 main ()
 {
-int *p = &optreset; return optreset;
-  ;
+  static char program[] = "program";
+  static char a[] = "-a";
+  static char foo[] = "foo";
+  static char bar[] = "bar";
+  char *argv[] = { program, a, foo, bar, NULL };
+  int c;
+
+  c = getopt (4, argv, "ab");
+  if (!(c == 'a'))
+    return 1;
+  c = getopt (4, argv, "ab");
+  if (!(c == -1))
+    return 2;
+  if (!(optind == 2))
+    return 3;
   return 0;
 }
+
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  gl_optind_min=1
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_getopt_posix=maybe
+else
+  gl_cv_func_getopt_posix=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+          if test $gl_cv_func_getopt_posix = maybe; then
+                                    if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <getopt.h>
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
 int
 main ()
 {
-return !getopt_clip;
-  ;
+  static char program[] = "program";
+  static char donald[] = "donald";
+  static char p[] = "-p";
+  static char billy[] = "billy";
+  static char duck[] = "duck";
+  static char a[] = "-a";
+  static char bar[] = "bar";
+  char *argv[] = { program, donald, p, billy, duck, a, bar, NULL };
+  int c;
+
+  c = getopt (7, argv, "+abp:q:");
+  if (!(c == -1))
+    return 4;
+  if (!(strcmp (argv[0], "program") == 0))
+    return 5;
+  if (!(strcmp (argv[1], "donald") == 0))
+    return 6;
+  if (!(strcmp (argv[2], "-p") == 0))
+    return 7;
+  if (!(strcmp (argv[3], "billy") == 0))
+    return 8;
+  if (!(strcmp (argv[4], "duck") == 0))
+    return 9;
+  if (!(strcmp (argv[5], "-a") == 0))
+    return 10;
+  if (!(strcmp (argv[6], "bar") == 0))
+    return 11;
+  if (!(optind == 1))
+    return 12;
   return 0;
 }
+
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gl_optind_min=1
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_getopt_posix=maybe
 else
-  gl_optind_min=0
+  gl_cv_func_getopt_posix=no
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-
-                gl_save_CPPFLAGS=$CPPFLAGS
-        CPPFLAGS="$CPPFLAGS -DOPTIND_MIN=$gl_optind_min"
-        if test "$cross_compiling" = yes; then :
-  case "$host_os" in
-             mingw*)         gl_cv_func_getopt_posix="guessing no";;
-             darwin* | aix*) gl_cv_func_getopt_posix="guessing no";;
-             *)              gl_cv_func_getopt_posix="guessing yes";;
-           esac
 
+          fi
+          if test $gl_cv_func_getopt_posix = maybe; then
+                        if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -15915,78 +17439,17 @@ else
 int
 main ()
 {
-  {
-    static char program[] = "program";
-    static char a[] = "-a";
-    static char foo[] = "foo";
-    static char bar[] = "bar";
-    char *argv[] = { program, a, foo, bar, NULL };
-    int c;
-
-    optind = OPTIND_MIN;
-    opterr = 0;
-
-    c = getopt (4, argv, "ab");
-    if (!(c == 'a'))
-      return 1;
-    c = getopt (4, argv, "ab");
-    if (!(c == -1))
-      return 2;
-    if (!(optind == 2))
-      return 3;
-  }
-  /* Some internal state exists at this point.  */
-  {
-    static char program[] = "program";
-    static char donald[] = "donald";
-    static char p[] = "-p";
-    static char billy[] = "billy";
-    static char duck[] = "duck";
-    static char a[] = "-a";
-    static char bar[] = "bar";
-    char *argv[] = { program, donald, p, billy, duck, a, bar, NULL };
-    int c;
-
-    optind = OPTIND_MIN;
-    opterr = 0;
-
-    c = getopt (7, argv, "+abp:q:");
-    if (!(c == -1))
-      return 4;
-    if (!(strcmp (argv[0], "program") == 0))
-      return 5;
-    if (!(strcmp (argv[1], "donald") == 0))
-      return 6;
-    if (!(strcmp (argv[2], "-p") == 0))
-      return 7;
-    if (!(strcmp (argv[3], "billy") == 0))
-      return 8;
-    if (!(strcmp (argv[4], "duck") == 0))
-      return 9;
-    if (!(strcmp (argv[5], "-a") == 0))
-      return 10;
-    if (!(strcmp (argv[6], "bar") == 0))
-      return 11;
-    if (!(optind == 1))
-      return 12;
-  }
-  /* Detect MacOS 10.5, AIX 7.1 bug.  */
-  {
-    static char program[] = "program";
-    static char ab[] = "-ab";
-    char *argv[3] = { program, ab, NULL };
-    optind = OPTIND_MIN;
-    opterr = 0;
-    if (getopt (2, argv, "ab:") != 'a')
-      return 13;
-    if (getopt (2, argv, "ab:") != '?')
-      return 14;
-    if (optopt != 'b')
-      return 15;
-    if (optind != 2)
-      return 16;
-  }
-
+  static char program[] = "program";
+  static char ab[] = "-ab";
+  char *argv[3] = { program, ab, NULL };
+  if (getopt (2, argv, "ab:") != 'a')
+    return 13;
+  if (getopt (2, argv, "ab:") != '?')
+    return 14;
+  if (optopt != 'b')
+    return 15;
+  if (optind != 2)
+    return 16;
   return 0;
 }
 
@@ -16000,7 +17463,13 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-        CPPFLAGS=$gl_save_CPPFLAGS
+          fi
+        else
+          case "$host_os" in
+            darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";;
+            *)                       gl_cv_func_getopt_posix="guessing yes";;
+          esac
+        fi
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_posix" >&5
@@ -16031,11 +17500,7 @@ else
        POSIXLY_CORRECT=1
        export POSIXLY_CORRECT
        if test "$cross_compiling" = yes; then :
-           case $host_os:$ac_cv_have_decl_optreset in
-           *-gnu*:* | mingw*:*) gl_cv_func_getopt_gnu=no;;
-           *:yes)               gl_cv_func_getopt_gnu=no;;
-           *)                   gl_cv_func_getopt_gnu=yes;;
-         esac
+           gl_cv_func_getopt_gnu="guessing no"
 
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -16046,7 +17511,7 @@ else
 
 #include <stdlib.h>
 #if defined __MACH__ && defined __APPLE__
-/* Avoid a crash on MacOS X.  */
+/* Avoid a crash on Mac OS X.  */
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 #include <mach/thread_status.h>
@@ -16166,7 +17631,7 @@ main ()
              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,
+                and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5,
                 OSF/1 5.1, Solaris 10.  */
              {
                static char conftest[] = "conftest";
@@ -16177,7 +17642,7 @@ main ()
                  result |= 1;
              }
              /* This code succeeds on glibc 2.8, mingw,
-                and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
+                and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
                 IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x.  */
              {
                static char program[] = "program";
@@ -16206,7 +17671,7 @@ main ()
                if (getopt (3, argv, "-p") != 1)
                  result |= 16;
                else if (getopt (3, argv, "-p") != 'p')
-                 result |= 32;
+                 result |= 16;
              }
              /* This code fails on glibc 2.11.  */
              {
@@ -16216,9 +17681,9 @@ main ()
                char *argv[] = { program, b, a, NULL };
                optind = opterr = 0;
                if (getopt (3, argv, "+:a:b") != 'b')
-                 result |= 64;
+                 result |= 32;
                else if (getopt (3, argv, "+:a:b") != ':')
-                 result |= 64;
+                 result |= 32;
              }
              /* This code dumps core on glibc 2.14.  */
              {
@@ -16228,7 +17693,7 @@ main ()
                char *argv[] = { program, w, dummy, NULL };
                optind = opterr = 1;
                if (getopt (3, argv, "W;") != 'W')
-                 result |= 128;
+                 result |= 64;
              }
              return result;
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_gnu" >&5
 $as_echo "$gl_cv_func_getopt_gnu" >&6; }
-    if test "$gl_cv_func_getopt_gnu" = "no"; then
+    if test "$gl_cv_func_getopt_gnu" != yes; then
       gl_replace_getopt=yes
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working GNU getopt_long function" >&5
+$as_echo_n "checking for working GNU getopt_long function... " >&6; }
+if test "${gl_cv_func_getopt_long_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+              case "$host_os" in
+              openbsd*) gl_cv_func_getopt_long_gnu="guessing no";;
+              *)        gl_cv_func_getopt_long_gnu="guessing yes";;
+            esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <getopt.h>
+                #include <stddef.h>
+                #include <string.h>
+
+int
+main ()
+{
+static const struct option long_options[] =
+                  {
+                    { "xtremely-",no_argument,       NULL, 1003 },
+                    { "xtra",     no_argument,       NULL, 1001 },
+                    { "xtreme",   no_argument,       NULL, 1002 },
+                    { "xtremely", no_argument,       NULL, 1003 },
+                    { NULL,       0,                 NULL, 0 }
+                  };
+                /* This code fails on OpenBSD 5.0.  */
+                {
+                  static char program[] = "program";
+                  static char xtremel[] = "--xtremel";
+                  char *argv[] = { program, xtremel, NULL };
+                  int option_index;
+                  optind = 1; opterr = 0;
+                  if (getopt_long (2, argv, "", long_options, &option_index) != 1003)
+                    return 1;
+                }
+                return 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_getopt_long_gnu=yes
+else
+  gl_cv_func_getopt_long_gnu=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_long_gnu" >&5
+$as_echo "$gl_cv_func_getopt_long_gnu" >&6; }
+      case "$gl_cv_func_getopt_long_gnu" in
+        *yes) ;;
+        *) gl_replace_getopt=yes ;;
+      esac
+    fi
+  fi
+
+
+
+
+
+
+    REPLACE_GETOPT=0
+    if test -n "$gl_replace_getopt"; then
+      REPLACE_GETOPT=1
     fi
+
+  if test $REPLACE_GETOPT = 1; then
+
+  GETOPT_H=getopt.h
+
+$as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h
+
+
+
   fi
 
+ac_fn_c_check_decl "$LINENO" "getenv" "ac_cv_have_decl_getenv" "$ac_includes_default"
+if test "x$ac_cv_have_decl_getenv" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_GETENV $ac_have_decl
+_ACEOF
+
+:
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
+$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
+if test "${ac_cv_c_restrict+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_c_restrict=no
+   # The order here caters to the fact that C++ does not require restrict.
+   for ac_kw in __restrict __restrict__ _Restrict restrict; do
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+typedef int * int_ptr;
+       int foo (int_ptr $ac_kw ip) {
+       return ip[0];
+       }
+int
+main ()
+{
+int s[1];
+       int * $ac_kw t = s;
+       t[0] = 0;
+       return foo(t)
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_restrict=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+     test "$ac_cv_c_restrict" != no && break
+   done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5
+$as_echo "$ac_cv_c_restrict" >&6; }
+
+ case $ac_cv_c_restrict in
+   restrict) ;;
+   no) $as_echo "#define restrict /**/" >>confdefs.h
+ ;;
+   *)  cat >>confdefs.h <<_ACEOF
+#define restrict $ac_cv_c_restrict
+_ACEOF
+ ;;
+ esac
+
+
+  GNULIB_GETTIMEOFDAY=0;
+    HAVE_GETTIMEOFDAY=1;
+  HAVE_STRUCT_TIMEVAL=1;
+  HAVE_SYS_TIME_H=1;
+  REPLACE_GETTIMEOFDAY=0;
+  REPLACE_STRUCT_TIMEVAL=0;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+     if test $gl_cv_have_include_next = yes; then
+       gl_cv_next_sys_time_h='<'sys/time.h'>'
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/time.h>" >&5
+$as_echo_n "checking absolute name of <sys/time.h>... " >&6; }
+if test "${gl_cv_next_sys_time_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+             if test $ac_cv_header_sys_time_h = yes; then
+
+
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/time.h>
+
+_ACEOF
+                                                                                                                        case "$host_os" in
+                 aix*) gl_absname_cpp="$ac_cpp -C" ;;
+                 *)    gl_absname_cpp="$ac_cpp" ;;
+               esac
+
+               case "$host_os" in
+                 mingw*)
+                                                                                                                                     gl_dirsep_regex='[/\\]'
+                   ;;
+                 *)
+                   gl_dirsep_regex='\/'
+                   ;;
+               esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
+
+               gl_header_literal_regex=`echo 'sys/time.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
+                   s|^/[^/]|//&|
+                   p
+                   q
+                 }'
+                                                            gl_cv_next_sys_time_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
+                      sed -n "$gl_absolute_header_sed"`'"'
+          else
+               gl_cv_next_sys_time_h='<'sys/time.h'>'
+             fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_time_h" >&5
+$as_echo "$gl_cv_next_sys_time_h" >&6; }
+     fi
+     NEXT_SYS_TIME_H=$gl_cv_next_sys_time_h
+
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'sys/time.h'>'
+     else
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=$gl_cv_next_sys_time_h
+     fi
+     NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H=$gl_next_as_first_directive
+
 
 
 
 
-    REPLACE_GETOPT=0
+  if test $ac_cv_header_sys_time_h != yes; then
+    HAVE_SYS_TIME_H=0
+  fi
 
 
-  if test -n "$gl_replace_getopt"; then :
 
-      REPLACE_GETOPT=1
+
+
+  if test $ac_cv_header_sys_socket_h != yes; then
+                    for ac_header in winsock2.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default"
+if test "x$ac_cv_header_winsock2_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_WINSOCK2_H 1
+_ACEOF
 
 fi
 
+done
 
-  if test $REPLACE_GETOPT = 1; then
+  fi
+  if test "$ac_cv_header_winsock2_h" = yes; then
+    HAVE_WINSOCK2_H=1
+    UNISTD_H_HAVE_WINSOCK2_H=1
+    SYS_IOCTL_H_HAVE_WINSOCK2_H=1
+  else
+    HAVE_WINSOCK2_H=0
+  fi
 
-  GETOPT_H=getopt.h
 
-$as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timeval" >&5
+$as_echo_n "checking for struct timeval... " >&6; }
+if test "${gl_cv_sys_struct_timeval+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#if HAVE_SYS_TIME_H
+             #include <sys/time.h>
+            #endif
+            #include <time.h>
+            #if HAVE_WINSOCK2_H
+            # include <winsock2.h>
+            #endif
 
+int
+main ()
+{
+static struct timeval x; x.tv_sec = x.tv_usec;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_sys_struct_timeval=yes
+else
+  gl_cv_sys_struct_timeval=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timeval" >&5
+$as_echo "$gl_cv_sys_struct_timeval" >&6; }
+  if test $gl_cv_sys_struct_timeval != yes; then
+    HAVE_STRUCT_TIMEVAL=0
+  else
+                            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wide-enough struct timeval.tv_sec member" >&5
+$as_echo_n "checking for wide-enough struct timeval.tv_sec member... " >&6; }
+if test "${gl_cv_sys_struct_timeval_tv_sec+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#if HAVE_SYS_TIME_H
+               #include <sys/time.h>
+              #endif
+              #include <time.h>
+              #if HAVE_WINSOCK2_H
+              # include <winsock2.h>
+              #endif
 
-  fi
+int
+main ()
+{
+static struct timeval x;
+              typedef int verify_tv_sec_type[
+                sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1
+              ];
 
-ac_fn_c_check_decl "$LINENO" "getenv" "ac_cv_have_decl_getenv" "$ac_includes_default"
-if test "x$ac_cv_have_decl_getenv" = x""yes; then :
-  ac_have_decl=1
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_sys_struct_timeval_tv_sec=yes
 else
-  ac_have_decl=0
+  gl_cv_sys_struct_timeval_tv_sec=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timeval_tv_sec" >&5
+$as_echo "$gl_cv_sys_struct_timeval_tv_sec" >&6; }
+    if test $gl_cv_sys_struct_timeval_tv_sec != yes; then
+      REPLACE_STRUCT_TIMEVAL=1
+    fi
+  fi
+
+
+
+
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_GETENV $ac_have_decl
-_ACEOF
 
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5
@@ -17369,82 +19147,287 @@ $as_echo "$gl_cv_type_off_t_64" >&6; }
 
 
 
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
-$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
-if test "${gl_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  rm -f conftest.sym conftest.file
-     echo >conftest.file
-     if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
-       if test "$cross_compiling" = yes; then :
-  case "$host_os" in
-                    # Guess yes on glibc systems.
-            *-gnu*) gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
-                    # If we don't know, assume the worst.
-            *)      gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;;
-          esac
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
+$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
+if test "${gl_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  rm -f conftest.sym conftest.file
+     echo >conftest.file
+     if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+       if test "$cross_compiling" = yes; then :
+  case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;;
+          esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+              /* Linux will dereference the symlink and fail, as required by
+                 POSIX.  That is better in the sense that it means we will not
+                 have to compile and use the lstat wrapper.  */
+              return lstat ("conftest.sym/", &sbuf) == 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_lstat_dereferences_slashed_symlink=yes
+else
+  gl_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+     else
+       # If the 'ln -s' command failed, then we probably don't even
+       # have an lstat function.
+       gl_cv_func_lstat_dereferences_slashed_symlink="guessing no"
+     fi
+     rm -f conftest.sym conftest.file
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lstat_dereferences_slashed_symlink" >&5
+$as_echo "$gl_cv_func_lstat_dereferences_slashed_symlink" >&6; }
+  case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+    *yes)
+
+cat >>confdefs.h <<_ACEOF
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+_ACEOF
+
+      ;;
+  esac
+
+
+  GNULIB_MKTIME=0;
+  GNULIB_NANOSLEEP=0;
+  GNULIB_STRPTIME=0;
+  GNULIB_TIMEGM=0;
+  GNULIB_TIME_R=0;
+    HAVE_DECL_LOCALTIME_R=1;
+  HAVE_NANOSLEEP=1;
+  HAVE_STRPTIME=1;
+  HAVE_TIMEGM=1;
+        REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;
+  REPLACE_MKTIME=GNULIB_PORTCHECK;
+  REPLACE_NANOSLEEP=GNULIB_PORTCHECK;
+  REPLACE_TIMEGM=GNULIB_PORTCHECK;
+
+
+
+
+  GNULIB_PSELECT=0;
+  GNULIB_SELECT=0;
+    HAVE_PSELECT=1;
+  REPLACE_PSELECT=0;
+  REPLACE_SELECT=0;
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <sys/select.h> is self-contained" >&5
+$as_echo_n "checking whether <sys/select.h> is self-contained... " >&6; }
+if test "${gl_cv_header_sys_select_h_selfcontained+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+                                    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+int
+main ()
+{
+struct timeval b;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_header_sys_select_h_selfcontained=yes
+else
+  gl_cv_header_sys_select_h_selfcontained=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+                        if test $gl_cv_header_sys_select_h_selfcontained = yes; then
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+int
+main ()
+{
+int memset; int bzero;
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+int
+main ()
+{
+
+                  #undef memset
+                  #define memset nonexistent_memset
+                  extern
+                  #ifdef __cplusplus
+                  "C"
+                  #endif
+                  void *memset (void *, int, unsigned long);
+                  #undef bzero
+                  #define bzero nonexistent_bzero
+                  extern
+                  #ifdef __cplusplus
+                  "C"
+                  #endif
+                  void bzero (void *, unsigned long);
+                  fd_set fds;
+                  FD_ZERO (&fds);
+
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+else
+  gl_cv_header_sys_select_h_selfcontained=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_select_h_selfcontained" >&5
+$as_echo "$gl_cv_header_sys_select_h_selfcontained" >&6; }
+
+
+
+
+
+
+
+
+
+     if test $gl_cv_have_include_next = yes; then
+       gl_cv_next_sys_select_h='<'sys/select.h'>'
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/select.h>" >&5
+$as_echo_n "checking absolute name of <sys/select.h>... " >&6; }
+if test "${gl_cv_next_sys_select_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+             if test $ac_cv_header_sys_select_h = yes; then
+
+
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+
+_ACEOF
+                                                                                                                        case "$host_os" in
+                 aix*) gl_absname_cpp="$ac_cpp -C" ;;
+                 *)    gl_absname_cpp="$ac_cpp" ;;
+               esac
+
+               case "$host_os" in
+                 mingw*)
+                                                                                                                                     gl_dirsep_regex='[/\\]'
+                   ;;
+                 *)
+                   gl_dirsep_regex='\/'
+                   ;;
+               esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
+
+               gl_header_literal_regex=`echo 'sys/select.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
+                   s|^/[^/]|//&|
+                   p
+                   q
+                 }'
+                                                            gl_cv_next_sys_select_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
+                      sed -n "$gl_absolute_header_sed"`'"'
+          else
+               gl_cv_next_sys_select_h='<'sys/select.h'>'
+             fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_select_h" >&5
+$as_echo "$gl_cv_next_sys_select_h" >&6; }
+     fi
+     NEXT_SYS_SELECT_H=$gl_cv_next_sys_select_h
+
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'sys/select.h'>'
+     else
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=$gl_cv_next_sys_select_h
+     fi
+     NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H=$gl_next_as_first_directive
+
+
+
 
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-struct stat sbuf;
-              /* Linux will dereference the symlink and fail, as required by
-                 POSIX.  That is better in the sense that it means we will not
-                 have to compile and use the lstat wrapper.  */
-              return lstat ("conftest.sym/", &sbuf) == 0;
+  if test $ac_cv_header_sys_select_h = yes; then
+    HAVE_SYS_SELECT_H=1
+  else
+    HAVE_SYS_SELECT_H=0
+  fi
 
-  ;
-  return 0;
-}
+
+
+
+
+  if test $ac_cv_header_sys_socket_h != yes; then
+                    for ac_header in winsock2.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default"
+if test "x$ac_cv_header_winsock2_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_WINSOCK2_H 1
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  gl_cv_func_lstat_dereferences_slashed_symlink=yes
-else
-  gl_cv_func_lstat_dereferences_slashed_symlink=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+
 fi
 
-     else
-       # If the 'ln -s' command failed, then we probably don't even
-       # have an lstat function.
-       gl_cv_func_lstat_dereferences_slashed_symlink="guessing no"
-     fi
-     rm -f conftest.sym conftest.file
+done
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lstat_dereferences_slashed_symlink" >&5
-$as_echo "$gl_cv_func_lstat_dereferences_slashed_symlink" >&6; }
-  case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
-    *yes)
+  fi
+  if test "$ac_cv_header_winsock2_h" = yes; then
+    HAVE_WINSOCK2_H=1
+    UNISTD_H_HAVE_WINSOCK2_H=1
+    SYS_IOCTL_H_HAVE_WINSOCK2_H=1
+  else
+    HAVE_WINSOCK2_H=0
+  fi
 
-cat >>confdefs.h <<_ACEOF
-#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
-_ACEOF
 
-      ;;
-  esac
 
 
-  GNULIB_MKTIME=0;
-  GNULIB_NANOSLEEP=0;
-  GNULIB_STRPTIME=0;
-  GNULIB_TIMEGM=0;
-  GNULIB_TIME_R=0;
-    HAVE_DECL_LOCALTIME_R=1;
-  HAVE_NANOSLEEP=1;
-  HAVE_STRPTIME=1;
-  HAVE_TIMEGM=1;
-        REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;
-  REPLACE_MKTIME=GNULIB_PORTCHECK;
-  REPLACE_NANOSLEEP=GNULIB_PORTCHECK;
-  REPLACE_TIMEGM=GNULIB_PORTCHECK;
 
 
 
@@ -17473,6 +19456,7 @@ _ACEOF
 
 
 
+
   ac_fn_c_check_type "$LINENO" "sigset_t" "ac_cv_type_sigset_t" "
       #include <signal.h>
       /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.  */
 
 
 
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
-$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
-if test "${ac_cv_c_restrict+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_c_restrict=no
-   # The order here caters to the fact that C++ does not require restrict.
-   for ac_kw in __restrict __restrict__ _Restrict restrict; do
-     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-typedef int * int_ptr;
-       int foo (int_ptr $ac_kw ip) {
-       return ip[0];
-       }
-int
-main ()
-{
-int s[1];
-       int * $ac_kw t = s;
-       t[0] = 0;
-       return foo(t)
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_restrict=$ac_kw
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-     test "$ac_cv_c_restrict" != no && break
-   done
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5
-$as_echo "$ac_cv_c_restrict" >&6; }
-
- case $ac_cv_c_restrict in
-   restrict) ;;
-   no) $as_echo "#define restrict /**/" >>confdefs.h
- ;;
-   *)  cat >>confdefs.h <<_ACEOF
-#define restrict $ac_cv_c_restrict
-_ACEOF
- ;;
- esac
-
-
-
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timespec in <time.h>" >&5
 $as_echo_n "checking for struct timespec in <time.h>... " >&6; }
 if test "${gl_cv_sys_struct_timespec_in_time_h+set}" = set; then :
@@ -18138,36 +20068,219 @@ _ACEOF
                       sed -n "$gl_absolute_header_sed"`'"'
 
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_time_h" >&5
-$as_echo "$gl_cv_next_time_h" >&6; }
-     fi
-     NEXT_TIME_H=$gl_cv_next_time_h
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_time_h" >&5
+$as_echo "$gl_cv_next_time_h" >&6; }
+     fi
+     NEXT_TIME_H=$gl_cv_next_time_h
+
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'time.h'>'
+     else
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=$gl_cv_next_time_h
+     fi
+     NEXT_AS_FIRST_DIRECTIVE_TIME_H=$gl_next_as_first_directive
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the utimes function works" >&5
+$as_echo_n "checking whether the utimes function works... " >&6; }
+if test "${gl_cv_func_working_utimes+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  if test "$cross_compiling" = yes; then :
+  gl_cv_func_working_utimes=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <time.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <utime.h>
+
+static int
+inorder (time_t a, time_t b, time_t c)
+{
+  return a <= b && b <= c;
+}
+
+int
+main ()
+{
+  int result = 0;
+  char const *file = "conftest.utimes";
+  static struct timeval timeval[2] = {{9, 10}, {999999, 999999}};
+
+  /* Test whether utimes() essentially works.  */
+  {
+    struct stat sbuf;
+    FILE *f = fopen (file, "w");
+    if (f == NULL)
+      result |= 1;
+    else if (fclose (f) != 0)
+      result |= 1;
+    else if (utimes (file, timeval) != 0)
+      result |= 2;
+    else if (lstat (file, &sbuf) != 0)
+      result |= 1;
+    else if (!(sbuf.st_atime == timeval[0].tv_sec
+               && sbuf.st_mtime == timeval[1].tv_sec))
+      result |= 4;
+    if (unlink (file) != 0)
+      result |= 1;
+  }
+
+  /* Test whether utimes() with a NULL argument sets the file's timestamp
+     to the current time.  Use 'fstat' as well as 'time' to
+     determine the "current" time, to accommodate NFS file systems
+     if there is a time skew between the host and the NFS server.  */
+  {
+    int fd = open (file, O_WRONLY|O_CREAT, 0644);
+    if (fd < 0)
+      result |= 1;
+    else
+      {
+        time_t t0, t2;
+        struct stat st0, st1, st2;
+        if (time (&t0) == (time_t) -1)
+          result |= 1;
+        else if (fstat (fd, &st0) != 0)
+          result |= 1;
+        else if (utimes (file, timeval) != 0)
+          result |= 2;
+        else if (utimes (file, NULL) != 0)
+          result |= 8;
+        else if (fstat (fd, &st1) != 0)
+          result |= 1;
+        else if (write (fd, "\n", 1) != 1)
+          result |= 1;
+        else if (fstat (fd, &st2) != 0)
+          result |= 1;
+        else if (time (&t2) == (time_t) -1)
+          result |= 1;
+        else
+          {
+            int m_ok_POSIX = inorder (t0, st1.st_mtime, t2);
+            int m_ok_NFS = inorder (st0.st_mtime, st1.st_mtime, st2.st_mtime);
+            if (! (st1.st_atime == st1.st_mtime))
+              result |= 16;
+            if (! (m_ok_POSIX || m_ok_NFS))
+              result |= 32;
+          }
+        if (close (fd) != 0)
+          result |= 1;
+      }
+    if (unlink (file) != 0)
+      result |= 1;
+  }
+
+  /* Test whether utimes() with a NULL argument works on read-only files.  */
+  {
+    int fd = open (file, O_WRONLY|O_CREAT, 0444);
+    if (fd < 0)
+      result |= 1;
+    else if (close (fd) != 0)
+      result |= 1;
+    else if (utimes (file, NULL) != 0)
+      result |= 64;
+    if (unlink (file) != 0)
+      result |= 1;
+  }
+
+  return result;
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_working_utimes=yes
+else
+  gl_cv_func_working_utimes=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_working_utimes" >&5
+$as_echo "$gl_cv_func_working_utimes" >&6; }
+
+  if test $gl_cv_func_working_utimes = yes; then
+
+$as_echo "#define HAVE_WORKING_UTIMES 1" >>confdefs.h
+
+  fi
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct utimbuf" >&5
+$as_echo_n "checking for struct utimbuf... " >&6; }
+if test "${gl_cv_sys_struct_utimbuf+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#if HAVE_SYS_TIME_H
+             #include <sys/time.h>
+            #endif
+            #include <time.h>
+            #ifdef HAVE_UTIME_H
+             #include <utime.h>
+            #endif
+
+int
+main ()
+{
+static struct utimbuf x; x.actime = x.modtime;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_sys_struct_utimbuf=yes
+else
+  gl_cv_sys_struct_utimbuf=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_utimbuf" >&5
+$as_echo "$gl_cv_sys_struct_utimbuf" >&6; }
+
+  if test $gl_cv_sys_struct_utimbuf = yes; then
+
+$as_echo "#define HAVE_STRUCT_UTIMBUF 1" >>confdefs.h
+
+  fi
 
-     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
-       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
-       gl_next_as_first_directive='<'time.h'>'
-     else
-       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
-       gl_next_as_first_directive=$gl_cv_next_time_h
-     fi
-     NEXT_AS_FIRST_DIRECTIVE_TIME_H=$gl_next_as_first_directive
 
 
 
 
 
 
-ac_fn_c_check_decl "$LINENO" "localtime_r" "ac_cv_have_decl_localtime_r" "$ac_includes_default"
-if test "x$ac_cv_have_decl_localtime_r" = x""yes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_LOCALTIME_R $ac_have_decl
-_ACEOF
 
 
 
 
 
 
+  # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
+  # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
+
+  # Save and restore LIBS so e.g., -lrt, isn't added to it.  Otherwise, *all*
+  # programs in the package would end up linked with that potentially-shared
+  # library, inducing unnecessary run-time overhead.
+  LIB_CLOCK_GETTIME=
+
+  gl_saved_libs=$LIBS
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
+$as_echo_n "checking for library containing clock_gettime... " >&6; }
+if test "${ac_cv_search_clock_gettime+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' rt posix4; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_clock_gettime=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_clock_gettime+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_clock_gettime+set}" = set; then :
+
+else
+  ac_cv_search_clock_gettime=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
+$as_echo "$ac_cv_search_clock_gettime" >&6; }
+ac_res=$ac_cv_search_clock_gettime
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  test "$ac_cv_search_clock_gettime" = "none required" ||
+                    LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime
+fi
+
+    for ac_func in clock_gettime clock_settime
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+  LIBS=$gl_saved_libs
+
+
+
+
   :
 
 
@@ -18354,7 +20551,7 @@ $as_echo "$gl_cv_func_dup2_works" >&6; }
   fi
 
 
-if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
+  if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
 
 
 
@@ -18366,7 +20563,7 @@ if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
   gl_LIBOBJS="$gl_LIBOBJS dup2.$ac_objext"
 
 
-fi
+  fi
 
 
 
 
 
 
+          GNULIB_ENVIRON=1
+
+
+
+
+
+
+
+
+  LIB_EXECINFO=''
+  EXECINFO_H='execinfo.h'
+
+  if test $ac_cv_header_execinfo_h = yes; then
+    gl_saved_libs=$LIBS
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing backtrace_symbols_fd" >&5
+$as_echo_n "checking for library containing backtrace_symbols_fd... " >&6; }
+if test "${ac_cv_search_backtrace_symbols_fd+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char backtrace_symbols_fd ();
+int
+main ()
+{
+return backtrace_symbols_fd ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' execinfo; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_backtrace_symbols_fd=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_backtrace_symbols_fd+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_backtrace_symbols_fd+set}" = set; then :
+
+else
+  ac_cv_search_backtrace_symbols_fd=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_backtrace_symbols_fd" >&5
+$as_echo "$ac_cv_search_backtrace_symbols_fd" >&6; }
+ac_res=$ac_cv_search_backtrace_symbols_fd
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  test "$ac_cv_search_backtrace_symbols_fd" = "none required" ||
+         LIB_EXECINFO=$ac_cv_search_backtrace_symbols_fd
+fi
+
+    LIBS=$gl_saved_libs
+    test "$ac_cv_search_backtrace_symbols_fd" = no || EXECINFO_H=''
+  fi
+
+  if test -n "$EXECINFO_H"; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS execinfo.$ac_objext"
+
+  fi
+
+
+
+   if test -n "$EXECINFO_H"; then
+  GL_GENERATE_EXECINFO_H_TRUE=
+  GL_GENERATE_EXECINFO_H_FALSE='#'
+else
+  GL_GENERATE_EXECINFO_H_TRUE='#'
+  GL_GENERATE_EXECINFO_H_FALSE=
+fi
+
+
+
+
+
+
+
+
+
 # Persuade glibc <stdlib.h> to declare getloadavg().
 
 
 gl_save_LIBS=$LIBS
 
-# getloadvg is present in libc on glibc >= 2.2, MacOS X, FreeBSD >= 2.0,
+# getloadvg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0,
 # NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7.
 HAVE_GETLOADAVG=1
 ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg"
@@ -18777,7 +21080,7 @@ else
 fi
 
 
-if test $HAVE_GETLOADAVG = 0; then
+  if test $HAVE_GETLOADAVG = 0; then
 
 
 
@@ -18791,6 +21094,8 @@ if test $HAVE_GETLOADAVG = 0; then
 
 # Figure out what our getloadavg.c needs.
 
+
+
 # On HPUX9, an unprivileged user can get load averages this way.
 if test $gl_func_getloadavg_done = no; then
   for ac_func in pstat_getdynamic
 
 done
 
-fi
+fi
+
+for ac_header in nlist.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "nlist.h" "ac_cv_header_nlist_h" "$ac_includes_default"
+if test "x$ac_cv_header_nlist_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_NLIST_H 1
+_ACEOF
+ ac_fn_c_check_member "$LINENO" "struct nlist" "n_un.n_name" "ac_cv_member_struct_nlist_n_un_n_name" "#include <nlist.h>
+"
+if test "x$ac_cv_member_struct_nlist_n_un_n_name" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_NLIST_N_UN_N_NAME 1
+_ACEOF
+
+
+fi
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <nlist.h>
+int
+main ()
+{
+struct nlist x;
+                    #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
+                    x.n_un.n_name = "";
+                    #else
+                    x.n_name = "";
+                    #endif
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+$as_echo "#define N_NAME_POINTER 1" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+done
+
+  fi
+
+
+
+
+
+          GNULIB_GETLOADAVG=1
+
+
+
+
+
+
+
+
+
+
+  if test $REPLACE_GETOPT = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS getopt.$ac_objext"
+
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS getopt1.$ac_objext"
+
+
+
+
+        GNULIB_GL_UNISTD_H_GETOPT=1
+  fi
+
+
+
+
+
+
+
+    REPLACE_GETOPT=0
+    if test -n "$gl_replace_getopt"; then
+      REPLACE_GETOPT=1
+    fi
+
+  if test $REPLACE_GETOPT = 1; then
+
+  GETOPT_H=getopt.h
+
+$as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h
+
+
+
+  fi
 
-for ac_header in nlist.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "nlist.h" "ac_cv_header_nlist_h" "$ac_includes_default"
-if test "x$ac_cv_header_nlist_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_NLIST_H 1
-_ACEOF
- ac_fn_c_check_member "$LINENO" "struct nlist" "n_un.n_name" "ac_cv_member_struct_nlist_n_un_n_name" "#include <nlist.h>
-"
-if test "x$ac_cv_member_struct_nlist_n_un_n_name" = x""yes; then :
+  if test $REPLACE_GETOPT = 1; then
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_NLIST_N_UN_N_NAME 1
-_ACEOF
 
 
-fi
 
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <nlist.h>
-int
-main ()
-{
-struct nlist x;
-                    #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
-                    x.n_un.n_name = "";
-                    #else
-                    x.n_name = "";
-                    #endif
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
 
-$as_echo "#define N_NAME_POINTER 1" >>confdefs.h
 
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
 
-fi
 
-done
+  gl_LIBOBJS="$gl_LIBOBJS getopt.$ac_objext"
 
-fi
 
 
 
 
 
-          GNULIB_GETLOADAVG=1
 
 
 
+  gl_LIBOBJS="$gl_LIBOBJS getopt1.$ac_objext"
 
 
 
 
+        GNULIB_GL_UNISTD_H_GETOPT=1
+  fi
 
 
 
-if test $REPLACE_GETOPT = 1; then
 
 
 
@@ -18929,75 +21310,200 @@ if test $REPLACE_GETOPT = 1; then
 
 
 
-  gl_LIBOBJS="$gl_LIBOBJS getopt.$ac_objext"
 
+  gl_gettimeofday_timezone=void
+  if test $ac_cv_func_gettimeofday != yes; then
+    HAVE_GETTIMEOFDAY=0
+  else
 
 
 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gettimeofday clobbers localtime buffer" >&5
+$as_echo_n "checking whether gettimeofday clobbers localtime buffer... " >&6; }
+if test "${gl_cv_func_gettimeofday_clobber+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  # When cross-compiling:
+      case "$host_os" in
+                # Guess all is fine on glibc systems.
+        *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
+                # If we don't know, assume the worst.
+        *)      gl_cv_func_gettimeofday_clobber="guessing yes" ;;
+      esac
 
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+          #include <sys/time.h>
+          #include <time.h>
+          #include <stdlib.h>
 
+int
+main ()
+{
 
+          time_t t = 0;
+          struct tm *lt;
+          struct tm saved_lt;
+          struct timeval tv;
+          lt = localtime (&t);
+          saved_lt = *lt;
+          gettimeofday (&tv, NULL);
+          return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0;
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_gettimeofday_clobber=no
+else
+  gl_cv_func_gettimeofday_clobber=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-  gl_LIBOBJS="$gl_LIBOBJS getopt1.$ac_objext"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_gettimeofday_clobber" >&5
+$as_echo "$gl_cv_func_gettimeofday_clobber" >&6; }
 
+ case "$gl_cv_func_gettimeofday_clobber" in
+   *yes)
+     REPLACE_GETTIMEOFDAY=1
 
 
+$as_echo "#define gmtime rpl_gmtime" >>confdefs.h
 
-    GNULIB_GL_UNISTD_H_GETOPT=1
-fi
 
+$as_echo "#define localtime rpl_localtime" >>confdefs.h
 
 
 
+$as_echo "#define GETTIMEOFDAY_CLOBBERS_LOCALTIME 1" >>confdefs.h
 
+     ;;
+ esac
 
-    REPLACE_GETOPT=0
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettimeofday with POSIX signature" >&5
+$as_echo_n "checking for gettimeofday with POSIX signature... " >&6; }
+if test "${gl_cv_func_gettimeofday_posix_signature+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/time.h>
+              struct timeval c;
+              int gettimeofday (struct timeval *restrict, void *restrict);
 
+int
+main ()
+{
+/* glibc uses struct timezone * rather than the POSIX void *
+                 if _GNU_SOURCE is defined.  However, since the only portable
+                 use of gettimeofday uses NULL as the second parameter, and
+                 since the glibc definition is actually more typesafe, it is
+                 not worth wrapping this to get a compliant signature.  */
+              int (*f) (struct timeval *restrict, void *restrict)
+                = gettimeofday;
+              int x = f (&c, 0);
+              return !(x | c.tv_sec | c.tv_usec);
 
-  if test -n "$gl_replace_getopt"; then :
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_func_gettimeofday_posix_signature=yes
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/time.h>
+int gettimeofday (struct timeval *restrict, struct timezone *restrict);
 
-      REPLACE_GETOPT=1
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_func_gettimeofday_posix_signature=almost
+else
+  gl_cv_func_gettimeofday_posix_signature=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_gettimeofday_posix_signature" >&5
+$as_echo "$gl_cv_func_gettimeofday_posix_signature" >&6; }
+    if test $gl_cv_func_gettimeofday_posix_signature = almost; then
+      gl_gettimeofday_timezone='struct timezone'
+    elif test $gl_cv_func_gettimeofday_posix_signature != yes; then
+      REPLACE_GETTIMEOFDAY=1
+    fi
+        if test $REPLACE_STRUCT_TIMEVAL = 1; then
+      REPLACE_GETTIMEOFDAY=1
+    fi
 
+  fi
 
-  if test $REPLACE_GETOPT = 1; then
-
-  GETOPT_H=getopt.h
+cat >>confdefs.h <<_ACEOF
+#define GETTIMEOFDAY_TIMEZONE $gl_gettimeofday_timezone
+_ACEOF
 
-$as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h
 
+  if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then
 
 
-  fi
 
-if test $REPLACE_GETOPT = 1; then
 
 
 
 
 
+  gl_LIBOBJS="$gl_LIBOBJS gettimeofday.$ac_objext"
 
 
+  for ac_header in sys/timeb.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "sys/timeb.h" "ac_cv_header_sys_timeb_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_timeb_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_TIMEB_H 1
+_ACEOF
 
-  gl_LIBOBJS="$gl_LIBOBJS getopt.$ac_objext"
+fi
 
+done
 
+  for ac_func in _ftime
+do :
+  ac_fn_c_check_func "$LINENO" "_ftime" "ac_cv_func__ftime"
+if test "x$ac_cv_func__ftime" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE__FTIME 1
+_ACEOF
 
+fi
+done
 
 
+  fi
 
 
 
 
-  gl_LIBOBJS="$gl_LIBOBJS getopt1.$ac_objext"
 
+          GNULIB_GETTIMEOFDAY=1
 
 
 
-    GNULIB_GL_UNISTD_H_GETOPT=1
-fi
 
 
 
@@ -19016,7 +21522,7 @@ fi
     HAVE_LSTAT=0
   fi
 
-if test $REPLACE_LSTAT = 1; then
+  if test $REPLACE_LSTAT = 1; then
 
 
 
@@ -19031,7 +21537,7 @@ if test $REPLACE_LSTAT = 1; then
 
   :
 
-fi
+  fi
 
 
 
@@ -19050,7 +21556,7 @@ fi
 
 
   if test $APPLE_UNIVERSAL_BUILD = 1; then
-    # A universal build on Apple MacOS X platforms.
+    # A universal build on Apple Mac OS X platforms.
     # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode.
     # But we need a configuration result that is valid in both modes.
     gl_cv_func_working_mktime=no
@@ -19205,62 +21711,192 @@ year_2050_test ()
 int
 main ()
 {
-  int result = 0;
-  time_t t, delta;
-  int i, j;
-  int time_t_signed_magnitude = (time_t) ~ (time_t) 0 < (time_t) -1;
-  int time_t_signed = ! ((time_t) 0 < (time_t) -1);
-
-  /* This test makes some buggy mktime implementations loop.
-     Give up after 60 seconds; a mktime slower than that
-     isn't worth using anyway.  */
-  alarm (60);
-
-  time_t_max = (! time_t_signed
-                ? (time_t) -1
-                : ((((time_t) 1 << (sizeof (time_t) * CHAR_BIT - 2)) - 1)
-                   * 2 + 1));
-  time_t_min = (! time_t_signed
-                ? (time_t) 0
-                : time_t_signed_magnitude
-                ? ~ (time_t) 0
-                : ~ time_t_max);
-
-  delta = time_t_max / 997; /* a suitable prime number */
-  for (i = 0; i < N_STRINGS; i++)
-    {
-      if (tz_strings[i])
-        putenv (tz_strings[i]);
+  int result = 0;
+  time_t t, delta;
+  int i, j;
+  int time_t_signed_magnitude = (time_t) ~ (time_t) 0 < (time_t) -1;
+  int time_t_signed = ! ((time_t) 0 < (time_t) -1);
+
+  /* This test makes some buggy mktime implementations loop.
+     Give up after 60 seconds; a mktime slower than that
+     isn't worth using anyway.  */
+  alarm (60);
+
+  time_t_max = (! time_t_signed
+                ? (time_t) -1
+                : ((((time_t) 1 << (sizeof (time_t) * CHAR_BIT - 2)) - 1)
+                   * 2 + 1));
+  time_t_min = (! time_t_signed
+                ? (time_t) 0
+                : time_t_signed_magnitude
+                ? ~ (time_t) 0
+                : ~ time_t_max);
+
+  delta = time_t_max / 997; /* a suitable prime number */
+  for (i = 0; i < N_STRINGS; i++)
+    {
+      if (tz_strings[i])
+        putenv (tz_strings[i]);
+
+      for (t = 0; t <= time_t_max - delta && (result & 1) == 0; t += delta)
+        if (! mktime_test (t))
+          result |= 1;
+      if ((result & 2) == 0
+          && ! (mktime_test ((time_t) 1)
+                && mktime_test ((time_t) (60 * 60))
+                && mktime_test ((time_t) (60 * 60 * 24))))
+        result |= 2;
+
+      for (j = 1; (result & 4) == 0; j <<= 1)
+        {
+          if (! bigtime_test (j))
+            result |= 4;
+          if (INT_MAX / 2 < j)
+            break;
+        }
+      if ((result & 8) == 0 && ! bigtime_test (INT_MAX))
+        result |= 8;
+    }
+  if (! irix_6_4_bug ())
+    result |= 16;
+  if (! spring_forward_gap ())
+    result |= 32;
+  if (! year_2050_test ())
+    result |= 64;
+  return result;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_working_mktime=yes
+else
+  gl_cv_func_working_mktime=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_working_mktime" >&5
+$as_echo "$gl_cv_func_working_mktime" >&6; }
+
+  if test $gl_cv_func_working_mktime = no; then
+    REPLACE_MKTIME=1
+  else
+    REPLACE_MKTIME=0
+  fi
+
+  if test $REPLACE_MKTIME = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS mktime.$ac_objext"
+
+    :
+  fi
+
+
+
+
+
+          GNULIB_MKTIME=1
+
+
+
+
+
+
+
+
+
+
+
+  if test $ac_cv_func_pselect = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether signature of pselect conforms to POSIX" >&5
+$as_echo_n "checking whether signature of pselect conforms to POSIX... " >&6; }
+if test "${gl_cv_sig_pselect+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+
+int
+main ()
+{
+int (*p) (int, fd_set *, fd_set *, fd_set *restrict,
+                          struct timespec const *restrict,
+                          sigset_t const *restrict) = pselect;
+                return !p;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gl_cv_sig_pselect=yes
+else
+  gl_cv_sig_pselect=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sig_pselect" >&5
+$as_echo "$gl_cv_sig_pselect" >&6; }
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pselect detects invalid fds" >&5
+$as_echo_n "checking whether pselect detects invalid fds... " >&6; }
+if test "${gl_cv_func_pselect_detects_ebadf+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        if test "$cross_compiling" = yes; then :
+
+           case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_pselect_detects_ebadf="guessing no" ;;
+           esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <sys/types.h>
+#include <sys/time.h>
+#if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#include <unistd.h>
+#include <errno.h>
+
+int
+main ()
+{
 
-      for (t = 0; t <= time_t_max - delta; t += delta)
-        if (! mktime_test (t))
-          result |= 1;
-      if (! (mktime_test ((time_t) 1)
-             && mktime_test ((time_t) (60 * 60))
-             && mktime_test ((time_t) (60 * 60 * 24))))
-        result |= 2;
+  fd_set set;
+  dup2(0, 16);
+  FD_ZERO(&set);
+  FD_SET(16, &set);
+  close(16);
+  struct timespec timeout;
+  timeout.tv_sec = 0;
+  timeout.tv_nsec = 5000;
+  return pselect (17, &set, NULL, NULL, &timeout, NULL) != -1 || errno != EBADF;
 
-      for (j = 1; ; j <<= 1)
-        if (! bigtime_test (j))
-          result |= 4;
-        else if (INT_MAX / 2 < j)
-          break;
-      if (! bigtime_test (INT_MAX))
-        result |= 8;
-    }
-  if (! irix_6_4_bug ())
-    result |= 16;
-  if (! spring_forward_gap ())
-    result |= 32;
-  if (! year_2050_test ())
-    result |= 64;
-  return result;
+  ;
+  return 0;
 }
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
-  gl_cv_func_working_mktime=yes
+  gl_cv_func_pselect_detects_ebadf=yes
 else
-  gl_cv_func_working_mktime=no
+  gl_cv_func_pselect_detects_ebadf=no
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_working_mktime" >&5
-$as_echo "$gl_cv_func_working_mktime" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_pselect_detects_ebadf" >&5
+$as_echo "$gl_cv_func_pselect_detects_ebadf" >&6; }
+    case $gl_cv_func_pselect_detects_ebadf in
+      *yes) ;;
+      *) REPLACE_PSELECT=1 ;;
+    esac
+  fi
 
-  if test $gl_cv_func_working_mktime = no; then
-    REPLACE_MKTIME=1
-  else
-    REPLACE_MKTIME=0
+  if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then
+    REPLACE_PSELECT=1
   fi
 
-if test $REPLACE_MKTIME = 1; then
+  if test $HAVE_PSELECT = 0 || test $REPLACE_PSELECT = 1; then
 
 
 
@@ -19286,36 +21925,82 @@ if test $REPLACE_MKTIME = 1; then
 
 
 
-  gl_LIBOBJS="$gl_LIBOBJS mktime.$ac_objext"
+  gl_LIBOBJS="$gl_LIBOBJS pselect.$ac_objext"
 
+  fi
 
 
 
-fi
 
 
+          GNULIB_PSELECT=1
+
 
 
 
-          GNULIB_MKTIME=1
 
 
 
 
 
+  LIB_PTHREAD_SIGMASK=
 
 
 
 
+    if test "$gl_threads_api" = posix; then
+      if test $ac_cv_func_pthread_sigmask = yes; then
+                :
+      else
+        if test -n "$LIBMULTITHREAD"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_sigmask in $LIBMULTITHREAD" >&5
+$as_echo_n "checking for pthread_sigmask in $LIBMULTITHREAD... " >&6; }
+if test "${gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  gl_save_LIBS="$LIBS"
+             LIBS="$LIBS $LIBMULTITHREAD"
+             cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <pthread.h>
+                    #include <signal.h>
 
-  LIB_PTHREAD_SIGMASK=
+int
+main ()
+{
+return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);
+  ;
+  return 0;
+}
 
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=yes
+else
+  gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+             LIBS="$gl_save_LIBS"
 
-                    if test $ac_cv_func_pthread_sigmask = yes; then
-                  :
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD" >&5
+$as_echo "$gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD" >&6; }
+          if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
+                        LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD"
+          else
+                        HAVE_PTHREAD_SIGMASK=0
+          fi
+        else
+                    HAVE_PTHREAD_SIGMASK=0
+        fi
+      fi
     else
-            HAVE_PTHREAD_SIGMASK=0
-                        REPLACE_PTHREAD_SIGMASK=1
+                                          if test $ac_cv_func_pthread_sigmask = yes; then
+        REPLACE_PTHREAD_SIGMASK=1
+      else
+        HAVE_PTHREAD_SIGMASK=0
+      fi
     fi
 
 
@@ -19510,7 +22195,7 @@ $as_echo "#define PTHREAD_SIGMASK_UNBLOCK_BUG 1" >>confdefs.h
     esac
   fi
 
-if test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1; then
+  if test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1; then
 
 
 
@@ -19528,7 +22213,7 @@ $as_echo "#define HAVE_PTHREAD_SIGMASK 1" >>confdefs.h
 
   fi
 
-fi
+  fi
 
 
 
@@ -19631,7 +22316,7 @@ $as_echo "#define READLINK_TRAILING_SLASH_BUG 1" >>confdefs.h
     esac
   fi
 
-if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
+  if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
 
 
 
@@ -19645,7 +22330,7 @@ if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
 
   :
 
-fi
+  fi
 
 
 
@@ -19759,7 +22444,7 @@ fi
 
 
 
-   ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "
+     ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "
 /* <sys/types.h> is not needed according to POSIX, but the
    <sys/socket.h> in i386-unknown-freebsd4.10 and
    powerpc-apple-darwin5.5 required it. */
@@ -19856,6 +22541,144 @@ $as_echo "#define ssize_t int" >>confdefs.h
   fi
 
 
+
+
+
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_atim.tv_nsec" "ac_cv_member_struct_stat_st_atim_tv_nsec" "#include <sys/types.h>
+     #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_atim_tv_nsec" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1
+_ACEOF
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct stat.st_atim is of type struct timespec" >&5
+$as_echo_n "checking whether struct stat.st_atim is of type struct timespec... " >&6; }
+if test "${ac_cv_typeof_struct_stat_st_atim_is_struct_timespec+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+            #include <sys/types.h>
+            #include <sys/stat.h>
+            #if HAVE_SYS_TIME_H
+            # include <sys/time.h>
+            #endif
+            #include <time.h>
+            struct timespec ts;
+            struct stat st;
+
+int
+main ()
+{
+
+            st.st_atim = ts;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes
+else
+  ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&5
+$as_echo "$ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&6; }
+     if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then
+
+$as_echo "#define TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC 1" >>confdefs.h
+
+     fi
+else
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_atimespec.tv_nsec" "ac_cv_member_struct_stat_st_atimespec_tv_nsec" "#include <sys/types.h>
+        #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_atimespec_tv_nsec" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC 1
+_ACEOF
+
+
+else
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_atimensec" "ac_cv_member_struct_stat_st_atimensec" "#include <sys/types.h>
+           #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_atimensec" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1
+_ACEOF
+
+
+else
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_atim.st__tim.tv_nsec" "ac_cv_member_struct_stat_st_atim_st__tim_tv_nsec" "#include <sys/types.h>
+              #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_atim_st__tim_tv_nsec" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC 1
+_ACEOF
+
+
+fi
+
+fi
+
+fi
+
+fi
+
+
+
+
+
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimespec.tv_nsec" "ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" "#include <sys/types.h>
+     #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1
+_ACEOF
+
+
+else
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimensec" "ac_cv_member_struct_stat_st_birthtimensec" "#include <sys/types.h>
+        #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_birthtimensec" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC 1
+_ACEOF
+
+
+else
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtim.tv_nsec" "ac_cv_member_struct_stat_st_birthtim_tv_nsec" "#include <sys/types.h>
+          #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_birthtim_tv_nsec" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC 1
+_ACEOF
+
+
+fi
+
+fi
+
+fi
+
+
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working stdalign.h" >&5
 $as_echo_n "checking for working stdalign.h... " >&6; }
 if test "${gl_cv_header_working_stdalign_h+set}" = set; then :
@@ -20318,7 +23141,21 @@ $as_echo "$gl_cv_next_stdio_h" >&6; }
 
 
       GNULIB_FSCANF=1
+
+
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_FSCANF 1
+_ACEOF
+
+
   GNULIB_SCANF=1
+
+
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_SCANF 1
+_ACEOF
+
+
   GNULIB_FGETC=1
   GNULIB_GETC=1
   GNULIB_GETCHAR=1
@@ -20512,7 +23349,7 @@ $as_echo "$gl_cv_func_strtoimax" >&6; }
     HAVE_STRTOIMAX=0
   fi
 
-if test $HAVE_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; then
+  if test $HAVE_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; then
 
 
 
@@ -20537,7 +23374,7 @@ _ACEOF
 
 
 
-fi
+  fi
 
 
 
@@ -20557,7 +23394,7 @@ fi
     HAVE_DECL_STRTOUMAX=0
   fi
 
-if test $ac_cv_func_strtoumax = no; then
+  if test $ac_cv_func_strtoumax = no; then
 
 
 
@@ -20582,7 +23419,7 @@ _ACEOF
 
 
 
-fi
+  fi
 
 
 
@@ -20654,7 +23491,7 @@ $as_echo "$gl_cv_func_symlink_works" >&6; }
     esac
   fi
 
-if test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1; then
+  if test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1; then
 
 
 
@@ -20665,7 +23502,7 @@ if test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1; then
 
   gl_LIBOBJS="$gl_LIBOBJS symlink.$ac_objext"
 
-fi
+  fi
 
 
 
 
 
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <sys/select.h> is self-contained" >&5
+$as_echo_n "checking whether <sys/select.h> is self-contained... " >&6; }
+if test "${gl_cv_header_sys_select_h_selfcontained+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+                                    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+int
+main ()
+{
+struct timeval b;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_header_sys_select_h_selfcontained=yes
+else
+  gl_cv_header_sys_select_h_selfcontained=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+                        if test $gl_cv_header_sys_select_h_selfcontained = yes; then
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+int
+main ()
+{
+int memset; int bzero;
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+int
+main ()
+{
+
+                  #undef memset
+                  #define memset nonexistent_memset
+                  extern
+                  #ifdef __cplusplus
+                  "C"
+                  #endif
+                  void *memset (void *, int, unsigned long);
+                  #undef bzero
+                  #define bzero nonexistent_bzero
+                  extern
+                  #ifdef __cplusplus
+                  "C"
+                  #endif
+                  void bzero (void *, unsigned long);
+                  fd_set fds;
+                  FD_ZERO (&fds);
+
+  ;
+  return 0;
+}
 
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
 
+else
+  gl_cv_header_sys_select_h_selfcontained=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      fi
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_select_h_selfcontained" >&5
+$as_echo "$gl_cv_header_sys_select_h_selfcontained" >&6; }
 
 
 
 
 
      if test $gl_cv_have_include_next = yes; then
-       gl_cv_next_sys_stat_h='<'sys/stat.h'>'
+       gl_cv_next_sys_select_h='<'sys/select.h'>'
      else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/stat.h>" >&5
-$as_echo_n "checking absolute name of <sys/stat.h>... " >&6; }
-if test "${gl_cv_next_sys_stat_h+set}" = set; then :
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/select.h>" >&5
+$as_echo_n "checking absolute name of <sys/select.h>... " >&6; }
+if test "${gl_cv_next_sys_select_h+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
-             if test $ac_cv_header_sys_stat_h = yes; then
+             if test $ac_cv_header_sys_select_h = yes; then
 
 
                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/stat.h>
+#include <sys/select.h>
 
 _ACEOF
                                                                                                                         case "$host_os" in
@@ -20725,7 +23639,7 @@ _ACEOF
                esac
                                              gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
 
-               gl_header_literal_regex=`echo 'sys/stat.h' \
+               gl_header_literal_regex=`echo 'sys/select.h' \
                                         | sed -e "$gl_make_literal_regex_sed"`
                gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
                    s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
@@ -20733,54 +23647,69 @@ _ACEOF
                    p
                    q
                  }'
-                                                            gl_cv_next_sys_stat_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
+                                                            gl_cv_next_sys_select_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
                       sed -n "$gl_absolute_header_sed"`'"'
           else
-               gl_cv_next_sys_stat_h='<'sys/stat.h'>'
+               gl_cv_next_sys_select_h='<'sys/select.h'>'
              fi
 
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_stat_h" >&5
-$as_echo "$gl_cv_next_sys_stat_h" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_select_h" >&5
+$as_echo "$gl_cv_next_sys_select_h" >&6; }
      fi
-     NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h
+     NEXT_SYS_SELECT_H=$gl_cv_next_sys_select_h
 
      if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
        # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
-       gl_next_as_first_directive='<'sys/stat.h'>'
+       gl_next_as_first_directive='<'sys/select.h'>'
      else
        # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
-       gl_next_as_first_directive=$gl_cv_next_sys_stat_h
+       gl_next_as_first_directive=$gl_cv_next_sys_select_h
      fi
-     NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H=$gl_next_as_first_directive
-
+     NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H=$gl_next_as_first_directive
 
 
 
 
+  if test $ac_cv_header_sys_select_h = yes; then
+    HAVE_SYS_SELECT_H=1
+  else
+    HAVE_SYS_SELECT_H=0
+  fi
 
 
 
 
 
+  if test $ac_cv_header_sys_socket_h != yes; then
+                    for ac_header in winsock2.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default"
+if test "x$ac_cv_header_winsock2_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_WINSOCK2_H 1
+_ACEOF
 
-  if test $WINDOWS_64_BIT_ST_SIZE = 1; then
+fi
 
-$as_echo "#define _GL_WINDOWS_64_BIT_ST_SIZE 1" >>confdefs.h
+done
 
   fi
+  if test "$ac_cv_header_winsock2_h" = yes; then
+    HAVE_WINSOCK2_H=1
+    UNISTD_H_HAVE_WINSOCK2_H=1
+    SYS_IOCTL_H_HAVE_WINSOCK2_H=1
+  else
+    HAVE_WINSOCK2_H=0
+  fi
+
+
+
 
-      ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include <sys/types.h>
-     #include <sys/stat.h>
-"
-if test "x$ac_cv_type_nlink_t" = x""yes; then :
 
-else
 
-$as_echo "#define nlink_t int" >>confdefs.h
 
-fi
 
 
 
 
 
      if test $gl_cv_have_include_next = yes; then
-       gl_cv_next_sys_types_h='<'sys/types.h'>'
+       gl_cv_next_sys_stat_h='<'sys/stat.h'>'
      else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/types.h>" >&5
-$as_echo_n "checking absolute name of <sys/types.h>... " >&6; }
-if test "${gl_cv_next_sys_types_h+set}" = set; then :
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/stat.h>" >&5
+$as_echo_n "checking absolute name of <sys/stat.h>... " >&6; }
+if test "${gl_cv_next_sys_stat_h+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
+             if test $ac_cv_header_sys_stat_h = yes; then
+
+
                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
+#include <sys/stat.h>
 
 _ACEOF
                                                                                                                         case "$host_os" in
@@ -20825,7 +23757,7 @@ _ACEOF
                esac
                                              gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
 
-               gl_header_literal_regex=`echo 'sys/types.h' \
+               gl_header_literal_regex=`echo 'sys/stat.h' \
                                         | sed -e "$gl_make_literal_regex_sed"`
                gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
                    s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
@@ -20833,24 +23765,30 @@ _ACEOF
                    p
                    q
                  }'
-                                                            gl_cv_next_sys_types_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
+                                                            gl_cv_next_sys_stat_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
                       sed -n "$gl_absolute_header_sed"`'"'
+          else
+               gl_cv_next_sys_stat_h='<'sys/stat.h'>'
+             fi
 
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_types_h" >&5
-$as_echo "$gl_cv_next_sys_types_h" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_stat_h" >&5
+$as_echo "$gl_cv_next_sys_stat_h" >&6; }
      fi
-     NEXT_SYS_TYPES_H=$gl_cv_next_sys_types_h
+     NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h
 
      if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
        # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
-       gl_next_as_first_directive='<'sys/types.h'>'
+       gl_next_as_first_directive='<'sys/stat.h'>'
      else
        # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
-       gl_next_as_first_directive=$gl_cv_next_sys_types_h
+       gl_next_as_first_directive=$gl_cv_next_sys_stat_h
      fi
-     NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H=$gl_next_as_first_directive
+     NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H=$gl_next_as_first_directive
+
+
+
 
 
 
@@ -20859,6 +23797,22 @@ $as_echo "$gl_cv_next_sys_types_h" >&6; }
 
 
 
+  if test $WINDOWS_64_BIT_ST_SIZE = 1; then
+
+$as_echo "#define _GL_WINDOWS_64_BIT_ST_SIZE 1" >>confdefs.h
+
+  fi
+
+      ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include <sys/types.h>
+     #include <sys/stat.h>
+"
+if test "x$ac_cv_type_nlink_t" = x""yes; then :
+
+else
+
+$as_echo "#define nlink_t int" >>confdefs.h
+
+fi
 
 
 
@@ -20873,6 +23827,22 @@ $as_echo "$gl_cv_next_sys_types_h" >&6; }
 
 
 
+
+
+
+
+      ac_fn_c_check_decl "$LINENO" "localtime_r" "ac_cv_have_decl_localtime_r" "#include <time.h>
+"
+if test "x$ac_cv_have_decl_localtime_r" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_LOCALTIME_R $ac_have_decl
+_ACEOF
+
   if test $ac_cv_have_decl_localtime_r = no; then
     HAVE_DECL_LOCALTIME_R=0
   fi
@@ -20923,7 +23893,7 @@ $as_echo "$gl_cv_time_r_posix" >&6; }
     HAVE_LOCALTIME_R=0
   fi
 
-if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
+  if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
 
 
 
@@ -20937,7 +23907,7 @@ if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
 
   :
 
-fi
+  fi
 
 
 
 
 
 
+  LIB_TIMER_TIME=
+
+  gl_saved_libs=$LIBS
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing timer_settime" >&5
+$as_echo_n "checking for library containing timer_settime... " >&6; }
+if test "${ac_cv_search_timer_settime+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char timer_settime ();
+int
+main ()
+{
+return timer_settime ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' rt posix4; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_timer_settime=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_timer_settime+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_timer_settime+set}" = set; then :
+
+else
+  ac_cv_search_timer_settime=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_timer_settime" >&5
+$as_echo "$ac_cv_search_timer_settime" >&6; }
+ac_res=$ac_cv_search_timer_settime
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  test "$ac_cv_search_timer_settime" = "none required" ||
+                    LIB_TIMER_TIME=$ac_cv_search_timer_settime
+fi
+
+                    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
+     && !defined __UCLIBC__
+  Thread emulation available
+ #endif
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "Thread" >/dev/null 2>&1; then :
+  LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"
+fi
+rm -f conftest*
+
+    for ac_func in timer_settime
+do :
+  ac_fn_c_check_func "$LINENO" "timer_settime" "ac_cv_func_timer_settime"
+if test "x$ac_cv_func_timer_settime" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_TIMER_SETTIME 1
+_ACEOF
+
+fi
+done
+
+  LIBS=$gl_saved_libs
+
+  :
+
+
+
+
 
 
 
@@ -21041,10 +24107,72 @@ $as_echo "$gl_cv_next_unistd_h" >&6; }
 
 
 
+
+
+
+
+
+
+  if test $ac_cv_func_futimens = no && test $ac_cv_func_futimesat = yes; then
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether futimesat handles NULL file" >&5
+$as_echo_n "checking whether futimesat handles NULL file... " >&6; }
+if test "${gl_cv_func_futimesat_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  touch conftest.file
+       if test "$cross_compiling" = yes; then :
+  case "$host_os" in
+                   # Guess yes on glibc systems.
+           *-gnu*) gl_cv_func_futimesat_works="guessing yes" ;;
+                   # If we don't know, assume the worst.
+           *)      gl_cv_func_futimesat_works="guessing no" ;;
+         esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stddef.h>
+#include <sys/times.h>
+#include <fcntl.h>
+
+int
+main ()
+{
+    int fd = open ("conftest.file", O_RDWR);
+          if (fd < 0) return 1;
+          if (futimesat (fd, NULL, NULL)) return 2;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_futimesat_works=yes
+else
+  gl_cv_func_futimesat_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+      rm -f conftest.file
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_futimesat_works" >&5
+$as_echo "$gl_cv_func_futimesat_works" >&6; }
+    case "$gl_cv_func_futimesat_works" in
+      *yes) ;;
+      *)
+
+$as_echo "#define FUTIMESAT_NULL_BUG 1" >>confdefs.h
+
+        ;;
+    esac
+  fi
+
   gl_gnulib_enabled_dosname=false
   gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false
   gl_gnulib_enabled_pathmax=false
-  gl_gnulib_enabled_sigprocmask=false
   gl_gnulib_enabled_stat=false
   gl_gnulib_enabled_strtoll=false
   gl_gnulib_enabled_strtoull=false
@@ -21072,52 +24200,6 @@ $as_echo "$gl_cv_next_unistd_h" >&6; }
       gl_gnulib_enabled_pathmax=true
     fi
   }
-  func_gl_gnulib_m4code_sigprocmask ()
-  {
-    if ! $gl_gnulib_enabled_sigprocmask; then
-
-
-
-  if test $gl_cv_type_sigset_t = yes; then
-    ac_fn_c_check_func "$LINENO" "sigprocmask" "ac_cv_func_sigprocmask"
-if test "x$ac_cv_func_sigprocmask" = x""yes; then :
-  gl_cv_func_sigprocmask=1
-fi
-
-  fi
-  if test -z "$gl_cv_func_sigprocmask"; then
-    HAVE_POSIX_SIGNALBLOCKING=0
-  fi
-
-if test $HAVE_POSIX_SIGNALBLOCKING = 0; then
-
-
-
-
-
-
-
-
-  gl_LIBOBJS="$gl_LIBOBJS sigprocmask.$ac_objext"
-
-
-
-
-fi
-
-
-
-
-
-          GNULIB_SIGPROCMASK=1
-
-
-
-
-
-      gl_gnulib_enabled_sigprocmask=true
-    fi
-  }
   func_gl_gnulib_m4code_stat ()
   {
     if ! $gl_gnulib_enabled_stat; then
@@ -21225,7 +24307,7 @@ $as_echo "#define REPLACE_FUNC_STAT_FILE 1" >>confdefs.h
 ;;
   esac
 
-if test $REPLACE_STAT = 1; then
+      if test $REPLACE_STAT = 1; then
 
 
 
@@ -21240,7 +24322,7 @@ if test $REPLACE_STAT = 1; then
 
   :
 
-fi
+      fi
 
 
 
@@ -21287,7 +24369,7 @@ done
     fi
   fi
 
-if test $HAVE_STRTOLL = 0; then
+      if test $HAVE_STRTOLL = 0; then
 
 
 
@@ -21301,7 +24383,7 @@ if test $HAVE_STRTOLL = 0; then
 
   :
 
-fi
+      fi
 
 
 
@@ -21339,7 +24421,7 @@ done
     fi
   fi
 
-if test $HAVE_STRTOULL = 0; then
+      if test $HAVE_STRTOULL = 0; then
 
 
 
@@ -21353,7 +24435,7 @@ if test $HAVE_STRTOULL = 0; then
 
   :
 
-fi
+      fi
 
 
 
@@ -21383,9 +24465,6 @@ fi
   if test $REPLACE_LSTAT = 1; then
     func_gl_gnulib_m4code_stat
   fi
-  if test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1; then
-    func_gl_gnulib_m4code_sigprocmask
-  fi
   if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
     func_gl_gnulib_m4code_stat
   fi
@@ -21426,14 +24505,6 @@ else
   gl_GNULIB_ENABLED_pathmax_FALSE=
 fi
 
-   if $gl_gnulib_enabled_sigprocmask; then
-  gl_GNULIB_ENABLED_sigprocmask_TRUE=
-  gl_GNULIB_ENABLED_sigprocmask_FALSE='#'
-else
-  gl_GNULIB_ENABLED_sigprocmask_TRUE='#'
-  gl_GNULIB_ENABLED_sigprocmask_FALSE=
-fi
-
    if $gl_gnulib_enabled_stat; then
   gl_GNULIB_ENABLED_stat_TRUE=
   gl_GNULIB_ENABLED_stat_FALSE='#'
@@ -21506,6 +24577,8 @@ fi
   LIBGNU_LTLIBDEPS="$gl_ltlibdeps"
 
 
+CFLAGS=$SAVE_CFLAGS
+LIBS=$SAVE_LIBS
 
 case "$opsys" in
   aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
@@ -21639,34 +24712,33 @@ if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then
   esac
 fi
 
-
-## If we're using X11/GNUstep, define some consequences.
-if test "$HAVE_X_WINDOWS" = "yes" || test "$HAVE_NS" = "yes"; then
+## Common for all window systems
+if test "$window_system" != "none"; then
 
 $as_echo "#define HAVE_WINDOW_SYSTEM 1" >>confdefs.h
 
 
 $as_echo "#define HAVE_MOUSE 1" >>confdefs.h
 
+  WINDOW_SYSTEM_OBJ="fontset.o fringe.o image.o"
 fi
 
 
 
 
+
 #### Report on what we decided to do.
 #### Report GTK as a toolkit, even if it doesn't use Xt.
 #### It makes printing result more understandable as using GTK sets
 #### toolkit_scroll_bars to yes by default.
 if test "${HAVE_GTK}" = "yes"; then
-  USE_X_TOOLKIT=GTK
+  USE_X_TOOLKIT="$USE_GTK_TOOLKIT"
 fi
 
 echo "
 Configured for \`${canonical}'.
 
   Where should the build process find the source code?    ${srcdir}
-  What operating system file should Emacs use?
-        \`${opsysfile}'
   What compiler should emacs be built with?               ${CC} ${CFLAGS}
   Should Emacs use the GNU version of malloc?             ${GNU_MALLOC}${GNU_MALLOC_reason}
   Should Emacs use a relocating allocator for buffers?    ${REL_ALLOC}
@@ -21717,11 +24789,6 @@ if test -n "${EMACSDOC}"; then
    echo "  Environment variable EMACSDOC set to:                   $EMACSDOC"
 fi
 
-if test $USE_XASSERTS = yes; then
-   echo "  Compiling with asserts turned on."
-   CPPFLAGS="$CPPFLAGS -DXASSERTS=1"
-fi
-
 echo
 
 if test "$HAVE_NS" = "yes"; then
@@ -21754,9 +24821,19 @@ test "${prefix}" != NONE &&
 test "${exec_prefix}" != NONE &&
   exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`
 
-SUBDIR_MAKEFILES="lib/Makefile lib-src/Makefile oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile leim/Makefile"
+if test "$HAVE_NS" = "yes"; then
+  if test "$NS_IMPL_GNUSTEP" = yes; then
+    ac_config_files="$ac_config_files nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in"
+
+  else
+    ac_config_files="$ac_config_files nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in"
+
+  fi
+fi
 
-ac_config_files="$ac_config_files Makefile lib/Makefile lib-src/Makefile oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile leim/Makefile"
+SUBDIR_MAKEFILES="lib/Makefile lib-src/Makefile oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile leim/Makefile nextstep/Makefile"
+
+ac_config_files="$ac_config_files Makefile lib/Makefile lib-src/Makefile oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile leim/Makefile nextstep/Makefile"
 
 
 opt_makefile=test/automated/Makefile
@@ -21912,6 +24989,10 @@ if test -z "${GL_GENERATE_ALLOCA_H_TRUE}" && test -z "${GL_GENERATE_ALLOCA_H_FAL
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
+if test -z "${GL_GENERATE_EXECINFO_H_TRUE}" && test -z "${GL_GENERATE_EXECINFO_H_FALSE}"; then
+  as_fn_error "conditional \"GL_GENERATE_EXECINFO_H\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${GL_GENERATE_STDINT_H_TRUE}" && test -z "${GL_GENERATE_STDINT_H_FALSE}"; then
   as_fn_error "conditional \"GL_GENERATE_STDINT_H\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -21944,10 +25025,6 @@ if test -z "${gl_GNULIB_ENABLED_pathmax_TRUE}" && test -z "${gl_GNULIB_ENABLED_p
   as_fn_error "conditional \"gl_GNULIB_ENABLED_pathmax\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${gl_GNULIB_ENABLED_sigprocmask_TRUE}" && test -z "${gl_GNULIB_ENABLED_sigprocmask_FALSE}"; then
-  as_fn_error "conditional \"gl_GNULIB_ENABLED_sigprocmask\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${gl_GNULIB_ENABLED_stat_TRUE}" && test -z "${gl_GNULIB_ENABLED_stat_FALSE}"; then
   as_fn_error "conditional \"gl_GNULIB_ENABLED_stat\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -22404,7 +25481,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by emacs $as_me 24.1.50, which was
+This file was extended by emacs $as_me 24.2.50, which was
 generated by GNU Autoconf 2.65.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -22470,7 +25547,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-emacs config.status 24.1.50
+emacs config.status 24.2.50
 configured by $0, generated by GNU Autoconf 2.65,
   with options \\"\$ac_cs_config\\"
 
   case $ac_config_target in
     "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h:src/config.in" ;;
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist") CONFIG_FILES="$CONFIG_FILES nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in" ;;
+    "nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop") CONFIG_FILES="$CONFIG_FILES nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in" ;;
+    "nextstep/Cocoa/Emacs.base/Contents/Info.plist") CONFIG_FILES="$CONFIG_FILES nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in" ;;
+    "nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings") CONFIG_FILES="$CONFIG_FILES nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
     "lib-src/Makefile") CONFIG_FILES="$CONFIG_FILES lib-src/Makefile" ;;
@@ -22608,6 +25689,7 @@ do
     "lwlib/Makefile") CONFIG_FILES="$CONFIG_FILES lwlib/Makefile" ;;
     "lisp/Makefile") CONFIG_FILES="$CONFIG_FILES lisp/Makefile" ;;
     "leim/Makefile") CONFIG_FILES="$CONFIG_FILES leim/Makefile" ;;
+    "nextstep/Makefile") CONFIG_FILES="$CONFIG_FILES nextstep/Makefile" ;;
     "test/automated/Makefile") CONFIG_FILES="$CONFIG_FILES test/automated/Makefile" ;;
     "admin/unidata/Makefile") CONFIG_FILES="$CONFIG_FILES admin/unidata/Makefile" ;;
     "mkdirs") CONFIG_COMMANDS="$CONFIG_COMMANDS mkdirs" ;;
@@ -23338,7 +26420,7 @@ done
  ;;
     "epaths":C)
 echo creating src/epaths.h
-${MAKE-make} epaths-force
+${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force
  ;;
     "gdbinit":C)
 if test ! -f src/.gdbinit && test -f $srcdir/src/.gdbinit; then
@@ -23384,4 +26466,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-