2010-05-16  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* gawkmisc.c [MSDOS, OS2, WIN32]: Use include path "pc/gawkmisc.pc"
	instead of "gawkmisc.pc".

	* pc/Makefile: Add infodir and mandir.  Both use $(prefix) to define
	their path.
	Add MKINSTALL.  Defines the use of pc/mkinstal.sh to install the
	products.
	Change dependecy popen.h to pc/popen.h.
	Add popen.o to the list of gawk objects.

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

	* pc/config.h: Adjust version number.

	* 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.8.orig/README_d/README.pc gawk-3.1.8/README_d/README.pc
--- gawk-3.1.8.orig/README_d/README.pc	2009-07-21 19:35:52 +0000
+++ gawk-3.1.8/README_d/README.pc	2010-05-16 18:46:10 +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.8.orig/gawkmisc.c gawk-3.1.8/gawkmisc.c
--- gawk-3.1.8.orig/gawkmisc.c	2010-04-20 08:15:00 +0000
+++ gawk-3.1.8/gawkmisc.c	2010-05-16 18:46:10 +0000
@@ -30,16 +30,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"
@@ -49,12 +46,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.8.orig/pc/Makefile gawk-3.1.8/pc/Makefile
--- gawk-3.1.8.orig/pc/Makefile	2010-04-13 19:12:56 +0000
+++ gawk-3.1.8/pc/Makefile	2010-05-16 18:46:10 +0000
@@ -72,14 +72,17 @@ MAK = $(MAKE) $(MAKEFILE)
 # in bin, lib/awk, man, and info under $(prefix)/. Most likely, you should
 # edit config.h so that $(prefix)/lib/awk appears as part of DEFPATH.
 #prefix =
 prefix = c:/gnu
 pkgdatadir = $(prefix)/lib/awk
+infodir = $(prefix)/info
+mandir = $(prefix)/share/man
 #
 # 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.,
@@ -108,24 +111,26 @@ DO_PBIND= $($(PBIND))
 #========================================================================
 
 ifneq ($(DJGPP),)
 prefix = $(DJDIR)
 pkgdatadir = $(prefix)/share/awk
+infodir = $(prefix)/share/info
+mandir = $(prefix)/share/man
 endif
 LDJG = $(CC) $(LF) -o gawk.exe $(LDRSP) $(LF2)
 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 +372,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,16 +404,16 @@ 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) $(mandir)/man1 $(infodir)
 	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
+	cp doc/*.1 $(mandir)/man1
+	cp doc/gawk.info $(infodir)
 
 # install2 is equivalent to install1, but doesn't require cp, sed, etc.
 install2:
 	gawk -v prefix=$(prefix) -f install.awk
 
diff -aprNU5 gawk-3.1.8.orig/pc/Makefile.tst gawk-3.1.8/pc/Makefile.tst
--- gawk-3.1.8.orig/pc/Makefile.tst	2010-05-03 18:14:28 +0000
+++ gawk-3.1.8/pc/Makefile.tst	2010-05-16 18:46:10 +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 = ;
 
 # ============================================================================
@@ -284,11 +284,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::
diff -aprNU5 gawk-3.1.8.orig/pc/config.h gawk-3.1.8/pc/config.h
--- gawk-3.1.8.orig/pc/config.h	2010-04-13 19:12:44 +0000
+++ gawk-3.1.8/pc/config.h	2010-05-16 18:46:10 +0000
@@ -422,20 +422,20 @@
 
 /* Define to the full name of this package. */
 #define PACKAGE_NAME "GNU Awk"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "GNU Awk 3.1.5a"
+#define PACKAGE_STRING "GNU Awk 3.1.8"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "gawk"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "3.1.5a"
+#define PACKAGE_VERSION "3.1.8"
 
 /* Version number of package */
-#define VERSION "3.1.5a"
+#define VERSION "3.1.8"
 
 /* Number of bits in a file offset, on hosts where this is settable. */
 /* #undef _FILE_OFFSET_BITS */
 
 /* Define to make ftello visible on some hosts (e.g. HP-UX 10.20). */
