2007-10-26  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* gawkmisc.c [MSDOS, OS2, WIN32]: Include pc/gawkmisc.pc instead of
	gawkmisc.pc.

	* pc/Makefile: Change dependecy popen.h to pc/popen.h.
	Add popen.o to the list of gawk objects.
	Use MKINSTALL for pc/mkinstal.sh

	* pc/Makefile.tst (manyfiles): Linit the number of simultaneously
	opened files to 200.
	Set DATE to /dev/env/DJDIR/date.

	* pc/popen.c: File from djgpp CVS-tree to replace the broken one
	from djgpp 2.04.

	* README_d/README.pc: Explain that only config.h and Makefile need
	to be copied to srcdir.



diff -aprNU5 gawk-3.1.6.orig/README_d/README.pc gawk-3.1.6/README_d/README.pc
--- gawk-3.1.6.orig/README_d/README.pc	2006-08-24 16:22:40 +0000
+++ gawk-3.1.6/README_d/README.pc	2007-10-26 11:44:30 +0000
@@ -37,11 +37,11 @@ Building versions which do not understan
 that offer long names is a special case.  The maintainers unpack the
 distribution and process using utilities (unzip, make, cmp) which do not
 use long filenames.  (For example, the djgpp tools will work if LFN=n is
 set in the environment.)
 
-Copy the files in the `pc' directory (EXCEPT for `ChangeLog') to the
+Copy the files config.h and Makefile in the `pc' directory to the
 directory with the rest of the gawk sources.  (The subdirectories of 
 `pc' need not be copied.)  The makefile contains a configuration 
 section with comments, and may need to be edited in order to work
 with your make utility.
 
diff -aprNU5 gawk-3.1.6.orig/gawkmisc.c gawk-3.1.6/gawkmisc.c
--- gawk-3.1.6.orig/gawkmisc.c	2007-08-11 19:39:48 +0000
+++ gawk-3.1.6/gawkmisc.c	2007-10-26 11:37:14 +0000
@@ -29,16 +29,13 @@
 #include <fcntl.h>
 #endif
 
 /* some old compilers don't grok #elif. sigh */
 
-#ifdef __EMX__
+#if defined(__EMX__) || defined(MSDOS) || defined(OS2) || defined(WIN32)
 #include "pc/gawkmisc.pc"
-#else /* not __EMX__ */
-#if defined(MSDOS) || defined(OS2) || defined(WIN32)
-#include "gawkmisc.pc"
-#else /* not MSDOS, not OS2, not WIN32 */
+#else /* not __EMX__, not MSDOS, not OS2, not WIN32 */
 #if defined(VMS)
 #include "vms/gawkmisc.vms"
 #else /* not VMS */
 #if defined(atarist)
 #include "unsupported/atari/gawkmisc.atr"
@@ -48,12 +45,11 @@
 #else /* not TANDEM */
 #include "posix/gawkmisc.c"
 #endif /* not TANDEM */
 #endif /* not atarist */
 #endif /* not VMS */
-#endif /* not MSDOS, not OS2, not WIN32 */
-#endif /* not __EMX__ */
+#endif /* not __EMX__, not MSDOS, not OS2, not WIN32 */
 
 /* xmalloc --- provide this so that other GNU library routines work */
 
 #if __STDC__
 typedef void *pointer;
diff -aprNU5 gawk-3.1.6.orig/pc/Makefile gawk-3.1.6/pc/Makefile
--- gawk-3.1.6.orig/pc/Makefile	2007-05-09 18:03:08 +0000
+++ gawk-3.1.6/pc/Makefile	2007-10-26 12:57:54 +0000
@@ -76,10 +76,11 @@ prefix = c:/gnu
 pkgdatadir = $(prefix)/lib/awk
 #
 # Define the install method. Method 1 is Unix-like (and requires cat,
 # cp, mkdir, sed, and sh); method 2 uses gawk and batch files.
 install = 1
+MKINSTALL = pc/mkinstal.sh
 #------------------------------------------------------------------------
 # To work around command-line length problems, this makefile assumes
 # that $($X) can be expanded.  If using a make (such as nmake) which 
 # cannot handle such macros, define DO_LNK and DO_BIND for your target 
 # as $(L<target>) and $(B<target>), resp.; e.g.,
@@ -115,17 +116,17 @@ LDJG = $(CC) $(LF) -o gawk.exe $(LDRSP) 
 PLDJG = $(CC) $(LF) -o pgawk.exe $(PLDRSP) $(LF2)
 BDJG = stubify -g awk.exe | stubedit awk.exe runfile=gawk
 
 djgpp:
 	$(MAK) all \
-	CC=gcc O=.o CF=-O2 \
+	CC=gcc O=.o CF=-O2 OBJ=popen.o \
 	LNK=LDJG PLNK=PLDJG LF=-s LF2=-lm \
 	BIND=BDJG PBIND=''
 
 djgpp-debug:
 	$(MAK) all \
-	CC=gcc O=.o CF='-O2 -g' \
+	CC=gcc O=.o CF='-O2 -g' OBJ=popen.o \
 	LNK=LDJG PLNK=PLDJG LF2=-lm \
 	BIND=BDJG PBIND=''
 
 LDJGv1 = $(CC) $(LF) -o gawk $(LDRSP) $(LF2)
 #BDJGv1 = coff2exe -s /djgpp/bin/go32.exe gawk
@@ -367,19 +368,25 @@ gawkmisc$O:	pc/gawkmisc.pc
 
 getopt$O:	getopt.h
 
 getopt1$O:	getopt.h
 
-io$O:		popen.h
+io$O:		pc/popen.h
 
 gawk.exp: gawkw32.def
 	$(DYN_MAKEXP)
 
 eval_p$O:	eval.c
 
 profile_p$O:	profile.c
 
+getid$O:	pc/getid.c
+	$(CC) -c $(CFLAGS) pc/getid.c
+
+popen$O:	pc/popen.c
+	$(CC) -c $(CFLAGS) pc/popen.c
+
 # A bug in ndmake requires the following rule
 awkgram$O: awk.h awkgram.c
 	$(CC) -c $(CFLAGS) awkgram.c
 
 awkgram.c:	awkgram.y
@@ -393,12 +400,12 @@ install: install$(install)
 install1: 
 	echo extproc sh $(prefix)/bin/igawk.cmd > igawk.cmd
 	echo shift >> igawk.cmd
 	cat pc/awklib/igawk >> igawk.cmd
 	sed "s;igawk;$(prefix)/bin/igawk;" pc/awklib/igawk.bat > igawk.bat
-	sh mkinstal.sh $(prefix)/bin
-	sh mkinstal.sh $(pkgdatadir) $(prefix)/man/man1 $(prefix)/info
+	sh $(MKINSTALL) $(prefix)/bin
+	sh $(MKINSTALL) $(pkgdatadir) $(prefix)/man/man1 $(prefix)/info
 	cp *awk.exe igawk.bat igawk.cmd pc/awklib/igawk $(prefix)/bin
 	cp awklib/eg/lib/* pc/awklib/igawk.awk $(pkgdatadir)
 	cp doc/*.1 $(prefix)/man/man1
 	cp doc/gawk.info $(prefix)/info
 
diff -aprNU5 gawk-3.1.6.orig/pc/Makefile.tst gawk-3.1.6/pc/Makefile.tst
--- gawk-3.1.6.orig/pc/Makefile.tst	2007-10-20 20:41:46 +0000
+++ gawk-3.1.6/pc/Makefile.tst	2007-10-26 11:37:14 +0000
@@ -98,11 +98,11 @@ CP  = command.com /c copy
 #MKDIR = : && command -c mkdir
 MKDIR  = command.com /c mkdir
 
 # Set your unix-style date function here
 #DATE = date
-DATE = gdate
+DATE = /dev/env/DJDIR/bin/date
 
 # MS-DOS and OS/2 use ; as a PATH delimiter
 PATH_SEPARATOR = ;
 
 # ============================================================================
@@ -252,11 +252,11 @@ regtest::
 
 manyfiles::
 	@echo manyfiles
 	@rm -rf junk
 	@mkdir junk
-	@$(AWK) 'BEGIN { for (i = 1; i <= 300; i++) print i, i}' >_$@
+	@$(AWK) 'BEGIN { for (i = 1; i <= 200; i++) print i, i}' >_$@
 	@$(AWK) -f $(srcdir)/manyfiles.awk _$@ _$@
 	@wc -l junk/* | $(AWK) '$$1 != 2' | wc -l | sed "s/  *//g" > _$@
 	@rm -rf junk ; $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
 
 compare::
