configure.ac (canonical, C_SWITCH_SYSTEM): Support a 64-bit
MinGW64 build on MS-Windows.
nt/inc/ms-w32.h (sys_kill): Fix prototype.
src/w32term.c (w32_initialize): Use LCID and LOWORD.
src/w32proc.c (create_child): Use pid_t for 5th argument.
(IsValidLocale): Don't provide prototype for MinGW64.
(Fw32_get_valid_keyboard_layouts, Fw32_get_keyboard_layout)
(Fw32_set_keyboard_layout): Use HKL and HIWORD/LOWORD.
src/w32heap.c (allocate_heap) [_WIN64]: Use "ull", not "i64", which
MinGW64 doesn't support.
src/lisp.h (EMACS_INT) [_WIN64]: Define for the MinGW64 build.
nt/emacs-x64.manifest:
nt/emacs-x86.manifest: Declare that we target Windows 8.1 as well
as earlier versions. This is so GetVersion and GetVersionEx APIs
used for bug reporting and other purposes return accurate version
number on Windows 8.1. See the discussion on MSDN
http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx
for more details.
src/w32.c (get_file_security, set_file_security)
(create_symbolic_link): Separate pointers and boolean flags for
ANSI and Unicode APIs. Use the latter if w32_unicode_filenames is
non-zero, else the former.
(codepage_for_filenames, filename_to_utf16, )
(filename_from_utf16, filename_to_ansi, filename_from_ansi): New
functions.
(init_user_info): Allow $HOME and $SHELL to include non-ANSI
characters.
(normalize_filename): Lose the DBCS code, now works on UTF-8.
Accept only one argument; all callers changed.
(dostounix_filename): Remove the second argument, now works in
UTF-8. All callers changed.
(parse_root): Lose DBCS code.
(get_long_basename, w32_get_short_filename, init_environment)
(GetCachedVolumeInformation, sys_readdir, open_unc_volume)
(read_unc_volume, logon_network_drive, faccessat, sys_chdir)
(sys_chmod, sys_creat, sys_fopen, sys_link, sys_mkdir, sys_open)
(sys_rename_replace, sys_rmdir, sys_unlink, stat_worker, utime)
(is_symlink, readlink, chase_symlinks, w32_delayed_load): Work in
Unicode mode if w32_unicode_filenames is non-zero, in ANSI mode
otherwise.
(ansi_encode_filename): New function.
(get_emacs_configuration, get_emacs_configuration_options):
Functions deleted.
(add_volume_info, GetCachedVolumeInformation): Run the input file
name through unixtodos_filename, to ensure it is stored and
referenced in canonical form.
(get_volume_info): Lose the DBCS code, now works in UTF-8.
(logon_network_drive, sys_link, utime): Improve error handling.
(sys_access): New function.
(hashval, generate_inode_val): Unused functions deleted.
(symlink, readlink, readlinkat): Lose DBCS code, now works in UTF-8.
(check_windows_init_file): Convert error message from UTF-8 to
ANSI codepage, for display in the message box.
(globals_of_w32): Set w32_unicode_filenames according to the OS
version.
src/w32term.c (construct_drag_n_drop): Work in Unicode mode when
w32_unicode_filenames is non-zero, ANSI mode otherwise.
(syms_of_w32term): Declare w32-unicode-filenames.
src/w32proc.c (new_child, delete_child): Remove code that handled
unused pending_deletion and input_file members of the child struct.
(create_child, sys_spawnve): Convert all file names to ANSI
codepage. Use ANSI APIs explicitly; forcibly fail if any file
name cannot be encoded in ANSI codepage. Don't use
unixtodos_filename, mirror slashes by hand.
(record_infile, record_pending_deletion): Functions deleted.
(Fw32_short_file_name): Call w32_get_short_filename instead of
GetShortPathName.
src/w32notify.c (add_watch): Work in Unicode mode when
w32_unicode_filenames is non-zero, ANSI mode otherwise.
(Fw32notify_add_watch): Rewrite to avoid using GetFullPathName;
instead, do the same with Lisp primitives.
src/w32fns.c (file_dialog_callback, Fx_file_dialog)
(Fsystem_move_file_to_trash, Fw32_shell_execute)
(Ffile_system_info, Fdefault_printer_name): Work in Unicode mode
when w32_unicode_filenames is non-zero, ANSI mode otherwise.
(Fw32_shell_execute): Improve error reporting.
(Fdefault_printer_name): Ifdef away for Cygwin.
src/w32.h (struct _child_process): Remove input_file and
pending_deletion members that are no longer used.
(dostounix_filename, w32_get_short_filename, filename_from_ansi)
(filename_to_ansi, filename_from_utf16, filename_to_utf16)
(ansi_encode_filename): New and updated prototypes.
src/unexw32.c (open_input_file, open_output_file, unexec): Use ANSI
APIs explicitly.
(unexec): Don't use dostounix_filename, it expects a file name in
UTF-8. Instead, mirror backslashes by hand. Convert NEW_NAME to
ANSI encoding.
src/fileio.c (Ffile_name_directory, file_name_as_directory)
(directory_file_name, Fexpand_file_name)
(Fsubstitute_in_file_name) [WINDOWSNT]: Adapt to the change in
arguments of dostounix_filename.
(Fexpand_file_name) [WINDOWSNT]: Convert value of $HOME to UTF-8.
use MAX_UTF8_PATH for size of file-name strings.
(emacs_readlinkat): Build an explicitly unibyte string for file
names.
(syms_of_fileio) <file-name-coding-system>
default-file-name-coding-system>: Mention MS-Windows peculiarities.
src/emacs.c (init_cmdargs) [WINDOWSNT]: Convert argv[0] to UTF-8.
(main) [WINDOWSNT]: Convert the argv[] elements that are files or
directories to UTF-8.
(decode_env_path) [WINDOWSNT]: Convert file names taken from the
environment, and each element of the input PATH, to UTF-8.
src/dired.c (file_attributes): Use build_unibyte_string explicitly
to make Lisp strings from user and group names.
src/coding.h (ENCODE_FILE, DECODE_FILE): Just call encode_file and
decode_file.
src/coding.c (decode_file_name, encode_file_name): New functions.
src/termcap.c (tgetent): Adapt to the change in arguments of
dostounix_filename.
src/sysdep.c (sys_subshell) [WINDOWSNT]: Use MAX_UTF8_PATH for file
names.
src/msdos.c (dostounix_filename, init_environment): Adapt to the
change in arguments of dostounix_filename.
src/image.c (xpm_load, tiff_load, gif_load, imagemagick_load)
[WINDOWSNT]: Encode file names passed to the image libraries in
ANSI codepage.
src/gnutls.c (Fgnutls_boot): Encode all file names passed to GnuTLS.
[WINDOWSNT]: Convert file names to the current ANSI codepage.
src/filelock.c (lock_file) [WINDOWSNT]: Adapt to the change in
arguments of dostounix_filename.
nt/inc/ms-w32.h (MAX_UTF8_PATH): New macro.
(opendir, closedir, readdir, seekdir): Redirect to replacement
functions.
nt/inc/dirent.h: Make d_name[] be MAXNAMELEN*4 characters long.
lisp/term/w32-win.el (w32-handle-dropped-file):
lisp/startup.el (normal-top-level):
lisp/net/browse-url.el (browse-url-file-url):
lisp/dnd.el (dnd-get-local-file-name): On MS-Windows, encode and
decode file names using 'utf-8' rather than
file-name-coding-system.
doc/emacs/mule.texi (File Name Coding): Document file-name encoding
peculiarities on MS-Windows.
doc/lispref/nonascii.texi (Encoding and I/O): Document file-name encoding
peculiarities on MS-Windows.
etc/NEWS: Mention support on MS-Windows of file names outside of the
current locale.
Fixes: debbugs:7100
This allows us to reuse much of the lisp build and installation machinery,
rather than duplicating it.
* Makefile.in (abs_builddir, leimdir): Remove.
(buildlisppath, SUBDIR, COPYDIR, COPYDESTS): No more leim directory.
(epaths-force-w32): No longer set BLD.
(leim): Remove.
(install-arch-indep): No longer run or install leim.
(mostlyclean, clean): No longer run leim rule.
(bootstrap-clean): Change leim target.
(maintainer-clean): Add leim.
(check-declare): Remove leim.
* README: Update for leim changes.
* configure.ac (leimdir): Remove.
(standardlisppath): No more leimdir.
* make-dist: Update for files from leim/ now being in lisp/leim/.
* doc/lispref/loading.texi (Library Search):
* doc/lispref/os.texi (Startup Summary): No more leim directory.
* leim/Makefile.in (leimdir): New variable.
(TIT_GB, TIT_BIG5, MISC, changed.tit, changed.misc)
(${leimdir}/leim-list.el, ${leimdir}/ja-dic/ja-dic.el):
Generate in $leimdir.
(all): Remove compilation, add ja-dic.
(leim-list.el): Now PHONY.
(setwins, compile-targets, compile-main, clean, mostlyclean)
(extraclean): Remove.
(bootstrap-clean): Delete all generated files.
* leim/README: Update for moved leim/ directory.
* leim/leim-ext.el (ucs-input-activate, hangul-input-method-activate):
Remove manual autoloads; now in loaddefs.el.
Disable byte-compile, version-control, autoloads in the output.
* lisp/Makefile.in (setwins_for_subdirs): Skip leim/ directory.
(compile-main): Depend on lisp/leim rule.
(leim): New rule.
* lisp/loadup.el: Move leim-list.el to leim/ subdirectory.
* lisp/startup.el (normal-top-level): No more leim directory.
* lisp/international/ja-dic-cnv.el (skkdic-convert):
Disable version-control and autoloads in output files.
* lisp/international/titdic-cnv.el (titdic-convert, miscdic-convert):
Disable version-control and autoloads in output files.
* lisp/leim/quail: Move here from ../leim.
* lisp/leim/quail/hangul.el (hangul-input-method-activate):
Add autoload cookie.
(generated-autoload-load-name): Set file-local value.
* lisp/leim/quail/uni-input.el (ucs-input-activate): Add autoload cookie.
(generated-autoload-load-name): Set file-local value.
* nt/README.W32:
* nt/addpm.c (env_vars):
* nt/epaths.nt (PATH_LOADSEARCH, PATH_DUMPLOADSEARCH):
* nt/paths.h (PATH_LOADSEARCH): No more leim directory.
* src/Makefile.in (leimdir): Now in lisp source directory.
($(leimdir)/leim-list.el): Just use ../leim .
* src/epaths.in (PATH_DUMPLOADSEARCH):
* src/lread.c (load_path_default):
* src/nsterm.m (ns_load_path): No more leim directory.
* .bzrignore: Update for relocated leim files.
Ref: http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00806.html
* autogen: Remove directory. Move update_autogen to admin/.
* autogen.sh: Remove reference to copy_autogen.
* GNUmakefile (configure):
* Makefile.in (bootstrap): Do not try to run copy_autogen.
* config.bat: Use msdos/autogen rather than autogen.
* admin/update_autogen: Move here from ../autogen.
(usage): Update. Remove -l, add -A.
(autogendir): New variable.
(ldefs_flag): Default to set.
(genfiles): Reduce to only ms-dos relevant files.
(main): Make checking autogen sources optional.
Make copying of autogen files optional.
* msdos/autogen/config.in:
* msdos/autogen/Makefile.in: Move here from ../autogen.
* nt/INSTALL: Remove reference to copy_autogen.
* nt/config.nt: Comment.
nt/inc/mingw_time.h: New file.
nt/inc/ms-w32.h: Include mingw_time.h instead of doing its job.
src/w32proc.c: Include mingw_time.h.
src/w32.c: Include mingw_time.h.
nt/inc/dirent.h (struct dirent) [__MINGW_MAJOR_VERSION >= 4]: Make
the layout of 'struct dirent' be compatible with MinGW32 runtime
versions 4.0 and later.
nt/inc/ms-w32.h (__MINGW_MAJOR_VERSION, __MINGW_MINOR_VERSION)
(__MINGW_PATCHLEVEL) [!__MINGW64_VERSION_MAJOR]: Define, if not
defined, but not for MinGW64.
(_USE_32BIT_TIME_T) [__MINGW64_VERSION_MAJOR]: Define, to force
use of 32-bit time_t type.
Do this by using the Gnulib modules for this.
This should generate faster code on non-GCC, non-MSC platforms,
and make the code a bit more portable, at least in theory.
* admin/merge-gnulib (GNULIB_MODULES): Add count-one-bits
and count-trailing-zeros.
* lib/count-one-bits.c, lib/count-one-bits.h:
* lib/count-trailing-zeros.c, lib/count-trailing-zeros.h:
* m4/count-one-bits.m4, m4/count-trailing-zeros.m4:
New files, copied from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* nt/gnulib.mk: Merge changes from lib/gnulib.mk.
* src/data.c: Include <count-one-bits.h>, <count-trailing-zeros.h>.
(USE_MSC_POPCOUNT, POPCOUNT_STATIC_INLINE)
(NEED_GENERIC_POPCOUNT, popcount_size_t_generic)
(popcount_size_t_msc, popcount_size_t_gcc):
Remove; now done by Gnulib.
(popcount_size_t): Now a macro that defers to Gnulib.
(count_trailing_zero_bits): Return int, for consistency with
Gnulib and because Emacs prefers signed to unsigned int.
Don't assume that size_t is either unsigned int or unsigned long
or unsigned long long.
(size_t_to_host_endian): Do not assume that size_t is either
exactly 32 or exactly 64 bits wide.
* src/lisp.h (BITS_PER_SIZE_T): Define consistently with BITS_PER_LONG
etc., so that it's now an enum constant, not a macro.
No need to assume that it's either 32 or 64.
Fixes: debbugs:15550
* nt/INSTALL: Rename from INSTALL.MSYS.
* nt/INSTALL.OLD: Rename from INSTALL.
* nt/configure.bat: Update for INSTALL name changes.
* make-dist: Update for nt/INSTALL* changes.
nt/mingw-cfg.site (ac_cv_func_mkostemp): New var with value of "yes".
nt/inc/ms-w32.h (mkostemp): Declare prototype.
nt/config.nt (HAVE_MKOSTEMP): Define to 1.
src/w32.c (mkostemp): New function.
(mktemp): Remove, no longer used. Most of the code reused in mkostemp.
Fixes: debbugs:15015
This simplifies Emacs a bit, since it no longer needs to worry
about closing file descriptors by hand in some cases.
It also fixes some unlikely races. Not all such races, as
libraries often open files internally without setting
close-on-exec, but it's an improvement.
* admin/merge-gnulib (GNULIB_MODULES): Add fcntl, pipe2.
(GNULIB_TOOL_FLAGS): Avoid binary-io, close. Do not avoid fcntl.
* configure.ac (mkostemp): New function to check for.
(PTY_OPEN): Pass O_CLOEXEC to posix_openpt.
* lib/fcntl.c, lib/getdtablesize.c, lib/pipe2.c, m4/fcntl.m4:
* m4/getdtablesize.m4, m4/pipe2.m4: New files, taken from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* nt/gnulib.mk: Remove empty gl_GNULIB_ENABLED_verify section;
otherwise, gnulib-tool complains given close-on-exec changes.
* nt/inc/ms-w32.h (pipe): Remove.
* nt/mingw-cfg.site (ac_cv_func_fcntl, gl_cv_func_fcntl_f_dupfd_cloexec)
(gl_cv_func_fcntl_f_dupfd_works, ac_cv_func_pipe2): New vars.
* src/alloc.c (valid_pointer_p) [!WINDOWSNT]:
* src/callproc.c (Fcall_process) [!MSDOS]:
* src/emacs.c (main) [!DOS_NT]:
* src/nsterm.m (ns_term_init):
* src/process.c (create_process):
Use 'pipe2' with O_CLOEXEC instead of 'pipe'.
* src/emacs.c (Fcall_process_region) [HAVE_MKOSTEMP]:
* src/filelock.c (create_lock_file) [HAVE_MKOSTEMP]:
Prefer mkostemp with O_CLOEXEC to mkstemp.
* src/callproc.c (relocate_fd) [!WINDOWSNT]:
* src/emacs.c (main): Use F_DUPFD_CLOEXEC, not plain F_DUPFD.
No need to use fcntl (..., F_SETFD, FD_CLOEXEC), since we're
now using pipe2.
* src/filelock.c (create_lock_file) [! HAVE_MKOSTEMP]:
Make the resulting file descriptor close-on-exec.
* src/lisp.h, src/lread.c, src/process.c (close_load_descs, close_process_descs):
* src/lread.c (load_descriptor_list, load_descriptor_unwind):
Remove; no longer needed. All uses removed.
* src/process.c (SOCK_CLOEXEC): Define to 0 if not supplied by system.
(close_on_exec, accept4, process_socket) [!SOCK_CLOEXEC]:
New functions.
(socket) [!SOCK_CLOEXEC]: Supply a substitute.
(Fmake_network_process, Fnetwork_interface_list):
(Fnetwork_interface_info, server_accept_connection):
Make newly-created socket close-on-exec.
* src/sysdep.c (emacs_open, emacs_fopen):
Make new-created descriptor close-on-exec.
* src/w32.c (fcntl): Support F_DUPFD_CLOEXEC well enough for Emacs.
* src/w32.c, src/w32.h (pipe2): Rename from 'pipe', with new flags arg.
Fixes: debbugs:14803
nt/INSTALL.MSYS: mingw-get is not a GUI program (yet).
msys-automake is not suitable for MinGW builds. Mention the
--enable-locallisppath switch to msysconfig.sh. Suggested by
׃scar Fuentes <ofv@wanadoo.es>.
Makefile.in (msys_to_w32): Modify to support d:\foo file names.
(msys_lisppath_to_w32, msys_prefix_subst, msys_sed_sh_escape): New
variables.
(epaths-force-w32): Use them.
epaths.nt (PATH_SITELOADSEARCH): Fix commentary.
epaths.in: Fix commentary to PATH_SITELOADSEARCH.