2007-11-25 Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	This is patch 3 of 3 and must be applied as third.


	* configure.bat: Update popen.c from djgpp/popen.c (CVS version).

	* dosbuild.bat: Use popen.c (CVS version).  Use /dev/env/DJDIR instead
	of c:/djgpp.
	Add -DLOCALEDIR to command line to compile main.c.
	Remove make.new if build successfull.

	* Makefile.DOS: Use popen.c (CVS version).
	(make$(EXEEXT)): Remove make.new.

	* tests/scripts/options/dash-B: Define $error_message to allow for an
	error message that may be issued by different systems.

	* tests/scripts/options/dash-k: Define $error_message to allow for an
	error message that may be issued by different systems.

	* tests/scripts/options/dash-W: Define $error_message to allow for an
	error message that may be issued by different systems.

	* tests/scripts/variables/MAKE_RESTARTS: Define $error_message to allow
	for an error message that may be issued by different systems.



diff -aprNU5 make-3.81.orig/Makefile.DOS make-3.81/Makefile.DOS
--- make-3.81.orig/Makefile.DOS	2007-11-25 04:31:54 +0000
+++ make-3.81/Makefile.DOS	2007-11-25 04:32:16 +0000
@@ -76,11 +76,11 @@ VERSION = 3.81
 
 AUTOMAKE_OPTIONS = 1.2
 
 bin_PROGRAMS =	make$(EXEEXT)
 
-make_SOURCES =	ar.c arscan.c commands.c default.c dir.c expand.c file.c function.c getopt.c getopt1.c implicit.c job.c main.c misc.c read.c remake.c rule.c signame.c strcache.c variable.c version.c vpath.c hash.c remote-$(REMOTE).c
+make_SOURCES =	popen.c ar.c arscan.c commands.c default.c dir.c expand.c file.c function.c getopt.c getopt1.c implicit.c job.c main.c misc.c read.c remake.c rule.c signame.c strcache.c variable.c version.c vpath.c hash.c remote-$(REMOTE).c
 # This should include the glob/ prefix
 libglob_a_SOURCES =	glob/fnmatch.c glob/glob.c glob/fnmatch.h glob/glob.h
 make_LDADD =	  glob/libglob.a
 
 info_TEXINFOS =	make.texi
@@ -103,11 +103,11 @@ MAKE_HOST = i386-pc-msdosdjgpp
 
 DEFS =  -I. -I$(srcdir) -I.
 CPPFLAGS = -DHAVE_CONFIG_H
 LDFLAGS =
 LIBS =
-make_OBJECTS =  ar.o arscan.o commands.o default.o dir.o expand.o file.o function.o getopt.o getopt1.o implicit.o job.o main.o misc.o read.o remake.o rule.o signame.o strcache.o variable.o version.o vpath.o hash.o remote-$(REMOTE).o
+make_OBJECTS =  popen.o ar.o arscan.o commands.o default.o dir.o expand.o file.o function.o getopt.o getopt1.o implicit.o job.o main.o misc.o read.o remake.o rule.o signame.o strcache.o variable.o version.o vpath.o hash.o remote-$(REMOTE).o
 make_DEPENDENCIES =    glob/libglob.a
 make_LDFLAGS =
 libglob_a_LIBADD =
 libglob_a_OBJECTS =  fnmatch.o glob.o
 noinst_LIBRARIES =	glob/libglob.a
@@ -149,10 +149,11 @@ maintainer-clean-hdr:
 
 mostlyclean-binPROGRAMS:
 
 clean-binPROGRAMS:
 	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+	-test -z make.new || rm -f make.new
 
 distclean-binPROGRAMS:
 
 maintainer-clean-binPROGRAMS:
 
@@ -697,5 +698,8 @@ version.o version.o: version.c config.h
 
 # .deps/vpath.Po
 vpath.o vpath.o: vpath.c make.h config.h \
   getopt.h \
   gettext.h filedef.h hash.h variable.h
+
+# .deps/popen.Po
+popen.o popen.o: popen.c
diff -aprNU5 make-3.81.orig/configure.bat make-3.81/configure.bat
--- make-3.81.orig/configure.bat	2006-02-11 22:16:04 +0000
+++ make-3.81/configure.bat	2007-11-25 04:32:16 +0000
@@ -32,10 +32,11 @@ set XSRC=%1
 if not "%XSRC%"=="%1" goto SmallEnv
 
 :SrcDone
 
 update %XSRC%/configh.dos ./config.h
+update %XSRC%/djgpp/popen.c ./popen.c
 
 rem Do they have Make?
 redir -o junk.$$$ -eo make -n -f NUL
 rem REDIR will return 1 if it cannot run Make.
 rem If it can run Make, it will usually return 2,
diff -aprNU5 make-3.81.orig/dosbuild.bat make-3.81/dosbuild.bat
--- make-3.81.orig/dosbuild.bat	2006-02-11 22:16:04 +0000
+++ make-3.81/dosbuild.bat	2007-11-25 04:32:16 +0000
@@ -17,18 +17,19 @@ rem Foundation, Inc., 51 Franklin St, Fi
 
 echo Building Make for MSDOS
 
 rem Echo ON so they will see what is going on.
 @echo on
+gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g popen.c -o popen.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g commands.c -o commands.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g job.c -o job.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g dir.c -o dir.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g file.c -o file.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g misc.c -o misc.o
-gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g main.c -o main.o
-gcc  -c -I. -I./glob -DHAVE_CONFIG_H -DINCLUDEDIR=\"c:/djgpp/include\" -O2 -g read.c -o read.o
-gcc  -c -I. -I./glob -DHAVE_CONFIG_H -DLIBDIR=\"c:/djgpp/lib\" -O2 -g remake.c -o remake.o
+gcc  -c -I. -I./glob -DHAVE_CONFIG_H -DLOCALEDIR=\"/dev/env/DJDIR/share/locale\" -O2 -g main.c -o main.o
+gcc  -c -I. -I./glob -DHAVE_CONFIG_H -DINCLUDEDIR=\"/dev/env/DJDIR/include\" -O2 -g read.c -o read.o
+gcc  -c -I. -I./glob -DHAVE_CONFIG_H -DLIBDIR=\"/dev/env/DJDIR/lib\" -O2 -g remake.c -o remake.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g rule.c -o rule.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g implicit.c -o implicit.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g default.c -o default.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g variable.c -o variable.o
 gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2 -g expand.c -o expand.o
@@ -48,15 +49,16 @@ gcc  -c -I. -I./glob -DHAVE_CONFIG_H -O2
 gcc -I. -c -DHAVE_CONFIG_H -I.. -O2 -g glob.c -o glob.o
 gcc -I. -c -DHAVE_CONFIG_H -I.. -O2 -g fnmatch.c -o fnmatch.o
 ar rv libglob.a glob.o fnmatch.o
 @echo off
 cd ..
-echo commands.o > respf.$$$
+echo popen.o commands.o > respf.$$$
 for %%f in (job dir file misc main read remake rule implicit default variable) do echo %%f.o >> respf.$$$
 for %%f in (expand function vpath hash strcache version ar arscan signame remote-stub getopt getopt1) do echo %%f.o >> respf.$$$
 echo glob/libglob.a >> respf.$$$
 @echo Linking...
 @echo on
 gcc -o make.new @respf.$$$
 @if exist make.exe echo Make.exe is now built!
 @if not exist make.exe echo Make.exe build failed...
 @if exist make.exe del respf.$$$
+@if exist make.exe del make.new
diff -aprNU5 make-3.81.orig/tests/scripts/options/dash-B make-3.81/tests/scripts/options/dash-B
--- make-3.81.orig/tests/scripts/options/dash-B	2005-06-25 18:57:28 +0000
+++ make-3.81/tests/scripts/options/dash-B	2007-11-25 06:09:16 +0000
@@ -36,19 +36,29 @@ run_make_test(undef, '-B', 'cp bar.x foo
 rmfiles('bar.x', 'foo');
 
 # Test -B with the re-exec feature: we don't want to re-exec forever
 # Savannah bug # 7566
 
+if ($port_type eq "DOS") {
+#
+#  If compiled with DJGPP an error message (ENOENT) is issued.
+#
+  $error_message = '(ENOENT)';
+}
+else {
+  $error_message = '';
+}
+
 run_make_test('
 all: ; @:
 $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
 include foo.x
 foo.x: ; @touch $@
 ',
-              '-B', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
-MAKE_RESTARTS=1');
+              '-B', "MAKE_RESTARTS=
+#MAKEFILE#:4: foo.x: No such file or directory $error_message
+MAKE_RESTARTS=1");
 
 rmfiles('foo.x');
 
 # Test -B with the re-exec feature: we DO want -B in the "normal" part of the
 # makefile.
@@ -60,14 +70,14 @@ all: blah.x ; @echo $@
 $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
 include foo.x
 foo.x: ; @touch $@
 blah.x: ; @echo $@
 ',
-              '-B', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
+              '-B', "MAKE_RESTARTS=
+#MAKEFILE#:4: foo.x: No such file or directory $error_message
 MAKE_RESTARTS=1
 blah.x
-all');
+all");
 
 rmfiles('foo.x', 'blah.x');
 
 1;
diff -aprNU5 make-3.81.orig/tests/scripts/options/dash-W make-3.81/tests/scripts/options/dash-W
--- make-3.81.orig/tests/scripts/options/dash-W	2006-03-08 20:15:08 +0000
+++ make-3.81/tests/scripts/options/dash-W	2007-11-25 04:32:16 +0000
@@ -31,24 +31,34 @@ rmfiles('a.x', 'b.x');
 # Test -W with the re-exec feature: we don't want to re-exec forever
 # Savannah bug # 7566
 
 # First set it up with a normal build
 
+if ($port_type eq "DOS") {
+#
+#  If compiled with DJGPP an error message (ENOENT) is issued.
+#
+  $error_message = '(ENOENT)';
+}
+else {
+  $error_message = '';
+}
+
 run_make_test('
 all: baz.x ; @:
 include foo.x
 foo.x: bar.x
 	@echo "\$$(info restarts=\$$(MAKE_RESTARTS))" > $@
 	@echo "touch $@"
 bar.x: ; echo >> $@
 baz.x: bar.x ; @echo "touch $@"
 ',
-              '', '#MAKEFILE#:3: foo.x: No such file or directory
+              '', "#MAKEFILE#:3: foo.x: No such file or directory $error_message
 echo >> bar.x
 touch foo.x
 restarts=1
-touch baz.x');
+touch baz.x");
 
 # Now run with -W bar.x
 
 # Tweak foo.x's timestamp so the update will change it.
 &utouch(1000, 'foo.x');
diff -aprNU5 make-3.81.orig/tests/scripts/options/dash-k make-3.81/tests/scripts/options/dash-k
--- make-3.81.orig/tests/scripts/options/dash-k	2004-05-16 19:16:56 +0000
+++ make-3.81/tests/scripts/options/dash-k	2007-11-25 04:32:16 +0000
@@ -98,16 +98,26 @@ $make_name: Target `all' not remade beca
 &compare_output($answer, &get_logfile(1));
 
 # TEST -- make sure we keep the error code if we can't create an included
 # makefile.
 
+if ($port_type eq "DOS") {
+#
+#  If compiled with DJGPP an error message (ENOENT) is issued.
+#
+  $error_message = '(ENOENT)';
+}
+else {
+  $error_message = '';
+}
+
 run_make_test('all: ; @echo hi
 include ifile
 ifile: no-such-file; @false
 ',
               '-k',
-              "#MAKEFILE#:2: ifile: No such file or directory
+              "#MAKEFILE#:2: ifile: No such file or directory $error_message
 #MAKE#: *** No rule to make target `no-such-file', needed by `ifile'.
 #MAKE#: Failed to remake makefile `ifile'.
 hi\n",
               512);
 
diff -aprNU5 make-3.81.orig/tests/scripts/variables/MAKE_RESTARTS make-3.81/tests/scripts/variables/MAKE_RESTARTS
--- make-3.81.orig/tests/scripts/variables/MAKE_RESTARTS	2005-06-25 18:57:28 +0000
+++ make-3.81/tests/scripts/variables/MAKE_RESTARTS	2007-11-25 04:37:54 +0000
@@ -2,19 +2,29 @@
 
 $description = "Test the MAKE_RESTARTS variable.";
 
 # Test basic capability
 
+if ($port_type eq "DOS") {
+#
+#  If compiled with DJGPP an error message (ENOENT) is issued.
+#
+  $error_message = '(ENOENT)';
+}
+else {
+  $error_message = '';
+}
+
 run_make_test('
 all: ; @:
 $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
 include foo.x
 foo.x: ; @touch $@
 ',
-              '', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
-MAKE_RESTARTS=1');
+              '', "MAKE_RESTARTS=
+#MAKEFILE#:4: foo.x: No such file or directory $error_message
+MAKE_RESTARTS=1");
 
 rmfiles('foo.x');
 
 # Test multiple restarts
 
@@ -23,15 +33,15 @@ all: ; @:
 $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
 include foo.x
 foo.x: ; @echo "include bar.x" > $@
 bar.x: ; @touch $@
 ',
-              '', 'MAKE_RESTARTS=
-#MAKEFILE#:4: foo.x: No such file or directory
+              '', "MAKE_RESTARTS=
+#MAKEFILE#:4: foo.x: No such file or directory $error_message
 MAKE_RESTARTS=1
-foo.x:1: bar.x: No such file or directory
-MAKE_RESTARTS=2');
+foo.x:1: bar.x: No such file or directory $error_message
+MAKE_RESTARTS=2");
 
 rmfiles('foo.x', 'bar.x');
 
 # Test multiple restarts and make sure the variable is cleaned up
 
@@ -45,13 +55,13 @@ $(info MAKE_RESTARTS=$(MAKE_RESTARTS))
 include foo.x
 foo.x: ; @echo "include bar.x" > $@
 bar.x: ; @touch $@
 ',
               '', "MAKE_RESTARTS=
-#MAKEFILE#:8: foo.x: No such file or directory
+#MAKEFILE#:8: foo.x: No such file or directory $error_message
 MAKE_RESTARTS=1
-foo.x:1: bar.x: No such file or directory
+foo.x:1: bar.x: No such file or directory $error_message
 MAKE_RESTARTS=2
 recurse MAKE_RESTARTS=
 MAKE_RESTARTS=
 #MAKE#[1]: Entering directory `#PWD#'
 all MAKE_RESTARTS=
