changeset 106497:d06619fa1742

* configure.in: Allow compiling Emacs with GTK on Cygwin. * src/s/cygwin.h (G_SLICE_ALWAYS_MALLOC): New variable. * src/emacs.c (main): Set the G_SLICE environment variable for Cygwin GTK builds.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 09 Dec 2009 01:06:32 +0000
parents 6e0007ff5e13
children b151ed491d50
files ChangeLog configure.in src/ChangeLog src/emacs.c src/s/cygwin.h
diffstat 5 files changed, 22 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Dec 09 01:02:28 2009 +0000
+++ b/ChangeLog	Wed Dec 09 01:06:32 2009 +0000
@@ -1,3 +1,7 @@
+2009-12-09  Ken Brown  <kbrown@cornell.edu>  (tiny change)
+
+	* configure.in: Allow compiling Emacs with GTK on Cygwin.
+
 2009-12-01  Glenn Morris  <rgm@gnu.org>
 
 	* make-dist: Add etc/images/mpc directory.
--- a/configure.in	Wed Dec 09 01:02:28 2009 +0000
+++ b/configure.in	Wed Dec 09 01:06:32 2009 +0000
@@ -3026,16 +3026,6 @@
 
 echo
 
-if test "$USE_X_TOOLKIT" = GTK; then
-  case "$canonical" in
-  *cygwin*)
-    echo "There are known problems with Emacs and Gtk+ on cygwin, so you
-  will probably get a crash on startup.  If this happens, please use another
-  toolkit for Emacs.  See etc/PROBLEMS for more information."
-  ;;
-  esac
-fi
-
 if test "$HAVE_NS" = "yes"; then
    echo
    echo "You must run \"make install\" in order to test the built application.
--- a/src/ChangeLog	Wed Dec 09 01:02:28 2009 +0000
+++ b/src/ChangeLog	Wed Dec 09 01:06:32 2009 +0000
@@ -1,3 +1,10 @@
+2009-12-09  Ken Brown  <kbrown@cornell.edu>  (tiny change)
+
+	* s/cygwin.h (G_SLICE_ALWAYS_MALLOC): New variable.
+
+	* emacs.c (main): Set the G_SLICE environment variable for Cygwin
+	GTK builds.
+
 2009-12-07  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* unexelf.c (unexec): Don't search for .data twice.
--- a/src/emacs.c	Wed Dec 09 01:02:28 2009 +0000
+++ b/src/emacs.c	Wed Dec 09 01:06:32 2009 +0000
@@ -809,6 +809,11 @@
   stack_base = &dummy;
 #endif
 
+#if defined (USE_GTK) && defined (G_SLICE_ALWAYS_MALLOC)
+  /* This is used by the Cygwin build.  */
+  setenv ("G_SLICE", "always-malloc", 1);
+#endif
+
   if (!initialized)
     {
       extern char my_endbss[];
--- a/src/s/cygwin.h	Wed Dec 09 01:02:28 2009 +0000
+++ b/src/s/cygwin.h	Wed Dec 09 01:06:32 2009 +0000
@@ -126,6 +126,12 @@
 /* Virtual addresses of pure and impure space can vary, as on Windows.  */
 #define VIRT_ADDR_VARIES
 
+/* Emacs supplies its own malloc, but glib (part of Gtk+) calls
+   memalign and on Cygwin, that becomes the Cygwin-supplied memalign.
+   As malloc is not the Cygwin malloc, the Cygwin memalign always
+   returns ENOSYS.  A workaround is to set G_SLICE=always-malloc. */
+#define G_SLICE_ALWAYS_MALLOC
+
 /* the end */
 
 /* arch-tag: 5ae7ba00-83b0-4ab3-806a-3e845779191b