changeset 109195:1bbf35fc0d68

Merge from mainline.
author Katsumi Yamaoka <katsumi@flagship2>
date Mon, 17 May 2010 12:37:57 +0000
parents e0b7f217b35a (current diff) a53949523193 (diff)
children f779e6dd2626
files
diffstat 18 files changed, 265 insertions(+), 107 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun May 16 00:18:09 2010 +0000
+++ b/ChangeLog	Mon May 17 12:37:57 2010 +0000
@@ -1,3 +1,30 @@
+2010-05-17  Glenn Morris  <rgm@gnu.org>
+
+	* configure.in (OLDXMENU_DEPS): New output variable.
+
+2010-05-16  Glenn Morris  <rgm@gnu.org>
+
+	* configure.in (ns_appbindir, ns_appresdir): Set using $ns_appdir.
+
+	* configure.in (ns_appdir, ns_appbindir): Add trailing "/" to value.
+	* Makefile.in (install-arch-dep): Update for above change.
+
+	* Makefile.in (ns_appdir): Remove.
+	(install-arch-dep): Test $ns_appresdir instead of $ns_appdir.
+
+	* configure.in (TEMACS_LDFLAGS2): New output variable.
+
+	* configure.in (NS_IMPL_GNUSTEP_TEMACS_LDFLAGS): New output variable.
+	(START_FILES): Set to empty if NS_IMPL_GNUSTEP.
+	(GNUSTEP_SYSTEM_HEADERS, GNUSTEP_SYSTEM_LIBRARIES): Do not output,
+	nothing uses.
+
+2010-05-16  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* configure.in: Remove references to usg5-4 and bsd-common, $opsys
+	does not use them.
+	(X11R5_INHIBIT_I18N): Remove, unused.
+
 2010-05-15  Glenn Morris  <rgm@gnu.org>
 
 	* configure.in (LIBXMENU): Set to empty if !HAVE_X_WINDOWS.
--- a/Makefile.in	Sun May 16 00:18:09 2010 +0000
+++ b/Makefile.in	Mon May 17 12:37:57 2010 +0000
@@ -164,7 +164,6 @@
 x_default_search_path=@x_default_search_path@
 
 # Location to install Emacs.app under NeXT/Open/GNUstep / Cocoa
-ns_appdir=@ns_appdir@
 ns_appbindir=@ns_appbindir@
 ns_appresdir=@ns_appresdir@
 
@@ -418,14 +417,14 @@
 	    ${INSTALL_DATA} lib-src/$$f $(DESTDIR)${archlibdir}/$$f; \
 	  else true; fi ; \
 	done
-	if test "${ns_appdir}" != ""; then \
+	if test "${ns_appresdir}" != ""; then \
 	  ( cd ${ns_appresdir} ; \
 	    if test -d share/emacs ; then dir=share/emacs/*/*; $(MV_DIRS); fi;\
 	    if test -d share/info ; then dir=share/info; $(MV_DIRS) ; fi ; \
 	    rm -fr share ) ; \
-	  ( cd ${ns_appbindir}/libexec ; dir=emacs/*/*/* ; $(MV_DIRS); \
+	  ( cd ${ns_appbindir}libexec ; dir=emacs/*/*/* ; $(MV_DIRS); \
 	    rm -fr emacs ) ; \
-	  ( cd ${ns_appbindir}/bin ; rm -f emacs emacs-24* ; \
+	  ( cd ${ns_appbindir}bin ; rm -f emacs emacs-24* ; \
 	    ln -sf ../libexec/* .) ; \
 	else true ; fi
 
--- a/configure	Sun May 16 00:18:09 2010 +0000
+++ b/configure	Mon May 17 12:37:57 2010 +0000
@@ -718,6 +718,8 @@
 LD_SWITCH_X_SITE_AUX
 LD_SWITCH_X_SITE_AUX_RPATH
 NS_IMPL_GNUSTEP_INC
+NS_IMPL_GNUSTEP_TEMACS_LDFLAGS
+TEMACS_LDFLAGS2
 NS_OBJ
 NS_SUPPORT
 LIB_STANDARD
@@ -795,8 +797,6 @@
 ns_appbindir
 ns_appresdir
 ns_appsrc
-GNUSTEP_SYSTEM_HEADERS
-GNUSTEP_SYSTEM_LIBRARIES
 GNU_OBJC_CFLAGS
 OTHER_FILES
 FONT_OBJ
@@ -809,6 +809,7 @@
 OLDXMENU
 LIBXMENU
 LIBX_OTHER
+OLDXMENU_DEPS
 CYGWIN_OBJ
 PRE_ALLOC_OBJ
 POST_ALLOC_OBJ
@@ -9933,22 +9934,24 @@
 NS_IMPL_COCOA=no
 NS_IMPL_GNUSTEP=no
 NS_IMPL_GNUSTEP_INC=
+NS_IMPL_GNUSTEP_TEMACS_LDFLAGS=
 tmp_CPPFLAGS="$CPPFLAGS"
 tmp_CFLAGS="$CFLAGS"
 CPPFLAGS="$CPPFLAGS -x objective-c"
 CFLAGS="$CFLAGS -x objective-c"
+TEMACS_LDFLAGS2="\${LDFLAGS}"
 if test "${with_ns}" != no; then
   if test "${opsys}" = darwin; then
      NS_IMPL_COCOA=yes
-     ns_appdir=`pwd`/nextstep/Emacs.app
-     ns_appbindir=`pwd`/nextstep/Emacs.app/Contents/MacOS
-     ns_appresdir=`pwd`/nextstep/Emacs.app/Contents/Resources
+     ns_appdir=`pwd`/nextstep/Emacs.app/
+     ns_appbindir=${ns_appdir}Contents/MacOS/
+     ns_appresdir=${ns_appdir}Contents/Resources
      ns_appsrc=${srcdir}/nextstep/Cocoa/Emacs.base
   elif test -f $GNUSTEP_CONFIG_FILE; then
      NS_IMPL_GNUSTEP=yes
-     ns_appdir=`pwd`/nextstep/Emacs.app
-     ns_appbindir=`pwd`/nextstep/Emacs.app
-     ns_appresdir=`pwd`/nextstep/Emacs.app/Resources
+     ns_appdir=`pwd`/nextstep/Emacs.app/
+     ns_appbindir=${ns_appdir}
+     ns_appresdir=${ns_appdir}Resources
      ns_appsrc=${srcdir}/nextstep/GNUstep/Emacs.base
           GNUSTEP_MAKEFILES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_MAKEFILES)"
      GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)"
@@ -9960,11 +9963,14 @@
 include $GNUSTEP_MAKEFILES/Additional/gui.make
 shared=no
 "
+          NS_IMPL_GNUSTEP_TEMACS_LDFLAGS="-L${GNUSTEP_SYSTEM_LIBRARIES} -lgnustep-gui -lgnustep-base -lobjc \${CONFIG_SYSTEM_LIBS} -lpthread"
      CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS}"
      CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}"
      REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}"
      LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES}"
      LIB_STANDARD=
+     START_FILES=
+     TEMACS_LDFLAGS2=
   fi
   if test "${ac_cv_header_AppKit_AppKit_h+set}" = set; then
   { $as_echo "$as_me:$LINENO: checking for AppKit/AppKit.h" >&5
@@ -10153,6 +10159,8 @@
 fi
 
 
+
+
 NS_OBJ=
 NS_SUPPORT=
 if test "${HAVE_NS}" = yes; then
@@ -21594,7 +21602,7 @@
 
 ## Use terminfo instead of termcap?
 ## Note only system files NOT using terminfo are:
-## bsd-common, freebsd < 40000, ms-w32, msdos, netbsd, and
+## freebsd < 40000, ms-w32, msdos, netbsd, and
 ## darwin|gnu without ncurses.
 TERMINFO=no
 LIBS_TERMCAP=
@@ -21603,7 +21611,7 @@
   ## hpux10-20: Use the system provided termcap(3) library.
   ## openbsd: David Mazieres <dm@reeducation-labor.lcs.mit.edu> says this
   ##  is necessary.  Otherwise Emacs dumps core when run -nw.
-  aix4-2|cygwin|hpux*|irix6-5|openbsd|usg5-4|sol2*|unixware) TERMINFO=yes ;;
+  aix4-2|cygwin|hpux*|irix6-5|openbsd|sol2*|unixware) TERMINFO=yes ;;
 
   ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2.
   ##  The ncurses library has been moved out of the System framework in
@@ -26359,8 +26367,6 @@
 
 
 
-
-
 cat >>confdefs.h <<_ACEOF
 #define EMACS_CONFIGURATION "${canonical}"
 _ACEOF
@@ -26483,6 +26489,7 @@
   fi
   LIBXMENU="\$(OLDXMENU)"
   LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
+  OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}"
 else
   OLDXMENU=
   ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?).
@@ -26492,12 +26499,15 @@
     LIBXMENU=
   fi
   LIBX_OTHER=
+  OLDXMENU_DEPS=
 fi
 
 if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then
   OLDXMENU=
   LIBXMENU=
-fi
+  OLDXMENU_DEPS=
+fi
+
 
 
 
--- a/configure.in	Sun May 16 00:18:09 2010 +0000
+++ b/configure.in	Mon May 17 12:37:57 2010 +0000
@@ -1453,22 +1453,27 @@
 NS_IMPL_COCOA=no
 NS_IMPL_GNUSTEP=no
 NS_IMPL_GNUSTEP_INC=
+NS_IMPL_GNUSTEP_TEMACS_LDFLAGS=
 tmp_CPPFLAGS="$CPPFLAGS"
 tmp_CFLAGS="$CFLAGS"
 CPPFLAGS="$CPPFLAGS -x objective-c"
 CFLAGS="$CFLAGS -x objective-c"
+TEMACS_LDFLAGS2="\${LDFLAGS}"
+dnl I don't think it's especially important, but src/Makefile.in
+dnl (now the only user of ns_appdir) used to go to the trouble of adding a
+dnl trailing "/" to it, so now we do it here.
 if test "${with_ns}" != no; then
   if test "${opsys}" = darwin; then
      NS_IMPL_COCOA=yes
-     ns_appdir=`pwd`/nextstep/Emacs.app
-     ns_appbindir=`pwd`/nextstep/Emacs.app/Contents/MacOS
-     ns_appresdir=`pwd`/nextstep/Emacs.app/Contents/Resources
+     ns_appdir=`pwd`/nextstep/Emacs.app/
+     ns_appbindir=${ns_appdir}Contents/MacOS/
+     ns_appresdir=${ns_appdir}Contents/Resources
      ns_appsrc=${srcdir}/nextstep/Cocoa/Emacs.base
   elif test -f $GNUSTEP_CONFIG_FILE; then
      NS_IMPL_GNUSTEP=yes
-     ns_appdir=`pwd`/nextstep/Emacs.app
-     ns_appbindir=`pwd`/nextstep/Emacs.app
-     ns_appresdir=`pwd`/nextstep/Emacs.app/Resources
+     ns_appdir=`pwd`/nextstep/Emacs.app/
+     ns_appbindir=${ns_appdir}
+     ns_appresdir=${ns_appdir}Resources
      ns_appsrc=${srcdir}/nextstep/GNUstep/Emacs.base
      dnl FIXME sourcing this 3 times in subshells seems inefficient.
      GNUSTEP_MAKEFILES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_MAKEFILES)"
@@ -1481,11 +1486,15 @@
 include $GNUSTEP_MAKEFILES/Additional/gui.make
 shared=no
 "
+     dnl Presumably ${CONFIG_SYSTEM_LIBS} is defined by above includes.
+     NS_IMPL_GNUSTEP_TEMACS_LDFLAGS="-L${GNUSTEP_SYSTEM_LIBRARIES} -lgnustep-gui -lgnustep-base -lobjc \${CONFIG_SYSTEM_LIBS} -lpthread"
      CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS}"
      CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}"
      REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS}"
      LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES}"
      LIB_STANDARD=
+     START_FILES=
+     TEMACS_LDFLAGS2=
   fi
   AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes],
   		  [AC_MSG_ERROR([`--with-ns' was specified, but the include
@@ -1500,6 +1509,8 @@
   fi
 fi
 AC_SUBST(NS_IMPL_GNUSTEP_INC)
+AC_SUBST(NS_IMPL_GNUSTEP_TEMACS_LDFLAGS)
+AC_SUBST(TEMACS_LDFLAGS2)
 
 NS_OBJ=
 NS_SUPPORT=
@@ -2612,7 +2623,7 @@
 
 ## Use terminfo instead of termcap?
 ## Note only system files NOT using terminfo are:
-## bsd-common, freebsd < 40000, ms-w32, msdos, netbsd, and
+## freebsd < 40000, ms-w32, msdos, netbsd, and
 ## darwin|gnu without ncurses.
 TERMINFO=no
 LIBS_TERMCAP=
@@ -2621,7 +2632,7 @@
   ## hpux10-20: Use the system provided termcap(3) library.
   ## openbsd: David Mazieres <dm@reeducation-labor.lcs.mit.edu> says this
   ##  is necessary.  Otherwise Emacs dumps core when run -nw.
-  aix4-2|cygwin|hpux*|irix6-5|openbsd|usg5-4|sol2*|unixware) TERMINFO=yes ;;
+  aix4-2|cygwin|hpux*|irix6-5|openbsd|sol2*|unixware) TERMINFO=yes ;;
 
   ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2.
   ##  The ncurses library has been moved out of the System framework in
@@ -3051,8 +3062,6 @@
 AC_SUBST(ns_appbindir)
 AC_SUBST(ns_appresdir)
 AC_SUBST(ns_appsrc)
-AC_SUBST(GNUSTEP_SYSTEM_HEADERS)
-AC_SUBST(GNUSTEP_SYSTEM_LIBRARIES)
 AC_SUBST(GNU_OBJC_CFLAGS)
 AC_SUBST(OTHER_FILES)
 
@@ -3150,6 +3159,7 @@
   fi
   LIBXMENU="\$(OLDXMENU)"
   LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
+  OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}"
 else
   OLDXMENU=
   ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?).
@@ -3159,16 +3169,19 @@
     LIBXMENU=
   fi
   LIBX_OTHER=
+  OLDXMENU_DEPS=
 fi
 
 if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then
   OLDXMENU=
   LIBXMENU=
+  OLDXMENU_DEPS=
 fi
 
 AC_SUBST(OLDXMENU)
 AC_SUBST(LIBXMENU)
 AC_SUBST(LIBX_OTHER)
+AC_SUBST(OLDXMENU_DEPS)
 
 if test "${HAVE_MENUS}" = "yes" ; then
   AC_DEFINE(HAVE_MENUS, 1,
@@ -3487,8 +3500,6 @@
 
 #ifdef HAVE_X11R6
 #define HAVE_X_I18N
-#elif !defined X11R5_INHIBIT_I18N
-#define HAVE_X_I18N
 #endif
 
 /* Define HAVE_X11R6_XIM if we have usable X11R6-style XIM support.  */
@@ -3508,11 +3519,7 @@
    that the stack is continuous.  */
 #ifdef __GNUC__
 #  ifndef GC_SETJMP_WORKS
-  /* GC_SETJMP_WORKS is nearly always appropriate for GCC --
-     see NON_SAVING_SETJMP in the target descriptions.  */
-  /* Exceptions (see NON_SAVING_SETJMP in target description) are
-     SCO5 non-ELF (but Emacs specifies ELF) and SVR3 on x86.
-     Fixme: Deal with SVR3.  */
+  /* GC_SETJMP_WORKS is nearly always appropriate for GCC.  */
 #    define GC_SETJMP_WORKS 1
 #  endif
 #  ifndef GC_LISP_OBJECT_ALIGNMENT
--- a/doc/misc/ChangeLog	Sun May 16 00:18:09 2010 +0000
+++ b/doc/misc/ChangeLog	Mon May 17 12:37:57 2010 +0000
@@ -1,6 +1,11 @@
+2010-05-16  Jay Belanger  <jay.p.belanger@gmail.com>
+
+	* calc.texi (Manipulating Vectors): Mention that vectors can
+	be used to determine bins for `calc-histogram'.
+
 2010-05-13  Jay Belanger  <jay.p.belanger@gmail.com>
 
-	* calc.texi: Remove "\turnoffactive" commands througout.
+	* calc.texi: Remove "\turnoffactive" commands throughout.
 
 2010-05-08  Štěpán Němec  <stepnem@gmail.com>  (tiny change)
 
--- a/doc/misc/calc.texi	Sun May 16 00:18:09 2010 +0000
+++ b/doc/misc/calc.texi	Mon May 17 12:37:57 2010 +0000
@@ -20030,6 +20030,20 @@
 that the counts in the result vector don't add up to the length of the
 input vector.)
 
+If no prefix is given, then you will be prompted for a vector which
+will be used to determine the bins. (If a positive integer is given at
+this prompt, it will be still treated as if it were given as a
+prefix.)  Each bin will consist of the interval of numbers closest to
+the corresponding number of this new vector; if the vector 
+@expr{[a, b, c, ...]} is entered at the prompt, the bins will be 
+@expr{(-inf, (a+b)/2]}, @expr{((a+b)/2, (b+c)/2]}, etc.  The result of 
+this command will be a vector counting how many elements of the
+original vector are in each bin.
+
+The result will then be a vector with the same length as this new vector;
+each element of the new vector will be replaced by the number of
+elements of the original vector which are closest to it.
+
 @kindex H v H
 @kindex H V H
 With the Hyperbolic flag, @kbd{H V H} pulls two vectors from the stack.
--- a/etc/DEBUG	Sun May 16 00:18:09 2010 +0000
+++ b/etc/DEBUG	Mon May 17 12:37:57 2010 +0000
@@ -627,8 +627,7 @@
 
   - In src/s/SYSTEM-NAME.h add "#define SYSTEM_MALLOC".
 
-  - In src/m/MACHINE-NAME.h add "#define CANNOT_DUMP" and
-    "#define CANNOT_UNEXEC".
+  - In src/m/MACHINE-NAME.h add "#define CANNOT_DUMP"
 
   - Configure with a different --prefix= option.  If you use GCC,
     version 2.7.2 is preferred, as some malloc debugging packages
--- a/lisp/ChangeLog	Sun May 16 00:18:09 2010 +0000
+++ b/lisp/ChangeLog	Mon May 17 12:37:57 2010 +0000
@@ -1,3 +1,17 @@
+2010-05-17  Jay Belanger  <jay.p.belanger@gmail.com>
+
+	* calc/calc-vec.el (math-vector-avg):  Put the vector elements in
+	order before computing the averages.
+
+2010-05-16  Jay Belanger  <jay.p.belanger@gmail.com>
+
+	* calc/calc-vec.el (calc-histogram):
+	(calcFunc-histogram):  Allow vectors as inputs.
+	(math-vector-avg): New function.
+
+	* calc/calc-ext.el (math-group-float):  Have the number of digits
+	being grouped depend on the radix (Bug#6189).
+
 2010-05-15  Ken Raeburn  <raeburn@raeburn.org>
 
 	* version.el (emacs-copyright, emacs-version): Don't define here,
--- a/lisp/calc/README	Sun May 16 00:18:09 2010 +0000
+++ b/lisp/calc/README	Mon May 17 12:37:57 2010 +0000
@@ -74,6 +74,8 @@
 
 Emacs 24.1
 
+* Gave `calc-histogram' the option of using a vector to determine the bins.
+
 * Added "O" option prefix.
 
 * Used "O" prefix to "d r" (`calc-radix') to turn on twos-complement mode.
--- a/lisp/calc/calc-ext.el	Sun May 16 00:18:09 2010 +0000
+++ b/lisp/calc/calc-ext.el	Mon May 17 12:37:57 2010 +0000
@@ -3469,7 +3469,8 @@
 
 (defun math-group-float (str)   ; [X X]
   (let* ((pt (or (string-match "[^0-9a-zA-Z]" str) (length str)))
-	 (g (if (integerp calc-group-digits) (math-abs calc-group-digits) 3))
+	 (g (if (integerp calc-group-digits) (math-abs calc-group-digits)
+              (if (memq calc-number-radix '(2 16)) 4 3)))
 	 (i pt))
     (if (and (integerp calc-group-digits) (< calc-group-digits 0))
 	(while (< (setq i (+ (1+ i) g)) (length str))
--- a/lisp/calc/calc-vec.el	Sun May 16 00:18:09 2010 +0000
+++ b/lisp/calc/calc-vec.el	Mon May 17 12:37:57 2010 +0000
@@ -451,16 +451,18 @@
      (calc-enter-result 1 "grad" (list 'calcFunc-grade (calc-top-n 1))))))
 
 (defun calc-histogram (n)
-  (interactive "NNumber of bins: ")
+  (interactive "P")
+  (unless (natnump n)
+    (setq n (math-read-expr (read-string "Centers of bins: "))))
   (calc-slow-wrapper
    (if calc-hyperbolic-flag
        (calc-enter-result 2 "hist" (list 'calcFunc-histogram
 					 (calc-top-n 2)
 					 (calc-top-n 1)
-					 (prefix-numeric-value n)))
+					 n))
      (calc-enter-result 1 "hist" (list 'calcFunc-histogram
 				       (calc-top-n 1)
-				       (prefix-numeric-value n))))))
+                                       n)))))
 
 (defun calc-transpose (arg)
   (interactive "P")
@@ -1135,22 +1137,53 @@
   (if (Math-vectorp wts)
       (or (= (length vec) (length wts))
 	  (math-dimension-error)))
-  (or (natnump n)
-      (math-reject-arg n 'fixnatnump))
-  (let ((res (make-vector n 0))
-	(vp vec)
-	(wvec (Math-vectorp wts))
-	(wp wts)
-	bin)
-    (while (setq vp (cdr vp))
-      (setq bin (car vp))
-      (or (natnump bin)
-	  (setq bin (math-floor bin)))
-      (and (natnump bin)
-	   (< bin n)
-	   (aset res bin (math-add (aref res bin)
-				   (if wvec (car (setq wp (cdr wp))) wts)))))
-    (cons 'vec (append res nil))))
+  (cond ((natnump n)
+         (let ((res (make-vector n 0))
+               (vp vec)
+               (wvec (Math-vectorp wts))
+               (wp wts)
+               bin)
+           (while (setq vp (cdr vp))
+             (setq bin (car vp))
+             (or (natnump bin)
+                 (setq bin (math-floor bin)))
+            (and (natnump bin)
+                 (< bin n)
+                 (aset res bin 
+                       (math-add (aref res bin)
+                                 (if wvec (car (setq wp (cdr wp))) wts)))))
+           (cons 'vec (append res nil))))
+        ((Math-vectorp n) ;; n is a vector of midpoints
+         (let* ((bds (math-vector-avg n))
+                (res (make-vector (1- (length n)) 0))
+                (vp (cdr vec))
+                (wvec (Math-vectorp wts))
+                (wp wts)
+                num)
+           (while vp
+             (setq num (car vp))
+             (let ((tbds (cdr bds))
+                   (i 0))
+               (while (and tbds (Math-lessp (car tbds) num))
+                 (setq i (1+ i))
+                 (setq tbds (cdr tbds)))
+               (aset res i 
+                     (math-add (aref res i)
+                               (if wvec (car (setq wp (cdr wp))) wts))))
+             (setq vp (cdr vp)))
+           (cons 'vec (append res nil))))
+        (t
+         (math-reject-arg n "*Expecting an integer or vector"))))
+
+;;; Replace a vector [a b c ...] with a vector of averages
+;;; [(a+b)/2 (b+c)/2 ...]
+(defun math-vector-avg (vec)
+  (let ((vp (sort (copy-sequence (cdr vec)) 'math-beforep))
+        (res nil))
+    (while (and vp (cdr vp))
+      (setq res (cons (math-div (math-add (car vp) (cadr vp)) 2) res)
+            vp (cdr vp)))
+    (cons 'vec (reverse res))))
 
 
 ;;; Set operations.
--- a/msdos/ChangeLog	Sun May 16 00:18:09 2010 +0000
+++ b/msdos/ChangeLog	Mon May 17 12:37:57 2010 +0000
@@ -1,3 +1,15 @@
+2010-05-17  Glenn Morris  <rgm@gnu.org>
+
+	* sed1v2.inp (OLDXMENU_DEPS): Edit to empty.
+	* sed1x.inp (OLDXMENU_DEPS): Edit to ${OLDXMENU} ../src/${OLDXMENU}.
+
+2010-05-16  Glenn Morris  <rgm@gnu.org>
+
+	* sed1v2.inp (TEMACS_LDFLAGS2): Edit to $(LDFLAGS).
+
+	* sed1v2.inp (GNUSTEP_SYSTEM_LIBRARIES): Remove.
+	(NS_IMPL_GNUSTEP_TEMACS_LDFLAGS): Edit to empty.
+
 2010-05-15  Glenn Morris  <rgm@gnu.org>
 
 	* sed1v2.inp (LIBXMENU): Edit to empty.
--- a/msdos/sed1v2.inp	Sun May 16 00:18:09 2010 +0000
+++ b/msdos/sed1v2.inp	Mon May 17 12:37:57 2010 +0000
@@ -52,6 +52,7 @@
 /^LD_SWITCH_X_SITE_AUX_RPATH *=/s/@LD_SWITCH_X_SITE_AUX_RPATH@//
 /^LD_SWITCH_SYSTEM *=/s/@LD_SWITCH_SYSTEM@//
 /^LD_SWITCH_SYSTEM_EXTRA *=/s/@LD_SWITCH_SYSTEM_EXTRA@//
+/^TEMACS_LDFLAGS2 *=/s/@TEMACS_LDFLAGS2@/$(LDFLAGS)/
 /^LIBS_SYSTEM *=/s/@LIBS_SYSTEM@//
 /^LIB_GCC *=/s/@LIB_GCC@/-Lgcc/
 /^LIB_STANDARD *=/s/@LIB_STANDARD@//
@@ -83,6 +84,7 @@
 /^LIBXTR6 *=/s/@LIBXTR6@//
 /^LIBXT_OTHER *=/s/@LIBXT_OTHER@//
 /^OLDXMENU_TARGET *=/s/@OLDXMENU_TARGET@//
+/^OLDXMENU_DEPS *=/s/@OLDXMENU_DEPS@//
 /^XOBJ *=/s/@XOBJ@//
 /^TOOLKIT_LIBW *=/s/@TOOLKIT_LIBW@//
 /^LIBSOUND *=/s/@LIBSOUND@//
@@ -99,7 +101,6 @@
 /^NS_OBJ *=/s/@NS_OBJ@//
 /^NS_SUPPORT *=/s/@NS_SUPPORT@//
 /^GNU_OBJC_CFLAGS*=/s/@GNU_OBJC_CFLAGS@//
-/^GNUSTEP_SYSTEM_LIBRARIES *=/s/@GNUSTEP_SYSTEM_LIBRARIES@//
 /^LIBRESOLV *=/s/@LIBRESOLV@//
 /^LIBSELINUX_LIBS *=/s/@LIBSELINUX_LIBS@//
 /^GETLOADAVG_LIBS *=/s/@[^@\n]*@//
@@ -123,6 +124,7 @@
 /^S_FILE *=/s!@[^@\n]*@!s/msdos.h!
 /^@SET_MAKE@$/s/@SET_MAKE@//
 /^@NS_IMPL_GNUSTEP_INC@/s/@NS_IMPL_GNUSTEP_INC@//
+/^NS_IMPL_GNUSTEP_TEMACS_LDFLAGS *=/s/@NS_IMPL_GNUSTEP_TEMACS_LDFLAGS@//
 /^.\${libsrc}make-docfile.*>/s!make-docfile!make-docfile -o ../etc/DOC!
 /^.\${libsrc}make-doc/s!>.*$!!
 /^[ 	]*$/d
--- a/msdos/sed1x.inp	Sun May 16 00:18:09 2010 +0000
+++ b/msdos/sed1x.inp	Mon May 17 12:37:57 2010 +0000
@@ -8,6 +8,7 @@
 /^LIBXMENU *=/s!= *!= ${OLDXMENU}!
 /^LIBX_OTHER *=/s!= *!= ${LIBXT} ${LIBX_EXTRA}!
 /^OLDXMENU_TARGET *=/s!= *!= really-oldxmenu!
+/^OLDXMENU_DEPS *=/s!= *!= ${OLDXMENU} ../src/${OLDXMENU}!
 /^LIBS_SYSTEM *=/s!= *!= -lxext -lsys!
 /^MSDOS_X_OBJ *=/s!= *!= w16select.o termcap.o!
 /^FONT_OBJ *=/s!= *!= xfont.o!
--- a/src/ChangeLog	Sun May 16 00:18:09 2010 +0000
+++ b/src/ChangeLog	Mon May 17 12:37:57 2010 +0000
@@ -1,5 +1,39 @@
+2010-05-17  Glenn Morris  <rgm@gnu.org>
+
+	* Makefile.in (OLDXMENU_DEPS): New, set by configure.
+	(stamp-oldxmenu): Use $OLDXMENU_DEPS.
+
 2010-05-16  Glenn Morris  <rgm@gnu.org>
 
+	* Makefile.in (${ns_appbindir}Emacs, ns-app): Always define these rules.
+
+	* Makefile.in (clean): Get rid of HAVE_NS conditional.
+
+	* Makefile.in (ns_appdir, ns_appbindir): Now configure adds the
+	trailing "/".
+
+	* Makefile.in (TEMACS_LDFLAGS2): New, set by configure.
+	(temacs${EXEEXT}): Combine the NS_IMPL_GNUSTEP case with the default.
+
+	* Makefile.in (GNUSTEP_SYSTEM_LIBRARIES): Remove, unused.
+	(NS_IMPL_GNUSTEP_TEMACS_LDFLAGS): New, set by configure.
+	(LD) [NS_IMPL_GNUSTEP]: Set to $(CC) -rdynamic.
+	(temacs${EXEEXT}): Remove $LOCALCPP, never defined or referenced.
+	Make most of the NS_IMPL_GNUSTEP case the same as the default case.
+
+	* Makefile.in (temacs${EXEEXT}) [!NS_IMPL_GNUSTEP]:
+	Remove ${STARTFLAGS}, nothing ever sets it.
+
+2010-05-16  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* m/ia64.h (UNEXEC): Remove, set in s/*.h.
+
+2010-05-16  Glenn Morris  <rgm@gnu.org>
+
+	* Makefile.in (LIBX_BASE): Always define.
+
+	* Makefile.in (LIBX_OTHER): Move out of cpp section.
+
 	* Makefile.in (LIBXT): Always define.
 
 2010-05-15  Glenn Morris  <rgm@gnu.org>
--- a/src/Makefile.in	Sun May 16 00:18:09 2010 +0000
+++ b/src/Makefile.in	Mon May 17 12:37:57 2010 +0000
@@ -115,6 +115,9 @@
 ## Flags to pass to ld only for temacs.
 TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_EXTRA) $(LD_SWITCH_SYSTEM_TEMACS)
 
+## $LDFLAGS, or empty if NS_IMPL_GNUSTEP (for some reason).
+TEMACS_LDFLAGS2 = @TEMACS_LDFLAGS2@
+
 ## Some systems define this to request special libraries.
 LIBS_SYSTEM=@LIBS_SYSTEM@
 
@@ -177,6 +180,12 @@
 ## Else ${oldXMenudir}libXMenu11.a.
 OLDXMENU=@OLDXMENU@
 
+## If HAVE_X11 && !USE_GTK, ${OLDXMENU} ../src/${OLDXMENU}; else empty.
+## We use stamp-xmenu with these two deps to both ensure that lwlib
+## gets remade based on its dependencies in its own makefile,
+## and remake temacs if lwlib gets changed by this. 
+OLDXMENU_DEPS=@OLDXMENU_DEPS@
+
 ## If !HAVE_X11 && HAVE_X_WINDOWS, -lXMenu (this case no longer possible).
 ## Else if !HAVE_X11 || USE_GTK, empty.
 ## Else $(OLDXMENU).
@@ -190,6 +199,15 @@
 ## Only used if HAVE_X11, in LIBX_OTHER.
 LIBXT=$(TOOLKIT_LIBW) $(LIBXT_OTHER)
 
+## If HAVE_X11, $(LIBXT) $(LIBX_EXTRA), else empty.
+LIBX_OTHER=@LIBX_OTHER@
+
+## LIBXMENU is nil if !HAVE_X_WINDOWS.
+## LD_SWITCH_X_SITE should not be used if not using X, but nothing
+## sets it at present, and if something ever does, it should be
+## configure, which should set it to nil in non-X builds.
+LIBX_BASE=$(LIBXMENU) $(LD_SWITCH_X_SITE)
+
 LIBSOUND= @LIBSOUND@
 CFLAGS_SOUND= @CFLAGS_SOUND@
 
@@ -212,14 +230,13 @@
 ## $MSDOS_SUPPORT_REAL if MSDOS.
 MSDOS_SUPPORT = 
 
-ns_appdir=@ns_appdir@/
-ns_appbindir=@ns_appbindir@/
+ns_appdir=@ns_appdir@
+ns_appbindir=@ns_appbindir@
 ns_appsrc=@ns_appsrc@
 NS_OBJ=@NS_OBJ@
 NS_SUPPORT=@NS_SUPPORT@
-## Next two only set if NS_IMPL_GNUSTEP.
+## Only set if NS_IMPL_GNUSTEP.
 GNU_OBJC_CFLAGS=@GNU_OBJC_CFLAGS@
-GNUSTEP_SYSTEM_LIBRARIES=@GNUSTEP_SYSTEM_LIBRARIES@
 
 ## Empty if !HAVE_X_WINDOWS
 ## xfont.o ftfont.o xftfont.o ftxfont.o if HAVE_XFT
@@ -278,6 +295,10 @@
 /* If NS_IMPL_GNUSTEP, some definitions and includes are expanded here.  */
 @NS_IMPL_GNUSTEP_INC@
 
+/* FIXME move to LD_SWITCH_SYSTEM_TEMACS?
+   This uses ${CONFIG_SYSTEM_LIBS}, presumably set by the above include.  */
+NS_IMPL_GNUSTEP_TEMACS_LDFLAGS=@NS_IMPL_GNUSTEP_TEMACS_LDFLAGS@
+
 /* DO NOT use -R.  There is a special hack described in lastfile.c
    which is used instead.  Some initialized data areas are modified
    at initial startup, then labeled as part of the text area when
@@ -307,12 +328,6 @@
 #endif
 	$(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $<
 
-#ifdef HAVE_X_WINDOWS
-LIBX_BASE=$(LIBXMENU) $(LD_SWITCH_X_SITE)
-#endif /* HAVE_X_WINDOWS */
-
-/* If HAVE_X11, $(LIBXT) $(LIBX_EXTRA), else empty.  */
-LIBX_OTHER=@LIBX_OTHER@
 
 /* A macro which other sections of Makefile can redefine to munge the
    flags before they are passed to LD.  This is helpful if you have
@@ -354,6 +369,12 @@
 
 #endif /* not ORDINARY_LINK */
 
+
+#ifdef NS_IMPL_GNUSTEP
+LD=$(CC) -rdynamic
+#endif
+
+
 /* lastfile must follow all files whose initialized data areas should
    be dumped as pure by dump-emacs.  */
 obj=    dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
@@ -667,18 +688,11 @@
 buildobj.h: Makefile
 	echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h
 
-/* FIXME LOCALCPP not defined or mentioned anywhere.  */
-temacs${EXEEXT}: $(LOCALCPP) $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT}
-#ifdef NS_IMPL_GNUSTEP
-	$(CC) -rdynamic YMF_PASS_LDFLAGS ( ${TEMACS_LDFLAGS} \
-	-L$(GNUSTEP_SYSTEM_LIBRARIES) -lgnustep-gui -lgnustep-base \
-	-lobjc $(CONFIG_SYSTEM_LIBS) -lpthread ) -o temacs \
-	${obj} ${otherobj} ${LIBES}
-#else
-	$(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
-    -o temacs ${START_FILES} ${obj} ${otherobj}  \
-    ${LIBES}
-#endif
+temacs${EXEEXT}: $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} prefix-args${EXEEXT}
+	$(LD) YMF_PASS_LDFLAGS ( ${TEMACS_LDFLAGS} \
+	  ${NS_IMPL_GNUSTEP_TEMACS_LDFLAGS} ) \
+	  ${TEMACS_LDFLAGS2} \
+	  -o temacs ${START_FILES} ${obj} ${otherobj} ${LIBES}
 
 prefix-args${EXEEXT}: prefix-args.o $(config_h)
 	$(CC) $(LDFLAGS) prefix-args.o -o prefix-args
@@ -698,23 +712,18 @@
 	@true  /* make -t should not create really-oldXMenu.  */
 .PHONY: really-oldXMenu
 
+/* We don''t really need this when OLDXMENU_DEPS is empty, but as
+   things stand we need something to satisfy the temacs dependency.  */
+stamp-oldxmenu: ${OLDXMENU_DEPS}
+	touch stamp-oldxmenu
+
 /* HAVE_X11 implies HAVE_X_WINDOWS and HAVE_MENUS.  */
 #if defined (HAVE_X11) && ! defined (USE_GTK)
-/* We use stamp-xmenu with these two deps to both ensure that lwlib
-   gets remade based on its dependencies in its own makefile,
-   and remake temacs if lwlib gets changed by this.  */
-stamp-oldxmenu: ${OLDXMENU} ../src/$(OLDXMENU)
-	touch stamp-oldxmenu
 /* Supply an ordering for parallel make.  */
 ../src/$(OLDXMENU): ${OLDXMENU}
 
 $(OLDXMENU): $(OLDXMENU_TARGET)
-
-#else /* !HAVE_X11 || USE_GTK */ 
-/* We don''t really need this, but satisfy the dependency.  */
-stamp-oldxmenu:
-	touch stamp-oldxmenu
-#endif /* HAVE_X11 && !USE_GTK */
+#endif /* HAVE_X11 && !USE_GTK */ 
 
 ../config.status:: epaths.in
 	@echo "The file epaths.h needs to be set up from epaths.in."
@@ -991,13 +1000,14 @@
 	rm -fr ${ns_appdir}
 	mkdir -p ${ns_appdir}
 	( cd ${ns_appsrc} ; tar cfh - . ) | ( cd ${ns_appdir} ; umask 022; tar xf - )
+#endif /* HAVE_NS */
 
+/* These are only used if HAVE_NS, but no harm in always defining them.  */
 ${ns_appbindir}Emacs: emacs${EXEEXT}
 	mkdir -p ${ns_appbindir}
 	cp -f emacs${EXEEXT} ${ns_appbindir}Emacs
 
 ns-app: ${ns_appdir} ${ns_appbindir}Emacs
-#endif /* HAVE_NS */
 
 mostlyclean:
 	rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
@@ -1007,9 +1017,8 @@
 clean: mostlyclean
 	rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT}
 	-rm -rf deps
-#ifdef HAVE_NS
-	rm -fr ${ns_appdir}
-#endif
+	test "X${ns_appdir}" = "X" || rm -rf ${ns_appdir}
+
 /* bootstrap-clean is used to clean up just before a bootstrap.
    It should remove all files generated during a compilation/bootstrap,
    but not things like config.status or TAGS.  */
--- a/src/config.in	Sun May 16 00:18:09 2010 +0000
+++ b/src/config.in	Mon May 17 12:37:57 2010 +0000
@@ -1179,8 +1179,6 @@
 
 #ifdef HAVE_X11R6
 #define HAVE_X_I18N
-#elif !defined X11R5_INHIBIT_I18N
-#define HAVE_X_I18N
 #endif
 
 /* Define HAVE_X11R6_XIM if we have usable X11R6-style XIM support.  */
@@ -1200,11 +1198,7 @@
    that the stack is continuous.  */
 #ifdef __GNUC__
 #  ifndef GC_SETJMP_WORKS
-  /* GC_SETJMP_WORKS is nearly always appropriate for GCC --
-     see NON_SAVING_SETJMP in the target descriptions.  */
-  /* Exceptions (see NON_SAVING_SETJMP in target description) are
-     SCO5 non-ELF (but Emacs specifies ELF) and SVR3 on x86.
-     Fixme: Deal with SVR3.  */
+  /* GC_SETJMP_WORKS is nearly always appropriate for GCC.  */
 #    define GC_SETJMP_WORKS 1
 #  endif
 #  ifndef GC_LISP_OBJECT_ALIGNMENT
--- a/src/m/ia64.h	Sun May 16 00:18:09 2010 +0000
+++ b/src/m/ia64.h	Mon May 17 12:37:57 2010 +0000
@@ -48,11 +48,6 @@
 /* Convert that into an integer that is 100 for a load average of 1.0  */
 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
 
-#ifdef __ELF__
-#undef UNEXEC
-#define UNEXEC unexelf.o
-#endif
-
 #ifndef NOT_C_CODE
 
 #ifdef REL_ALLOC