* Updates for VMS, Windows, and DOS ports.
* Clean up some warnings.
diff --git a/ChangeLog b/ChangeLog
index 8fdd6d7..2988bd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,38 @@
 	pat_variables info; it's done earlier now to ensure the parent's
 	pattern variables are set up correctly as well.
 
+2000-02-03  Paul D. Smith  <psmith@gnu.org>
+
+	* job.c (sh_chars_dos) [WINDOWS32]: Add "&" as a shell
+	metacharacter for the W32 DOS shell.
+	Reported by Warren Jones <wjones@tc.fluke.com>.
+
+2000-02-02  Paul D. Smith  <psmith@gnu.org>
+
+	Fixes for the OpenVMS port from Hartmut Becker <becker@rto.dec.com>
+
+	* config.h-vms [VMS]: Define LOCALEDIR to something; needed for
+	the expansion of bindtextdomain() even though it's a no-op.
+	* vmsfunctions.c (strcmpi): Remove duplicate definition of strcmpi().
+	(readdir): Use DB() instead of testing debug_flag.
+	* dir.c (file_impossible) [VMS]: Search "p" not "name".
+	* job.c [VMS]: Switch from debug_flag to the new DB macro.  Add
+	some i18n _() macros (even though VMS doesn't yet support it).
+
+	* function.c (patsubst_expand): Change "len" to not be unsigned to
+	avoid type mismatches.
+
+	* main.c (main): Declare signame_init() if we're going to call it.
+
+2000-01-29  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* Makefile.DOS.template: Track changes in Makefile.in
+	(install-recursive, uninstall-recursive): Add missing targets.
+	(DESTDIR): Define.
+	(install-binPROGRAMS, uninstall-binPROGRAMS): Use $(DESTDIR).
+
+	* default.c (default_variables) [__MSDOS__]: Define CXX to gpp.
+
 2000-01-25  Paul D. Smith  <psmith@gnu.org>
 
 	Change gettext support to use the simplified version in libit 0.7.
diff --git a/Makefile.DOS.template b/Makefile.DOS.template
index 7970c92..c445381 100644
--- a/Makefile.DOS.template
+++ b/Makefile.DOS.template
@@ -5,8 +5,6 @@
 # This Makefile.DOS is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 
-# -*-Makefile-*-, or close enough
-
 
 SHELL = /bin/sh
 
@@ -14,7 +12,7 @@
 VPATH = $(srcdir)
 # $DJDIR is defined automatically by DJGPP to point
 # to the root of the DJGPP installation tree.
-prefix = ${DJDIR}
+prefix = /dev/env/DJDIR
 exec_prefix = ${prefix}
 
 bindir = ${exec_prefix}/bin
@@ -26,9 +24,12 @@
 includedir = ${prefix}/include
 oldincludedir = c:/djgpp/include
 
+DESTDIR =
+
 pkgdatadir = $(datadir)/make
 pkglibdir = $(libdir)/make
 pkgincludedir = $(includedir)/make
+localedir = $(prefix)/share/locale
 
 INSTALL = ${bindir}/ginstall -c
 INSTALL_PROGRAM = ${bindir}/ginstall -c
@@ -70,11 +71,11 @@
 info_TEXINFOS =	make.texinfo
 man_MANS =	make.1
 
-INCLUDES =	-I$(srcdir)/glob -DLIBDIR=\"c:/djgpp/lib\" -DINCLUDEDIR=\"c:/djgpp/include\"
+INCLUDES =	-I$(srcdir)/glob -DLIBDIR=\"c:/djgpp/lib\" -DINCLUDEDIR=\"c:/djgpp/include\" -DLOCALEDIR=\"$(localedir)\"
 
-BUILT_SOURCES =	README build.sh.in
+BUILT_SOURCES =	README build.sh-in
 
-EXTRA_DIST = 	$(BUILT_SOURCES) $(man_MANS) README.customs remote-cstms.c  make-stds.texi texinfo.tex SCOPTIONS SMakefile  Makefile.ami README.Amiga config.ami amiga.c amiga.h  NMakefile README.DOS configh.dos configure.bat makefile.com  README.W32 build_w32.bat config.h.W32 subproc.bat make.lnk  config.h-vms makefile.vms readme.vms vmsdir.h vmsfunctions.c  vmsify.c
+EXTRA_DIST = 	$(BUILT_SOURCES) $(man_MANS) README.customs remote-cstms.c  make-stds.texi texinfo.tex SCOPTIONS SMakefile  Makefile.ami README.Amiga config.ami amiga.c amiga.h  NMakefile README.DOS configh.dos configure.bat makefile.com  README.W32 build_w32.bat config.h-W32 subproc.bat make.lnk  config.h-vms makefile.vms readme.vms vmsdir.h vmsfunctions.c  vmsify.c
 
 SUBDIRS =	glob
 mkinstalldirs = ${bindir}/gmkdir -p
@@ -107,7 +108,7 @@
 MANS = $(man_MANS)
 
 NROFF = nroff
-DIST_COMMON =  README AUTHORS COPYING ChangeLog INSTALL Makefile.am  Makefile.in NEWS acconfig.h aclocal.m4 alloca.c build.sh.in config.h.in  configure configure.in getloadavg.c install-sh missing mkinstalldirs  stamp-h.in texinfo.tex
+DIST_COMMON =  README ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL Makefile.am  Makefile.in NEWS acconfig.h aclocal.m4 alloca.c build.sh.in config.h.in  configure configure.in getloadavg.c gettext.c install-sh missing mkinstalldirs  stamp-h.in texinfo.tex
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -144,11 +145,11 @@
 install-binPROGRAMS: $(bin_PROGRAMS)
 	@$(NORMAL_INSTALL)
 	$(mkinstalldirs) $(DESTDIR)$(bindir)
-	@list='$(bin_PROGRAMS)'; for p in $$list; do    if test -f $$p; then      echo "  $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p | sed '$(transform)'`";       $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p | sed '$(transform)'`;    else :; fi;  done
+	@list='$(bin_PROGRAMS)'; for p in $$list; do    if test -f $$p; then      echo "  $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p | sed '$(transform)'`";       $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p | sed '$(transform)'`;    else :; fi;  done
 
 uninstall-binPROGRAMS:
 	$(NORMAL_UNINSTALL)
-	list='$(bin_PROGRAMS)'; for p in $$list; do    rm -f $(bindir)/`echo $$p|sed '$(transform)'`.exe;  done
+	list='$(bin_PROGRAMS)'; for p in $$list; do    rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`.exe;  done
 
 .c.o:
 	$(COMPILE) -c $<
@@ -388,6 +389,9 @@
 install-data: install-data-recursive install-data-am
 	@$(NORMAL_INSTALL)
 
+install-recursive uninstall-recursive:
+	@:
+
 install: install-recursive install-exec-am install-data-am
 	@:
 
diff --git a/Makefile.am b/Makefile.am
index 0ed497c..08db1a6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -47,7 +47,7 @@
 
 # --------------- Internationalization Section
 
-POTFILES     =	$(SRCS) remote-cstms.c
+POTFILES     =	$(SRCS) remote-cstms.c vmsfunctions.c
 
 localedir    =	$(prefix)/share/locale
 aliaspath    =	$(localedir):.
diff --git a/config.h-vms.template b/config.h-vms.template
index 67b9447..2d060bb 100644
--- a/config.h-vms.template
+++ b/config.h-vms.template
@@ -16,6 +16,24 @@
 #define alloca(n)	__ALLOCA(n)
 #endif
 
+/* Define to 1 if NLS is requested.  */
+/* #undef ENABLE_NLS */
+
+/* Define as 1 if you have dcgettext.  */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define as 1 if you have gettext and don't want to use GNU gettext.  */
+/* #undef HAVE_GETTEXT */
+
+/* Define if your locale.h file contains LC_MESSAGES.  */
+/* #undef HAVE_LC_MESSAGES */
+
+/* Define to the installation directory for locales.  */
+#define LOCALEDIR ""
+
+/* Define as 1 if you have the stpcpy function.  */
+/* #undef HAVE_STPCPY */
+
 /* Define if the closedir function returns void instead of int.  */
 /* #undef CLOSEDIR_VOID */
 
diff --git a/configure.in b/configure.in
index d7bd71b..83fbb52 100644
--- a/configure.in
+++ b/configure.in
@@ -3,7 +3,7 @@
 AC_PREREQ(2.13)dnl		dnl Minimum Autoconf version required.
 AC_INIT(vpath.c)dnl		dnl A distinctive file to look for in srcdir.
 
-AM_INIT_AUTOMAKE(make, 3.78.90)
+AM_INIT_AUTOMAKE(make, 3.78.91)
 AM_CONFIG_HEADER(config.h)
 
 dnl Regular configure stuff
diff --git a/default.c b/default.c
index e50813d..517d325 100644
--- a/default.c
+++ b/default.c
@@ -384,7 +384,11 @@
     "AS", "as",
 #ifdef GCC_IS_NATIVE
     "CC", "gcc",
+# ifdef __MSDOS__
+    "CXX", "gpp",	/* g++ is an invalid name on MSDOS */
+# else
     "CXX", "gcc",
+# endif /* __MSDOS__ */
 #else
     "CC", "cc",
     "CXX", "g++",
diff --git a/dir.c b/dir.c
index ccc5163..caa8042 100644
--- a/dir.c
+++ b/dir.c
@@ -708,7 +708,7 @@
 #ifdef VMS
   dirend = strrchr (p, ']');
   if (dirend == 0)
-    dirend = strrchr (name, ':');
+    dirend = strrchr (p, ':');
   dirend++;
   if (dirend == (char *)1)
     dir = find_directory ("[]");
diff --git a/function.c b/function.c
index ca66b91..743fe79 100644
--- a/function.c
+++ b/function.c
@@ -128,7 +128,7 @@
   unsigned int pattern_prepercent_len, pattern_postpercent_len;
   unsigned int replace_prepercent_len, replace_postpercent_len = 0;
   char *t;
-  unsigned int len;
+  int len;
   int doneany = 0;
 
   /* We call find_percent on REPLACE before checking PATTERN so that REPLACE
diff --git a/job.c b/job.c
index c4e30c9..e82865e 100644
--- a/job.c
+++ b/job.c
@@ -249,7 +249,10 @@
 
 #ifdef VMS
   if (!(exit_code & 1))
-      error (NILF, _("*** [%s] Error 0x%x%s"), target_name, exit_code, ((ignored)? _(" (ignored)") : ""));
+      error (NILF,
+             (ignored ? _("*** [%s] Error 0x%x (ignored)")
+              : _("*** [%s] Error 0x%x")),
+             target_name, exit_code);
 #else
   if (exit_sig == 0)
     error (NILF, ignored ? _("[%s] Error %d (ignored)") :
@@ -310,7 +313,7 @@
   desc->dsc$b_class = DSC$K_CLASS_S;
 
   if (*fname == 0)
-    printf ("Warning: Empty redirection\n");
+    printf (_("Warning: Empty redirection\n"));
   return ibuf;
 }
 
@@ -346,7 +349,7 @@
 		inside = 0;
 	      else
 		{
-		  fprintf (stderr, "Syntax error, still inside '\"'\n");
+		  fprintf (stderr, _("Syntax error, still inside '\"'\n"));
 		  exit (3);
 		}
 	    }
@@ -1559,7 +1562,8 @@
 	{
 	  if (errno == 0)
 	    /* An errno value of zero means getloadavg is just unsupported.  */
-	    error (NILF, _("cannot enforce load limits on this operating system"));
+	    error (NILF,
+                   _("cannot enforce load limits on this operating system"));
 	  else
 	    perror_with_name (_("cannot enforce load limit: "), "getloadavg");
 	}
@@ -1664,7 +1668,8 @@
 	    break;
 
 	  default:
-	    error (NILF, _("internal error: `%s' command_state"), c->file->name);
+	    error (NILF, _("internal error: `%s' command_state"),
+                   c->file->name);
 	    abort ();
 	    break;
 	  }
@@ -1747,8 +1752,8 @@
 	if (status==SS$_ILLIOFUNC) {
 		sys$dassgn(chan);
 #ifdef	CTRLY_ENABLED_ANYWAY
-		fprintf (stderr, "-warning, CTRL-Y will leave "
-			"sub-process(es) around.\n");
+		fprintf (stderr,
+                         _("-warning, CTRL-Y will leave sub-process(es) around.\n"));
 #else
 		return;
 #endif
@@ -1764,8 +1769,8 @@
 	if (setupYAstTried>1)
 		return;
 	if (atexit(reEnableAst))
-		fprintf (stderr, "-warning, you may have to re-enable CTRL-Y"
-			"handling from DCL.\n");
+		fprintf (stderr,
+                         _("-warning, you may have to re-enable CTRL-Y handling from DCL.\n"));
 	status= lib$disable_ctrl (&ctrlMask, &oldCtrlMask);
 	if (!(status&SS$_NORMAL)) {
 		lib$signal(status);
@@ -1799,8 +1804,7 @@
   ofile[0] = 0;
   efile[0] = 0;
 
-  if (debug_flag)
-    printf ("child_execute_job (%s)\n", argv);
+  DB (DB_JOBS, ("child_execute_job (%s)\n", argv));
 
   while (isspace (*argv))
     argv++;
@@ -1879,8 +1883,7 @@
       child->efn = 0;
       child->cstatus = 1;
 
-      if (debug_flag)
-	printf ("BUILTIN [%s][%s]\n", cmd, cmd+8);
+      DB (DB_JOBS, (_("BUILTIN [%s][%s]\n"), cmd, cmd+8));
 
       p = cmd + 8;
 
@@ -1891,8 +1894,7 @@
 	  p += 3;
 	  while ((*p == ' ') || (*p == '\t'))
 	    p++;
-	  if (debug_flag)
-	    printf ("BUILTIN CD %s\n", p);
+	  DB (DB_JOBS, (_("BUILTIN CD %s\n"), p));
 	  if (chdir (p))
 	    return 0;
 	  else
@@ -1910,8 +1912,7 @@
 	    p++;
 	  in_arg = 1;
 
-	  if (debug_flag)
-	    printf ("BUILTIN RM %s\n", p);
+	  DB (DB_JOBS, (_("BUILTIN RM %s\n"), p));
 	  while (*p)
 	    {
 	      switch (*p)
@@ -1932,7 +1933,7 @@
 	}
       else
 	{
-	  printf("Unknown builtin command '%s'\n", cmd);
+	  printf(_("Unknown builtin command '%s'\n"), cmd);
 	  fflush(stdout);
 	  return 0;
 	}
@@ -1956,7 +1957,7 @@
 
       if (strlen (cmd) == 0)
 	{
-	  printf ("Error, empty command\n");
+	  printf (_("Error, empty command\n"));
 	  fflush (stdout);
 	  return 0;
 	}
@@ -2145,11 +2146,11 @@
 
   if (!(status & 1))
     {
-      printf ("Error spawning, %d\n",status);
+      printf (_("Error spawning, %d\n") ,status);
       fflush (stdout);
     }
 
-  if (comname[0] && !ISDB (DB_JOBS)))
+  if (comname[0] && !ISDB (DB_JOBS))
     unlink (comname);
 
   return (status & 1);
@@ -2397,7 +2398,7 @@
 			     0 };
 #else
 #ifdef WINDOWS32
-  static char sh_chars_dos[] = "\"|<>";
+  static char sh_chars_dos[] = "\"|&<>";
   static char *sh_cmds_dos[] = { "break", "call", "cd", "chcp", "chdir", "cls",
 			     "copy", "ctty", "date", "del", "dir", "echo",
 			     "erase", "exit", "for", "goto", "if", "if", "md",
@@ -2989,8 +2990,7 @@
 	cptr++;
       if (*cptr == 0)
 	break;
-      if (debug_flag)
-	printf ("argv[%d] = [%s]\n", argc, cptr);
+      DB (DB_JOBS, ("argv[%d] = [%s]\n", argc, cptr));
       argv[argc++] = cptr;
       while ((*cptr != 0)
 	     && (!isspace(*cptr)))
diff --git a/main.c b/main.c
index 9891b43..0cc72ec 100644
--- a/main.c
+++ b/main.c
@@ -776,7 +776,10 @@
   textdomain (PACKAGE);
 
 #if !defined (HAVE_STRSIGNAL) && !defined (HAVE_SYS_SIGLIST)
-  signame_init ();
+  {
+    extern void signame_init ();
+    signame_init ();
+  }
 #endif
 
 #ifdef	POSIX
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 368a30c..231c486 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -2,6 +2,21 @@
 
 	* scripts/features/patspecific_vars: Add a test for PR/1407.
 
+2000-02-02  Paul D. Smith  <psmith@gnu.org>
+
+	* run_make_tests.pl (set_more_defaults): Hard-code the LANG to C
+	to make sure porting order, etc. is predictable.
+	Reported by Andreas Jaeger <aj@suse.de>.
+
+	* run_make_tests.pl (set_more_defaults): Set the $wtime variable
+	depending on the OS.  Eli Zaretskii <eliz@is.elta.co.il> reports
+	this seems to need to be *4* on DOS/Windows, not just 2.  Keep it
+	1 for other systems.
+	* scripts/features/vpathplus (touchfiles): Use the $wtime value
+	instead of hardcoding 2.
+	* scripts/targets/SECONDARY: Ditto.
+	* scripts/targets/INTERMEDIATE: Ditto.
+
 2000-01-23  Paul D. Smith  <psmith@gnu.org>
 
 	* scripts/features/include: Remove a check; the fix caused more
diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl
index 70b1cf8..baf55f8 100755
--- a/tests/run_make_tests.pl
+++ b/tests/run_make_tests.pl
@@ -129,6 +129,11 @@
    local($string);
    local($index);
 
+   # Make sure we're in the C locale for those systems that support it,
+   # so sorting, etc. is predictable.
+   #
+   $ENV{LANG} = 'C';
+
    # find the type of the port.  We do this up front to have a single
    # point of change if it needs to be tweaked.
    #
@@ -152,6 +157,12 @@
      $port_type = 'UNIX';
    }
 
+   # On DOS/Windows system the filesystem apparently can't track
+   # timestamps with second granularity (!!).  Change the sleep time
+   # needed to force a file to be considered "old".
+   #
+   $wtime = $port_type eq 'UNIX' ? 1 : 4;
+
    # Find the full pathname of Make.  For DOS systems this is more
    # complicated, so we ask make itself.
 
diff --git a/tests/scripts/features/vpathplus b/tests/scripts/features/vpathplus
index 6c9a2a0..76312b3 100644
--- a/tests/scripts/features/vpathplus
+++ b/tests/scripts/features/vpathplus
@@ -57,12 +57,10 @@
 
 sub touchfiles {
   foreach (@_) {
+    sleep($wtime);
     ($f = $_) =~ s,VP/,$VP,g;
     &touch($f);
     push(@touchedfiles, $f);
-    # Sleep 2 seconds for DOS/Windows FAT volumes which have 2-second
-    # granularity of file times.
-    sleep(2);
   }
 }
 
diff --git a/tests/scripts/targets/INTERMEDIATE b/tests/scripts/targets/INTERMEDIATE
index a1df8bf..7041e83 100644
--- a/tests/scripts/targets/INTERMEDIATE
+++ b/tests/scripts/targets/INTERMEDIATE
@@ -35,6 +35,7 @@
 
 &touch('foo.f');
 &touch('bar.f');
+sleep($wtime);
 
 &run_make_with_options($makefile,'foo.d',&get_logfile);
 $answer = "cp foo.f foo.e\ncp foo.e foo.d\nrm foo.e\n";
@@ -48,9 +49,7 @@
 
 # TEST #2
 
-# Sleep 2 seconds for DOS/Windows FAT volumes which have 2-second
-# granularity of file times.
-sleep(2);
+sleep($wtime);
 &touch('foo.f');
 
 &run_make_with_options($makefile,'foo.d',&get_logfile);
@@ -71,9 +70,7 @@
 
 # TEST #5
 
-# Sleep 2 seconds for DOS/Windows FAT volumes which have 2-second
-# granularity of file times.
-sleep(2);
+sleep($wtime);
 &touch('foo.f');
 
 &run_make_with_options($makefile,'foo.c',&get_logfile);
diff --git a/tests/scripts/targets/SECONDARY b/tests/scripts/targets/SECONDARY
index dbf052d..3ae34fd 100644
--- a/tests/scripts/targets/SECONDARY
+++ b/tests/scripts/targets/SECONDARY
@@ -49,9 +49,7 @@
 
 # TEST #3
 
-# Sleep 2 seconds for DOS/Windows FAT volumes which have 2-second
-# granularity of file times.
-sleep(2);
+sleep($wtime);
 &touch('foo.f');
 
 &run_make_with_options($makefile,'foo.d',&get_logfile);
@@ -74,9 +72,7 @@
 
 # TEST #6
 
-# Sleep 2 seconds for DOS/Windows FAT volumes which have 2-second
-# granularity of file times.
-sleep(2);
+sleep($wtime);
 &touch('foo.f');
 
 &run_make_with_options($makefile,'foo.c',&get_logfile);
diff --git a/vmsfunctions.c b/vmsfunctions.c
index 69ba28c..f6708cc 100644
--- a/vmsfunctions.c
+++ b/vmsfunctions.c
@@ -73,13 +73,11 @@
   dnam->nam$l_rsa = dir->d_result;
   dnam->nam$b_rss = MAXNAMLEN;
 
-  if (debug_flag)
-    printf (".");
+  DB (DB_VERBOSE, ("."));
 
   if (!((i = sys$search (dfab)) & 1))
     {
-      if (debug_flag)
-	printf ("sys$search failed with %d\n", i);
+      DB (DB_VERBOSE, (_("sys$search failed with %d\n"), i));
       return (NULL);
     }
 
@@ -248,22 +246,6 @@
   return (str);
 }
 
-
-int
-strcmpi (s1, s2)
-    const char *s1;
-    const char *s2;
-{
-  while (*s1 != '\0' && toupper(*s1) == toupper(*s2))
-    {
-      s1++;
-      s2++;
-    }
-
-  return toupper(*(unsigned char *) s1) - toupper(*(unsigned char *) s2);
-}
-
-
 int
 strcmpi (s1, s2)
     const char *s1;