How's this?
Craig
Ben Wing writes:
could you merge your patch with Dan's patch included below? You
both have good
stuff and some overlapping -- e.g. his additions to mingw32.h are good, and are
a better approach than mucking with systime.h and getpagesize.h. if you get a
merged patch to me, i'll put it into cvs right away.
ben
Dan Holmsand wrote:
> The mingw build doesn't work again, following the change to
> WIN32_NATIVE, etc. I've made a few changes (below) to mingw32.h and a
> few other files, that (at least on my machine :-) makes the build work
> again.
>
> The code in buffer.c assumed $PWD to be correct, which it almost
> certainly isn't on windows. The code in finder.el assumed filenames to
> be valid regexps, again on windows they certainly aren't. The makefile
> in lib-src tries to build gnuclient, which doesn't work under mingw.
>
> A question remains, though: run.c was deleted from lib-src, which
> means no more runxemacs.exe. I kind of miss this (I don't like the
> console window)...
>
> /dan
>
> --
> Dan Ola Holmsand
> Innehållsbolaget
> dan(a)innehall.com
---------- ChangeLog
2000-07-05 Craig Lanning <lanning(a)scra.org>
* configure.in: Clean up configure support for cygwin and mingw.
* aclocal.m4: First pass at module support for cygwin and mingw.
---------- lib-src/ChangeLog
2000-07-05 Craig Lanning <lanning(a)scra.org>
* Makefile.in.in: mingw support: don't try to build gnuclient, add
support for building and installing minitar
---------- lisp/ChangeLog
2000-07-06 Craig Lanning <lanning(a)scra.org>
* finder.el (finder-compile-keywords): from Dan Holmsand, make sure
dir is a regex.
* process.el (call-process-internal): from Dan Holmsand, use binary
coding systems so that jka-compr works.
---------- nt/ChangeLog
2000-07-05 Craig Lanning <lanning(a)scra.org>
* xemacs.rc: Uppercase the id's so that windres will work.
---------- src/ChangeLog
2000-07-05 Craig Lanning <lanning(a)scra.org>
* Makefile.in.in: Add support for including the Windows resources
when building with the cygwin and mingw targets.
* buffer.c: from Dan Holmsand, on Windows $PWD is most likely either
not set or not correct.
(directory_is_current_directory): Don't compile for WIN32_NATIVE.
(init_initial_directory): Don't try to use $PWD on the
WIN32_NATIVE target.
* s\cygwin32.h: Add -mwindows to eliminate console window.
(HAVE_NATIVE_SOUND): removed; now handled by configure.
(MAIL_USE_POP): removed; now handled by configure.
* s\mingw32.h: Add -mwindows to eliminate console window.
(HAVE_NATIVE_SOUND): removed; now handled by configure.
(MAIL_USE_POP): removed; now handled by configure.
(ENCAPSULATE_STAT): from Dan Holmsand, added.
(ENCAPSULATE_FSTAT): from Dan Holmsand, added.
(DIRECTORY_SEP): from Dan Holmsand, use lisp variable instead of
constant string.
(HAVE_TIMEVAL): from Dan Holmsand, added; struct timeval is picked
up from <winsock.h> via systime.h.
(HAVE_GETPAGESIZE): from Dan Holmsand, added.
(getpagesize): from Dan Holmsand, added.
Added #endif which was left dangling by Ben's mega patch; added
comment to help prevent this in the future.
* sysdll.c: added #include <windows.h> for WIN32_NATIVE case.
------------------------------------------------------------
diff -urx CVS xemacsb/aclocal.m4 xemacs-cl/aclocal.m4
--- xemacsb/aclocal.m4 Fri Mar 10 03:17:26 2000
+++ xemacs-cl/aclocal.m4 Mon Jul 3 16:26:38 2000
@@ -101,6 +101,9 @@
# like `-m68040'.
dll_cflags='-m68020 -resident32 -malways-restore-a4'
;;
+ *cygwin* | *mingw* )
+ # PIC is the default
+ ;;
*)
dll_cflags='-fPIC'
;;
diff -urx CVS xemacsb/configure.in xemacs-cl/configure.in
--- xemacsb/configure.in Thu Jun 1 03:41:44 2000
+++ xemacs-cl/configure.in Wed Jul 5 10:06:36 2000
@@ -2442,9 +2442,18 @@
test -z "$mail_locking" -a "$mail_use_flock" = "yes"
&& mail_locking=flock
test -z "$mail_locking" -a "$mail_use_lockf" = "yes"
&& mail_locking=lockf
test -z "$mail_locking" -a "$mail_use_locking" = "yes"
&& mail_locking=locking
+if test -z "$mail_locking"; then
+ case "$opsys" in cygwin* | mingw*)
+ mail_locking=pop ;;
+ esac
+fi
+
if test "$mail_locking" = "lockf"; then AC_DEFINE(MAIL_LOCK_LOCKF)
elif test "$mail_locking" = "flock"; then AC_DEFINE(MAIL_LOCK_FLOCK)
elif test "$mail_locking" = "locking"; then
AC_DEFINE(MAIL_LOCK_LOCKING)
+elif test "$mail_locking" = "pop"; then
+ with_pop=yes
+ mail_locking=
else mail_locking="dot-locking"; AC_DEFINE(MAIL_LOCK_DOT)
fi
test "$mail_locking" = "lockf" -a "$ac_cv_func_lockf" !=
"yes" && \
@@ -3821,6 +3830,14 @@
done
fi
+ dnl Win32 Native uses native sound
+ if test -z "$sound_found"; then
+ if test "$with_msw" = "yes"; then
+ sound_found=yes
+ native_sound_lib=
+ fi
+ fi
+
test "$sound_found" = "yes" && with_native_sound=yes
fi
@@ -4068,20 +4085,25 @@
if test "$with_modules" != "no"; then
AC_CHECKING(for module support)
- dnl Find headers and libraries
- AC_CHECK_HEADER(dlfcn.h, [
- AC_CHECK_LIB(dl, dlopen, [ have_dl=yes libdl=dl], [
- AC_CHECK_LIB(c, dlopen, [ have_dl=yes ])])])
- if test -n "$have_dl"; then
- AC_DEFINE(HAVE_DLOPEN)
+ dnl Check for MS-Windows
+ if test "$with_msw" == "yes"; then
+ have_dl=yes;
else
- AC_CHECK_LIB(dld, shl_load, [
- libdl=dld have_dl=yes;
- AC_DEFINE(HAVE_SHL_LOAD)], [
- AC_CHECK_LIB(dld, dld_init, [
- libdl=dld have_dl=yes;
- AC_DEFINE(HAVE_DLD_INIT)])])
- fi
+ dnl Find headers and libraries
+ AC_CHECK_HEADER(dlfcn.h, [
+ AC_CHECK_LIB(dl, dlopen, [ have_dl=yes libdl=dl], [
+ AC_CHECK_LIB(c, dlopen, [ have_dl=yes ])])])
+ if test -n "$have_dl"; then
+ AC_DEFINE(HAVE_DLOPEN)
+ else
+ AC_CHECK_LIB(dld, shl_load, [
+ libdl=dld have_dl=yes;
+ AC_DEFINE(HAVE_SHL_LOAD)], [
+ AC_CHECK_LIB(dld, dld_init, [
+ libdl=dld have_dl=yes;
+ AC_DEFINE(HAVE_DLD_INIT)])])
+ fi
+ fi dnl end !MS-Windows
if test -n "$have_dl"; then
dnl XE_SHLIB_STUFF (in aclocal.m4) defines $can_build_shared
@@ -4659,7 +4681,7 @@
test "$with_pop" = yes && echo " Compiling in support for POP
mail retrieval."
test "$with_kerberos" = yes && echo " Compiling in support for
Kerberos POP authentication."
test "$with_hesiod" = yes && echo " Compiling in support for
Hesiod POP server access."
-echo " Compiling in support for \"$mail_locking\" mail spool file locking
method."
+test -n "$mail_locking" && echo " Compiling in support for
\"$mail_locking\" mail spool file locking method."
echo "
Other Features:"
diff -urx CVS xemacsb/lib-src/Makefile.in.in xemacs-cl/lib-src/Makefile.in.in
--- xemacsb/lib-src/Makefile.in.in Mon Jun 12 00:17:46 2000
+++ xemacs-cl/lib-src/Makefile.in.in Wed Jun 28 11:01:20 2000
@@ -75,7 +75,11 @@
## Things that a user might actually run,
## which should be installed in bindir.
+#ifdef WIN32_NATIVE
+INSTALLABLES_BASE = etags ctags b2m ootags
+#else
INSTALLABLES_BASE = etags ctags b2m gnuclient ootags
+#endif
INSTALLABLE_SCRIPTS = rcs-checkin gnudoit gnuattach
#ifdef HAVE_SHLIB
INSTALLABLES = $(INSTALLABLES_BASE) ellcc
@@ -89,7 +93,7 @@
#ifdef WIN32_NATIVE
UTILITIES= make-path wakeup profile make-docfile digest-doc \
sorted-doc movemail cvtmail yow i hexl \
- mmencode
+ mmencode minitar
#else
UTILITIES= make-path wakeup profile make-docfile digest-doc \
sorted-doc movemail cvtmail fakemail yow hexl \
@@ -339,6 +343,9 @@
i: ${srcdir}/i.c
$(CC) $(cflags) ${srcdir}/i.c $(ldflags) -o $@
+
+minitar: ${srcdir}/../nt/minitar.c
+ $(CC) $(cflags) ${srcdir}/../nt/minitar.c $(ldflags) -lz -o $@
hexl: ${srcdir}/hexl.c
$(CC) $(cflags) ${srcdir}/hexl.c $(ldflags) -o $@
diff -urx CVS xemacsb/lisp/finder.el xemacs-cl/lisp/finder.el
--- xemacsb/lisp/finder.el Sun Apr 2 07:58:40 2000
+++ xemacs-cl/lisp/finder.el Thu Jul 6 07:12:18 2000
@@ -150,7 +150,9 @@
(let ((processed nil)
(directory-abbrev-alist
(append
- (mapcar (function (lambda (dir) (cons dir "")))
+ (mapcar (function (lambda (dir)
+ (cons (concat "^" (regexp-quote dir))
+ "")))
finder-abbreviate-directory-list)
directory-abbrev-alist))
(using-load-path))
diff -urx CVS xemacsb/lisp/process.el xemacs-cl/lisp/process.el
--- xemacsb/lisp/process.el Mon Jun 5 04:42:48 2000
+++ xemacs-cl/lisp/process.el Thu Jul 6 07:14:18 2000
@@ -105,8 +105,10 @@
(setq infile (expand-file-name infile))
(setq inbuf (generate-new-buffer "*call-process*"))
(with-current-buffer inbuf
- (insert-file-contents-internal infile nil nil nil nil
- coding-system-for-read)))
+ ;; Make sure this works with jka-compr
+ (let ((file-name-handler-alist nil))
+ (insert-file-contents-internal infile nil nil nil nil
+ 'binary))))
(let ((stderr (if (consp buffer) (second buffer) t)))
(if (consp buffer) (setq buffer (car buffer)))
(setq buffer
diff -urx CVS xemacsb/nt/xemacs.rc xemacs-cl/nt/xemacs.rc
--- xemacsb/nt/xemacs.rc Sat Mar 11 12:53:16 2000
+++ xemacs-cl/nt/xemacs.rc Wed Jul 5 09:46:08 2000
@@ -2,6 +2,6 @@
101 DUMP "xemacs.dmp"
#endif
-XEmacs icon preload "xemacs.ico"
-XEmacsFile icon "File.ico"
-XEmacsLisp icon "Lisp.ico"
+XEmacs ICON PRELOAD "xemacs.ico"
+XEmacsFile ICON "File.ico"
+XEmacsLisp ICON "Lisp.ico"
diff -urx CVS xemacsb/src/Makefile.in.in xemacs-cl/src/Makefile.in.in
--- xemacsb/src/Makefile.in.in Mon Jun 12 00:18:06 2000
+++ xemacs-cl/src/Makefile.in.in Wed Jul 5 09:50:52 2000
@@ -138,6 +138,10 @@
sheap_obj=sheap.o
#endif
+#if defined(MINGW) || defined(CYGWIN)
+res_obj=xemacs_res.o
+#endif
+
## -Demacs is needed to make some files produce the correct version
## for use in Emacs.
@@ -191,7 +195,7 @@
rangetab.o redisplay.o redisplay-output.o regex.o\
search.o select.o $(sheap_obj) signal.o sound.o\
specifier.o strftime.o symbols.o syntax.o sysdep.o\
- undo.o $(x_objs) widget.o window.o
+ undo.o $(x_objs) widget.o window.o $(res_obj)
obj_rtl = $(objs:.o=.c.rtl)
@@ -689,6 +693,9 @@
hpplay.o: ${srcdir}/hpplay.c
$(CC) -c -Demacs $(sound_cflags) $(cflags) ${srcdir}/hpplay.c
#endif /* HAVE_NATIVE_SOUND */
+
+xemacs_res.o: ../nt/xemacs.rc
+ windres --include-dir ../nt -i ../nt/xemacs.rc -o $@
## System-specific programs to be made.
## ${other_files}, $(objects_system) and $(objects_machine)
diff -urx CVS xemacsb/src/buffer.c xemacs-cl/src/buffer.c
--- xemacsb/src/buffer.c Mon Jun 12 00:18:06 2000
+++ xemacs-cl/src/buffer.c Thu Jul 6 07:18:32 2000
@@ -3100,6 +3100,7 @@
}
}
+#ifndef WIN32_NATIVE
/* Is PWD another name for `.' ? */
static int
directory_is_current_directory (Extbyte *pwd)
@@ -3119,23 +3120,29 @@
&& dotstat.st_dev == pwdstat.st_dev
&& pwd_internal_len < MAXPATHLEN);
}
+#endif
void
init_initial_directory (void)
{
/* This function can GC */
+#ifndef WIN32_NATIVE
Extbyte *pwd;
+#endif
initial_directory[0] = 0;
/* If PWD is accurate, use it instead of calling getcwd. This is faster
when PWD is right, and may avoid a fatal error. */
+#ifndef WIN32_NATIVE
if ((pwd = (Extbyte *) getenv ("PWD")) != NULL
&& directory_is_current_directory (pwd))
strcpy (initial_directory, (char *) pwd);
- else if (getcwd (initial_directory, MAXPATHLEN) == NULL)
- fatal ("`getcwd' failed: %s\n", strerror (errno));
+ else
+#endif
+ if (getcwd (initial_directory, MAXPATHLEN) == NULL)
+ fatal ("`getcwd' failed: %s\n", strerror (errno));
/* Make sure pwd is DIRECTORY_SEP-terminated.
Maybe this should really use some standard subroutine
diff -urx CVS xemacsb/src/s/cygwin32.h xemacs-cl/src/s/cygwin32.h
--- xemacsb/src/s/cygwin32.h Mon Jun 12 00:18:30 2000
+++ xemacs-cl/src/s/cygwin32.h Wed Jul 5 10:05:14 2000
@@ -102,8 +102,8 @@
#define ORDINARY_LINK
#endif
-#define C_SWITCH_SYSTEM -Wno-sign-compare -fno-caller-saves
-#define LIBS_SYSTEM -lwinmm
+#define C_SWITCH_SYSTEM -mwindows -Wno-sign-compare -fno-caller-saves
+#define LIBS_SYSTEM -mwindows -lwinmm
#define WIN32_LEAN_AND_MEAN
#define TEXT_START -1
@@ -128,10 +128,8 @@
#define HAVE_SOCKETS
#endif
#define OBJECTS_SYSTEM ntplay.o
-#define HAVE_NATIVE_SOUND
#undef MAIL_USE_SYSTEM_LOCK
-#define MAIL_USE_POP
/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
* group of arguments and treat it as an array of the arguments. */
diff -urx CVS xemacsb/src/s/mingw32.h xemacs-cl/src/s/mingw32.h
--- xemacsb/src/s/mingw32.h Mon Jun 12 21:40:10 2000
+++ xemacs-cl/src/s/mingw32.h Thu Jul 6 07:24:06 2000
@@ -31,8 +31,8 @@
#define ORDINARY_LINK
#endif
-#define C_SWITCH_SYSTEM "-mno-cygwin -Wno-sign-compare -fno-caller-saves
-DWIN32_NATIVE"
-#define LIBS_SYSTEM "-mno-cygwin -lwinmm -lwsock32"
+#define C_SWITCH_SYSTEM "-mno-cygwin -mwindows -Wno-sign-compare -fno-caller-saves
-DWIN32_NATIVE"
+#define LIBS_SYSTEM "-mno-cygwin -mwindows -lwinmm -lwsock32"
#define WIN32_LEAN_AND_MEAN
#define TEXT_START -1
@@ -56,10 +56,8 @@
#define HAVE_SOCKETS
/* #endif */
#define OBJECTS_SYSTEM ntplay.o nt.o ntheap.o ntproc.o dired-msw.o
-#define HAVE_NATIVE_SOUND
#undef MAIL_USE_SYSTEM_LOCK
-#define MAIL_USE_POP
#define HAVE_MSW_C_DIRED
/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
@@ -72,6 +70,8 @@
#define ENCAPSULATE_OPEN
#define ENCAPSULATE_FOPEN
#define ENCAPSULATE_MKDIR
+#define ENCAPSULATE_STAT
+#define ENCAPSULATE_FSTAT
/* Data type of load average, as read out of kmem. */
@@ -128,7 +128,7 @@
/* Define this to be the separator between devices and paths */
#define DEVICE_SEP ':'
-#define DIRECTORY_SEP '\\'
+#define DIRECTORY_SEP ((char)XCHAR(Vdirectory_sep_char))
/* The null device on Windows NT. */
#define NULL_DEVICE "NUL:"
@@ -211,6 +211,10 @@
#define HAVE_SETITIMER
#define HAVE_GETTIMEOFDAY
#define HAVE_SELECT
+/* systime.h includes winsock.h which defines timeval */
+#define HAVE_TIMEVAL
+#define HAVE_GETPAGESIZE
+#define getpagesize() 4096
/*#define HAVE_STRUCT_UTIMBUF*/
#ifndef HAVE_H_ERRNO
#define HAVE_H_ERRNO
@@ -243,6 +247,7 @@
#ifndef MAXPATHLEN
#define MAXPATHLEN _MAX_PATH
#endif
+#endif /* !NOT_C_CODE */
/* Define for those source files that do not include enough NT
system files. */
diff -urx CVS xemacsb/src/sysdll.c xemacs-cl/src/sysdll.c
--- xemacsb/src/sysdll.c Mon Jun 12 00:18:26 2000
+++ xemacs-cl/src/sysdll.c Mon Jul 3 16:48:48 2000
@@ -217,6 +217,11 @@
return dld_get_symbol(n);
}
#elif defined (WIN32_NATIVE)
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+
int
dll_init (const char *arg)
{