changeset 4994:76af7fc13e81

Automatic merge
author Ben Wing <ben@xemacs.org>
date Sat, 06 Feb 2010 04:27:47 -0600
parents c0934cef10c6 (current diff) ef3b2f38dd7c (diff)
children b46c89ccbed3 44d7bde26046
files lisp/ChangeLog src/ChangeLog
diffstat 9 files changed, 622 insertions(+), 101 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Feb 06 04:26:09 2010 -0600
+++ b/ChangeLog	Sat Feb 06 04:27:47 2010 -0600
@@ -1,3 +1,19 @@
+2010-02-06  Ben Wing  <ben@xemacs.org>
+
+	* configure:
+	* configure.ac (AC_LANG):
+	* configure.ac (TAB):
+	Add AC_LANG(C++) defs in a way very similar to AC_LANG(C), inserting
+	our own flags, compiler, etc.
+
+	When using g++, if we found ndbm, check whether we can compile a
+	file using g++ and ndbm.h, calling some DBM routines.  Currently, this
+	fails because the prototypes in ndbm.h are incomplete, omitting the
+	arguments, which doesn't work with g++.  When ndbm.h is bad, we don't
+	include it and instead provide our own prototypes; otherwise, we
+	define TRUST_NDBM_H_PROTOTYPES, which signals to use the ones in
+	ndbm.h.
+
 2010-01-31  Ben Wing  <ben@xemacs.org>
 
 	* configure.ac (TAB):
--- a/configure	Sat Feb 06 04:26:09 2010 -0600
+++ b/configure	Sat Feb 06 04:27:47 2010 -0600
@@ -712,6 +712,9 @@
 MAKE_SUBDIR
 INSTALL_ARCH_DEP_SUBDIR
 SRC_SUBDIR_DEPS
+ac_ct_CXX
+CXXFLAGS
+CXX
 have_esd_config
 ALLOCA
 canna_libs
@@ -1035,7 +1038,10 @@
 CPP
 YACC
 YFLAGS
-XMKMF'
+XMKMF
+CXX
+CXXFLAGS
+CCC'
 
 
 # Initialize some variables set by options.
@@ -2022,6 +2028,8 @@
               This script will default YFLAGS to the empty string to avoid a
               default value of `-d' given by some make applications.
   XMKMF       Path to xmkmf, Makefile generator for X Window System
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -2830,6 +2838,44 @@
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_compute_int
+
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_compile
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -19751,6 +19797,320 @@
 
   $as_echo "#define HAVE_DBM 1" >>confdefs.h
 
+        if test "$XEMACS_CC_GPP" = "yes"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
+$as_echo "" >&6; }
+    ac_ext=c
+xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
+xe_ldflags='$LDFLAGS $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_x_site $ld_switch_run'
+xe_libs='$ld_call_shared $xe_check_libs $X_EXTRA_LIBS $libs_x $libs_gtk $X_PRE_LIBS $LIBS $libs_machine $libs_system $libs_standard'
+ac_cpp='$CPP '"$xe_cppflags"
+ac_compile='$XEMACS_CC -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext >&5'
+ac_link='$XEMACS_CC -o conftest$ac_exeext $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+    ac_ext=c
+xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
+xe_ldflags='$LDFLAGS $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_x_site $ld_switch_run'
+xe_libs='$ld_call_shared $xe_check_libs $X_EXTRA_LIBS $libs_x $libs_gtk $X_PRE_LIBS $LIBS $libs_machine $libs_system $libs_standard'
+ac_cpp='$CPP '"$xe_cppflags"
+ac_compile='$XEMACS_CC -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext >&5'
+ac_link='$XEMACS_CC -o conftest$ac_exeext $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; 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_prog_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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_prog_CXX="$ac_tool_prefix$ac_prog"
+    $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
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; 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_prog_ac_ct_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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_prog_ac_ct_CXX="$ac_prog"
+    $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
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+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
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=c
+xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
+xe_ldflags='$LDFLAGS $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_x_site $ld_switch_run'
+xe_libs='$ld_call_shared $xe_check_libs $X_EXTRA_LIBS $libs_x $libs_gtk $X_PRE_LIBS $LIBS $libs_machine $libs_system $libs_standard'
+ac_cpp='$CPP '"$xe_cppflags"
+ac_compile='$XEMACS_CC -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext >&5'
+ac_link='$XEMACS_CC -o conftest$ac_exeext $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include "$ndbm_h_file"
+int
+main ()
+{
+dbm_close((DBM *) 0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ndbm.h is compatible with g++" >&5
+$as_echo_n "checking whether ndbm.h is compatible with g++... " >&6; }
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       $as_echo "#define TRUST_NDBM_H_PROTOTYPES 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ndbm.h is compatible with g++" >&5
+$as_echo_n "checking whether ndbm.h is compatible with g++... " >&6; }
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    ac_ext=c
+xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
+xe_ldflags='$LDFLAGS $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_x_site $ld_switch_run'
+xe_libs='$ld_call_shared $xe_check_libs $X_EXTRA_LIBS $libs_x $libs_gtk $X_PRE_LIBS $LIBS $libs_machine $libs_system $libs_standard'
+ac_cpp='$CPP '"$xe_cppflags"
+ac_compile='$CC -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+  else
+    $as_echo "#define TRUST_NDBM_H_PROTOTYPES 1" >>confdefs.h
+
+  fi
   $as_unset ndbm_h_file
 fi
 
--- a/configure.ac	Sat Feb 06 04:26:09 2010 -0600
+++ b/configure.ac	Sat Feb 06 04:27:47 2010 -0600
@@ -15,6 +15,19 @@
 ac_link='$CC -o conftest$ac_exeext $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' >&AS_MESSAGE_LOG_FD'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 ])
+# AC_LANG(C++)
+# ----------
+# Similar to AC_LANG(C) but we use XEMACS_CC, which may be g++.
+m4_define([AC_LANG(C++)],
+[ac_ext=c
+xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
+xe_ldflags='$LDFLAGS $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_x_site $ld_switch_run'
+xe_libs='$ld_call_shared $xe_check_libs $X_EXTRA_LIBS $libs_x $libs_gtk $X_PRE_LIBS $LIBS $libs_machine $libs_system $libs_standard'
+ac_cpp='$CPP '"$xe_cppflags"
+ac_compile='$XEMACS_CC -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
+ac_link='$XEMACS_CC -o conftest$ac_exeext $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' >&AS_MESSAGE_LOG_FD'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+])
 dnl
 dnl -------------------------------------------------------------------------
 dnl Autoconf startup.
@@ -5082,6 +5095,23 @@
         "$with_database_dbm"  = "yes"; then
   AC_DEFINE_UNQUOTED(NDBM_H_FILE,"$ndbm_h_file")
   AC_DEFINE(HAVE_DBM)
+  dnl gdbm's ndbm.h has old-style prototypes with missing arguments.
+  dnl These just don't cut it for c++.  So if we're using c++, then
+  dnl test whether we can make a dbm call, using dbm_close(DBM *).
+  if test "$XEMACS_CC_GPP" = "yes"; then
+    AC_MSG_RESULT()
+    AC_LANG_PUSH(C++)
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "$ndbm_h_file"],
+    [dbm_close((DBM *) 0);])],
+      [AC_MSG_CHECKING(whether ndbm.h is compatible with g++)
+       AC_MSG_RESULT(yes)
+       AC_DEFINE(TRUST_NDBM_H_PROTOTYPES)],
+      [AC_MSG_CHECKING(whether ndbm.h is compatible with g++)
+       AC_MSG_RESULT(no)])
+    AC_LANG_POP()
+  else
+    AC_DEFINE(TRUST_NDBM_H_PROTOTYPES)
+  fi
   $as_unset ndbm_h_file
 fi
 
--- a/lisp/ChangeLog	Sat Feb 06 04:26:09 2010 -0600
+++ b/lisp/ChangeLog	Sat Feb 06 04:27:47 2010 -0600
@@ -4,6 +4,53 @@
 	* unicode.el (for):
 	Convert file to utf-8.
 
+2010-02-06  Ben Wing  <ben@xemacs.org>
+
+	* code-init.el:
+	* code-init.el (set-eol-detection):
+	* code-init.el (coding-system-current-system-configuration):
+	* code-init.el (coding-system-default-configuration-table): New.
+	* code-init.el (no-mule-no-eol-detection):
+	* code-init.el (define-coding-system-default-configuration): New.
+	* code-init.el (coding-system-variable-default-value-table): Removed.
+	* code-init.el (no-mule-eol-detection):
+	* code-init.el (coding-system-default-configuration-list): Removed.
+	* code-init.el (coding-system-default-variable-list):
+	* code-init.el (get-coding-system-variable):
+	* code-init.el (set-coding-system-variable):
+	* code-init.el (coding-system-variable-default-value):
+	* code-init.el (reset-coding-categories-to-default):
+	Significant clean-up, add Cygwin-UTF-8 support.
+
+	1. Shorten the names of the coding system variables to follow
+	   what used to be considered the "abbreviations":
+
+	   default-process-coding-system-read	->	process-read
+	   default-process-coding-system-write	->	process-write
+	   buffer-file-coding-system-for-read	->	bfcs-for-read
+	   default-buffer-file-coding-system	->	default-bfcs
+	   no-conversion-coding-system-mapping	->	no-conv-cs
+
+	2. Instead of listing all the defaults in a big, strangely organized
+	   table, use a new function
+	   `define-coding-system-default-configuration' to define a
+	   particular configuration.  This uses a hash table stored in
+	   `coding-system-default-configuration-table'.  Rewrite
+	   `coding-system-variable-default-value' appropriately.
+
+	3. Rename configurations to eliminate `unix' from the name:
+
+	   unix-no-mule-no-eol-detection      ->     no-mule-no-eol-detection
+	   unix-no-mule-eol-detection	      ->     no-mule-eol-detection
+	   unix-mule			      ->     mule
+
+	   This is because these are really for all systems but Windows,
+	   not just Unix.
+
+	4. Add configuration `cygwin-utf-8', enabled when (featurep
+	   'cygwin-use-utf-8).  Uses `utf-8' for all defaults except for
+	   `bfcs-for-read', which is `undecided'.
+
 2010-01-28  Ben Wing  <ben@xemacs.org>
 
 	* lisp-mode.el: Finish documenting `lisp-indent-specform',
--- a/lisp/code-init.el	Sat Feb 06 04:26:09 2010 -0600
+++ b/lisp/code-init.el	Sat Feb 06 04:27:47 2010 -0600
@@ -1,6 +1,6 @@
 ;;; code-init.el --- Handle coding system default values
 
-;; Copyright (C) 2001, 2002, 2003 Ben Wing.
+;; Copyright (C) 2001, 2002, 2003, 2010 Ben Wing.
 
 ;; This file is part of XEmacs.
 
@@ -21,6 +21,8 @@
 
 ;;; Commentary:
 
+;; Author: Ben wing, 2001?
+
 ;; Placed in a separate file so it can be loaded after the various
 ;; coding systems have been created, because we'll be using them at
 ;; load time.
@@ -60,62 +62,112 @@
 default, but this may change.  NOTE: You *REALLY* should not turn off EOL
 detection on Windows!  Your files will have lots of annoying ^M's in them
 if you do this."
-  (dolist (x '(buffer-file-coding-system-for-read
+  (dolist (x '(bfcs-for-read
 	       keyboard
-	       default-process-coding-system-read
-	       no-conversion-coding-system-mapping))
+	       process-read
+	       no-conv-cs))
     (set-coding-system-variable
      x (coding-system-change-eol-conversion (get-coding-system-variable x)
 					    (if flag nil 'lf)))))
 
 (defun coding-system-current-system-configuration ()
-  (cond ((memq system-type '(windows-nt cygwin32))
+  "Function to decide which default coding system configuration applies."
+  (cond ((featurep 'cygwin-use-utf-8) 'cygwin-utf-8)
+	((memq system-type '(windows-nt cygwin32))
 	 (if (featurep 'mule) 'windows-mule 'windows-no-mule))
-	((featurep 'mule) 'unix-mule)
-	(eol-detection-enabled-p 'unix-no-mule-eol-detection)
-	(t 'unix-no-mule-no-eol-detection)))
+	((featurep 'mule) 'mule)
+	(eol-detection-enabled-p 'no-mule-eol-detection)
+	(t 'no-mule-no-eol-detection)))
+
+(defvar coding-system-default-configuration-table (make-hash-table))
+
+(defun define-coding-system-default-configuration (name doc props)
+  (puthash name (nconc `(doc ,doc) props)
+	   coding-system-default-configuration-table))
 
 ;; NOTE NOTE NOTE: These values may get overridden when the language
 ;; environment is initialized (set-language-environment-coding-systems).
-(defvar coding-system-variable-default-value-table
-  '((buffer-file-coding-system-for-read
-     binary raw-text undecided raw-text undecided)
-    (default-buffer-file-coding-system
-      ;; #### iso-2022-8 with no eol specified?  can that be OK?
-      binary binary iso-2022-8 raw-text-dos mswindows-multibyte-dos)
-    (native
-     binary binary binary raw-text-dos mswindows-multibyte-system-default-dos)
-    (keyboard
-     binary raw-text undecided-unix raw-text undecided-unix)
-    ;; the `terminal' coding system is used for output to stderr.  such
-    ;; streams do automatic lf->crlf encoding in the C library, so we need
-    ;; to not do the same translations ourselves.
-    (terminal
-     binary binary binary binary mswindows-multibyte-unix)
-    (default-process-coding-system-read
-      binary raw-text undecided raw-text undecided)
-    (default-process-coding-system-write
-      binary binary binary raw-text mswindows-multibyte-system-default)
-    (no-conversion-coding-system-mapping
-     binary raw-text raw-text raw-text mswindows-multibyte)
-    ))
+(define-coding-system-default-configuration
+  'no-mule-no-eol-detection
+  "No Mule support, EOL detection not enabled."
+  '(bfcs-for-read	binary
+    default-bfcs	binary
+    process-read	binary
+    process-write	binary
+    keyboard		binary
+    native		binary
+    no-conv-cs		binary
+    terminal		binary))
+
+(define-coding-system-default-configuration
+  'no-mule-eol-detection
+  "No Mule support, EOL detection enabled."
+  '(bfcs-for-read	raw-text
+    default-bfcs	binary
+    process-read	raw-text
+    process-write	binary
+    keyboard		raw-text
+    native		binary
+    no-conv-cs		raw-text
+    terminal		binary))
+
+(define-coding-system-default-configuration
+  'mule
+  "Mule support enabled."
+  '(bfcs-for-read	undecided
+    default-bfcs	iso-2022-8
+    process-read	undecided
+    process-write	binary
+    keyboard		undecided-unix
+    native		binary
+    no-conv-cs		raw-text
+    terminal		binary))
 
-(defvar coding-system-default-configuration-list
-  '(unix-no-mule-no-eol-detection
-    unix-no-mule-eol-detection
-    unix-mule
-    windows-no-mule
-    windows-mule))
+(define-coding-system-default-configuration
+  'windows-no-mule
+  "Microsoft Windows, no Mule support."
+  '(bfcs-for-read	raw-text
+    default-bfcs	raw-text-dos
+    process-read	raw-text
+    process-write	raw-text
+    keyboard		raw-text
+    native		raw-text-dos
+    no-conv-cs		raw-text
+    terminal		binary))
+
+(define-coding-system-default-configuration
+  'windows-mule
+  "Microsoft Windows, Mule support enabled."
+  '(bfcs-for-read	undecided
+    default-bfcs	mswindows-multibyte-dos
+    process-read	undecided
+    process-write	mswindows-multibyte-system-default
+    keyboard		undecided-unix
+    native		mswindows-multibyte-system-default-dos
+    no-conv-cs		mswindows-multibyte
+    terminal		mswindows-multibyte-unix))
+
+(define-coding-system-default-configuration
+  'cygwin-utf-8
+  "Mule support enabled."
+  '(bfcs-for-read	undecided
+    default-bfcs	utf-8
+    process-read	utf-8
+    process-write	utf-8
+    keyboard		utf-8
+    native		utf-8
+    no-conv-cs		utf-8
+    terminal		utf-8))
 
 (defvar coding-system-default-variable-list
-  '(buffer-file-coding-system-for-read
-    default-buffer-file-coding-system
+  '(bfcs-for-read
+    default-bfcs
     native
     keyboard
     terminal
-    default-process-coding-system-read
-    default-process-coding-system-write
-    no-conversion-coding-system-mapping))
+    process-read
+    process-write
+    no-conv-cs))
 
 (defun get-coding-system-variable (var)
   "Return the value of a basic coding system variable.
@@ -124,15 +176,15 @@
 `coding-system-variable-default-value' for a list of the possible values of
 VAR."
   (case var
-    (buffer-file-coding-system-for-read buffer-file-coding-system-for-read)
-    (default-buffer-file-coding-system
+    (bfcs-for-read buffer-file-coding-system-for-read)
+    (default-bfcs
       (default-value 'buffer-file-coding-system))
     (native (coding-system-aliasee 'native))
     (keyboard (coding-system-aliasee 'keyboard))
     (terminal (coding-system-aliasee 'terminal))
-    (default-process-coding-system-read (car default-process-coding-system))
-    (default-process-coding-system-write (cdr default-process-coding-system))
-    (no-conversion-coding-system-mapping
+    (process-read (car default-process-coding-system))
+    (process-write (cdr default-process-coding-system))
+    (no-conv-cs
      (coding-category-system 'no-conversion))
     (t (error 'invalid-constant "Invalid coding system variable" var))))
 
@@ -143,20 +195,20 @@
 `coding-system-variable-default-value' for a list of the possible values of
 VAR."
   (case var
-    (buffer-file-coding-system-for-read
+    (bfcs-for-read
      (set-buffer-file-coding-system-for-read value))
-    (default-buffer-file-coding-system
+    (default-bfcs
       (set-default-buffer-file-coding-system value))
     (native (define-coding-system-alias 'native value))
     (keyboard (set-keyboard-coding-system value))
     (terminal (set-terminal-coding-system value))
-    (default-process-coding-system-read
+    (process-read
       (setq default-process-coding-system
 	    (cons value (cdr default-process-coding-system))))
-    (default-process-coding-system-write
+    (process-write
       (setq default-process-coding-system
 	    (cons (car default-process-coding-system) value)))
-    (no-conversion-coding-system-mapping
+    (no-conv-cs
      (set-coding-category-system 'no-conversion value))
     (t (error 'invalid-constant "Invalid coding system variable" var))))
 
@@ -170,28 +222,29 @@
 The table of default values looks like this: (see below for abbreviations)
 
 
-               Unix    Unix+EOL  Unix+Mule       MSW           MSW+Mule
------------------------------------------------------------------------------
-bfcs-for-read  binary  raw-text  undecided       raw-text      undecided
-default bfcs   binary  binary    iso-2022-8      raw-text-dos  MSW-MB-dos
-native         binary  binary    binary          raw-text-dos  MSW-MB-SD-dos
-keyboard       binary  raw-text  undecided-unix  raw-text      undecided-unix
-terminal       binary  binary    binary          binary        MSW-MB-unix
-process-read   binary  raw-text  undecided       raw-text      undecided
-process-write  binary  binary    binary          raw-text      MSW-MB-SD
-no-conv-cs     binary  raw-text  raw-text        raw-text      MSW-MB
+              NoMule NoMuleEOL Mule       MSW          MSWMule       CygUTF 
+------------------------------------------------------------------------------
+bfcs-for-read binary raw-text undecided   raw-text     undecided     undecided
+default-bfcs  binary binary   iso-2022-8  raw-text-dos MSW-MB-dos    utf-8
+native        binary binary   binary      raw-text-dos MSW-MB-SD-dos utf-8
+keyboard      binary raw-text undecided-  raw-text     undecided-    utf-8
+                                unix                     unix
+terminal      binary binary   binary      binary       MSW-MB-unix   utf-8
+process-read  binary raw-text undecided   raw-text     undecided     utf-8
+process-write binary binary   binary      raw-text     MSW-MB-SD     utf-8
+no-conv-cs    binary raw-text raw-text    raw-text     MSW-MB        utf-8
 
 
-VAR can be one of: (abbreviations in parens)
+VAR can be one of:
 
-`buffer-file-coding-system-for-read' (bfcs-for-read)
+`bfcs-for-read'
 
   Lisp variable of the same name; the default coding system used when
   reading in a file, in the absence of more specific settings. (See
   `insert-file-contents' for a description of exactly how a file's
   coding system is determined when it's read in.)
 
-`default-buffer-file-coding-system' (default bfcs)
+`default-bfcs'
 
   Default value of `buffer-file-coding-system', the buffer-local
   variable specifying a file's coding system to be used when it is
@@ -201,58 +254,61 @@
   system used to read the file in; the default value applies to newly
   created files.
 
-`native' (native)
+`native'
 
   The coding system named `native'.  Changed using
   `define-coding-system-alias'.  Used internally when passing
   text to or from system API's, unless the particular
   API specifies another coding system.
 
-`keyboard' (keyboard)
+`keyboard'
 
  #### fill in
 
-`terminal' (terminal)
+`terminal'
 
  #### fill in
 
-`default-process-coding-system-read' (process-read)
+`process-read'
 
  #### fill in
 
-`default-process-coding-system-write' (process-write)
+`process-write'
 
  #### fill in
 
-`no-conversion-coding-system-mapping' (no-conv-cs)
+`no-conv-cs'
 
   Coding system used when category `no-conversion' is detected.
 
 
 CONFIG is one of: (abbreviations in parens)
 
-`unix-no-mule-no-eol-detection' (Unix)
+`no-mule-no-eol-detection' (NoMule)
 
-Unix, no Mule support, no automatic EOL detection. (Controlled by
+Non-Windows, no Mule support, no automatic EOL detection. (Controlled by
 `eol-detection-enabled-p', which is set by the command-line flag
 -enable-eol-detection or the configure flag --with-default-eol-detection.)
 
-`unix-no-mule-eol-detection' (Unix+EOL)
+`unix-no-mule-eol-detection' (NoMuleEOL)
 
-Unix, no Mule support, automatic EOL detection.
+Non-Windows, no Mule support, automatic EOL detection.
 
-`unix-mule' (Unix+Mule)
+`unix-mule' (Mule)
 
-Unix, Mule support.
+Non-Windows, Mule support.
 
 `windows-no-mule' (MSW)
 
-MS Windows or Cygwin, no Mule support.
+MS Windows or old Cygwin, no Mule support.
+
+`windows-mule' (MSWMule)
 
-`windows-mule'. (MSW+Mule)
+MS Windows or old Cygwin, Mule support.
 
-MS Windows or Cygwin, Mule support.
+`cygwin-utf-8' (CygUTF)
 
+Cygwin 1.7 or later, which uses UTF-8 consistently.
 
 The following coding system abbreviations are also used in the table:
 
@@ -260,12 +316,12 @@
 MSW-MB = mswindows-multibyte-system-default
 "
   (setq config (or config (coding-system-current-system-configuration)))
-  (let ((defs (cdr (assq var coding-system-variable-default-value-table))))
-    (or defs (error 'invalid-constant "Invalid coding system variable" var))
-    (let ((pos (position config coding-system-default-configuration-list)))
-      (or pos (error 'invalid-constant "Invalid coding system configuration"
+  (or (memq var coding-system-default-variable-list)
+      (error 'invalid-constant "Invalid coding system variable" var))
+  (let ((props (gethash config coding-system-default-configuration-table)))
+    (or props (error 'invalid-constant "Invalid coding system configuration"
 		     config))
-      (nth pos defs))))
+    (getf props var)))
 
 (defun reset-coding-system-defaults (&optional config)
   "Reset all basic coding system variables are set to their default values.
@@ -332,7 +388,7 @@
     )
   (set-coding-category-system
    'no-conversion
-   (coding-system-variable-default-value 'no-conversion-coding-system-mapping))
+   (coding-system-variable-default-value 'no-conv-cs))
   (set-coding-category-system 'ucs-4 'ucs-4)
   (set-coding-category-system 'utf-8 'utf-8)
   (set-coding-category-system 'utf-8-bom 'utf-8-bom)
--- a/src/ChangeLog	Sat Feb 06 04:26:09 2010 -0600
+++ b/src/ChangeLog	Sat Feb 06 04:27:47 2010 -0600
@@ -3,6 +3,16 @@
 	* mule-wnnfns.c:
 	Convert file to utf-8.
 
+2010-02-06  Ben Wing  <ben@xemacs.org>
+
+	* config.h.in: Add undef for TRUST_NDBM_H_PROTOTYPES.
+	* database.c:
+	* database.c (struct):
+	Use TRUST_NDBM_H_PROTOTYPES to determine whether to include ndbm.h
+	or to specify our own prototypes, in place of CYGWIN_HEADERS (or
+	more generally, any random list of systems).
+	* depend: Regenerate.
+
 2010-02-05  Ben Wing  <ben@xemacs.org>
 
 	* syswindows.h (LOCAL_FILE_FORMAT_TO_TSTR):
--- a/src/config.h.in	Sat Feb 06 04:26:09 2010 -0600
+++ b/src/config.h.in	Sat Feb 06 04:27:47 2010 -0600
@@ -1,6 +1,6 @@
 /* XEmacs site configuration template file.  -*- C -*-
    Copyright (C) 1986, 1991-1994, 1998, 1999 Free Software Foundation, Inc.
-   Copyright (C) 2000, 2001, 2002, 2004, 2005 Ben Wing.
+   Copyright (C) 2000, 2001, 2002, 2004, 2005, 2010 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -534,6 +534,8 @@
 #undef HAVE_DBM
 /* Full #include file path for GDBM's or platforms ndbm.h */
 #undef NDBM_H_FILE
+/* Can we trust the prototypes in ndbm.h?  If not, we need to declare our own */
+#undef TRUST_NDBM_H_PROTOTYPES
 
 /* Define to 1 if the system has the type `u_int8_t'. */
 #undef HAVE_U_INT8_T
--- a/src/database.c	Sat Feb 06 04:26:09 2010 -0600
+++ b/src/database.c	Sat Feb 06 04:27:47 2010 -0600
@@ -85,26 +85,28 @@
 #endif /* HAVE_BERKELEY_DB */
 
 #ifdef HAVE_DBM
-#ifdef CYGWIN_HEADERS
+# ifdef TRUST_NDBM_H_PROTOTYPES
+#  include NDBM_H_FILE
+# else /* not TRUST_NDBM_H_PROTOTYPES */
+
+/* The prototypes in gdbm/ndbm.h currently are broken when compiling
+using C++, since they are of the form `datum dbm_firstkey()', without any
+args given. */
 
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {
 #endif
 
-/* As of Cygwin 1.7.0, the prototypes in ndbm.h are broken when compiling
-using C++, since they are of the form `datum dbm_firstkey()', without any
-args given. */
 /* Parameters to dbm_store for simple insertion or replacement. */
 #define  DBM_INSERT  0
 #define  DBM_REPLACE 1
 
-
 /* The data and key structure.  This structure is defined for compatibility. */
-typedef struct {
-        char *dptr;
-        int   dsize;
-      } datum;
-
+typedef struct
+{
+  char *dptr;
+  int   dsize;
+} datum;
 
 /* The file information header. This is good enough for most applications. */
 typedef struct {int dummy[10];} DBM;
@@ -123,9 +125,7 @@
 }
 #endif
 
-#else
-#include NDBM_H_FILE
-#endif
+# endif /* (not) TRUST_NDBM_H_PROTOTYPES */
 Lisp_Object Qdbm;
 #endif /* HAVE_DBM */
 
--- a/src/depend	Sat Feb 06 04:26:09 2010 -0600
+++ b/src/depend	Sat Feb 06 04:27:47 2010 -0600
@@ -154,7 +154,7 @@
 floatfns.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h sysfloat.h syssignal.h text.h vdb.h
 fns.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h compiler.h console.h device.h dumper.h events.h extents.h frame.h gc.h general-slots.h insdel.h intl-auto-encap-win32.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h process.h redisplay.h symeval.h symsinit.h sysfile.h sysproc.h syssignal.h systime.h syswindows.h text.h vdb.h
 font-lock.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h dumper.h gc.h general-slots.h insdel.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h syntax.h text.h vdb.h
-font-mgr.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h font-mgr.h gc.h general-slots.h hash.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-impl.h objects-x-impl.h objects-x.h objects.h specifier.h symeval.h symsinit.h text.h vdb.h xintrinsic.h
+font-mgr.o: $(CONFIG_H) $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h compiler.h conslots.h console-impl.h console-x-impl.h console-x.h console.h device-impl.h device.h devslots.h dumper.h font-mgr.h gc.h general-slots.h hash.h intl-auto-encap-win32.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h objects-impl.h objects-x-impl.h objects-x.h objects.h specifier.h symeval.h symsinit.h sysfile.h syswindows.h text.h vdb.h xintrinsic.h
 frame.o: $(CONFIG_H) $(LISP_H) buffer.h bufslots.h casetab.h charset.h chartab.h compiler.h conslots.h console-impl.h console.h device-impl.h device.h devslots.h dumper.h events.h extents.h faces.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h gui.h gutter.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h menubar.h number-gmp.h number-mp.h number.h process.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h systime.h text.h toolbar.h vdb.h window-impl.h window.h winslots.h
 free-hook.o: $(CONFIG_H) $(LISP_H) compiler.h dumper.h gc.h general-slots.h hash.h lisp-disunion.h lisp-union.h lisp.h lrecord.h mc-alloc.h number-gmp.h number-mp.h number.h symeval.h symsinit.h text.h vdb.h
 gc.o: $(CONFIG_H) $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h casetab.h charset.h chartab.h coding-system-slots.h compiler.h conslots.h console-impl.h console-stream.h console.h device.h dumper.h elhash.h events.h extents-impl.h extents.h file-coding.h frame-impl.h frame.h frameslots.h gc.h general-slots.h glyphs.h intl-auto-encap-win32.h keymap-buttons.h lisp-disunion.h lisp-union.h lisp.h lrecord.h lstream.h mc-alloc.h number-gmp.h number-mp.h number.h opaque.h process.h profile.h redisplay.h scrollbar.h specifier.h symeval.h symsinit.h sysdep.h sysfile.h systime.h syswindows.h text.h vdb.h window-impl.h window.h winslots.h