summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog28
-rw-r--r--GNUmakefile7
-rw-r--r--Makefile.in71
-rw-r--r--configure.ac528
-rw-r--r--etc/ChangeLog4
-rw-r--r--etc/NEWS10
-rw-r--r--leim/ChangeLog4
-rw-r--r--leim/Makefile.in4
-rw-r--r--lib-src/ChangeLog24
-rw-r--r--lib-src/Makefile.in83
-rw-r--r--lib-src/ntlib.c12
-rw-r--r--lib-src/ntlib.h4
-rw-r--r--lib-src/update-game-score.c4
-rw-r--r--lib/Makefile.am4
-rw-r--r--lisp/ChangeLog15
-rw-r--r--lisp/Makefile.in22
-rw-r--r--lisp/loadup.el20
-rw-r--r--lisp/subr.el16
-rw-r--r--nt/ChangeLog45
-rw-r--r--nt/INSTALL10
-rw-r--r--nt/INSTALL.MSYS640
-rw-r--r--nt/Makefile.in212
-rw-r--r--nt/addpm.c17
-rw-r--r--nt/epaths.nt89
-rw-r--r--nt/gnulib.mk902
-rw-r--r--nt/inc/ms-w32.h55
-rw-r--r--nt/inc/sys/socket.h12
-rw-r--r--nt/inc/sys/stat.h36
-rw-r--r--nt/inc/sys/time.h18
-rw-r--r--nt/inc/unistd.h3
-rw-r--r--nt/makefile.w32-in2
-rw-r--r--nt/mingw-cfg.site106
-rw-r--r--nt/msysconfig.sh39
-rw-r--r--src/ChangeLog24
-rw-r--r--src/Makefile.in42
-rw-r--r--src/unexw32.c8
-rw-r--r--src/w32.c72
37 files changed, 2964 insertions, 228 deletions
diff --git a/ChangeLog b/ChangeLog
index ce2014288e6..f47d2b70585 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2013-05-16 Eli Zaretskii <eliz@gnu.org>
+
+ * lib/Makefile.am: If building for MS-Windows, include
+ nt/gnulib.mk instead of lib/gnulib.mk.
+
+ * configure.ac: Adapt to MSYS build on MS-Windows.
+
+ * Makefile.in (NTDIR): New variable, for the MSYS build on
+ MS-Windows.
+ (SUBDIR): Add $(NTDIR).
+ (.PHONY): Add epaths-force-w32.
+ (msys_to_w32): New variable.
+ (epaths-force-w32, install-nt, uninstall-nt): New targets.
+ (lib-src src): Add $(NTLIB) to prerequisites.
+ (lib lib-src lisp leim nt): Add 'nt'.
+ (config.status): Use $(CFG).
+ (.PHONY): Add install-$(NTDIR) and uninstall-$(NTDIR).
+ (install, install-arch-dep): Add install-$(NTDIR).
+ (uninstall): Depend on uninstall-$(NTDIR).
+ (mostlyclean, clean, distclean, bootstrap-clean): Add 'nt'.
+
+ * GNUmakefile (CFG): New variable, uses mingw-cfg.site as
+ CONFIG_SITE for the MSYS build on MS-Windows.
+ (Makefile): Use $(CFG).
+
+ * .bzrignore: Ignore *.res, *.tmp, and *.map. Remove
+ src/emacs.res.
+
2013-05-16 Paul Eggert <eggert@cs.ucla.edu>
Merge from gnulib, incorporating:
diff --git a/GNUmakefile b/GNUmakefile
index b829e93b498..a2a630ba9d5 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -32,6 +32,11 @@
# run "configure" by hand. But run autogen.sh first, if the source
# was checked out directly from the repository.
+ifneq ($(MSYSTEM),)
+CFG = CONFIG_SITE=$(CURDIR)/nt/mingw-cfg.site
+else
+CFG =
+endif
# If a Makefile already exists, just use it.
@@ -70,7 +75,7 @@ configure:
Makefile: configure
@echo >&2 'There seems to be no Makefile in this directory.'
@echo >&2 'Running ./configure ...'
- ./configure
+ $(CFG) ./configure
@echo >&2 'Makefile built.'
endif
diff --git a/Makefile.in b/Makefile.in
index 3c1feae5945..583aa99f83d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -93,6 +93,9 @@ version=@version@
### for, like `mips-dec-ultrix' or `sparc-sun-sunos'.
configuration=@configuration@
+### The nt/ subdirectory gets built only for MinGW
+NTDIR=@NTDIR@
+
# ==================== Where To Install Things ====================
# Location to install Emacs.app under GNUstep / Mac OS X.
@@ -272,23 +275,23 @@ EMACS = ${EMACS_NAME}${EXEEXT}
EMACSFULL = `echo emacs-${version} | sed '$(TRANSFORM)'`${EXEEXT}
# Subdirectories to make recursively.
-SUBDIR = lib lib-src src lisp leim
+SUBDIR = $(NTDIR) lib lib-src src lisp leim
# The subdir makefiles created by config.status.
SUBDIR_MAKEFILES_IN = @SUBDIR_MAKEFILES_IN@
SUBDIR_MAKEFILES = `echo $(SUBDIR_MAKEFILES_IN:.in=) | sed 's|$(srcdir)/||g'`
-# Subdirectories to install, and where they'll go.
-# lib-src's makefile knows how to install it, so we don't do that here.
-# Directories that cannot simply be copied, eg info,
-# are treated separately.
-# quail appears twice because in out-of-tree builds, it exists twice.
+# Subdirectories to install, and where they'll go. lib-src's and nt's
+# makefiles know how to install them, so we don't do that here.
+# Directories that cannot simply be copied, eg info, are treated
+# separately. quail appears twice because in out-of-tree builds, it
+# exists twice.
COPYDIR = ${srcdir}/etc ${srcdir}/lisp ${srcdir}/leim/ja-dic ${srcdir}/leim/quail leim/quail
COPYDESTS = $(DESTDIR)${etcdir} $(DESTDIR)${lispdir} $(DESTDIR)${leimdir}/ja-dic $(DESTDIR)${leimdir}/quail $(DESTDIR)${leimdir}/quail
all: ${SUBDIR}
-.PHONY: all ${SUBDIR} blessmail epaths-force FRC
+.PHONY: all ${SUBDIR} blessmail epaths-force epaths-force-w32 FRC
removenullpaths=sed -e 's/^://g' -e 's/:$$//g' -e 's/::/:/g'
@@ -315,7 +318,20 @@ epaths-force: FRC
-e 's;\(#.*PATH_DOC\).*$$;\1 "${docdir}";') && \
${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h
-lib-src src: lib
+# Convert MSYS-style /x/foo file name into x:/foo that Windows can grok.
+msys_to_w32=sed -e 's,^/\([A-Za-z]\)/,\1:/,'
+
+# The w32 build needs a slightly different editing, and it uses
+# nt/epaths.nt as the template.
+epaths-force-w32: FRC
+ @(w32srcdir=`echo "${srcdir}" | ${msys_to_w32}` ; \
+ sed < ${srcdir}/nt/epaths.nt > epaths.h.$$$$ \
+ -e '/^.*#/s/@VER@/${version}/g' \
+ -e '/^.*#/s/@CFG@/${configuration}/g' \
+ -e "/^.*#/s|@SRC@|$${w32srcdir}|g") && \
+ ${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h
+
+lib-src src: $(NTDIR) lib
src: lib-src FRC
@@ -324,7 +340,7 @@ src: lib-src FRC
lisp leim: src
# These targets should be "${SUBDIR} without `src'".
-lib lib-src lisp leim: Makefile FRC
+lib lib-src lisp leim nt: Makefile FRC
cd $@ && $(MAKE) all $(MFLAGS) \
CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \
LDFLAGS='${LDFLAGS}' MAKE='${MAKE}'
@@ -378,9 +394,9 @@ $(MAKEFILE_NAME): config.status $(srcdir)/src/config.in \
config.status: ${srcdir}/configure ${srcdir}/lisp/version.el
if [ -x ./config.status ]; then \
- ./config.status --recheck; \
+ $(CFG) ./config.status --recheck; \
else \
- $(srcdir)/configure $(CONFIGURE_FLAGS); \
+ $(CFG) $(srcdir)/configure $(CONFIGURE_FLAGS); \
fi
AUTOCONF_INPUTS = $(srcdir)/configure.ac $(srcdir)/aclocal.m4
@@ -417,13 +433,14 @@ $(srcdir)/src/stamp-h.in: $(AUTOCONF_INPUTS)
# ==================== Installation ====================
.PHONY: install install-arch-dep install-arch-indep install-doc install-info
-.PHONY: install-man install-etc install-strip uninstall
+.PHONY: install-man install-etc install-strip install-$(NTDIR)
+.PHONY: uninstall uninstall-$(NTDIR)
## If we let lib-src do its own installation, that means we
## don't have to duplicate the list of utilities to install in
## this Makefile as well.
-install: all install-arch-indep install-doc install-arch-dep blessmail
+install: all install-arch-indep install-doc install-arch-dep install-$(NTDIR) blessmail
@true
## Ensure that $subdir contains a subdirs.el file.
@@ -444,7 +461,7 @@ write_subdir=if [ -f $${subdir}/subdirs.el ]; \
### Install the executables that were compiled specifically for this machine.
### We do install-arch-indep first because the executable needs the
### Lisp files and DOC file to work properly.
-install-arch-dep: src install-arch-indep install-doc
+install-arch-dep: src install-arch-indep install-doc install-$(NTDIR)
umask 022; ${MKDIR_P} $(DESTDIR)${bindir}
cd lib-src && \
$(MAKE) install $(MFLAGS) prefix=${prefix} \
@@ -464,6 +481,16 @@ install-arch-dep: src install-arch-indep install-doc
rm -rf ${ns_appresdir}/share; \
fi
+### Windows-specific install target for installing programs produced
+### in nt/, and its Posix do-nothing shadow.
+install-:
+install-nt:
+ cd $(NTDIR) && \
+ $(MAKE) install $(MFLAGS) prefix=${prefix} \
+ exec_prefix=${exec_prefix} bindir=${bindir} \
+ libexecdir=${libexecdir} archlibdir=${archlibdir} \
+ INSTALL_STRIP=${INSTALL_STRIP}
+
## In the share directory, we are deleting:
## applications (with emacs.desktop, also found in etc/)
## emacs (basically empty except for unneeded site-lisp directories)
@@ -678,11 +705,12 @@ install-strip:
### create (but not the noninstalled files such as `make all' would create).
###
### Don't delete the lisp and etc directories if they're in the source tree.
-uninstall:
+uninstall: uninstall-$(NTDIR)
cd lib-src && \
$(MAKE) $(MFLAGS) uninstall \
prefix=${prefix} exec_prefix=${exec_prefix} \
bindir=${bindir} libexecdir=${libexecdir} archlibdir=${archlibdir}
+
-unset CDPATH; \
for dir in $(DESTDIR)${lispdir} $(DESTDIR)${etcdir} ; do \
if [ -d $${dir} ]; then \
@@ -727,6 +755,15 @@ uninstall:
[ -s $${file} ] || rm -f $$file; \
done
+### Windows-specific uninstall target for removing programs produced
+### in nt/, and its Posix do-nothing shadow.
+uninstall-:
+uninstall-nt:
+ cd $(NTDIR) && \
+ $(MAKE) $(MFLAGS) uninstall \
+ prefix=${prefix} exec_prefix=${exec_prefix} \
+ bindir=${bindir} libexecdir=${libexecdir} archlibdir=${archlibdir}
+
FRC:
# ==================== Cleaning up and miscellanea ====================
@@ -744,6 +781,7 @@ mostlyclean: FRC
(cd lwlib; $(MAKE) $(MFLAGS) mostlyclean)
(cd lib; $(MAKE) $(MFLAGS) mostlyclean)
(cd lib-src; $(MAKE) $(MFLAGS) mostlyclean)
+ (cd nt; $(MAKE) $(MFLAGS) mostlyclean)
-(cd doc/emacs && $(MAKE) $(MFLAGS) mostlyclean)
-(cd doc/misc && $(MAKE) $(MFLAGS) mostlyclean)
-(cd doc/lispref && $(MAKE) $(MFLAGS) mostlyclean)
@@ -765,6 +803,7 @@ clean: FRC
(cd lwlib; $(MAKE) $(MFLAGS) clean)
(cd lib; $(MAKE) $(MFLAGS) clean)
(cd lib-src; $(MAKE) $(MFLAGS) clean)
+ (cd nt; $(MAKE) $(MFLAGS) clean)
-(cd doc/emacs && $(MAKE) $(MFLAGS) clean)
-(cd doc/misc && $(MAKE) $(MFLAGS) clean)
-(cd doc/lispref && $(MAKE) $(MFLAGS) clean)
@@ -791,6 +830,7 @@ distclean: FRC
(cd lwlib; $(MAKE) $(MFLAGS) distclean)
(cd lib; $(MAKE) $(MFLAGS) distclean)
(cd lib-src; $(MAKE) $(MFLAGS) distclean)
+ (cd nt; $(MAKE) $(MFLAGS) distclean)
(cd doc/emacs && $(MAKE) $(MFLAGS) distclean)
(cd doc/misc && $(MAKE) $(MFLAGS) distclean)
(cd doc/lispref && $(MAKE) $(MFLAGS) distclean)
@@ -809,6 +849,7 @@ bootstrap-clean: FRC
(cd lwlib; $(MAKE) $(MFLAGS) maintainer-clean)
(cd lib; $(MAKE) $(MFLAGS) maintainer-clean)
(cd lib-src; $(MAKE) $(MFLAGS) maintainer-clean)
+ (cd nt; $(MAKE) $(MFLAGS) maintainer-clean)
-(cd doc/emacs && $(MAKE) $(MFLAGS) maintainer-clean)
-(cd doc/misc && $(MAKE) $(MFLAGS) maintainer-clean)
-(cd doc/lispref && $(MAKE) $(MFLAGS) maintainer-clean)
diff --git a/configure.ac b/configure.ac
index a52e25249c6..54f499e2126 100644
--- a/configure.ac
+++ b/configure.ac
@@ -192,7 +192,7 @@ OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars])
OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
OPTION_DEFAULT_ON([xim],[don't use X11 XIM])
OPTION_DEFAULT_OFF([ns],[use NeXTstep (Cocoa or GNUstep) windowing system])
-OPTION_DEFAULT_OFF([w32], [use native MS Windows GUI])
+OPTION_DEFAULT_OFF([w32], [use native MS Windows GUI in a Cygwin build])
OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
@@ -376,7 +376,7 @@ AC_ARG_ENABLE(gtk-deprecation-warnings,
## Make sure CDPATH doesn't affect cd (in case PWD is relative).
unset CDPATH
case "${srcdir}" in
- /* ) ;;
+ [[\\/]]* | ?:[[\\/]]*) ;;
. )
## We may be able to use the $PWD environment variable to make this
## absolute. But sometimes PWD is inaccurate.
@@ -554,6 +554,11 @@ case "${canonical}" in
i[3456]86-*-* )
case "${canonical}" in
*-darwin* ) opsys=darwin ;;
+ *-mingw32 )
+ opsys=mingw32
+ # MinGW overrides and adds some system headers in nt/inc.
+ GCC_TEST_OPTIONS="-I $srcdir/nt/inc"
+ ;;
*-sysv4.2uw* ) opsys=unixware ;;
*-sysv5uw* ) opsys=unixware ;;
*-sysv5OpenUNIX* ) opsys=unixware ;;
@@ -602,6 +607,11 @@ else
test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
fi
+dnl This is used in lib/Makefile.am to use nt/gnulib.mk, the
+dnl alternative to lib/gnulib.mk, so as to avoid generating header files
+dnl that clash with MinGW.
+AM_CONDITIONAL([BUILDING_FOR_WINDOWSNT], [test "x$opsys" = "xmingw32"])
+
# Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW,
# as we don't use them.
AC_DEFUN([gl_FCNTL_O_FLAGS])
@@ -635,6 +645,9 @@ if test "$ac_test_CFLAGS" != set; then
if test $emacs_cv_prog_cc_g3 != yes; then
CFLAGS=$emacs_save_CFLAGS
fi
+ if test $opsys = mingw32; then
+ CFLAGS="$CFLAGS -gdwarf-2"
+ fi
fi
case $CFLAGS in
@@ -852,6 +865,16 @@ fi
AC_SUBST(LN_S_FILEONLY)
+dnl AC_PROG_LN_S sets LN_S to 'cp -pR' for MinGW, on the premise that 'ln'
+dnl doesn't support links to directories, as in "ln file dir". But that
+dnl use is non-portable, and OTOH MinGW wants to use hard links for Emacs
+dnl executables at "make install" time.
+dnl See http://lists.gnu.org/archive/html/emacs-devel/2013-04/msg00475.html
+dnl for more details.
+if test "$opsys" = "mingw32"; then
+ LN_S="ln"
+fi
+
AC_PATH_PROG(INSTALL_INFO, install-info, :,
$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
dnl Don't use GZIP, which is used by gzip for additional parameters.
@@ -957,7 +980,6 @@ AC_SUBST(CANNOT_DUMP)
UNEXEC_OBJ=unexelf.o
case "$opsys" in
# MSDOS uses unexcoff.o
- # MSWindows uses unexw32.o
aix4-2)
UNEXEC_OBJ=unexaix.o
;;
@@ -970,6 +992,9 @@ case "$opsys" in
hpux10-20 | hpux11)
UNEXEC_OBJ=unexhp9k800.o
;;
+ mingw32)
+ UNEXEC_OBJ=unexw32.o
+ ;;
sol2-10)
# Use the Solaris dldump() function, called from unexsol.c, to dump
# emacs, instead of the generic ELF dump code found in unexelf.c.
@@ -1064,6 +1089,7 @@ C_SWITCH_SYSTEM=
## additional optimization. --nils@exp-math.uni-essen.de
test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
C_SWITCH_SYSTEM="-ma -qmaxmem=4000"
+test "$opsys" = "mingw32" && C_SWITCH_SYSTEM="-mtune=pentium4"
## gnu-linux might need -D_BSD_SOURCE on old libc5 systems.
## It is redundant in glibc2, since we define _GNU_SOURCE.
AC_SUBST(C_SWITCH_SYSTEM)
@@ -1083,8 +1109,8 @@ case "$opsys" in
## Motif needs -lgen.
unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
esac
-AC_SUBST(LIBS_SYSTEM)
+AC_SUBST(LIBS_SYSTEM)
### Make sure subsequent tests use flags consistent with the build flags.
@@ -1122,6 +1148,10 @@ case $opsys in
;;
hpux10-20 | hpux11 )
;;
+ mingw32 )
+ LIB_MATH=
+ SYSTEM_TYPE=windows-nt
+ ;;
dnl NB this may be adjusted below.
netbsd | openbsd )
SYSTEM_TYPE=berkeley-unix
@@ -1197,11 +1227,15 @@ AC_DEFUN([PKG_CHECK_MODULES], [
fi
])
-
if test "${with_sound}" != "no"; then
- # Sound support for GNU/Linux and the free BSDs.
- AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h,
- have_sound_header=yes)
+ # Sound support for GNU/Linux, the free BSDs, and MinGW.
+ AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h mmsystem.h,
+ have_sound_header=yes, [], [
+ #ifdef __MINGW32__
+ #define WIN32_LEAN_AND_MEAN
+ #include <windows.h>
+ #endif
+ ])
# Emulation library used on NetBSD.
AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
AC_SUBST(LIBSOUND)
@@ -1241,7 +1275,7 @@ if test "${with_sound}" != "no"; then
if test x$have_sound_header = xyes || test $HAVE_ALSA = yes; then
case "$opsys" in
dnl defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
- gnu-linux|freebsd|netbsd)
+ gnu-linux|freebsd|netbsd|mingw32)
AC_DEFINE(HAVE_SOUND, 1, [Define to 1 if you have sound support.])
;;
esac
@@ -1563,31 +1597,98 @@ AC_SUBST(NS_OBJC_OBJ)
HAVE_W32=no
W32_OBJ=
W32_LIBS=
-W32_RES=
+EMACSRES=
+CLIENTRES=
+CLIENTW=
W32_RES_LINK=
+EMACS_MANIFEST=
if test "${with_w32}" != no; then
- if test "${opsys}" != "cygwin"; then
- AC_MSG_ERROR([Using w32 with an autotools build is only supported for Cygwin.])
+ case "${opsys}" in
+ cygwin)
+ AC_CHECK_HEADER([windows.h], [HAVE_W32=yes],
+ [AC_MSG_ERROR([`--with-w32' was specified, but windows.h
+ cannot be found.])])
+ ;;
+ mingw32)
+ ## Using --with-w32 with MinGW is a no-op, but we allow it.
+ ;;
+ *)
+ AC_MSG_ERROR([Using w32 with an autotools build is only supported for Cygwin and MinGW32.])
+ ;;
+ esac
+fi
+
+if test "${opsys}" = "mingw32"; then
+ AC_MSG_CHECKING([whether Windows API headers are recent enough])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <windows.h>
+ #include <usp10.h>]],
+ [[void test(PIMAGE_NT_HEADERS pHeader)
+ {PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader);}]])],
+ [emacs_cv_w32api=yes
+ HAVE_W32=yes],
+ emacs_cv_w32api=no)
+ AC_MSG_RESULT($emacs_cv_w32api)
+ if test "${emacs_cv_w32api}" = "no"; then
+ AC_MSG_ERROR([the Windows API headers are too old to support this build.])
fi
- AC_CHECK_HEADER([windows.h], [HAVE_W32=yes],
- [AC_MSG_ERROR([`--with-w32' was specified, but windows.h
- cannot be found.])])
+fi
+
+FIRSTFILE_OBJ=
+NTDIR=
+LIBS_ECLIENT=
+LIB_WSOCK32=
+NTLIB=
+CM_OBJ="cm.o"
+XARGS_LIMIT=
+if test "${HAVE_W32}" = "yes"; then
AC_DEFINE(HAVE_NTGUI, 1, [Define to use native MS Windows GUI.])
AC_CHECK_TOOL(WINDRES, [windres],
[AC_MSG_ERROR([No resource compiler found.])])
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"
- W32_RES="emacs.res"
- # Tell the linker that emacs.res is an object (which we compile from
- # the rc file), not a linker script.
- W32_RES_LINK="-Wl,emacs.res"
+ EMACSRES="emacs.res"
+ case "$canonical" in
+ x86_64-*-*) EMACS_MANIFEST="emacs-x64.manifest" ;;
+ *) EMACS_MANIFEST="emacs-x86.manifest" ;;
+ esac
+ if test "${opsys}" = "cygwin"; then
+ W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32"
+ W32_LIBS="$W32_LIBS -lusp10 -lcomctl32 -lwinspool"
+ # Tell the linker that emacs.res is an object (which we compile from
+ # the rc file), not a linker script.
+ W32_RES_LINK="-Wl,emacs.res"
+ else
+ W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o"
+ W32_OBJ="$W32_OBJ w32notify.o"
+ W32_LIBS="$W32_LIBS -lwinmm -lgdi32 -lcomdlg32"
+ W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lcomctl32 -lusp10"
+ W32_RES_LINK="\$(EMACSRES)"
+ CLIENTRES="emacsclient.res"
+ CLIENTW="emacsclientw\$(EXEEXT)"
+ FIRSTFILE_OBJ=firstfile.o
+ NTDIR=nt
+ CM_OBJ=
+ LIBS_ECLIENT="-lcomctl32"
+ LIB_WSOCK32="-lwsock32"
+ NTLIB="ntlib.$ac_objext"
+ XARGS_LIMIT="-s 10000"
+ fi
fi
AC_SUBST(W32_OBJ)
AC_SUBST(W32_LIBS)
-AC_SUBST(W32_RES)
+AC_SUBST(EMACSRES)
+AC_SUBST(EMACS_MANIFEST)
+AC_SUBST(CLIENTRES)
+AC_SUBST(CLIENTW)
AC_SUBST(W32_RES_LINK)
+AC_SUBST(FIRSTFILE_OBJ)
+AC_SUBST(NTDIR)
+AC_SUBST(CM_OBJ)
+AC_SUBST(LIBS_ECLIENT)
+AC_SUBST(LIB_WSOCK32)
+AC_SUBST(NTLIB)
+AC_SUBST(XARGS_LIMIT)
if test "${HAVE_W32}" = "yes"; then
window_system=w32
@@ -1912,7 +2013,7 @@ fi
### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
HAVE_RSVG=no
-if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes"; then
+if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${opsys}" = "mingw32"; then
if test "${with_rsvg}" != "no"; then
RSVG_REQUIRED=2.11.0
RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
@@ -1955,43 +2056,45 @@ HAVE_GTK=no
GTK_OBJ=
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"
-
- dnl Checks for libraries.
- PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
- if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then
- AC_MSG_ERROR($GTK_PKG_ERRORS)
- fi
- if test "$pkg_check_gtk" = "yes"; then
- AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.])
- GTK_OBJ=emacsgtkfixed.o
- term_header=gtkutil.h
- USE_GTK_TOOLKIT="GTK3"
- if test "x$ac_enable_gtk_deprecation_warnings" = x; then
- GTK_CFLAGS="$GTK_CFLAGS -DGDK_DISABLE_DEPRECATION_WARNINGS"
- fi
- else
- check_gtk2=yes
- gtk3_pkg_errors="$GTK_PKG_ERRORS "
+if test "${opsys}" != "mingw32"; then
+ 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"
+
+ dnl Checks for libraries.
+ PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
+ if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then
+ AC_MSG_ERROR($GTK_PKG_ERRORS)
+ fi
+ if test "$pkg_check_gtk" = "yes"; then
+ AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.])
+ GTK_OBJ=emacsgtkfixed.o
+ term_header=gtkutil.h
+ USE_GTK_TOOLKIT="GTK3"
+ if test "x$ac_enable_gtk_deprecation_warnings" = x; then
+ GTK_CFLAGS="$GTK_CFLAGS -DGDK_DISABLE_DEPRECATION_WARNINGS"
+ fi
+ else
+ check_gtk2=yes
+ gtk3_pkg_errors="$GTK_PKG_ERRORS "
+ fi
fi
-fi
-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"
+ 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"
- dnl Checks for libraries.
- PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
- if test "$pkg_check_gtk" = "no" &&
- { test "$with_gtk" = yes || test "$with_gtk2" = "yes"; }
- then
- AC_MSG_ERROR($gtk3_pkg_errors$GTK_PKG_ERRORS)
+ dnl Checks for libraries.
+ PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
+ if test "$pkg_check_gtk" = "no" &&
+ { test "$with_gtk" = yes || test "$with_gtk2" = "yes"; }
+ then
+ AC_MSG_ERROR($gtk3_pkg_errors$GTK_PKG_ERRORS)
+ fi
+ test "$pkg_check_gtk" = "yes" && USE_GTK_TOOLKIT="GTK2"
fi
- test "$pkg_check_gtk" = "yes" && USE_GTK_TOOLKIT="GTK2"
fi
if test x"$pkg_check_gtk" = xyes; then
@@ -2161,6 +2264,8 @@ if test "${with_gnutls}" = "yes" ; then
AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.])
fi
+ OLD_CFLAGS=$CFLAGS
+ OLD_LIBS=$LIBS
CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
LIBS="$LIBGNUTLS_LIBS $LIBS"
AC_CHECK_FUNCS(gnutls_certificate_set_verify_function, HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY=yes)
@@ -2168,6 +2273,13 @@ if test "${with_gnutls}" = "yes" ; then
if test "${HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY}" = "yes"; then
AC_DEFINE(HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY, 1, [Define if using GnuTLS certificate verification callbacks.])
fi
+
+ # Windows loads GnuTLS dynamically
+ if test "${opsys}" = "mingw32"; then
+ CFLAGS=$OLD_CFLAGS
+ LIBS=$OLD_LIBS
+ LIBGNUTLS_LIBS=
+ fi
fi
AC_SUBST(LIBGNUTLS_LIBS)
@@ -2283,6 +2395,9 @@ case $opsys in
hpux* | aix4-2 )
test "X$ac_cv_lib_Xmu_XmuConvertStandardSelection" != "Xyes" && LIBXMU=
;;
+ mingw32 )
+ LIBXMU=
+ ;;
esac
AC_SUBST(LIBXMU)
@@ -2541,10 +2656,10 @@ AC_SUBST(M17N_FLT_CFLAGS)
AC_SUBST(M17N_FLT_LIBS)
### Use -lXpm if available, unless `--with-xpm=no'.
+### mingw32 doesn't use -lXpm, since it loads the library dynamically.
HAVE_XPM=no
LIBXPM=
-
-if test "${HAVE_W32}" = "yes"; then
+if test "${HAVE_W32}" = "yes" && test "${opsys}" = "cygwin"; then
if test "${with_xpm}" != "no"; then
SAVE_CPPFLAGS="$CPPFLAGS"
SAVE_LDFLAGS="$LDFLAGS"
@@ -2605,19 +2720,33 @@ no_return_alloc_pixels
fi
fi
+### FIXME: Perhaps regroup to minimize code duplication due to MinGW's
+### slightly different requirements wrt image libraries (it doesn't
+### use -lXpm because it loads the xpm shared library dynamically at
+### run time).
+if test "${opsys}" = "mingw32"; then
+ if test "${with_xpm}" != "no"; then
+ AC_CHECK_HEADER(X11/xpm.h, HAVE_XPM=yes, HAVE_XPM=no, [
+#define FOR_MSW 1])
+ fi
+
+ if test "${HAVE_XPM}" = "yes"; then
+ AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
+ fi
+fi
+
AC_SUBST(LIBXPM)
### Use -ljpeg if available, unless `--with-jpeg=no'.
+### mingw32 doesn't use -ljpeg, since it loads the library dynamically.
HAVE_JPEG=no
LIBJPEG=
-if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
+if test "${opsys}" = "mingw32"; then
if test "${with_jpeg}" != "no"; then
dnl Checking for jpeglib.h can lose because of a redefinition of
- dnl HAVE_STDLIB_H.
- AC_CHECK_HEADER(jerror.h,
- [AC_CHECK_LIB(jpeg, jpeg_destroy_compress, HAVE_JPEG=yes)])
+ dnl HAVE_STDLIB_H.
+ AC_CHECK_HEADER(jerror.h, HAVE_JPEG=yes, HAVE_JPEG=no)
fi
-
AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
if test "${HAVE_JPEG}" = "yes"; then
AC_DEFINE(HAVE_JPEG)
@@ -2629,6 +2758,25 @@ if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
[AC_MSG_WARN([libjpeg found, but not version 6b or later])
HAVE_JPEG=no])
fi
+elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
+ if test "${with_jpeg}" != "no"; then
+ dnl Checking for jpeglib.h can lose because of a redefinition of
+ dnl HAVE_STDLIB_H.
+ AC_CHECK_HEADER(jerror.h,
+ [AC_CHECK_LIB(jpeg, jpeg_destroy_compress, HAVE_JPEG=yes)])
+ fi
+
+ AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
+ if test "${HAVE_JPEG}" = "yes"; then
+ AC_DEFINE(HAVE_JPEG)
+ AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])],
+ [#include <jpeglib.h>
+ version=JPEG_LIB_VERSION
+],
+ [AC_DEFINE(HAVE_JPEG)],
+ [AC_MSG_WARN([libjpeg found, but not version 6b or later])
+ HAVE_JPEG=no])
+ fi
if test "${HAVE_JPEG}" = "yes"; then
LIBJPEG=-ljpeg
fi
@@ -2636,9 +2784,30 @@ fi
AC_SUBST(LIBJPEG)
### Use -lpng if available, unless `--with-png=no'.
+### mingw32 doesn't use -lpng, since it loads the library dynamically.
HAVE_PNG=no
LIBPNG=
-if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
+if test "${opsys}" = "mingw32"; then
+ if test "${with_png}" != "no"; then
+ AC_CHECK_HEADER(png.h, HAVE_PNG=yes, HAVE_PNG=no)
+ fi
+ if test "${HAVE_PNG}" = "yes"; then
+ AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
+
+ AC_CHECK_DECL(png_longjmp,
+ [],
+ [AC_DEFINE(PNG_DEPSTRUCT, [],
+ [Define to empty to suppress deprecation warnings when building
+ with --enable-gcc-warnings and with libpng versions before 1.5,
+ which lack png_longjmp.])],
+ [[#ifdef HAVE_LIBPNG_PNG_H
+ # include <libpng/png.h>
+ #else
+ # include <png.h>
+ #endif
+ ]])
+ fi
+elif 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.
@@ -2669,9 +2838,17 @@ fi
AC_SUBST(LIBPNG)
### Use -ltiff if available, unless `--with-tiff=no'.
+### mingw32 doesn't use -ltiff, since it loads the library dynamically.
HAVE_TIFF=no
LIBTIFF=
-if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
+if test "${opsys}" = "mingw32"; then
+ if test "${with_tiff}" != "no"; then
+ AC_CHECK_HEADER(tiffio.h, HAVE_TIFF=yes, HAVE_TIFF=no)
+ fi
+ if test "${HAVE_TIFF}" = "yes"; then
+ AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
+ fi
+elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
if test "${with_tiff}" != "no"; then
AC_CHECK_HEADER(tiffio.h,
[tifflibs="-lz -lm"
@@ -2689,9 +2866,17 @@ fi
AC_SUBST(LIBTIFF)
### Use -lgif or -lungif if available, unless `--with-gif=no'.
+### mingw32 doesn't use -lgif/-lungif, since it loads the library dynamically.
HAVE_GIF=no
LIBGIF=
-if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \
+if test "${opsys}" = "mingw32"; then
+ if test "${with_gif}" != "no"; then
+ AC_CHECK_HEADER(gif_lib.h, HAVE_GIF=yes, HAVE_GIF=no)
+ fi
+ if test "${HAVE_GIF}" = "yes"; then
+ AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
+ fi
+elif test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \
|| test "${HAVE_W32}" = "yes"; then
AC_CHECK_HEADER(gif_lib.h,
# EGifPutExtensionLast only exists from version libungif-4.1.0b1.
@@ -2847,13 +3032,18 @@ fi
### Use libxml (-lxml2) if available
+### mingw32 doesn't use -lxml2, since it loads the library dynamically.
HAVE_LIBXML2=no
if test "${with_xml2}" != "no"; then
### I'm not sure what the version number should be, so I just guessed.
PKG_CHECK_MODULES(LIBXML2, libxml-2.0 > 2.6.17, HAVE_LIBXML2=yes, HAVE_LIBXML2=no)
if test "${HAVE_LIBXML2}" = "yes"; then
- LIBS="$LIBXML2_LIBS $LIBS"
- AC_CHECK_LIB(xml2, htmlReadMemory, HAVE_LIBXML2=yes, HAVE_LIBXML2=no)
+ if test "${opsys}" != "mingw32"; then
+ LIBS="$LIBXML2_LIBS $LIBS"
+ AC_CHECK_LIB(xml2, htmlReadMemory, HAVE_LIBXML2=yes, HAVE_LIBXML2=no)
+ else
+ LIBXML2_LIBS=""
+ fi
if test "${HAVE_LIBXML2}" = "yes"; then
AC_DEFINE(HAVE_LIBXML2, 1, [Define to 1 if you have the libxml library (-lxml2).])
else
@@ -2866,6 +3056,10 @@ AC_SUBST(LIBXML2_LIBS)
AC_SUBST(LIBXML2_CFLAGS)
# If netdb.h doesn't declare h_errno, we must declare it by hand.
+# On MinGW, that is provided by nt/inc/sys/socket.h and w32.c.
+if test "${opsys}" = "mingw32"; then
+ emacs_cv_netdb_declares_h_errno=yes
+fi
AC_CACHE_CHECK(whether netdb declares h_errno,
emacs_cv_netdb_declares_h_errno,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
@@ -2876,8 +3070,10 @@ if test $emacs_cv_netdb_declares_h_errno = yes; then
fi
# sqrt and other floating-point functions such as fmod and frexp
-# are found in -lm on most systems.
-AC_CHECK_LIB(m, sqrt)
+# are found in -lm on most systems, but mingw32 doesn't use -lm.
+if test "${opsys}" != "mingw32"; then
+ AC_CHECK_LIB(m, sqrt)
+fi
# Check for mail-locking functions in a "mail" library. Probably this should
# have the same check as for liblockfile below.
@@ -2941,6 +3137,9 @@ case "$opsys" in
test $ac_cv_header_maillock_h = yes && mail_lock=no
fi
;;
+
+ mingw32)
+ mail_lock="none-needed" ;;
esac
BLESSMAIL_TARGET=
@@ -2949,6 +3148,8 @@ case "$mail_lock" in
lockf) AC_DEFINE(MAIL_USE_LOCKF, 1, [Define if the mailer uses lockf to interlock the mail spool.]) ;;
+ none-needed) ;;
+
*) BLESSMAIL_TARGET="need-blessmail" ;;
esac
AC_SUBST(BLESSMAIL_TARGET)
@@ -3020,25 +3221,29 @@ AC_DEFUN([tputs_link_source], [
return 0;
}]])
])
-# Maybe curses should be tried earlier?
-# See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9736#35
-for tputs_library in '' tinfo ncurses terminfo termcap curses; do
- OLIBS=$LIBS
- if test -z "$tputs_library"; then
- LIBS_TERMCAP=
- msg='none required'
- else
- LIBS_TERMCAP=-l$tputs_library
- msg=$LIBS_TERMCAP
- LIBS="$LIBS_TERMCAP $LIBS"
- fi
- AC_RUN_IFELSE([tputs_link_source], [], [msg=no],
- [AC_LINK_IFELSE([tputs_link_source], [], [msg=no])])
- LIBS=$OLIBS
- if test "X$msg" != Xno; then
- break
- fi
-done
+if test "${opsys}" = "mingw32"; then
+ msg='none required'
+else
+ # Maybe curses should be tried earlier?
+ # See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9736#35
+ for tputs_library in '' tinfo ncurses terminfo termcap curses; do
+ OLIBS=$LIBS
+ if test -z "$tputs_library"; then
+ LIBS_TERMCAP=
+ msg='none required'
+ else
+ LIBS_TERMCAP=-l$tputs_library
+ msg=$LIBS_TERMCAP
+ LIBS="$LIBS_TERMCAP $LIBS"
+ fi
+ AC_RUN_IFELSE([tputs_link_source], [], [msg=no],
+ [AC_LINK_IFELSE([tputs_link_source], [], [msg=no])])
+ LIBS=$OLIBS
+ if test "X$msg" != Xno; then
+ break
+ fi
+ done
+fi
AC_MSG_RESULT([$msg])
if test "X$msg" = Xno; then
AC_MSG_ERROR([The required function `tputs' was not found in any library.
@@ -3084,6 +3289,11 @@ fail;
fi
;;
+ mingw32)
+ TERMINFO=no
+ LIBS_TERMCAP=
+ ;;
+
netbsd)
if test "x$LIBS_TERMCAP" != "x-lterminfo"; then
TERMINFO=no
@@ -3373,11 +3583,14 @@ dnl AC_DEFINE(HAVE_TCATTR, 1, [Define to 1 if you have tcgetattr and tcsetatt
dnl fi
dnl Turned on June 1996 supposing nobody will mind it.
-AC_DEFINE(AMPERSAND_FULL_NAME, 1, [Define to use the convention that &
- in the full name stands for the login id.])
+dnl MinGW emulates passwd database, so this feature doesn't make sense there.
+if test "${opsys}" != "mingw32"; then
+ AC_DEFINE(AMPERSAND_FULL_NAME, 1, [Define to use the convention that &
+ in the full name stands for the login id.])
+fi
-dnl Every platform that uses configure (ie every non-MS platform)
-dnl supports this. There is a create-lockfiles option you can
+dnl Every platform that uses configure supports this.
+dnl There is a create-lockfiles option you can
dnl customize if you do not want the lock files to be written.
dnl So it is not clear that this #define still needs to exist.
AC_DEFINE(CLASH_DETECTION, 1, [Define if you want lock files to be written,
@@ -3387,7 +3600,9 @@ AC_DEFINE(CLASH_DETECTION, 1, [Define if you want lock files to be written,
dnl Everybody supports this, except MS.
dnl Seems like the kind of thing we should be testing for, though.
## Note: PTYs are broken on darwin <6. Use at your own risk.
-AC_DEFINE(HAVE_PTYS, 1, [Define if the system supports pty devices.])
+if test "${opsys}" != "mingw32"; then
+ AC_DEFINE(HAVE_PTYS, 1, [Define if the system supports pty devices.])
+fi
dnl Everybody supports this, except MS-DOS.
dnl Seems like the kind of thing we should be testing for, though.
@@ -3397,10 +3612,20 @@ AC_DEFINE(HAVE_SOCKETS, 1, [Define if the system supports
AH_TEMPLATE(INTERNAL_TERMINAL, [This is substituted when $TERM is "internal".])
-AC_DEFINE(NULL_DEVICE, ["/dev/null"], [Name of the file to open to get
+AH_TEMPLATE(NULL_DEVICE, [Name of the file to open to get
a null file, or a data sink.])
+if test "${opsys}" = "mingw32"; then
+ AC_DEFINE(NULL_DEVICE, ["NUL:"])
+else
+ AC_DEFINE(NULL_DEVICE, ["/dev/null"])
+fi
-AC_DEFINE(SEPCHAR, [':'], [Character that separates PATH elements.])
+AH_TEMPLATE(SEPCHAR, [Character that separates PATH elements.])
+if test "${opsys}" = "mingw32"; then
+ AC_DEFINE(SEPCHAR, [';'])
+else
+ AC_DEFINE(SEPCHAR, [':'])
+fi
dnl Everybody supports this, except MS-DOS.
AC_DEFINE(subprocesses, 1, [Define to enable asynchronous subprocesses.])
@@ -3411,19 +3636,28 @@ AC_DEFINE(USER_FULL_NAME, [pw->pw_gecos], [How to get a user's full name.])
AC_DEFINE(DIRECTORY_SEP, ['/'],
[Character that separates directories in a file name.])
-dnl Only used on MS platforms.
AH_TEMPLATE(DEVICE_SEP, [Character that separates a device in a file name.])
+if test "${opsys}" = "mingw32"; then
+ dnl Only used on MS platforms.
+ AC_DEFINE(DEVICE_SEP, ':')
+ AC_DEFINE(IS_DEVICE_SEP(_c_), [((_c_) == DEVICE_SEP)],
+ [Returns true if character is a device separator.])
-AC_DEFINE(IS_DEVICE_SEP(_c_), 0,
- [Returns true if character is a device separator.])
+ AC_DEFINE(IS_DIRECTORY_SEP(_c_), [((_c_) == '/' || (_c_) == '\\')],
+ [Returns true if character is a directory separator.])
-AC_DEFINE(IS_DIRECTORY_SEP(_c_), [((_c_) == DIRECTORY_SEP)],
- [Returns true if character is a directory separator.])
+ AC_DEFINE(IS_ANY_SEP(_c_), [(IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP(_c_))],
+ [Returns true if character is any form of separator.])
+else
+ AC_DEFINE(IS_DEVICE_SEP(_c_), 0,
+ [Returns true if character is a device separator.])
-dnl On MS, this also accepts IS_DEVICE_SEP.
-AC_DEFINE(IS_ANY_SEP(_c_), [(IS_DIRECTORY_SEP (_c_))],
- [Returns true if character is any form of separator.])
+ AC_DEFINE(IS_DIRECTORY_SEP(_c_), [((_c_) == DIRECTORY_SEP)],
+ [Returns true if character is a directory separator.])
+ AC_DEFINE(IS_ANY_SEP(_c_), [(IS_DIRECTORY_SEP (_c_))],
+ [Returns true if character is any form of separator.])
+fi
AH_TEMPLATE(NO_EDITRES, [Define if XEditRes should not be used.])
@@ -3812,10 +4046,14 @@ else
esac
fi dnl GCC?
+dnl In a weird quirk, MS runtime uses _setjmp and longjmp.
AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <setjmp.h>
+ #ifdef __MINGW32__
+ # define _longjmp longjmp
+ #endif
]],
[[jmp_buf j;
if (! _setjmp (j))
@@ -3910,6 +4148,14 @@ case $opsys in
AC_DEFINE(IRIX6_5, [], [Define if the system is IRIX.])
;;
+ mingw32)
+ AC_DEFINE(DOS_NT, [])
+ AC_DEFINE(WINDOWSNT, 1, [Define if compiling for native MS Windows.])
+ if test "x$ac_enable_checking" != "x" ; then
+ AC_DEFINE(EMACSDEBUG, 1, [Define to 1 to enable w32 debug facilities.])
+ fi
+ ;;
+
sol2*)
AC_DEFINE(USG, [])
AC_DEFINE(USG5, [])
@@ -3931,6 +4177,10 @@ AC_CACHE_CHECK([for usable FIONREAD], [emacs_cv_usable_FIONREAD],
emacs_cv_usable_FIONREAD=no
;;
+ mingw32)
+ emacs_cv_usable_FIONREAD=yes
+ ;;
+
*)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sys/types.h>
@@ -4071,6 +4321,12 @@ AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${emacs_config_options}",
AH_TEMPLATE(config_opsysfile, [Some platforms that do not use configure
define this to include extra configuration information.])
+case $opsys in
+ mingw32)
+ AC_DEFINE(config_opsysfile, <ms-w32.h>, [])
+ ;;
+esac
+
XMENU_OBJ=
XOBJ=
FONT_OBJ=
@@ -4131,12 +4387,14 @@ case "$USE_X_TOOLKIT" in
esac
AC_SUBST(TOOLKIT_LIBW)
-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"
+if test "${opsys}" != "mingw32"; then
+ 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
fi
AC_SUBST(LIBXT_OTHER)
@@ -4210,6 +4468,10 @@ if test "$opsys" = "cygwin"; then
## Cygwin differs because of its unexec().
PRE_ALLOC_OBJ=
POST_ALLOC_OBJ=lastfile.o
+elif test "$opsys" = "mingw32"; then
+ CYGWIN_OBJ=
+ PRE_ALLOC_OBJ=
+ POST_ALLOC_OBJ=lastfile.o
else
CYGWIN_OBJ=
PRE_ALLOC_OBJ=lastfile.o
@@ -4237,6 +4499,12 @@ gl_INIT
CFLAGS=$SAVE_CFLAGS
LIBS=$SAVE_LIBS
+if test "${opsys}" = "mingw32"; then
+ CPPFLAGS="$CPPFLAGS -DUSE_CRT_DLL=1 -I $srcdir/nt/inc"
+ # Remove unneeded switches from the value of CC that goes to Makefiles
+ CC=`echo $CC | sed -e "s,$GCC_TEST_OPTIONS,,"`
+fi
+
case "$opsys" in
aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
@@ -4273,6 +4541,16 @@ case "$opsys" in
## It seems clearer therefore to put this piece in LD_SWITCH_SYSTEM_TEMACS.
gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_RPATH)" ;;
+ mingw32)
+ ## MinGW64 does not prepend an underscore to symbols, so we must
+ ## pass a different -entry switch to linker. FIXME: It is better
+ ## to make the entry points the same by changing unexw32.c.
+ case "$canonical" in
+ x86_64-*-*) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -Wl,-entry,_start -Wl,-Map,./temacs.map" ;;
+ *) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;;
+ esac
+ ;;
+
openbsd) LD_SWITCH_SYSTEM_TEMACS='-nopie' ;;
*) LD_SWITCH_SYSTEM_TEMACS= ;;
@@ -4287,6 +4565,24 @@ fi
AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
+## MinGW-specific post-link processing of temacs.
+TEMACS_POST_LINK=":"
+ADDSECTION=
+EMACS_HEAPSIZE=
+if test "${opsys}" = "mingw32"; then
+ TEMACS_POST_LINK="\$(MINGW_TEMACS_POST_LINK)"
+ ADDSECTION="../nt/addsection\$(EXEEXT)"
+ ## Preload heap size of temacs.exe in MB.
+ case "$canonical" in
+ x86_64-*-*) EMACS_HEAPSIZE=42 ;;
+ *) EMACS_HEAPSIZE=27 ;;
+ esac
+fi
+
+AC_SUBST(ADDSECTION)
+AC_SUBST(TEMACS_POST_LINK)
+AC_SUBST(EMACS_HEAPSIZE)
+
## Common for all window systems
if test "$window_system" != "none"; then
AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.])
@@ -4445,12 +4741,12 @@ dnl This will work, but you get a config.status that is not quite right
dnl (see http://lists.gnu.org/archive/html/bug-autoconf/2008-08/msg00028.html).
dnl That doesn't have any obvious consequences for Emacs, but on the whole
dnl it seems better to just live with the duplication.
-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"
+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 nt/Makefile"
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])
+ leim/Makefile nextstep/Makefile nt/Makefile])
dnl test/ is not present in release tarfiles.
opt_makefile=test/automated/Makefile
@@ -4493,8 +4789,12 @@ dnl by configure. This also explains the `move-if-change' test and
dnl the use of force in the `epaths-force' rule in Makefile.in.
AC_CONFIG_COMMANDS([epaths], [
echo creating src/epaths.h
-${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force
-], [GCC="$GCC" CPPFLAGS="$CPPFLAGS"])
+if test "${opsys}" = "mingw32"; then
+ ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force-w32
+else
+ ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force
+fi
+], [GCC="$GCC" CPPFLAGS="$CPPFLAGS" opsys="$opsys"])
AC_CONFIG_COMMANDS([gdbinit], [
if test ! -f src/.gdbinit && test -f "$srcdir/src/.gdbinit"; then
diff --git a/etc/ChangeLog b/etc/ChangeLog
index f4f17ac29cf..b516d1aef65 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,7 @@
+2013-05-16 Eli Zaretskii <eliz@gnu.org>
+
+ * NEWS: Advertise the MSYS build on MS-Windows.
+
2013-05-15 Stefan Monnier <monnier@iro.umontreal.ca>
* .gitignore: Don't ignore DOC-* any more.
diff --git a/etc/NEWS b/etc/NEWS
index 5f238988820..fc0eaf33640 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -29,7 +29,15 @@ build time, like libacl on GNU/Linux. To prevent this, use the
configure option `--disable-acl'.
** The configure option --with-crt-dir has been removed.
-It is no longer needed, as the crt*.o files are no longer linked specially.
+It is no longer needed, as the crt*.o files are no longer linked
+specially.
+
+** Emacs for MS-Windows can now be built by running the configure script
+using the MSYS environment and MinGW development tools.
+This is from now on the preferred method of building Emacs on
+MS-Windows. The Windows-specific configure.bat and makefile.w32-in
+files are deprecated. See the file nt/INSTALL.MSYS for detailed
+instructions.
* Startup Changes in Emacs 24.4
diff --git a/leim/ChangeLog b/leim/ChangeLog
index 64954ddad85..f86fb23eb5e 100644
--- a/leim/ChangeLog
+++ b/leim/ChangeLog
@@ -1,3 +1,7 @@
+2013-05-16 Eli Zaretskii <eliz@gnu.org>
+
+ * Makefile.in (leim-list.el, check-declare): Use reveal-filename.
+
2013-04-01 Paul Eggert <eggert@cs.ucla.edu>
Use UTF-8 for most files with non-ASCII characters (Bug#13936).
diff --git a/leim/Makefile.in b/leim/Makefile.in
index 0242244295e..a660d9b56e0 100644
--- a/leim/Makefile.in
+++ b/leim/Makefile.in
@@ -140,7 +140,7 @@ leim-list.el: ${TIT_MISC} ${srcdir}/leim-ext.el
--eval "(update-leim-list-file \".\")" ; \
else \
${RUN_EMACS} -l ${buildlisppath}/international/quail \
- --eval "(update-leim-list-file \".\" \"${srcdir}\")" ; \
+ --eval "(update-leim-list-file \".\" (reveal-filename \"${srcdir}\"))" ; \
fi
sed -n '/^[^;]/ p' < ${srcdir}/leim-ext.el >> $@
@@ -199,4 +199,4 @@ extraclean: maintainer-clean
check-declare:
$(RUN_EMACS) -l $(buildlisppath)/emacs-lisp/check-declare \
- --eval '(check-declare-directory "$(srcdir)")'
+ --eval '(check-declare-directory (reveal-filename "$(srcdir)"))'
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 63108cae9a9..6ff653b7be6 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,27 @@
+2013-05-16 Eli Zaretskii <eliz@gnu.org>
+
+ * update-game-score.c [WINDOWSNT]: Include "ntlib.h".
+
+ * ntlib.h (sleep): Update prototype.
+ (geteuid): Add prototype.
+
+ * ntlib.c (sleep): Now returns an unsigned value.
+ (getgid): New function.
+
+ * Makefile.in (CLIENTW, LIB_WSOCK32, LIBS_ECLIENT, NTLIB)
+ (CLIENTRES, WINDRES, NTINC, NTDEPS): New variables.
+ (INSTALLABLES): Add $(CLIENTW).
+ (LIBS_MOVE): Use $(LIB_WSOCK32).
+ ($(DESTDIR)${archlibdir}): Use $(EXEEXT) on update-game-score.
+ (test-distrib${EXEEXT}): Use $(EXEEXT) on test-distrib.
+ (etags${EXEEXT}, ebrowse${EXEEXT}, ctags${EXEEXT})
+ (profile${EXEEXT}, make-docfile${EXEEXT}, movemail${EXEEXT})
+ (emacsclient${EXEEXT}, hexl${EXEEXT}, update-game-score${EXEEXT}):
+ Add $(NTLIB) to prerequisites. Use $(EXEEXT).
+ (pop.o): Add pop.h to prerequisites.
+ (emacsclientw${EXEEXT}, ntlib.o): New targets.
+ (emacsclient.res): New target.
+
2013-05-15 Stefan Monnier <monnier@iro.umontreal.ca>
* makefile.w32-in ($(DOC)): Use DOC rather than DOC-X.
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index 7069af9767a..e0acea867b7 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -113,8 +113,11 @@ MKDIR_P = @MKDIR_P@
# ========================== Lists of Files ===========================
+# emacsclientw.exe for MinGW, empty otherwise
+CLIENTW = @CLIENTW@
+
# Things that a user might actually run, which should be installed in bindir.
-INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \
+INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \
ebrowse${EXEEXT}
INSTALLABLE_SCRIPTS = grep-changelog
@@ -163,10 +166,21 @@ LIBS_MAIL=@LIBS_MAIL@
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
## empty or -lrt or -lposix4 if HAVE_FDATASYNC
LIB_FDATASYNC = @LIB_FDATASYNC@
+## empty or -lwsock2 for MinGW
+LIB_WSOCK32=@LIB_WSOCK32@
## Extra libraries to use when linking movemail.
LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
- $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV)
+ $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) $(LIB_WSOCK32)
+
+## Extra libraries when linking emacsclient
+## (empty or -lcomctl32 for MinGW)
+LIBS_ECLIENT = @LIBS_ECLIENT@
+
+## Extra object files for linking for MinGW
+NTLIB = @NTLIB@
+CLIENTRES = @CLIENTRES@
+WINDRES = @WINDRES@
## Some systems define this to request special libraries.
LIBS_SYSTEM = @LIBS_SYSTEM@
@@ -227,7 +241,7 @@ $(DESTDIR)${archlibdir}: all
umask 022; ${MKDIR_P} $(DESTDIR)${gamedir}; \
touch $(DESTDIR)${gamedir}/snake-scores; \
touch $(DESTDIR)${gamedir}/tetris-scores
- -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
+ -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score${EXEEXT} && chmod u+s $(DESTDIR)${archlibdir}/update-game-score${EXEEXT}; then \
chown ${gameuser} $(DESTDIR)${gamedir}; \
chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \
fi
@@ -292,7 +306,7 @@ TAGS: etags${EXEEXT}
## distribute Emacs. If they were clobbered, all the .elc files were
## clobbered too.
test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
- $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
+ $(CC) ${ALL_CFLAGS} -o test-distrib${EXEEXT} ${srcdir}/test-distrib.c
./test-distrib ${srcdir}/testfile
../lib/libgnu.a: $(config_h)
@@ -302,47 +316,68 @@ regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
${srcdir}/../src/regex.c
-etags${EXEEXT}: ${srcdir}/etags.c regex.o $(config_h)
+etags${EXEEXT}: ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
$(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
-DVERSION="\"${version}\"" ${srcdir}/etags.c \
- regex.o $(LOADLIBES) -o etags
+ regex.o $(LOADLIBES) $(NTLIB) -o etags${EXEEXT}
-ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(config_h)
+ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
+ $(config_h)
$(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
- ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse
+ ${srcdir}/ebrowse.c $(LOADLIBES) $(NTLIB) -o ebrowse${EXEEXT}
## We depend on etags to assure that parallel makes do not write two
## etags.o files on top of each other.
ctags${EXEEXT}: etags${EXEEXT}
$(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \
-DVERSION="\"${version}\"" ${srcdir}/etags.c \
- regex.o $(LOADLIBES) -o ctags
+ regex.o $(LOADLIBES) $(NTLIB) -o ctags${EXEEXT}
-profile${EXEEXT}: ${srcdir}/profile.c $(config_h)
+profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
$(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \
- $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o profile
+ $(LOADLIBES) $(NTLIB) $(LIB_CLOCK_GETTIME) -o profile${EXEEXT}
-make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(config_h)
- $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \
- -o make-docfile
+make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
+ $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) $(NTLIB) \
+ -o make-docfile${EXEEXT}
-movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(config_h)
+movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
$(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
- $(LOADLIBES) $(LIBS_MOVE) -o movemail
+ $(LOADLIBES) $(NTLIB) $(LIBS_MOVE) -o movemail${EXEEXT}
-pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h $(config_h)
+pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
$(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
-emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(config_h)
+emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
$(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
- -DVERSION="\"${version}\"" \
- $(LOADLIBES) $(LIB_FDATASYNC) -o emacsclient
+ -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
+ $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclient${EXEEXT}
+
+emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
+ $(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows ${srcdir}/emacsclient.c \
+ -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
+ $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclientw${EXEEXT}
-hexl${EXEEXT}: ${srcdir}/hexl.c $(config_h)
- $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
+NTINC = ${srcdir}/../nt/inc
+NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \
+ $(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \
+ $(NTINC)/sys/wait.h $(NTINC)/unistd.h $(NTINC)/sys/file.h $(NTINC)/netdb.h
-update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(config_h)
+# The dependency on $(NTDEPS) is a trick intended to cause recompile of
+# programs on MinGW whenever some private header in nt/inc is modified.
+ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS)
+ $(CC) -c ${CPP_CFLAGS} ${srcdir}/ntlib.c
+
+hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
+ $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl${EXEEXT}
+
+update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
$(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
- ${srcdir}/update-game-score.c $(LOADLIBES) -o update-game-score
+ ${srcdir}/update-game-score.c $(LOADLIBES) $(NTLIB) \
+ -o update-game-score${EXEEXT}
+
+emacsclient.res: $(NTINC)/../emacsclient.rc
+ $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o emacsclient.res \
+ $(NTINC)/../emacsclient.rc
## Makefile ends here.
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index 849abc2ede5..41b4e3a0cbc 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -49,10 +49,11 @@ struct timezone
/* Emulate sleep...we could have done this with a define, but that
would necessitate including windows.h in the files that used it.
This is much easier. */
-void
-sleep (unsigned long seconds)
+unsigned
+sleep (unsigned seconds)
{
Sleep (seconds * 1000);
+ return 0;
}
/* Get the current working directory. */
@@ -138,6 +139,12 @@ getuid (void)
}
unsigned
+geteuid (void)
+{
+ return getuid ();
+}
+
+unsigned
getgid (void)
{
return 0;
@@ -415,4 +422,3 @@ lstat (const char * path, struct stat * buf)
{
return stat (path, buf);
}
-
diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h
index 1b2f57f35e5..3e48d2997e0 100644
--- a/lib-src/ntlib.h
+++ b/lib-src/ntlib.h
@@ -16,7 +16,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
-
#include <pwd.h>
#include <malloc.h>
@@ -29,12 +28,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef sleep
#undef sleep
#endif
-void sleep (unsigned long seconds);
+unsigned sleep (unsigned seconds);
char *getwd (char *dir);
int getppid (void);
char * getlogin (void);
char * cuserid (char * s);
unsigned getuid (void);
+unsigned geteuid (void);
unsigned getegid (void);
unsigned getgid (void);
int setuid (unsigned uid);
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c
index 29c81a8936c..ec8b4317770 100644
--- a/lib-src/update-game-score.c
+++ b/lib-src/update-game-score.c
@@ -46,6 +46,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/stat.h>
#include <getopt.h>
+#ifdef WINDOWSNT
+#include "ntlib.h"
+#endif
+
#define MAX_ATTEMPTS 5
#define MAX_SCORES 200
#define MAX_DATA_LEN 1024
diff --git a/lib/Makefile.am b/lib/Makefile.am
index c72e0904221..f76d0d3928d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -9,6 +9,10 @@ SUFFIXES =
AM_CFLAGS = $(PROFILING_CFLAGS) $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS)
DEFAULT_INCLUDES = -I. -I$(top_srcdir)/lib -I../src -I$(top_srcdir)/src
+if BUILDING_FOR_WINDOWSNT
+include ../nt/gnulib.mk
+else
include gnulib.mk
libgnu_a_SOURCES += openat-die.c save-cwd.c
+endif
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e6f56664a52..a33796ce24f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,18 @@
+2013-05-16 Eli Zaretskii <eliz@gnu.org>
+
+ * subr.el (reveal-filename): New function.
+
+ * loadup.el: Compute Emacs executable versions on MS-Windows,
+ where executables have the .exe extension. Add a hard link
+ emacs-XX.YY.ZZ.exe on MS-Windows.
+
+ * Makefile.in (XARGS_LIMIT): New variable.
+ (custom-deps, finder-data, autoloads)
+ ($(MH_E_DIR)/mh-loaddefs.el, $(TRAMP_DIR)/tramp-loaddefs.el)
+ ($(CAL_DIR)/cal-loaddefs.el, $(CAL_DIR)/diary-loaddefs.el)
+ ($(CAL_DIR)/hol-loaddefs.el): Use reveal-filename.
+ (compile-main): Limit xargs according to $(XARGS_LIMIT).
+
2013-05-16 Leo Liu <sdl.web@gmail.com>
* progmodes/octave.el (octave-indent-defun): Mark obsolete.
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index c8707df15df..138ad5abfa6 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -24,6 +24,10 @@ abs_top_builddir = @abs_top_builddir@
lisp = $(srcdir)
VPATH = $(srcdir)
+# Empty for all systems except MinGW, where xargs needs an explicit
+# limitation.
+XARGS_LIMIT = @XARGS_LIMIT@
+
# You can specify a different executable on the make command line,
# e.g. "make EMACS=../src/emacs ...".
@@ -160,21 +164,21 @@ $(lisp)/cus-load.el:
custom-deps: doit
cd $(lisp); $(setwins_almost); \
echo Directories: $$wins; \
- $(emacs) -l cus-dep --eval '(setq generated-custom-dependencies-file "$(lisp)/cus-load.el")' -f custom-make-dependencies $$wins
+ $(emacs) -l cus-dep --eval '(setq generated-custom-dependencies-file (reveal-filename "$(lisp)/cus-load.el"))' -f custom-make-dependencies $$wins
$(lisp)/finder-inf.el:
$(MAKE) $(MFLAGS) finder-data
finder-data: doit
cd $(lisp); $(setwins_almost); \
echo Directories: $$wins; \
- $(emacs) -l finder --eval '(setq generated-finder-keywords-file "$(lisp)/finder-inf.el")' -f finder-compile-keywords-make-dist $$wins
+ $(emacs) -l finder --eval '(setq generated-finder-keywords-file (reveal-filename "$(lisp)/finder-inf.el"))' -f finder-compile-keywords-make-dist $$wins
# The chmod +w is to handle env var CVSREAD=1.
autoloads: $(LOADDEFS) doit
cd $(lisp) && chmod +w $(AUTOGEN_VCS)
cd $(lisp); $(setwins_almost); \
echo Directories: $$wins; \
- $(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins
+ $(emacs) -l autoload --eval '(setq generated-autoload-file (reveal-filename "$(lisp)/loaddefs.el"))' -f batch-update-autoloads $$wins
# This is required by the bootstrap-emacs target in ../src/Makefile, so
# we know that if we have an emacs executable, we also have a subdirs.el.
@@ -274,7 +278,7 @@ compile-main: compile-clean
test -f $$el || continue; \
test ! -f $${el}c && GREP_OPTIONS= grep '^;.*no-byte-compile: t' $$el > /dev/null && continue; \
echo "$${el}c"; \
- done | xargs echo) | \
+ done | xargs $(XARGS_LIMIT) echo) | \
while read chunk; do \
$(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \
done
@@ -369,7 +373,7 @@ mh-autoloads: $(MH_E_DIR)/mh-loaddefs.el
$(MH_E_DIR)/mh-loaddefs.el: $(MH_E_SRC)
$(emacs) -l autoload \
--eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
- --eval "(setq generated-autoload-file \"$@\")" \
+ --eval "(setq generated-autoload-file (reveal-filename \"$@\"))" \
--eval "(setq make-backup-files nil)" \
-f batch-update-autoloads $(MH_E_DIR)
@@ -387,7 +391,7 @@ TRAMP_SRC = $(TRAMP_DIR)/tramp.el $(TRAMP_DIR)/tramp-adb.el \
$(TRAMP_DIR)/tramp-loaddefs.el: $(TRAMP_SRC)
$(emacs) -l autoload \
--eval "(setq generate-autoload-cookie \";;;###tramp-autoload\")" \
- --eval "(setq generated-autoload-file \"$@\")" \
+ --eval "(setq generated-autoload-file (reveal-filename \"$@\"))" \
--eval "(setq make-backup-files nil)" \
-f batch-update-autoloads $(TRAMP_DIR)
@@ -409,21 +413,21 @@ CAL_SRC = $(CAL_DIR)/cal-bahai.el $(CAL_DIR)/cal-china.el \
$(CAL_DIR)/cal-loaddefs.el: $(CAL_SRC)
$(emacs) -l autoload \
--eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \
- --eval "(setq generated-autoload-file \"$@\")" \
+ --eval "(setq generated-autoload-file (reveal-filename \"$@\"))" \
--eval "(setq make-backup-files nil)" \
-f batch-update-autoloads $(CAL_DIR)
$(CAL_DIR)/diary-loaddefs.el: $(CAL_SRC)
$(emacs) -l autoload \
--eval "(setq generate-autoload-cookie \";;;###diary-autoload\")" \
- --eval "(setq generated-autoload-file \"$@\")" \
+ --eval "(setq generated-autoload-file (reveal-filename \"$@\"))" \
--eval "(setq make-backup-files nil)" \
-f batch-update-autoloads $(CAL_DIR)
$(CAL_DIR)/hol-loaddefs.el: $(CAL_SRC)
$(emacs) -l autoload \
--eval "(setq generate-autoload-cookie \";;;###holiday-autoload\")" \
- --eval "(setq generated-autoload-file \"$@\")" \
+ --eval "(setq generated-autoload-file (reveal-filename \"$@\"))" \
--eval "(setq make-backup-files nil)" \
-f batch-update-autoloads $(CAL_DIR)
diff --git a/lisp/loadup.el b/lisp/loadup.el
index a2e0d8ecec5..5764cdec7eb 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -290,9 +290,12 @@
(equal (nth 4 command-line-args) "dump"))
(not (eq system-type 'ms-dos)))
(let* ((base (concat "emacs-" emacs-version "."))
+ (exelen (if (eq system-type 'windows-nt) -4))
(files (file-name-all-completions base default-directory))
- (versions (mapcar (function (lambda (name)
- (string-to-number (substring name (length base)))))
+ (versions (mapcar (function
+ (lambda (name)
+ (string-to-number
+ (substring name (length base) exelen))))
files)))
(setq emacs-bzr-version (condition-case nil (emacs-bzr-get-version)
(error nil)))
@@ -376,18 +379,25 @@
(dump-emacs "emacs" "temacs")
(message "%d pure bytes used" pure-bytes-used)
;; Recompute NAME now, so that it isn't set when we dump.
- (if (not (or (memq system-type '(ms-dos windows-nt))
+ (if (not (or (eq system-type 'ms-dos)
;; Don't bother adding another name if we're just
;; building bootstrap-emacs.
(equal (nth 3 command-line-args) "bootstrap")
(equal (nth 4 command-line-args) "bootstrap")))
- (let ((name (concat "emacs-" emacs-version)))
+ (let ((name (concat "emacs-" emacs-version))
+ (exe (if (eq system-type 'windows-nt) ".exe" "")))
(while (string-match "[^-+_.a-zA-Z0-9]+" name)
(setq name (concat (downcase (substring name 0 (match-beginning 0)))
"-"
(substring name (match-end 0)))))
+ (setq name (concat name exe))
(message "Adding name %s" name)
- (add-name-to-file "emacs" name t)))
+ ;; When this runs on Windows, invocation-directory is not
+ ;; necessarily the current directory.
+ (add-name-to-file (expand-file-name (concat "emacs" exe)
+ invocation-directory)
+ (expand-file-name name invocation-directory)
+ t)))
(kill-emacs)))
;; For machines with CANNOT_DUMP defined in config.h,
diff --git a/lisp/subr.el b/lisp/subr.el
index 177e9a84a58..9bf11a13ef6 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4678,4 +4678,20 @@ as alpha versions."
(prin1-to-string (make-hash-table)))))
(provide 'hashtable-print-readable))
+;; This is used in lisp/Makefile.in and in leim/Makefile.in to
+;; generate file names for autoloads, custom-deps, and finder-data.
+(defun reveal-filename (file)
+ "Produce the real file name for FILE.
+
+On systems other than MS-Windows, just returns FILE.
+On MS-Windows, converts /d/foo/bar form of file names
+passed by MSYS Make into d:/foo/bar that Emacs can grok.
+
+This function is called from lisp/Makefile."
+ (when (and (eq system-type 'windows-nt)
+ (string-match "\\`/[a-zA-Z]/" file))
+ (setq file (concat (substring file 1 2) ":" (substring file 2))))
+ file)
+
+
;;; subr.el ends here
diff --git a/nt/ChangeLog b/nt/ChangeLog
index b66871e319b..80b6390d368 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,48 @@
+2013-05-16 Eli Zaretskii <eliz@gnu.org>
+
+ * msysconfig.sh: New file.
+
+ * mingw-cfg.site: New file.
+
+ * makefile.w32-in (LOCAL_FLAGS): Add -DOLD_PATHS=1.
+
+ * inc/unistd.h: Include pwd.h and sys/types.h.
+
+ * inc/sys/time.h (_TIMEVAL_DEFINED, timerisset, timercmp)
+ (timerclear): Define.
+ (gettimeofday): Adjust signature to be Posix compatible, by using
+ the 'restrict' keyword.
+
+ * inc/sys/stat.h (UTIME_NOW, UTIME_OMIT): Define.
+ (struct _stat, struct _stati64): Define.
+
+ * inc/sys/socket.h (timeval): Define only for MSVC.
+ (FD_SET, FD_CLR, FD_ISSET, fd_set): Redefine only if
+ EMACS_CONFIG_H is defined.
+ (timeval): Undefine only for MSVC.
+
+ * inc/ms-w32.h (HAVE___BUILTIN_UNWIND_INIT, restrict)
+ (HAVE_WINDOW_SYSTEM, HAVE_MENUS, EMACS_CONFIGURATION)
+ (EMACS_CONFIG_OPTIONS, HAVE_LONG_LONG_INT)
+ (HAVE_UNSIGNED_LONG_LONG_INT): Define only if not already defined.
+ (fileno): Move definition after including stdio.h.
+ (sigset_t): Guard typedef by _W64.
+
+ * gnulib.mk: New file.
+
+ * epaths.nt: New file.
+
+ * addpm.c [!OLD_PATHS]: Include src/epaths.h, instead of having a
+ copy of the file names there.
+ <env_vars> [!OLD_PATHS]: Use macros from epaths.h instead of
+ literal strings.
+
+ * Makefile.in: New file.
+
+ * INSTALL.MSYS: New file.
+
+ * INSTALL: Mention INSTALL.MSYS.
+
2013-05-15 Stefan Monnier <monnier@iro.umontreal.ca>
* makefile.w32-in (clean, top-distclean): DOC-X doesn't exist any more.
diff --git a/nt/INSTALL b/nt/INSTALL
index 0c4b50f0c28..8abd8aff920 100644
--- a/nt/INSTALL
+++ b/nt/INSTALL
@@ -13,9 +13,13 @@
Do not use this recipe with Cygwin. For building on Cygwin,
use the normal installation instructions, ../INSTALL.
- If you have a Cygwin or MSYS port of Bash on your Path, you will be
- better off removing it from PATH. (For details, search for "MSYS
- sh.exe" below.)
+ Do not use these instructions with MSYS environment. For building
+ the native Windows binary with MinGW and MSYS, follow the
+ instructions in the file INSTALL.MSYS in this directory.
+
+ For building without MSYS, if you have a Cygwin or MSYS port of Bash
+ on your Path, you will be better off removing it from PATH. (For
+ details, search for "MSYS sh.exe" below.)
1. Change to the `nt' directory (the directory of this file):
diff --git a/nt/INSTALL.MSYS b/nt/INSTALL.MSYS
new file mode 100644
index 00000000000..05ba6c65b22
--- /dev/null
+++ b/nt/INSTALL.MSYS
@@ -0,0 +1,640 @@
+ Building and Installing Emacs on MS-Windows
+ using the MSYS and MinGW tools
+
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ See the end of the file for license conditions.
+
+The MSYS/MinGW build described here is supported on versions of
+Windows starting with Windows 2000 and newer. Windows 9X are not
+supported (but the Emacs binary produced by this build will run on
+Windows 9X as well).
+
+* For the brave (a.k.a. "impatient"):
+
+ For those who have a working MSYS/MinGW development environment and
+ are comfortable with running Posix configure scripts, here are the
+ concise instructions for configuring and building the native Windows
+ binary of Emacs with these tools.
+
+ Do not use this recipe with Cygwin. For building on Cygwin, use the
+ normal installation instructions, ../INSTALL.
+
+ Do not use these instructions if you don't have MSYS installed; for
+ that, see the file INSTALL in this directory.
+
+ 0. Start the MSYS Bash window. Everything else below is done from
+ that window's Bash prompt.
+
+ 0a. If you are building from the development trunk (as opposed to a
+ release tarball), produce the configure script, by typing from
+ the top-level Emacs source directory:
+
+ ./autogen.sh
+
+ 1. If you want to build Emacs outside of the source tree
+ (recommended), create the build directory and chdir there.
+
+ 2. Invoke the MSYS-specific configure script:
+
+ - If you are building outside the source tree:
+
+ /PATH/TO/EMACS/SOURCE/TREE/nt/msysconfig.sh --prefix=PREFIX ...
+
+ - If you are building in-place, i.e. inside the source tree:
+
+ ./nt/msysconfig.sh --prefix=PREFIX ...
+
+ It is always preferable to use --prefix to configure Emacs for
+ some specific location of its installed tree; the default
+ /usr/local is not suitable for Windows.
+
+ You can pass other options to the configure script. Here's a
+ typical example (for an in-place debug build):
+
+ CPPFLAGS='-DGLYPH_DEBUG=1' CFLAGS='-O0 -g3' ./nt/msysconfig.sh --prefix=d:/usr/emacs --enable-checking
+
+ 3. After the configure script finishes, it should display the
+ resulting configuration. After that, type
+
+ make
+
+ Use "make -j N" if your MSYS Make supports parallel execution;
+ the build will take significantly less time in that case. Here N
+ is the number of simultaneous parallel jobs; use the number of
+ the cores on your system.
+
+ 4. Install the produced binaries:
+
+ make install
+
+ If you want the installation tree to go to a place that is
+ different from the one specified by --prefix, say
+
+ make install prefix=/where/ever/you/want
+
+ That's it!
+
+ If these short instructions somehow fail, read the rest of this
+ file.
+
+* Installing MinGW and MSYS
+
+ Make sure you carefully read the following two sections in their
+ entirety and install/configure the various packages as instructed.
+ A correct installation makes all the rest almost trivial; a botched
+ installation will likely make you miserable for quite some time.
+
+ There are two alternative to installing MinGW + MSYS: using the GUI
+ installer, called mingw-get, provided by the MinGW project, or
+ manual installation. The next two sections describe each one of
+ these.
+
+** Installing MinGW and MSYS using mingw-get
+
+ A nice GUI installer, called mingw-get, is available for those who
+ don't like to mess with manual installations. You can download it
+ from here:
+
+ https://sourceforge.net/projects/mingw/files/Installer/mingw-get/
+
+ (This installer only supports packages downloaded from the MinGW
+ site; for the rest you will still need the manual method.)
+
+ After installing mingw-get, invoke it to install the packages that
+ are already selected by default on the "Select Components" screen of
+ its wizard.
+
+ After that, use "ming-get install PACKAGE" to install the following
+ additional packages:
+
+ . msys-base
+ . mingw-developer-toolkit
+ . msys-automake
+
+ (We recommend that you refrain from installing the MSYS Texinfo
+ package, which is part of msys-base, because it might produce mixed
+ EOL format when installing Info files. Instead, install the MinGW
+ port of Texinfo, see the ezwinports URL below.)
+
+ At this point, you should be ready to configure and build Emacs in
+ its basic configuration. Skip to the "Generating the configure
+ script" section for the build instructions. If you want to build it
+ with image support and other optional libraries, read about the
+ optional libraries near the end of this document, before you start
+ the build. Also, consider installing additional MinGW packages that
+ are required/recommended, especially if you are building from the
+ Bazaar repository, as described in the next section.
+
+** Installing MinGW and MSYS manually
+
+*** MinGW
+
+ You will need to install the MinGW port of GCC and Binutils, and the
+ MinGW runtime and Windows API distributions, to compile Emacs. You
+ can find these on the MinGW download/Base page:
+
+ https://sourceforge.net/projects/mingw/files/MinGW/Base/
+
+ In general, install the latest stable versions of the following
+ MinGW packages from that page: gcc, binutils, mingw-rt, w32api. You
+ only need the 'bin' and the 'dll' tarballs of each of the above.
+
+ MinGW packages are distributed as .tar.lzma compressed archives. To
+ install the packages manually, we recommend to use the Windows port
+ of the 'bsdtar' program to unpack the tarballs. 'bsdtar' is
+ available as part of the 'libarchive' package from here:
+
+ http://sourceforge.net/projects/ezwinports/files/
+
+ The recommended place to install these packages is a single tree
+ starting from some directory on a drive other than the system drive
+ C:. A typical example would be D:\usr, with D:\usr\bin holding the
+ binaries and DLLs (should be added to your Path environment
+ variable), D:\usr\include holding the include files, D:\usr\lib
+ holding the static and import libraries, D:\usr\share holding docs,
+ message catalogs, and package-specific subdirectories, etc.
+
+ Having all the headers and libraries in a single place will greatly
+ reduce the number of -I and -L flags you will have to pass to the
+ configure script (see below), as these files will be right where the
+ compiler expects them.
+
+ We specifically do NOT recommend installing packages below
+ "C:\Program Files" or "C:\Program Files (x86)". These directories
+ are protected on versions of Windows from Vista and on, and you will
+ have difficulties updating and maintaining your installation later,
+ due to UAC elevation prompts, file virtualization, etc. You *have*
+ been warned!
+
+ Additional MinGW packages are required/recommended, especially if
+ you are building from the Bazaar repository:
+
+ . Texinfo (needed to produce the Info manuals when building from
+ bzr, and for "make install")
+
+ Available from http://sourceforge.net/projects/ezwinports/files/.
+
+ . gzip (needed to compress files during "make install")
+
+ Available from http://gnuwin32.sourceforge.net/packages/gzip.htm.
+
+ . pkg-config (needed for building with some optional libraries,
+ such as GnuTLS and libxml2)
+
+ Available from http://www.gtk.org/download/win32.php
+
+ Each package might list other packages as prerequisites on its
+ download page (under "Runtime requirements"); download those as
+ well. (Using the GUI installer mingw-get will fetch those
+ prerequisites automatically for you.) A missing prerequisite will
+ manifest itself by the program failing to run and presenting a
+ pop-up dialog that states the missing or incompatible DLL; be sure
+ to find and install these missing DLLs.
+
+ Once you think you have MinGW installed, test the installation by
+ building a trivial "hello, world!" program, and make sure that it
+ builds without any error messages and the binary works when run.
+
+*** MSYS
+
+ You will need a reasonably full MSYS installation. MSYS is an
+ environment needed to run the Posix configure scripts and the
+ resulting Makefile's, in order to produce native Windows binaries
+ using the MinGW compiler and runtime libraries. Here's the list of
+ MSYS packages that are required:
+
+ . All the packages from the MSYS Base distribution, listed here:
+
+ https://sourceforge.net/projects/mingw/files/MSYS/Base/
+
+ . Additional packages listed below, from the MSYS Extension
+ distribution here:
+
+ https://sourceforge.net/projects/mingw/files/MSYS/Extension/
+
+ - flex
+ - bison
+ - m4
+ - perl
+ - mktemp
+
+ These should only be needed if you intend to build development
+ versions of Emacs from the Bazaar repository.
+
+ . Additional packages (needed only if building from the Bazaar
+ repository): Automake and Autoconf. They are available from
+ here:
+
+ http://sourceforge.net/projects/ezwinports/files/automake-1.11.6-msys-bin.zip/download
+ http://sourceforge.net/projects/ezwinports/files/autoconf-2.65-msys-bin.zip/download
+
+ MSYS packages are distributed as .tar.lzma compressed archives. To
+ install the packages manually, we recommend to use the Windows port
+ of the 'bsdtar' program, already mentioned above.
+
+ If/when you are confident in your MinGW/MSYS installation, and want
+ to speed up the builds, we recommend installing a pre-release
+ version of Make from here:
+
+ https://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/
+
+ These are snapshot builds of many packages, but you only need
+ make.exe from there. The advantage of this make.exe is that it
+ supports parallel builds, so you can use "make -j N" to considerably
+ speed up your builds
+
+ For each of these packages, install the 'bin' and 'dll' tarballs of
+ their latest stable releases. If there's an 'ext' tarball (e.g.,
+ msysCORE and Coreutils have it), download and install those as well.
+
+ Each package might list other packages as prerequisites on its
+ download page (under "Runtime requirements"); download those as
+ well. (Using the GUI installer mingw-get will fetch those
+ prerequisites automatically for you.) A missing prerequisite will
+ manifest itself by the program failing to run and presenting a
+ pop-up dialog that states the missing or incompatible DLL; be sure
+ to find and install these missing DLLs.
+
+ MSYS packages should be installed in a separate tree from MinGW.
+ For example, use D:\MSYS or D:\usr\MSYS as the top-level directory
+ from which you unpack all of the MSYS packages.
+
+ Do NOT add the MSYS bin directory to your Windows Path! Only the
+ MinGW bin directory should be on Path. When you install MSYS, it
+ creates a shortcut on your desktop that invokes the MSYS Bash shell
+ in a Command Prompt window; that shell is already set up so that the
+ MSYS bin directory is on PATH ahead of any other directory. Thus,
+ Bash will find MSYS executables first, which is exactly what you
+ need.
+
+ At this point, you are ready to build Emacs in its basic
+ configuration. If you want to build it with image support and other
+ optional libraries, read about that near the end of this document.
+
+* Generating the configure script
+
+ If you are building a release or pretest tarball, skip this section,
+ because the configure script is already present in the tarball.
+
+ To build a development snapshot from the Emacs Bazaar repository,
+ you will first need to generate the configure script and a few other
+ auto-generated files. (If this step, described below, somehow
+ fails, you can use the files in the autogen/ directory instead, but
+ they might be outdated, and, most importantly, you are well advised
+ not to disregard any failures in your local build procedures, as
+ these are likely to be symptoms of incorrect installation that will
+ bite you down the road.)
+
+ To generate the configure script, type this at the MSYS Bash prompt
+ from the top-level directory of the Emacs tree:
+
+ ./autogen.sh
+
+ If successful, this command should produce the following output:
+
+ $ ./autogen.sh
+ Checking whether you have the necessary tools...
+ (Read INSTALL.BZR for more details on building Emacs)
+
+ Checking for autoconf (need at least version 2.65)...
+ ok
+ Checking for automake (need at least version 1.11)...
+ ok
+ Your system has the required tools, running autoreconf...
+ You can now run `./configure'.
+
+* Configuring Emacs for MinGW:
+
+ Now it's time to run the configure script. You can do that either
+ from a separate build directory that is outside of the Emacs source
+ tree (recommended), or from inside the source tree. The former is
+ recommended because it allows you to have several different builds,
+ e.g., an optimized build and an unoptimized one, of the same
+ revision of the source tree; the source tree will be left in its
+ pristine state, without any build products.
+
+ You invoke the configure script like this:
+
+ /PATH/TO/EMACS/SOURCE/TREE/nt/msysconfig.sh --prefix=PREFIX ...
+
+ or, if you are building in-place, i.e. inside the source tree:
+
+ ./nt/msysconfig.sh --prefix=PREFIX ...
+
+ Here PREFIX is the place where you eventually want to install Emacs
+ once built, e.g. d:/usr.
+
+ You can pass additional options to the configure script, for the
+ full list type
+
+ ./nt/msysconfig.sh --help
+
+ As explained in the help text, you may need to tell the script what
+ are the optional flags to invoke the compiler. This is needed if
+ some of your headers and libraries, e.g., those belonging to
+ optional image libraries, are installed in places where the compiler
+ normally doesn't look for them. (Remember that advice above to
+ avoid such situations? here's is where you will start paying for
+ disregarding that recommendation.) For example, if you have libpng
+ headers in C:\emacs\libs\libpng-1.2.37-lib\include and jpeg library
+ headers in C:\emacs\libs\jpeg-6b-4-lib\include, you will need to say
+ something like this:
+
+ CPPFLAGS='-Ic:/emacs/libs/libpng-1.2.37-lib/include -Ic:/emacs/libs/jpeg-6b-4-lib/include' ./nt/msysconfig.sh --prefix=PREFIX
+
+ which is quite a mouth-full, especially if you have more directories
+ to specify... Perhaps you may wish to revisit your installation
+ decisions now.
+
+ A few frequently used options are needed when you want to produce an
+ unoptimized binary with runtime checks enabled:
+
+ CPPFLAGS='-DGLYPH_DEBUG=1' CFLAGS='-O0 -g3' ./nt/msysconfig.sh --prefix=PREFIX --enable-checking
+
+ Once invoked, the configure script will run for some time, and, if
+ successful, will eventually produce a summary of the configuration
+ like this:
+
+ Configured for `i686-pc-mingw32'.
+
+ Where should the build process find the source code? /path/to/emacs/sources
+ What compiler should emacs be built with? gcc -std=gnu99 -O0 -g3
+ Should Emacs use the GNU version of malloc? yes
+ Should Emacs use a relocating allocator for buffers? yes
+ Should Emacs use mmap(2) for buffer allocation? no
+ What window system should Emacs use? w32
+ What toolkit should Emacs use? none
+ Where do we find X Windows header files? NONE
+ Where do we find X Windows libraries? NONE
+ Does Emacs use -lXaw3d? no
+ Does Emacs use -lXpm? yes
+ Does Emacs use -ljpeg? yes
+ Does Emacs use -ltiff? yes
+ Does Emacs use a gif library? yes
+ Does Emacs use -lpng? yes
+ Does Emacs use -lrsvg-2? no
+ Does Emacs use imagemagick? no
+ Does Emacs use -lgpm? no
+ Does Emacs use -ldbus? no
+ Does Emacs use -lgconf? no
+ Does Emacs use GSettings? no
+ Does Emacs use -lselinux? no
+ Does Emacs use -lgnutls? yes
+ Does Emacs use -lxml2? yes
+ Does Emacs use -lfreetype? no
+ Does Emacs use -lm17n-flt? no
+ Does Emacs use -lotf? no
+ Does Emacs use -lxft? no
+ Does Emacs use toolkit scroll bars? yes
+
+ You are almost there, hang on.
+
+ If the output is significantly different, or if configure finishes
+ prematurely and displays some error message, you should examine the
+ configuration log in config.log and find the reason for the failure.
+
+ Once you succeeded in configuring Emacs, and just want to rebuild it
+ after updating your local repository from the main repository, you
+ don't need to re-run the configure script manually, unless you want
+ to change the configure-time options. Just typing "make" will
+ re-run configure if necessary with the exact same options you
+ specified originally, and then go on to invoking Make, described
+ below.
+
+* Running Make.
+
+ This is simple: just type "make" and sit back, watching the fun.
+
+ If you installed a snapshot build of Make, the build will be much
+ faster if you type "make -j N" instead, where N is the number of
+ independent processing units on your machine. E.g., on a core i7
+ system try using N of 6 or even 8.
+
+ When Make finishes, you can install the produced binaries:
+
+ make install
+
+ or, if you want the installed tree to go in a place different from
+ the configured one, type
+
+ make install prefix=WHEREVER
+
+ Congrats! You have built and installed your own Emacs!
+
+* Make targets
+
+ The following make targets may be used by users building the source
+ distribution, or users who have checked out of Bazaar after
+ an initial bootstrapping.
+
+ make
+ Builds Emacs from the available sources and pre-compiled lisp files.
+
+ make install
+ Installs the built programs and the auxiliary files.
+
+ make clean
+ Removes object and executable files produced by the build process in
+ the current configuration. After "make clean", you can rebuild with
+ the same configuration using make. useful when you want to be sure
+ that all of the products are built from coherent sources.
+
+ make distclean
+ In addition to the files removed by make clean, this also removes
+ Makefiles and other generated files to get back to the state of a
+ freshly unpacked source distribution. After make distclean, it is
+ necessary to run the configure script followed by "make", in order
+ to rebuild.
+
+ The following targets are intended only for use with the Bazaar sources.
+
+ make bootstrap
+ Removes all the auto-generated files and all the *.elc byte-compiled
+ files, and builds Emacs from scratch. Useful when some change in
+ basic Emacs functionality makes byte compilation of updated files
+ fail.
+
+ make maintainer-clean
+ Removes everything that can be recreated, including compiled Lisp
+ files, to get back to the state of a fresh Bazaar tree. After make
+ maintainer-clean, it is necessary to run configure and "make" or
+ "make bootstrap" to rebuild. Occasionally it may be necessary to
+ run this target after an update.
+
+* Optional image library support
+
+ In addition to its "native" image formats (pbm and xbm), Emacs can
+ handle other image types: xpm, tiff, gif, png, jpeg and experimental
+ support for svg.
+
+ To build Emacs with support for them, the corresponding headers must
+ be in the include path and libraries should be where the linker
+ looks for them, when the configure script is run. If needed, this
+ can be set up using the CPPFLAGS and CFLAGS variable specified on
+ the configure command line. The configure script will report
+ whether it was able to detect the headers and libraries. If the
+ results of this testing appear to be incorrect, please look for
+ details in the file config.log: it will show the failed test
+ programs and compiler error messages that should explain what is
+ wrong. (Usually, any such failures happen because some headers are
+ missing due to bad packaging of the image support libraries.)
+
+ Note that any file path passed to the compiler or linker must use
+ forward slashes, or double each backslash, as that is how Bash
+ works.
+
+ If the configure script finds the necessary headers and libraries,
+ but they are for some reason incompatible, or if you want to omit
+ support for some image library that is installed on your system for
+ some other reason, use the --without-PACKAGE option to configure,
+ such as --without-gif to omit GIF, --without-tiff to omit TIFF, etc.
+ Passing the --help option to the configure script displays all of
+ the supported --without-PACKAGE options.
+
+ To use the external image support, the DLLs implementing the
+ functionality must be found when Emacs first needs them, either on the
+ PATH, or in the same directory as emacs.exe. Failure to find a
+ library is not an error; the associated image format will simply be
+ unavailable. Note that once Emacs has determined that a library can
+ not be found, there's no way to force it to try again, other than
+ restarting. See the variable `dynamic-library-alist' to configure the
+ expected names of the libraries.
+
+ Some image libraries have dependencies on one another, or on zlib.
+ For example, tiff support depends on the jpeg library. If you did not
+ compile the libraries yourself, you must make sure that any dependency
+ is in the PATH or otherwise accessible and that the binaries are
+ compatible (for example, that they were built with the same compiler).
+
+ Binaries for the image libraries (among many others) can be found at
+ the GnuWin32 project. PNG, JPEG and TIFF libraries are also
+ included with GTK, which is installed along with other Free Software
+ that requires it. Note specifically that, due to some packaging
+ snafus in the GnuWin32-supplied image libraries, you will need to
+ download _source_ packages for some of the libraries in order to get
+ the header files necessary for building Emacs with image support.
+
+ For PNG images, we recommend to use versions 1.4.x and later of
+ libpng, because previous versions had security issues. You can find
+ precompiled libraries and headers on the GTK download page for
+ Windows (http://www.gtk.org/download/win32.php).
+
+ Versions 1.4.0 and later of libpng are binary incompatible with
+ earlier versions, so Emacs will only look for libpng libraries which
+ are compatible with the version it was compiled against. That
+ version is given by the value of the Lisp variable `libpng-version';
+ e.g., 10403 means version 1.4.3. The variable `dynamic-library-alist'
+ is automatically set to name only those DLL names that are known to
+ be compatible with the version given by `libpng-version'. If PNG
+ support does not work for you even though you have the support DLL
+ installed, check the name of the installed DLL against
+ `dynamic-library-alist' and the value of `libpng-version', and
+ download compatible DLLs if needed.
+
+* Optional GnuTLS support
+
+ To compile with GnuTLS, you will need pkg-config to be installed, as
+ the configure script invokes pkg-config to find out which compiler
+ switches to use for GnuTLS. See above for the URL where you can
+ find pkg-config for Windows.
+
+ You will also need to install the p11-kit package, which is a
+ dependency of GnuTLS, and its header files are needed for
+ compilation of programs that use GnuTLS. You can find p11-kit on
+ the same site as GnuTLS, see the URL below.
+
+ If the configure script finds the GnuTLS header files and libraries
+ on your system, Emacs is built with GnuTLS support by default; to
+ avoid that you can pass the argument --without-gnutls.
+
+ In order to support GnuTLS at runtime, a GnuTLS-enabled Emacs must
+ be able to find the relevant DLLs during startup; failure to do so
+ is not an error, but GnuTLS won't be available to the running
+ session.
+
+ You can get pre-built binaries (including any required DLL and the
+ header files) at http://sourceforge.net/projects/ezwinports/files/.
+
+* Optional libxml2 support
+
+ To compile with libxml2, you will need pkg-config to be installed,
+ as the configure script invokes pkg-config to find out which
+ compiler switches to use for libxml2. See above for the URL where
+ you can find pkg-config for Windows.
+
+ If the configure script finds the libxml2 header files and libraries
+ on your system, Emacs is built with libxml2 support by default; to
+ avoid that you can pass the argument --without-libxml2.
+
+ In order to support libxml2 at runtime, a libxml2-enabled Emacs must
+ be able to find the relevant DLLs during startup; failure to do so
+ is not an error, but libxml2 features won't be available to the
+ running session.
+
+ One place where you can get pre-built Windows binaries of libxml2
+ (including any required DLL and the header files) is here:
+
+ http://sourceforge.net/projects/ezwinports/files/
+
+ For runtime support of libxml2, you will also need to install the
+ libiconv "development" tarball, because the libiconv headers need to
+ be available to the compiler when you compile with libxml2 support.
+ A MinGW port of libiconv can be found on the MinGW site:
+
+ http://sourceforge.net/projects/mingw/files/MinGW/Base/libiconv/
+
+ You need the libiconv-X.Y.Z-N-mingw32-dev.tar.lzma tarball from that
+ site.
+
+* Experimental SVG support
+
+ To compile with SVG, you will need pkg-config to be installed, as
+ the configure script invokes pkg-config to find out which compiler
+ switches to use for SVG. See above for the URL where you can find
+ pkg-config for Windows.
+
+ SVG support is currently experimental, and not built by default.
+ Specify --with-rsvg and ensure you have all the dependencies in your
+ include path. Unless you have built a minimalist librsvg yourself
+ (untested), librsvg depends on a significant chunk of GTK+ to build,
+ plus a few Gnome libraries, libxml2, libbz2 and zlib at runtime. The
+ easiest way to obtain the dependencies required for building is to
+ download a pre-bundled GTK+ development environment for Windows.
+
+ To use librsvg at runtime, ensure that librsvg and its dependencies
+ are on your PATH. If you didn't build librsvg yourself, you will
+ need to check with where you downloaded it from for the
+ dependencies, as there are different build options. If it is a
+ short list, then it most likely only lists the immediate
+ dependencies of librsvg, but the dependencies themselves have
+ dependencies - so don't download individual libraries from GTK+,
+ download and install the whole thing. If you think you've got all
+ the dependencies and SVG support is still not working, check your
+ PATH for other libraries that shadow the ones you downloaded.
+ Libraries of the same name from different sources may not be
+ compatible, this problem was encountered with libbzip2 from GnuWin32
+ with libcroco from gnome.org.
+
+ If you can see etc/images/splash.svg, then you have managed to get
+ SVG support working. Congratulations for making it through DLL hell
+ to this point. You'll probably find that some SVG images crash
+ Emacs. Problems have been observed in some images that contain
+ text, they seem to be a problem in the Windows port of Pango, or
+ maybe a problem with the way Cairo or librsvg is using it that
+ doesn't show up on other platforms.
+
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
diff --git a/nt/Makefile.in b/nt/Makefile.in
new file mode 100644
index 00000000000..3d5e1ca084c
--- /dev/null
+++ b/nt/Makefile.in
@@ -0,0 +1,212 @@
+# nt/Makefile for GNU Emacs.
+
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
+# This file is part of GNU Emacs.
+
+# GNU Emacs is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU Emacs is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+# Avoid trouble on systems where the `SHELL' variable might be
+# inherited from the environment.
+SHELL = /bin/sh
+
+# ==================== Things `configure' will edit ====================
+
+CC=@CC@
+CFLAGS=@CFLAGS@
+version=@version@
+## Used in $archlibdir.
+configuration=@configuration@
+EXEEXT=@EXEEXT@
+C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
+C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
+PROFILING_CFLAGS = @PROFILING_CFLAGS@
+WARN_CFLAGS = @WARN_CFLAGS@
+WERROR_CFLAGS = @WERROR_CFLAGS@
+
+# Program name transformation.
+TRANSFORM = @program_transform_name@
+
+# ==================== Where To Install Things ====================
+
+# The default location for installation. Everything is placed in
+# subdirectories of this directory. The default values for many of
+# the variables below are expressed in terms of this one, so you may
+# not need to change them. This is set with the --prefix option to
+# `../configure'.
+prefix=@prefix@
+
+# Like `prefix', but used for architecture-specific files. This is
+# set with the --exec-prefix option to `../configure'.
+exec_prefix=@exec_prefix@
+
+# Where to install Emacs and other binaries that people will want to
+# run directly (like etags). This is set with the --bindir option
+# to `../configure'.
+bindir=@bindir@
+
+# Where to install and expect executable files to be run by Emacs
+# rather than directly by users, and other architecture-dependent
+# data. ${archlibdir} is usually below this. This is set with the
+# --libexecdir option to `../configure'.
+libexecdir=@libexecdir@
+
+# Directory for local state files for all programs.
+localstatedir=@localstatedir@
+
+# Where to find the source code. This is set by the configure
+# script's `--srcdir' option. However, the value of ${srcdir} in
+# this makefile is not identical to what was specified with --srcdir,
+# since the variable here has `/lib-src' added at the end.
+
+# We use $(srcdir) explicitly in dependencies so as not to depend on VPATH.
+srcdir=@srcdir@
+VPATH=@srcdir@
+
+# The top-level source directory, also set by configure.
+top_srcdir=@top_srcdir@
+
+# ==================== Emacs-specific directories ====================
+
+# These variables hold the values Emacs will actually use. They are
+# based on the values of the standard Make variables above.
+
+# Where to put executables to be run by Emacs rather than the user.
+# This path usually includes the Emacs version and configuration name,
+# so that multiple configurations for multiple versions of Emacs may
+# be installed at once. This can be set with the --archlibdir option
+# to `../configure'.
+archlibdir=@archlibdir@
+
+# ==================== Utility Programs for the Build =================
+
+# ../configure figures out the correct values for these.
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+# By default, we uphold the dignity of our programs.
+INSTALL_STRIP =
+MKDIR_P = @MKDIR_P@
+
+# ========================== Lists of Files ===========================
+
+# Things that a user might actually run, which should be installed in bindir.
+INSTALLABLES = runemacs${EXEEXT} addpm${EXEEXT}
+
+# Things that Emacs runs internally, which should not be installed in bindir.
+UTILITIES = cmdproxy${EXEEXT} ddeclient${EXEEXT}
+
+# Things that Emacs runs during the build process.
+DONT_INSTALL = addsection${EXEEXT}
+
+# All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
+EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
+
+# =========================== Configuration ===========================
+
+# MS-Windows resource files and resource compiler
+EMACSRES = @EMACSRES@
+EMACS_MANIFEST = @EMACS_MANIFEST@
+WINDRES = @WINDRES@
+
+## Extra libraries to use when linking addpm.
+LIBS_ADDPM = -lole32 -luuid
+
+## Compilation and linking flags
+BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
+ $(WARN_CFLAGS) $(WERROR_CFLAGS) \
+ -I. -I${srcdir}
+
+ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
+LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
+CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
+
+all: ${EXE_FILES}
+
+.PHONY: all
+
+## Install the internal utilities. Until they are installed, we can
+## just run them directly from nt/.
+$(DESTDIR)${archlibdir}: all
+ @echo
+ @echo "Installing utilities run internally by Emacs."
+ umask 022; ${MKDIR_P} $(DESTDIR)${archlibdir}
+ if [ `cd $(DESTDIR)${archlibdir} && /bin/pwd` != `/bin/pwd` ]; then \
+ for file in ${UTILITIES}; do \
+ $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
+ done ; \
+ fi
+
+.PHONY: install uninstall mostlyclean clean distclean maintainer-clean
+.PHONY: extraclean check tags
+
+install: $(DESTDIR)${archlibdir}
+ @echo
+ @echo "Installing utilities for users to run."
+ umask 022; ${MKDIR_P} $(DESTDIR)${bindir}
+ for file in ${INSTALLABLES} ; do \
+ $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
+ done
+
+uninstall:
+ for file in ${INSTALLABLES}; do \
+ rm -f $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
+ done
+ if [ -d $(DESTDIR)${archlibdir} ]; then \
+ (cd $(DESTDIR)${archlibdir} && rm -f ${UTILITIES}) \
+ fi
+
+mostlyclean:
+ -rm -f core *.o
+
+clean: mostlyclean
+ -rm -f ${EXE_FILES}
+
+distclean: clean
+ -rm -f TAGS
+ -rm -f Makefile
+
+maintainer-clean: distclean
+ true
+
+extraclean: maintainer-clean
+ -rm -f *~ \#*
+
+## Test the contents of the directory.
+check:
+ @echo "We don't have any tests for the nt/ directory yet."
+
+tags: TAGS
+TAGS: ${EXE_FILES:${EXEEXT}=.c}
+ ../lib-src/etags *.[ch]
+
+## Build the programs
+addsection${EXEEXT}: ${srcdir}/addsection.c
+ $(CC) ${ALL_CFLAGS} ${srcdir}/addsection.c -o addsection${EXEEXT}
+
+addpm${EXEEXT}: ${srcdir}/addpm.c ../src/epaths.h
+ $(CC) ${ALL_CFLAGS} ${srcdir}/addpm.c $(LIBS_ADDPM) -o addpm${EXEEXT}
+
+ddeclient${EXEEXT}: ${srcdir}/ddeclient.c
+ $(CC) ${ALL_CFLAGS} ${srcdir}/ddeclient.c -o ddeclient${EXEEXT}
+
+cmdproxy${EXEEXT}: ${srcdir}/cmdproxy.c
+ $(CC) ${ALL_CFLAGS} ${srcdir}/cmdproxy.c -o cmdproxy${EXEEXT}
+
+runemacs${EXEEXT}: ${srcdir}/runemacs.c $(EMACSRES)
+ $(CC) ${ALL_CFLAGS} ${srcdir}/runemacs.c $(EMACSRES) -mwindows \
+ -o runemacs${EXEEXT}
+
+emacs.res: ${srcdir}/emacs.rc ${srcdir}/icons/emacs.ico ${srcdir}/$(EMACS_MANIFEST)
+ ${WINDRES} -O coff -o emacs.res ${srcdir}/emacs.rc
diff --git a/nt/addpm.c b/nt/addpm.c
index 688e0167334..48c77821c8c 100644
--- a/nt/addpm.c
+++ b/nt/addpm.c
@@ -50,6 +50,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <shlobj.h>
#include <ddeml.h>
+#ifndef OLD_PATHS
+#include "../src/epaths.h"
+#endif
+
HDDEDATA CALLBACK
DdeCallback (UINT uType, UINT uFmt, HCONV hconv,
HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
@@ -76,6 +80,7 @@ static struct entry
}
env_vars[] =
{
+#ifdef OLD_PATHS
{"emacs_dir", NULL},
{"EMACSLOADPATH", "%emacs_dir%/site-lisp;%emacs_dir%/../site-lisp;%emacs_dir%/lisp;%emacs_dir%/leim"},
{"SHELL", "%emacs_dir%/bin/cmdproxy.exe"},
@@ -86,6 +91,18 @@ env_vars[] =
/* {"INFOPATH", "%emacs_dir%/info"}, */
{"EMACSDOC", "%emacs_dir%/etc"},
{"TERM", "cmd"}
+#else /* !OLD_PATHS */
+ {"emacs_dir", NULL},
+ {"EMACSLOADPATH", PATH_SITELOADSEARCH ";" PATH_LOADSEARCH},
+ {"SHELL", PATH_EXEC "/cmdproxy.exe"},
+ {"EMACSDATA", PATH_DATA},
+ {"EMACSPATH", PATH_EXEC},
+ /* We no longer set INFOPATH because Info-default-directory-list
+ is then ignored. */
+ /* {"INFOPATH", "%emacs_dir%/info"}, */
+ {"EMACSDOC", PATH_DOC},
+ {"TERM", "cmd"}
+#endif
};
BOOL
diff --git a/nt/epaths.nt b/nt/epaths.nt
new file mode 100644
index 00000000000..1e418550d52
--- /dev/null
+++ b/nt/epaths.nt
@@ -0,0 +1,89 @@
+/* Hey Emacs, this is -*- C -*- code! */
+/* epaths.in file for MS-Windows build that uses the configure script.
+
+ Since Emacs on Windows must be relocatable to any directory, it
+ cannot have here hard-coded directories determined at configure
+ time. Therefore, each directory must begin with %emacs_dir%, which
+ is resolved at startup to the root of the Emacs installation tree
+ (see w32.c:init_environment).
+
+ This file is edited at configure time to replace @VER@ by the Emacs
+ version being built (e.g., 25.9.77), @CFG@ by the canonical name of
+ the host system (e.g., i686-pc-mingw32), and @SRC@ by the root of
+ the Emacs source tree used to build Emacs. */
+/*
+Copyright (C) 1993, 1995, 1997, 1999, 2001-2013 Free Software
+Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
+
+
+/* Together with PATH_SITELOADSEARCH, this gives the default value of
+ load-path, which is the search path for the Lisp function "load".
+ Configure (using "make epaths-force") sets this to
+ ${standardlisppath}, which typically has a value like:
+ <datadir>/emacs/VERSION/lisp:<datadir>/emacs/VERSION/leim
+ where datadir is eg /usr/local/share.
+*/
+#define PATH_LOADSEARCH "%emacs_dir%/share/emacs/@VER@/lisp;%emacs_dir%/share/emacs/@VER@/leim"
+
+/* Like PATH_LOADSEARCH, but contains the non-standard pieces.
+ These are the site-lisp directories, typically something like
+ <datadir>/emacs/VERSION/site-lisp:<datadir>/emacs/site-lisp
+ Configure prepends any $locallisppath, as set by the
+ --enable-locallisppath argument.
+ This is combined with PATH_LOADSEARCH to make the default load-path.
+ If the --no-site-lisp option is used, this piece is excluded.
+*/
+#define PATH_SITELOADSEARCH "%emacs_dir%/share/emacs/@VER@/site-lisp;%emacs_dir%/share/emacs/site-lisp"
+
+/* Like PATH_LOADSEARCH, but used only during the build process
+ when Emacs is dumping. Configure (using "make epaths-force") sets
+ this to $buildlisppath, which normally has the value: <srcdir>/lisp.
+*/
+#define PATH_DUMPLOADSEARCH "@SRC@/lisp"
+
+/* The extra search path for programs to invoke. This is appended to
+ whatever the PATH environment variable says to set the Lisp
+ variable exec-path and the first file name in it sets the Lisp
+ variable exec-directory. exec-directory is used for finding
+ executables and other architecture-dependent files. */
+#define PATH_EXEC "%emacs_dir%/libexec/emacs/@VER@/@CFG@"
+
+/* Where Emacs should look for its architecture-independent data
+ files, like the NEWS file. The lisp variable data-directory
+ is set to this value. */
+#define PATH_DATA "%emacs_dir%/share/emacs/@VER@/etc"
+
+/* Where Emacs should look for X bitmap files.
+ The lisp variable x-bitmap-file-path is set based on this value. */
+#define PATH_BITMAPS ""
+
+/* Where Emacs should look for its docstring file. The lisp variable
+ doc-directory is set to this value. */
+#define PATH_DOC "%emacs_dir%/share/emacs/@VER@/etc"
+
+/* Where the configuration process believes the info tree lives. The
+ lisp variable configure-info-directory gets its value from this
+ macro, and is then used to set the Info-default-directory-list. */
+#define PATH_INFO "%emacs_dir%/share/info"
+
+/* Where Emacs should store game score files. */
+#define PATH_GAME "%emacs_dir%/var/games/emacs"
+
+/* Where Emacs should look for the application default file. */
+#define PATH_X_DEFAULTS ""
+
diff --git a/nt/gnulib.mk b/nt/gnulib.mk
new file mode 100644
index 00000000000..ac4fc2768d9
--- /dev/null
+++ b/nt/gnulib.mk
@@ -0,0 +1,902 @@
+## This file is an edited copy if ../lib/gnulib.mk.
+##
+## The purpose of the edits is to avoid generating any headers
+## which would conflict with either the headers we have in nt/inc,
+## or with MinGW system headers and subsequent redirection of some
+## functions in nt/inc/ms-w32.h.
+##
+## In general, do NOT remove anything from ../lib/gnulib.mk that
+## doesn't need to be removed, to minimize the differences from
+## upstream gnulib.mk and thus make the maintenance easier. Every
+## header file whose generation is controlled by configure-time tests
+## does NOT need to be removed; instead, force the configure script to
+## accept whatever MinGW has to offer, by defining the appropriate
+## Autoconf variable in the nt/mingw-cfg.site file. Headers that are
+## generated conditionally have the tell-tale "if GL_GENERATE_foo_H"
+## condition before their Makefile snippet in this file. Likewise, do
+## NOT remove gnulib modules which introduce header files that don't
+## exist in MinGW and in nt/inc/, since they cannot possibly clash
+## with anything. Gnulib modules that introduce source *.c files also
+## need not be removed; if they define functions that could clash with
+## the w32 substitutes in Emacs, disable their compilation by defining
+## suitable variables in nt/mingw-cfg.site.
+##
+## Process this file with automake to produce Makefile.in.
+# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this file. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License,
+# this file may be distributed as part of a program that
+# contains a configuration script generated by Autoconf, under
+# the same distribution terms as the rest of that program.
+#
+# Generated by gnulib-tool.
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=dup --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings memrchr mktime pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv utimens warnings
+
+
+MOSTLYCLEANFILES += core *.stackdump
+
+noinst_LIBRARIES += libgnu.a
+
+libgnu_a_SOURCES =
+libgnu_a_LIBADD = $(gl_LIBOBJS)
+libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
+EXTRA_libgnu_a_SOURCES =
+
+## begin gnulib module alloca-opt
+
+BUILT_SOURCES += $(ALLOCA_H)
+
+# We need the following in order to create <alloca.h> when the system
+# doesn't have one that works with the given compiler.
+if GL_GENERATE_ALLOCA_H
+alloca.h: alloca.in.h $(top_builddir)/config.status
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ cat $(srcdir)/alloca.in.h; \
+ } > $@-t && \
+ mv -f $@-t $@
+else
+alloca.h: $(top_builddir)/config.status
+ rm -f $@
+endif
+MOSTLYCLEANFILES += alloca.h alloca.h-t
+
+EXTRA_DIST += alloca.in.h
+
+## end gnulib module alloca-opt
+
+## begin gnulib module c-ctype
+
+libgnu_a_SOURCES += c-ctype.h c-ctype.c
+
+## end gnulib module c-ctype
+
+## begin gnulib module c-strcase
+
+libgnu_a_SOURCES += c-strcase.h c-strcasecmp.c c-strncasecmp.c
+
+## end gnulib module c-strcase
+
+## begin gnulib module close-stream
+
+libgnu_a_SOURCES += close-stream.c
+
+EXTRA_DIST += close-stream.h
+
+## end gnulib module close-stream
+
+## begin gnulib module crypto/md5
+
+libgnu_a_SOURCES += md5.c
+
+EXTRA_DIST += md5.h
+
+## end gnulib module crypto/md5
+
+## begin gnulib module crypto/sha1
+
+libgnu_a_SOURCES += sha1.c
+
+EXTRA_DIST += sha1.h
+
+## end gnulib module crypto/sha1
+
+## begin gnulib module crypto/sha256
+
+libgnu_a_SOURCES += sha256.c
+
+EXTRA_DIST += sha256.h
+
+## end gnulib module crypto/sha256
+
+## begin gnulib module crypto/sha512
+
+libgnu_a_SOURCES += sha512.c
+
+EXTRA_DIST += sha512.h
+
+## end gnulib module crypto/sha512
+
+## begin gnulib module dosname
+
+if gl_GNULIB_ENABLED_dosname
+
+endif
+EXTRA_DIST += dosname.h
+
+## end gnulib module dosname
+
+## begin gnulib module dtoastr
+
+libgnu_a_SOURCES += dtoastr.c
+
+EXTRA_DIST += ftoastr.c ftoastr.h
+
+EXTRA_libgnu_a_SOURCES += ftoastr.c
+
+## end gnulib module dtoastr
+
+## begin gnulib module dtotimespec
+
+libgnu_a_SOURCES += dtotimespec.c
+
+## end gnulib module dtotimespec
+
+## begin gnulib module dup2
+
+
+EXTRA_DIST += dup2.c
+
+EXTRA_libgnu_a_SOURCES += dup2.c
+
+## end gnulib module dup2
+
+## begin gnulib module errno
+
+BUILT_SOURCES += $(ERRNO_H)
+
+# We need the following in order to create <errno.h> when the system
+# doesn't have one that is POSIX compliant.
+if GL_GENERATE_ERRNO_H
+errno.h: errno.in.h $(top_builddir)/config.status
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+ -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
+ -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \
+ -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \
+ -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \
+ -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \
+ -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
+ -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
+ < $(srcdir)/errno.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+else
+errno.h: $(top_builddir)/config.status
+ rm -f $@
+endif
+MOSTLYCLEANFILES += errno.h errno.h-t
+
+EXTRA_DIST += errno.in.h
+
+## end gnulib module errno
+
+## begin gnulib module euidaccess
+
+if gl_GNULIB_ENABLED_euidaccess
+
+endif
+EXTRA_DIST += euidaccess.c
+
+EXTRA_libgnu_a_SOURCES += euidaccess.c
+
+## end gnulib module euidaccess
+
+## begin gnulib module execinfo
+
+BUILT_SOURCES += $(EXECINFO_H)
+
+# We need the following in order to create <execinfo.h> when the system
+# doesn't have one that works.
+if GL_GENERATE_EXECINFO_H
+execinfo.h: execinfo.in.h $(top_builddir)/config.status
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ cat $(srcdir)/execinfo.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+else
+execinfo.h: $(top_builddir)/config.status
+ rm -f $@
+endif
+MOSTLYCLEANFILES += execinfo.h execinfo.h-t
+
+EXTRA_DIST += execinfo.c execinfo.in.h
+
+EXTRA_libgnu_a_SOURCES += execinfo.c
+
+## end gnulib module execinfo
+
+## begin gnulib module faccessat
+
+
+EXTRA_DIST += at-func.c faccessat.c
+
+EXTRA_libgnu_a_SOURCES += at-func.c faccessat.c
+
+## end gnulib module faccessat
+
+## begin gnulib module fdatasync
+
+
+EXTRA_DIST += fdatasync.c
+
+EXTRA_libgnu_a_SOURCES += fdatasync.c
+
+## end gnulib module fdatasync
+
+## begin gnulib module fdopendir
+
+
+EXTRA_DIST += fdopendir.c
+
+EXTRA_libgnu_a_SOURCES += fdopendir.c
+
+## end gnulib module fdopendir
+
+## begin gnulib module filemode
+
+libgnu_a_SOURCES += filemode.c
+
+EXTRA_DIST += filemode.h
+
+## end gnulib module filemode
+
+## begin gnulib module fpending
+
+
+EXTRA_DIST += fpending.c fpending.h
+
+EXTRA_libgnu_a_SOURCES += fpending.c
+
+## end gnulib module fpending
+
+## begin gnulib module fstatat
+
+
+EXTRA_DIST += at-func.c fstatat.c
+
+EXTRA_libgnu_a_SOURCES += at-func.c fstatat.c
+
+## end gnulib module fstatat
+
+## begin gnulib module fsync
+
+
+EXTRA_DIST += fsync.c
+
+EXTRA_libgnu_a_SOURCES += fsync.c
+
+## end gnulib module fsync
+
+## begin gnulib module getgroups
+
+if gl_GNULIB_ENABLED_getgroups
+
+endif
+EXTRA_DIST += getgroups.c
+
+EXTRA_libgnu_a_SOURCES += getgroups.c
+
+## end gnulib module getgroups
+
+## begin gnulib module getloadavg
+
+
+EXTRA_DIST += getloadavg.c
+
+EXTRA_libgnu_a_SOURCES += getloadavg.c
+
+## end gnulib module getloadavg
+
+## begin gnulib module getopt-posix
+
+BUILT_SOURCES += $(GETOPT_H)
+
+# We need the following in order to create <getopt.h> when the system
+# doesn't have one that works with the given compiler.
+getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H)
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+ -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
+ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+ < $(srcdir)/getopt.in.h; \
+ } > $@-t && \
+ mv -f $@-t $@
+MOSTLYCLEANFILES += getopt.h getopt.h-t
+
+EXTRA_DIST += getopt.c getopt.in.h getopt1.c getopt_int.h
+
+EXTRA_libgnu_a_SOURCES += getopt.c getopt1.c
+
+## end gnulib module getopt-posix
+
+## begin gnulib module gettext-h
+
+if gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36
+libgnu_a_SOURCES += gettext.h
+
+endif
+## end gnulib module gettext-h
+
+## begin gnulib module gettime
+
+libgnu_a_SOURCES += gettime.c
+
+## end gnulib module gettime
+
+## begin gnulib module gettimeofday
+
+
+EXTRA_DIST += gettimeofday.c
+
+EXTRA_libgnu_a_SOURCES += gettimeofday.c
+
+## end gnulib module gettimeofday
+
+## begin gnulib module group-member
+
+if gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1
+
+endif
+EXTRA_DIST += group-member.c
+
+EXTRA_libgnu_a_SOURCES += group-member.c
+
+## end gnulib module group-member
+
+## begin gnulib module ignore-value
+
+
+EXTRA_DIST += ignore-value.h
+
+## end gnulib module ignore-value
+
+## begin gnulib module intprops
+
+
+EXTRA_DIST += intprops.h
+
+## end gnulib module intprops
+
+## begin gnulib module lstat
+
+
+EXTRA_DIST += lstat.c
+
+EXTRA_libgnu_a_SOURCES += lstat.c
+
+## end gnulib module lstat
+
+## begin gnulib module memrchr
+
+
+EXTRA_DIST += memrchr.c
+
+EXTRA_libgnu_a_SOURCES += memrchr.c
+
+## end gnulib module memrchr
+
+## begin gnulib module mktime
+
+
+EXTRA_DIST += mktime-internal.h mktime.c
+
+EXTRA_libgnu_a_SOURCES += mktime.c
+
+## end gnulib module mktime
+
+## begin gnulib module openat-h
+
+if gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7
+
+endif
+EXTRA_DIST += openat.h
+
+## end gnulib module openat-h
+
+## begin gnulib module pathmax
+
+if gl_GNULIB_ENABLED_pathmax
+
+endif
+EXTRA_DIST += pathmax.h
+
+## end gnulib module pathmax
+
+## begin gnulib module pselect
+
+
+EXTRA_DIST += pselect.c
+
+EXTRA_libgnu_a_SOURCES += pselect.c
+
+## end gnulib module pselect
+
+## begin gnulib module pthread_sigmask
+
+
+EXTRA_DIST += pthread_sigmask.c
+
+EXTRA_libgnu_a_SOURCES += pthread_sigmask.c
+
+## end gnulib module pthread_sigmask
+
+## begin gnulib module putenv
+
+
+EXTRA_DIST += putenv.c
+
+EXTRA_libgnu_a_SOURCES += putenv.c
+
+## end gnulib module putenv
+
+## begin gnulib module qacl
+
+libgnu_a_SOURCES += acl-errno-valid.c file-has-acl.c qcopy-acl.c
+
+EXTRA_DIST += acl-internal.h acl.h acl_entries.c
+
+EXTRA_libgnu_a_SOURCES += acl_entries.c
+
+## end gnulib module qacl
+
+## begin gnulib module readlink
+
+
+EXTRA_DIST += readlink.c
+
+EXTRA_libgnu_a_SOURCES += readlink.c
+
+## end gnulib module readlink
+
+## begin gnulib module readlinkat
+
+
+EXTRA_DIST += at-func.c readlinkat.c
+
+EXTRA_libgnu_a_SOURCES += at-func.c readlinkat.c
+
+## end gnulib module readlinkat
+
+## begin gnulib module root-uid
+
+if gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c
+
+endif
+EXTRA_DIST += root-uid.h
+
+## end gnulib module root-uid
+
+## begin gnulib module sig2str
+
+
+EXTRA_DIST += sig2str.c sig2str.h
+
+EXTRA_libgnu_a_SOURCES += sig2str.c
+
+## end gnulib module sig2str
+
+## begin gnulib module snippet/_Noreturn
+
+# Because this Makefile snippet defines a variable used by other
+# gnulib Makefile snippets, it must be present in all Makefile.am that
+# need it. This is ensured by the applicability 'all' defined above.
+
+_NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h
+
+## end gnulib module snippet/_Noreturn
+
+## begin gnulib module snippet/arg-nonnull
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += arg-nonnull.h
+# The arg-nonnull.h that gets inserted into generated .h files is the same as
+# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut
+# off.
+arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ sed -n -e '/GL_ARG_NONNULL/,$$p' \
+ < $(top_srcdir)/build-aux/snippet/arg-nonnull.h \
+ > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
+
+ARG_NONNULL_H=arg-nonnull.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/arg-nonnull.h
+
+## end gnulib module snippet/arg-nonnull
+
+## begin gnulib module snippet/c++defs
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += c++defs.h
+# The c++defs.h that gets inserted into generated .h files is the same as
+# build-aux/snippet/c++defs.h, except that it has the copyright header cut off.
+c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ sed -n -e '/_GL_CXXDEFS/,$$p' \
+ < $(top_srcdir)/build-aux/snippet/c++defs.h \
+ > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += c++defs.h c++defs.h-t
+
+CXXDEFS_H=c++defs.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/c++defs.h
+
+## end gnulib module snippet/c++defs
+
+## begin gnulib module snippet/warn-on-use
+
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut
+# off.
+warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ sed -n -e '/^.ifndef/,$$p' \
+ < $(top_srcdir)/build-aux/snippet/warn-on-use.h \
+ > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h
+
+## end gnulib module snippet/warn-on-use
+
+## begin gnulib module stat
+
+if gl_GNULIB_ENABLED_stat
+
+endif
+EXTRA_DIST += stat.c
+
+EXTRA_libgnu_a_SOURCES += stat.c
+
+## end gnulib module stat
+
+## begin gnulib module stat-time
+
+libgnu_a_SOURCES += stat-time.c
+
+EXTRA_DIST += stat-time.h
+
+## end gnulib module stat-time
+
+## begin gnulib module stdalign
+
+BUILT_SOURCES += $(STDALIGN_H)
+
+# We need the following in order to create <stdalign.h> when the system
+# doesn't have one that works.
+if GL_GENERATE_STDALIGN_H
+stdalign.h: stdalign.in.h $(top_builddir)/config.status
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ cat $(srcdir)/stdalign.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+else
+stdalign.h: $(top_builddir)/config.status
+ rm -f $@
+endif
+MOSTLYCLEANFILES += stdalign.h stdalign.h-t
+
+EXTRA_DIST += stdalign.in.h
+
+## end gnulib module stdalign
+
+## begin gnulib module stdarg
+
+BUILT_SOURCES += $(STDARG_H)
+
+# We need the following in order to create <stdarg.h> when the system
+# doesn't have one that works with the given compiler.
+if GL_GENERATE_STDARG_H
+stdarg.h: stdarg.in.h $(top_builddir)/config.status
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+ -e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \
+ < $(srcdir)/stdarg.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+else
+stdarg.h: $(top_builddir)/config.status
+ rm -f $@
+endif
+MOSTLYCLEANFILES += stdarg.h stdarg.h-t
+
+EXTRA_DIST += stdarg.in.h
+
+## end gnulib module stdarg
+
+## begin gnulib module stdbool
+
+BUILT_SOURCES += $(STDBOOL_H)
+
+# We need the following in order to create <stdbool.h> when the system
+# doesn't have one that works.
+if GL_GENERATE_STDBOOL_H
+stdbool.h: stdbool.in.h $(top_builddir)/config.status
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+else
+stdbool.h: $(top_builddir)/config.status
+ rm -f $@
+endif
+MOSTLYCLEANFILES += stdbool.h stdbool.h-t
+
+EXTRA_DIST += stdbool.in.h
+
+## end gnulib module stdbool
+
+## begin gnulib module stddef
+
+BUILT_SOURCES += $(STDDEF_H)
+
+# We need the following in order to create <stddef.h> when the system
+# doesn't have one that works with the given compiler.
+if GL_GENERATE_STDDEF_H
+stddef.h: stddef.in.h $(top_builddir)/config.status
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
+ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
+ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
+ < $(srcdir)/stddef.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+else
+stddef.h: $(top_builddir)/config.status
+ rm -f $@
+endif
+MOSTLYCLEANFILES += stddef.h stddef.h-t
+
+EXTRA_DIST += stddef.in.h
+
+## end gnulib module stddef
+
+## begin gnulib module stdint
+
+BUILT_SOURCES += $(STDINT_H)
+
+# We need the following in order to create <stdint.h> when the system
+# doesn't have one that works with the given compiler.
+if GL_GENERATE_STDINT_H
+stdint.h: stdint.in.h $(top_builddir)/config.status
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+ -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+ -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
+ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
+ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
+ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
+ -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
+ -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
+ -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
+ -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
+ -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
+ -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
+ -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
+ -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
+ -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \
+ -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \
+ -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \
+ -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \
+ -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \
+ -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \
+ -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \
+ -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
+ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
+ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
+ < $(srcdir)/stdint.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+else
+stdint.h: $(top_builddir)/config.status
+ rm -f $@
+endif
+MOSTLYCLEANFILES += stdint.h stdint.h-t
+
+EXTRA_DIST += stdint.in.h
+
+## end gnulib module stdint
+
+## begin gnulib module strftime
+
+libgnu_a_SOURCES += strftime.c
+
+EXTRA_DIST += strftime.h
+
+## end gnulib module strftime
+
+## begin gnulib module strtoimax
+
+
+EXTRA_DIST += strtoimax.c
+
+EXTRA_libgnu_a_SOURCES += strtoimax.c
+
+## end gnulib module strtoimax
+
+## begin gnulib module strtoll
+
+if gl_GNULIB_ENABLED_strtoll
+
+endif
+EXTRA_DIST += strtol.c strtoll.c
+
+EXTRA_libgnu_a_SOURCES += strtol.c strtoll.c
+
+## end gnulib module strtoll
+
+## begin gnulib module strtoull
+
+if gl_GNULIB_ENABLED_strtoull
+
+endif
+EXTRA_DIST += strtol.c strtoul.c strtoull.c
+
+EXTRA_libgnu_a_SOURCES += strtol.c strtoul.c strtoull.c
+
+## end gnulib module strtoull
+
+## begin gnulib module strtoumax
+
+
+EXTRA_DIST += strtoimax.c strtoumax.c
+
+EXTRA_libgnu_a_SOURCES += strtoimax.c strtoumax.c
+
+## end gnulib module strtoumax
+
+## begin gnulib module symlink
+
+
+EXTRA_DIST += symlink.c
+
+EXTRA_libgnu_a_SOURCES += symlink.c
+
+## end gnulib module symlink
+
+## begin gnulib module time_r
+
+
+EXTRA_DIST += time_r.c
+
+EXTRA_libgnu_a_SOURCES += time_r.c
+
+## end gnulib module time_r
+
+## begin gnulib module timespec
+
+libgnu_a_SOURCES += timespec.c
+
+EXTRA_DIST += timespec.h
+
+## end gnulib module timespec
+
+## begin gnulib module timespec-add
+
+libgnu_a_SOURCES += timespec-add.c
+
+## end gnulib module timespec-add
+
+## begin gnulib module timespec-sub
+
+libgnu_a_SOURCES += timespec-sub.c
+
+## end gnulib module timespec-sub
+
+## begin gnulib module u64
+
+libgnu_a_SOURCES += u64.c
+
+EXTRA_DIST += u64.h
+
+## end gnulib module u64
+
+## begin gnulib module unsetenv
+
+
+EXTRA_DIST += unsetenv.c
+
+EXTRA_libgnu_a_SOURCES += unsetenv.c
+
+## end gnulib module unsetenv
+
+## begin gnulib module utimens
+
+libgnu_a_SOURCES += utimens.c
+
+EXTRA_DIST += utimens.h
+
+## end gnulib module utimens
+
+## begin gnulib module verify
+
+if gl_GNULIB_ENABLED_verify
+
+endif
+EXTRA_DIST += verify.h
+
+## end gnulib module verify
+
+## begin gnulib module xalloc-oversized
+
+if gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec
+
+endif
+EXTRA_DIST += xalloc-oversized.h
+
+## end gnulib module xalloc-oversized
+
+
+mostlyclean-local: mostlyclean-generic
+ @for dir in '' $(MOSTLYCLEANDIRS); do \
+ if test -n "$$dir" && test -d $$dir; then \
+ echo "rmdir $$dir"; rmdir $$dir; \
+ fi; \
+ done; \
+ :
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index 9ff03994be2..29c8e383893 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -67,7 +67,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#endif
#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
-#define HAVE___BUILTIN_UNWIND_INIT 1
+# ifndef HAVE___BUILTIN_UNWIND_INIT
+# define HAVE___BUILTIN_UNWIND_INIT 1
+# endif
#endif
/* This isn't perfect, as some systems might have the page file in
@@ -99,8 +101,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#endif
#ifdef __GNUC__
-# define restrict __restrict__
+/* config.h may have defined already. */
+# ifndef restrict
+# define restrict __restrict__
+# endif
#else
+ /* FIXME: should we define to __restrict, which MSVC supports? */
# define restrict
#endif
@@ -138,9 +144,6 @@ extern char *getenv ();
/* Make a leaner executable. */
#define WIN32_LEAN_AND_MEAN 1
-#ifdef HAVE_STRINGS_H
-#include "strings.h"
-#endif
#include <sys/types.h>
#ifndef MAXPATHLEN
@@ -148,8 +151,12 @@ extern char *getenv ();
#endif
#ifdef HAVE_NTGUI
-#define HAVE_WINDOW_SYSTEM 1
-#define HAVE_MENUS 1
+# ifndef HAVE_WINDOW_SYSTEM
+# define HAVE_WINDOW_SYSTEM 1
+# endif
+# ifndef HAVE_MENUS
+# define HAVE_MENUS 1
+# endif
#endif
/* Get some redefinitions in place. */
@@ -248,9 +255,6 @@ extern int sys_unlink (const char *);
#define execvp _execvp
#define fdatasync _commit
#define fdopen _fdopen
-#ifndef fileno
-#define fileno _fileno
-#endif
#define fsync _commit
#define ftruncate _chsize
#define getpid _getpid
@@ -266,9 +270,6 @@ typedef int pid_t;
#define popen _popen
#define pclose _pclose
#define umask _umask
-#ifndef _MSC_VER
-#define utimbuf _utimbuf
-#endif
#define strdup _strdup
#define strupr _strupr
#define strnicmp _strnicmp
@@ -285,10 +286,6 @@ int _getpid (void);
array, and triggers an error message. */
#include <time.h>
#define tzname _tzname
-#if !defined (_MSC_VER) || (_MSC_VER < 1400)
-#undef utime
-#define utime _utime
-#endif
/* 'struct timespec' is used by time-related functions in lib/ and
elsewhere, but we don't use lib/time.h where the structure is
@@ -327,6 +324,9 @@ extern struct tm *localtime_r (time_t const * restrict, struct tm * restrict);
#include <io.h>
#include <stdio.h>
#endif /* !_MSC_VER */
+#ifndef fileno
+#define fileno _fileno
+#endif
/* Defines that we need that aren't in the standard signal.h. */
#define SIGHUP 1 /* Hang up */
@@ -346,20 +346,21 @@ extern struct tm *localtime_r (time_t const * restrict, struct tm * restrict);
#define ENOTSUP ENOSYS
#endif
-/* WINDOWSNT <errno.h> doesn't define EOPNOTSUPP, and we don't have
- 'configure' working yet so we can't rely on the Gnulib replacement
- errno.h defining EOPNOTSUPP. Work around the problem by defining
- it here. */
+/* In case lib/errno.h is not used. */
+#ifndef EOPNOTSUPP
#define EOPNOTSUPP 130
+#endif
#ifdef _MSC_VER
typedef int sigset_t;
typedef int ssize_t;
#endif
-#ifndef _POSIX /* MinGW64 */
+#ifdef _W64 /* MinGW64 */
+#ifndef _POSIX
typedef _sigset_t sigset_t;
#endif
+#endif
typedef void (_CALLBACK_ *signal_handler) (int);
extern signal_handler sys_signal (int, signal_handler);
@@ -395,10 +396,12 @@ extern int sys_kill (int, int);
#define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN)
#endif
+#ifndef EMACS_CONFIGURATION
extern char *get_emacs_configuration (void);
extern char *get_emacs_configuration_options (void);
#define EMACS_CONFIGURATION get_emacs_configuration ()
#define EMACS_CONFIG_OPTIONS get_emacs_configuration_options ()
+#endif
/* Define this so that winsock.h definitions don't get included with
windows.h. For this to have proper effect, config.h must always be
@@ -452,10 +455,14 @@ extern void * memrchr (void const *, int, size_t);
#if defined (__MINGW32__)
/* Define to 1 if the system has the type `long long int'. */
-# define HAVE_LONG_LONG_INT 1
+# ifndef HAVE_LONG_LONG_INT
+# define HAVE_LONG_LONG_INT 1
+# endif
/* Define to 1 if the system has the type `unsigned long long int'. */
-# define HAVE_UNSIGNED_LONG_LONG_INT 1
+# ifndef HAVE_UNSIGNED_LONG_LONG_INT
+# define HAVE_UNSIGNED_LONG_LONG_INT 1
+# endif
#endif
diff --git a/nt/inc/sys/socket.h b/nt/inc/sys/socket.h
index 6029778394b..99227d75d28 100644
--- a/nt/inc/sys/socket.h
+++ b/nt/inc/sys/socket.h
@@ -43,8 +43,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#undef FD_ZERO
#endif
-/* avoid duplicate definition of timeval */
-#ifdef HAVE_TIMEVAL
+/* Avoid duplicate definition of timeval. MinGW uses _TIMEVAL_DEFINED
+ in sys/time.h to avoid that. */
+#if defined (HAVE_TIMEVAL) && defined (_MSC_VER)
#define timeval ws_timeval
#endif
@@ -62,7 +63,9 @@ typedef unsigned short uint16_t;
#undef MUST_REDEF_SELECT
#endif
-/* revert to our version of FD_SET */
+/* Revert to our version of FD_SET, but not when included from test
+ programs run by configure. */
+#ifdef EMACS_CONFIG_H
#undef FD_SET
#undef FD_CLR
#undef FD_ISSET
@@ -71,8 +74,9 @@ typedef unsigned short uint16_t;
/* allow us to provide our own version of fd_set */
#define fd_set ws_fd_set
#include "w32.h"
+#endif /* EMACS_CONFIG_H */
-#ifdef HAVE_TIMEVAL
+#if defined (HAVE_TIMEVAL) && defined (_MSC_VER)
#undef timeval
#endif
diff --git a/nt/inc/sys/stat.h b/nt/inc/sys/stat.h
index f6785c56477..f1d8341141e 100644
--- a/nt/inc/sys/stat.h
+++ b/nt/inc/sys/stat.h
@@ -83,6 +83,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define S_TYPEISSHM(p) 0
#define S_TYPEISTMO(p) 0
+#define UTIME_NOW (-1)
+#define UTIME_OMIT (-2)
+
struct stat {
unsigned __int64 st_ino; /* ino_t in sys/types.h is too narrow */
dev_t st_dev;
@@ -99,6 +102,39 @@ struct stat {
char st_gname[260];
};
+/* These are here to avoid compiler warnings when using wchar.h. */
+struct _stat
+{
+ _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */
+ _ino_t st_ino; /* Always zero ? */
+ _mode_t st_mode; /* See above constants */
+ short st_nlink; /* Number of links. */
+ short st_uid; /* User: Maybe significant on NT ? */
+ short st_gid; /* Group: Ditto */
+ _dev_t st_rdev; /* Seems useless (not even filled in) */
+ _off_t st_size; /* File size in bytes */
+ time_t st_atime; /* Accessed date (always 00:00 hrs local
+ * on FAT) */
+ time_t st_mtime; /* Modified time */
+ time_t st_ctime; /* Creation time */
+};
+
+#if defined (__MSVCRT__)
+struct _stati64 {
+ _dev_t st_dev;
+ _ino_t st_ino;
+ _mode_t st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ _dev_t st_rdev;
+ __int64 st_size;
+ time_t st_atime;
+ time_t st_mtime;
+ time_t st_ctime;
+};
+#endif
+
/* Internal variable for asking 'stat'/'lstat' to produce accurate
info about owner and group of files. */
extern int w32_stat_get_owner_group;
diff --git a/nt/inc/sys/time.h b/nt/inc/sys/time.h
index 80c725385bb..87ad9d3ff0d 100644
--- a/nt/inc/sys/time.h
+++ b/nt/inc/sys/time.h
@@ -9,12 +9,23 @@
/* The guards are for MinGW64, which defines these structs on its
system headers which are included by ms-w32.h. */
#ifndef _W64
+/* Allow inclusion of sys/time.h and winsock2.h in any order. Needed
+ for running the configure test, which is only relevant to MinGW. */
+#ifndef _TIMEVAL_DEFINED
+#define _TIMEVAL_DEFINED
struct timeval
{
long tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
-#endif
+#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
+#define timercmp(tvp, uvp, cmp) \
+ (((tvp)->tv_sec != (uvp)->tv_sec) ? \
+ ((tvp)->tv_sec cmp (uvp)->tv_sec) : \
+ ((tvp)->tv_usec cmp (uvp)->tv_usec))
+#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
+#endif /* _TIMEVAL_DEFINED */
+#endif /* _W64 */
#ifndef _TIMEZONE_DEFINED
struct timezone
@@ -24,7 +35,10 @@ struct timezone
};
#endif
-void gettimeofday (struct timeval *, struct timezone *);
+/* This needs to be compatible with Posix signature, in order to pass
+ the configure test for the type of the second argument. See
+ m4/gettimeofday.m4. */
+int gettimeofday (struct timeval *restrict, struct timezone *restrict);
#define ITIMER_REAL 0
#define ITIMER_PROF 1
diff --git a/nt/inc/unistd.h b/nt/inc/unistd.h
index e07c46533f7..8ad8cf213b1 100644
--- a/nt/inc/unistd.h
+++ b/nt/inc/unistd.h
@@ -3,6 +3,9 @@
#ifndef _UNISTD_H
#define _UNISTD_H
+#include <sys/types.h>
+#include <pwd.h>
+
/* On Microsoft platforms, <stdlib.h> declares 'environ'; on POSIX
platforms, <unistd.h> does. Every file in Emacs that includes
<unistd.h> also includes <stdlib.h>, so there's no need to declare
diff --git a/nt/makefile.w32-in b/nt/makefile.w32-in
index 4aa1ea91d44..79ca22bf44e 100644
--- a/nt/makefile.w32-in
+++ b/nt/makefile.w32-in
@@ -29,6 +29,8 @@ TMP_DIST_DIR = emacs-$(VERSION)
TRES = $(BLD)/emacs.res
CLIENTRES = $(BLD)/emacsclient.res
+LOCAL_FLAGS = -DOLD_PATHS=1
+
XMFLAGS =
ALL = $(BLD)/addpm.exe $(BLD)/ddeclient.exe $(BLD)/runemacs.exe \
diff --git a/nt/mingw-cfg.site b/nt/mingw-cfg.site
new file mode 100644
index 00000000000..96cda2d624a
--- /dev/null
+++ b/nt/mingw-cfg.site
@@ -0,0 +1,106 @@
+#! /bin/sh
+# Site defaults for the MinGW configuration of GNU Emacs.
+#
+# This file's purpose is to short-circuit configure-time tests for
+# which we want to provide the results instead of letting the
+# 'configure' script do that. This is mainly for features that
+# 'configure' tests that are implemented as part of Emacs sources, not
+# as part of system libraries. The idea is to set shell variables
+# that appear to the script as cached values.
+#
+# For each header file foo.h you want to supply test results, set the
+# value of a shell variable ac_cv_header_foo_h. The value should be
+# yes if the header is deemed to exist, no otherwise. Or it could be
+# something else, if the value computed by 'configure' requires that.
+# In general, since nt/msysconfig.sh instructs GCC to use header files
+# in nt/inc, you should not need to futz with header file tests. But
+# there are exceptions, like with getopt.h below (which is a MinGW
+# system header, but we do not want to use it).
+#
+# For each library function foo you want to supply test results, set
+# the value of a shell variable ac_cv_func_foo. Again, the value is
+# determined by what 'configure' expects; sometimes it could be "not
+# needed" or whatever, see the examples below. In addition, you may
+# need to set the various gl_cv_* variables for those tests that come
+# from gnulib.
+#
+# In short, examine the test in 'configure' and push the knobs that
+# are necessary to steer the test in the direction you need, by
+# judicioulsy setting variables that control the test results.
+
+# We want to use getopt.h from gnulib
+ac_cv_header_getopt_h=no
+
+# ACL functions are implemented in w32.c
+ac_cv_search_acl_get_file="none required"
+ac_cv_func_acl_get_file=yes
+ac_cv_func_acl_set_file=yes
+ac_cv_func_acl_free=yes
+ac_cv_func_acl_from_text=yes
+gl_cv_func_working_acl_get_file=yes
+# Autoconf's test program is not smart enough, and fails to detect gethostname
+ac_cv_func_gethostname=yes
+# Implemented as sys_select in w32proc.c
+ac_cv_func_select=yes
+ac_cv_func_pselect=yes
+gl_cv_sig_pselect=yes
+gl_cv_func_pselect_detects_ebadf=yes
+# Implemented as sys_shutdown in w32.c
+ac_cv_func_shutdown=yes
+# Implemented in w32proc.c
+ac_cv_func_setitimer=yes
+# Implemented as sys_sendto in w32.c
+ac_cv_func_sendto=yes
+# Implemented as sys_recvfrom in w32.c
+ac_cv_func_recvfrom=yes
+# Implemented as sys_getsockname in w32.c
+ac_cv_func_getsockname=yes
+# Implemented as sys_getpeername in w32.c
+ac_cv_func_getpeername=yes
+# Implemented as sys_socket in w32.c
+ac_cv_func_socket=yes
+# Implemented in w32.c
+ac_cv_func_readlink=yes
+ac_cv_func_symlink=yes
+# Avoid run-time tests of readlink and symlink, which will fail
+gl_cv_func_readlink_works=yes
+gl_cv_func_symlink_works=yes
+ac_cv_func_readlinkat=yes
+ac_cv_func_faccessat=yes
+# We don't need fdopendir
+ac_cv_func_fdopendir="not-needed"
+gl_cv_func_fdopendir_works="no-but-not-needed-so-yes"
+# Implemented in w32.c
+ac_cv_func_lstat=yes
+gl_cv_func_lstat_dereferences_slashed_symlink=yes
+ac_cv_func_fstatat=yes
+gl_cv_func_fstatat_zero_flag=yes
+# Aliased to _commit in ms-w32.h
+ac_cv_func_fsync=yes
+ac_cv_func_fdatasync=yes
+# Implemented in w32proc.c
+ac_cv_func_pthread_sigmask=yes
+# Avoid gnulib replacement
+gl_threads_api=posix
+gl_cv_func_pthread_sigmask_return_works=yes
+gl_cv_func_pthread_sigmask_unblock_works="not relevant"
+# Implemented in w32proc.c
+emacs_cv_langinfo_codeset=yes
+# Declared in ms-w32.h
+ac_cv_have_decl_alarm=yes
+# Avoid including the gnulib dup2 module
+gl_cv_func_dup2_works=yes
+# Defined in w32.c
+ac_cv_func_getloadavg=yes
+# Avoid compiling gnulib mktime
+gl_cv_func_working_mktime=yes
+# Implemented in w32.c
+ac_cv_have_decl_unsetenv=yes
+ac_cv_func_unsetenv=yes
+gt_cv_func_unsetenv_ret='int'
+gl_cv_func_unsetenv_works=yes
+gl_cv_func_stat_dir_slash=yes
+gl_cv_func_stat_file_slash=yes
+ac_cv_func_random=yes
+# Implemented in w32.c as sys_putenv
+gl_cv_func_svid_putenv=yes
diff --git a/nt/msysconfig.sh b/nt/msysconfig.sh
new file mode 100644
index 00000000000..95e56f64c42
--- /dev/null
+++ b/nt/msysconfig.sh
@@ -0,0 +1,39 @@
+#! /bin/sh
+### msysconfig.sh - Run the top-level 'configure' script as approriate
+### for the MinGW/MSYS build of a native MS-Windows port of Emacs.
+
+## Copyright (C) 2013 Free Software Foundation, Inc.
+
+## Author: Eli Zaretskii <eliz@gnu.org>
+
+## This file is part of GNU Emacs.
+
+## GNU Emacs is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+
+## GNU Emacs is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+### Commentary:
+
+## The Posix 'configure' script needs a few tweaks to produce desired
+## results when running under MSYS with the purpose of configuring
+## Emacs for the MinGW MS-Windows build. Rather than asking users to
+## type these tweaks every time they configure the package, we provide
+## this helper script which takes care of the mundane things.
+
+### Code:
+
+srcdir=`dirname "$0"`
+parent=`dirname "$srcdir"`
+
+## The nt/mingw-cfg.site file provides various autoconf variables that
+## are needed for a successful MinGW build.
+CONFIG_SITE="$srcdir/mingw-cfg.site" $parent/configure "$@"
diff --git a/src/ChangeLog b/src/ChangeLog
index c45ec824919..e5308e2db3b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,27 @@
+2013-05-16 Eli Zaretskii <eliz@gnu.org>
+
+ * w32.c: Include epaths.h.
+ (init_environment): Use cmdproxy.exe without leading directories.
+ Support emacs.exe in src; point SHELL to cmdproxy in ../nt in that
+ case.
+ (gettimeofday): Adjust signature and return value to Posix
+ expectations.
+
+ * unexw32.c (open_output_file): Delete the existing emacs.exe
+ before creating it, to break the hard link to the versioned
+ executable.
+
+ * Makefile.in (EMACS_MANIFEST, CM_OBJ, TEMACS_POST_LINK)
+ (ADDSECTION, EMACS_HEAPSIZE, MINGW_TEMACS_POST_LINK)
+ (FIRSTFILE_OBJ): New variables.
+ (W32_RES): Rename to EMACSRES. All users changed.
+ (base_obj): Use $(CM_OBJ).
+ (ALLOBJS): Use $(FIRSTFILE_OBJ).
+ (emacs$(EXEEXT)): Depend on $(ADDSECTION).
+ (temacs$(EXEEXT)): Use $(TEMACS_POST_LINK), and move
+ $(W32_RES_LINK) before $(LIBES).
+ (emacs.res): Depend on $(EMACS_MANIFEST). Put emacs.rc in nt.
+
2013-05-15 Stefan Monnier <monnier@iro.umontreal.ca>
* makefile.w32-in (DOC): Use just "DOC".
diff --git a/src/Makefile.in b/src/Makefile.in
index 80d23b2d58b..c7a18363a5a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -267,10 +267,13 @@ W32_OBJ=@W32_OBJ@
W32_LIBS=@W32_LIBS@
## emacs.res if HAVE_W32
-W32_RES=@W32_RES@
+EMACSRES = @EMACSRES@
+## emacs-*.manifest if HAVE_W32
+EMACS_MANIFEST = @EMACS_MANIFEST@
## If HAVE_W32, compiler arguments for including
## the resource file in the binary.
-## XXX -Wl,-b -Wl,pe-i386 -Wl,emacs.res
+## Cygwin: -Wl,emacs.res
+## MinGW: emacs.res
W32_RES_LINK=@W32_RES_LINK@
## Empty if !HAVE_X_WINDOWS
@@ -279,6 +282,9 @@ W32_RES_LINK=@W32_RES_LINK@
## else xfont.o
FONT_OBJ=@FONT_OBJ@
+## Empty for MinGW, cm.o for the rest.
+CM_OBJ=@CM_OBJ@
+
LIBGPM = @LIBGPM@
## -lresolv, or empty.
@@ -297,6 +303,14 @@ GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
RUN_TEMACS = `/bin/pwd`/temacs
+## Invoke ../nt/addsection for MinGW, ":" elsewhere.
+TEMACS_POST_LINK = @TEMACS_POST_LINK@
+ADDSECTION = @ADDSECTION@
+EMACS_HEAPSIZE = @EMACS_HEAPSIZE@
+MINGW_TEMACS_POST_LINK = \
+ mv temacs$(EXEEXT) temacs.tmp; \
+ ../nt/addsection temacs.tmp temacs$(EXEEXT) EMHEAP $(EMACS_HEAPSIZE)
+
UNEXEC_OBJ = @UNEXEC_OBJ@
CANNOT_DUMP=@CANNOT_DUMP@
@@ -339,7 +353,7 @@ ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS)
## be dumped as pure by dump-emacs.
base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
charset.o coding.o category.o ccl.o character.o chartab.o bidi.o \
- cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \
+ $(CM_OBJ) term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \
emacs.o keyboard.o macros.o keymap.o sysdep.o \
buffer.o filelock.o insdel.o marker.o \
minibuf.o fileio.o dired.o \
@@ -377,9 +391,9 @@ VMLIMIT_OBJ=@VMLIMIT_OBJ@
## ralloc.o if !SYSTEM_MALLOC && REL_ALLOC, else empty.
RALLOC_OBJ=@RALLOC_OBJ@
-## Empty on Cygwin, lastfile.o elsewhere.
+## Empty on Cygwin and MinGW, lastfile.o elsewhere.
PRE_ALLOC_OBJ=@PRE_ALLOC_OBJ@
-## lastfile.o on Cygwin, empty elsewhere.
+## lastfile.o on Cygwin and MinGW, empty elsewhere.
POST_ALLOC_OBJ=@POST_ALLOC_OBJ@
## List of object files that make-docfile should not be told about.
@@ -387,7 +401,9 @@ otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
$(POST_ALLOC_OBJ) $(WIDGET_OBJ) $(LIBOBJS)
## All object files linked into temacs. $(VMLIMIT_OBJ) should be first.
-ALLOBJS = $(VMLIMIT_OBJ) $(obj) $(otherobj)
+## (On MinGW, firstfile.o should be before vm-limit.o.)
+FIRSTFILE_OBJ=@FIRSTFILE_OBJ@
+ALLOBJS = $(FIRSTFILE_OBJ) $(VMLIMIT_OBJ) $(obj) $(otherobj)
## Configure inserts the file lisp.mk at this point, defining $lisp.
@lisp_frag@
@@ -416,7 +432,8 @@ $(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT)
## Strictly speaking, emacs does not depend directly on all of $lisp,
## since not all pieces are used on all platforms. But DOC depends
## on all of $lisp, and emacs depends on DOC, so it is ok to use $lisp here.
-emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) $(leimdir)/leim-list.el
+emacs$(EXEEXT): temacs$(EXEEXT) $(ADDSECTION) \
+ $(etc)/DOC $(lisp) $(leimdir)/leim-list.el
if test "$(CANNOT_DUMP)" = "yes"; then \
rm -f emacs$(EXEEXT); \
ln temacs$(EXEEXT) emacs$(EXEEXT); \
@@ -468,10 +485,10 @@ $(lib)/libgnu.a: $(config_h)
cd $(lib) && $(MAKE) libgnu.a
temacs$(EXEEXT): stamp-oldxmenu $(ALLOBJS) \
- $(lib)/libgnu.a $(W32_RES)
+ $(lib)/libgnu.a $(EMACSRES)
$(CC) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
- -o temacs $(ALLOBJS) $(lib)/libgnu.a $(LIBES) \
- $(W32_RES_LINK)
+ -o temacs $(ALLOBJS) $(lib)/libgnu.a $(W32_RES_LINK) $(LIBES)
+ $(TEMACS_POST_LINK)
test "$(CANNOT_DUMP)" = "yes" || \
test "X$(PAXCTL)" = X || $(PAXCTL) -r temacs$(EXEEXT)
@@ -514,8 +531,9 @@ doc.o: buildobj.h
emacs.res: $(ntsource)/emacs.rc \
$(ntsource)/icons/emacs.ico \
- $(ntsource)/emacs-x86.manifest
- $(WINDRES) -O COFF -o $@ $(ntsource)/emacs.rc
+ $(ntsource)/$(EMACS_MANIFEST)
+ $(WINDRES) -O COFF --include-dir=$(srcdir)/../nt \
+ -o $@ $(ntsource)/emacs.rc
ns-app: emacs$(EXEEXT)
cd ../nextstep && $(MAKE) $(MFLAGS) all
diff --git a/src/unexw32.c b/src/unexw32.c
index e8b553a87d3..a01ac799592 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -159,6 +159,14 @@ open_output_file (file_data *p_file, char *filename, unsigned long size)
HANDLE file_mapping;
void *file_base;
+ /* We delete any existing FILENAME because loadup.el will create a
+ hard link to it under the name emacs-XX.YY.ZZ.nn.exe. Evidently,
+ overwriting a file on Unix breaks any hard links to it, but that
+ doesn't happen on Windows. If we don't delete the file before
+ creating it, all the emacs-XX.YY.ZZ.nn.exe end up being hard
+ links to the same file, which defeats the purpose of these hard
+ links: being able to run previous builds. */
+ DeleteFile (filename);
file = CreateFile (filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (file == INVALID_HANDLE_VALUE)
diff --git a/src/w32.c b/src/w32.c
index 431826c4b82..7d63c73eb18 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -65,6 +65,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#undef localtime
#include "lisp.h"
+#include "epaths.h" /* for SHELL */
#include <pwd.h>
#include <grp.h>
@@ -2018,7 +2019,7 @@ init_environment (char ** argv)
{"PRELOAD_WINSOCK", NULL},
{"emacs_dir", "C:/emacs"},
{"EMACSLOADPATH", NULL},
- {"SHELL", "%emacs_dir%/bin/cmdproxy.exe"},
+ {"SHELL", "cmdproxy.exe"}, /* perhaps it is somewhere on PATH */
{"EMACSDATA", NULL},
{"EMACSPATH", NULL},
{"INFOPATH", NULL},
@@ -2094,9 +2095,12 @@ init_environment (char ** argv)
emacs_abort ();
*p = 0;
- if ((p = _mbsrchr (modname, '\\')) && xstrcasecmp (p, "\\bin") == 0)
+ if ((p = _mbsrchr (modname, '\\'))
+ /* From bin means installed Emacs, from src means uninstalled. */
+ && (xstrcasecmp (p, "\\bin") == 0 || xstrcasecmp (p, "\\src") == 0))
{
char buf[SET_ENV_BUF_SIZE];
+ int within_build_tree = xstrcasecmp (p, "\\src") == 0;
*p = 0;
for (p = modname; *p; p = CharNext (p))
@@ -2104,6 +2108,15 @@ init_environment (char ** argv)
_snprintf (buf, sizeof (buf)-1, "emacs_dir=%s", modname);
_putenv (strdup (buf));
+ /* If we are running from the Posix-like build tree, define
+ SHELL to point to our own cmdproxy. The loop below will
+ then disregard PATH_EXEC and the default value. */
+ if (within_build_tree)
+ {
+ _snprintf (buf, sizeof (buf) - 1,
+ "SHELL=%s/nt/cmdproxy.exe", modname);
+ _putenv (strdup (buf));
+ }
}
/* Handle running emacs from the build directory: src/oo-spd/i386/ */
@@ -2139,16 +2152,60 @@ init_environment (char ** argv)
if (!getenv (env_vars[i].name))
{
int dont_free = 0;
+ char bufc[SET_ENV_BUF_SIZE];
if ((lpval = w32_get_resource (env_vars[i].name, &dwType)) == NULL
/* Also ignore empty environment variables. */
|| *lpval == 0)
{
xfree (lpval);
- lpval = env_vars[i].def_value;
- dwType = REG_EXPAND_SZ;
dont_free = 1;
- if (!strcmp (env_vars[i].name, "HOME") && !appdata)
+ if (strcmp (env_vars[i].name, "SHELL") == 0)
+ {
+ /* Look for cmdproxy.exe in every directory in
+ PATH_EXEC. FIXME: This does not find cmdproxy
+ in nt/ when we run uninstalled. */
+ char fname[MAX_PATH];
+ const char *pstart = PATH_EXEC, *pend;
+
+ do {
+ pend = _mbschr (pstart, ';');
+ if (!pend)
+ pend = pstart + strlen (pstart);
+ /* Be defensive against series of ;;; characters. */
+ if (pend > pstart)
+ {
+ strncpy (fname, pstart, pend - pstart);
+ fname[pend - pstart] = '/';
+ strcpy (&fname[pend - pstart + 1], "cmdproxy.exe");
+ ExpandEnvironmentStrings ((LPSTR) fname, bufc,
+ sizeof (bufc));
+ if (check_existing (bufc))
+ {
+ lpval = bufc;
+ dwType = REG_SZ;
+ break;
+ }
+ }
+ if (*pend)
+ pstart = pend + 1;
+ else
+ pstart = pend;
+ if (!*pstart)
+ {
+ /* If not found in any directory, use the
+ default as the last resort. */
+ lpval = env_vars[i].def_value;
+ dwType = REG_EXPAND_SZ;
+ }
+ } while (*pstart);
+ }
+ else
+ {
+ lpval = env_vars[i].def_value;
+ dwType = REG_EXPAND_SZ;
+ }
+ if (strcmp (env_vars[i].name, "HOME") == 0 && !appdata)
Vdelayed_warnings_list
= Fcons (listn (CONSTYPE_HEAP, 2,
intern ("initialization"),
@@ -2394,8 +2451,8 @@ get_emacs_configuration_options (void)
#include <sys/timeb.h>
/* Emulate gettimeofday (Ulrich Leodolter, 1/11/95). */
-void
-gettimeofday (struct timeval *tv, struct timezone *tz)
+int
+gettimeofday (struct timeval *restrict tv, struct timezone *restrict tz)
{
struct _timeb tb;
_ftime (&tb);
@@ -2413,6 +2470,7 @@ gettimeofday (struct timeval *tv, struct timezone *tz)
tz->tz_minuteswest = tb.timezone; /* minutes west of Greenwich */
tz->tz_dsttime = tb.dstflag; /* type of dst correction */
}
+ return 0;
}
/* Emulate fdutimens. */