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

	* djgpp/djgppsed.sh: Do not run maybe_command test case in
	lib/ExtUtils/t/MM_Unix.t.
	Do not run qx operator test case in t/comp/t/opsubs.t.


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

	* utils/perlbug.PL: DOS specific fix.

	* README.dos: DJGPP specific issues updated .


2007-05-08  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* djgpp/djgppsed.sh: DOS specific fix for utils/c2ph.PL.


2007-05-07  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* hints/dos_djgpp.h: Do not use file locking of 2.04.  Undef d_flock,
	d_flockproto, d_fcntl_can_lock and d_lockf.

	* djgpp/djgppsed.sh: Do not run test case t/pod/pod2usage2.t.

	* djgpp/djgppsed.sh: Do not run test case t/lib/warnings/mg.


2007-05-06  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* dosish.h [DJGPP]: Add function prototype for djgpp_realpath.

	* djgpp/djgpp.h: Add function prototype for djgpp_realpath.

	* djgpp/djgpp.c: New function djgpp_realpath.  It is a full replacement
	for bsd_realpath in Cwd.xs.  This is needed because the bsd code is not
	capable to handle dos like path with backslash and drive letter.

	* ext/Cwd/Cwd.xs (bsd_realpath): If DJGPP use djgpp_realpath to compute
	the real path.

	* djgpp/djgppsed.sh: Added new sed subtitutions SPAKLIST for
	lib/ExtUtils/t/basic.t and lib/ExtUtils/t/installbase.t.


2007-05-04  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* hints/dos_djgpp.h: use $prefix/share/man/cat1 for man1dir and
	$prefix/share/man/cat3 for man3dir.  This is because formated
	man pages go into catN instead of manN.
	Logic changed not only to detect gcc 3.NN.NN but also higher
	compiler versions.


2007-05-03  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* Configure: Replace the use of the 5th uname entry (pc) by the 1st
	entry (ms-dos).  The first one is the only one that will always be
	the same string no matter the OS used.


2007-05-02  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* installman (pod2man): Do not convert name from  File/Basename.3
	to File::Basename.3 or File.Basename.3 format.


2007-04-30  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* dosish.h [DJGPP]: Add all required function prototypes.
	Include <io.h> for setmode prototype.

	* pp_sys.c (Perl_pp_system): Add DJGPP to the #if-clause for a
	correct selection of do_aspawn.

	* djgpp/djgppsed.sh: Added new sed subtitution SDOTEXISTS to fix
	lib/ExtUtils/MM_Any.pm.


2007-04-27  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* makedepend.SH:

	* djgpp/config.over: To make the configuration more generic use
	/dev/env/DJDIR instead of ${DJDIR}.

	* djgpp/djgppsed.sh: Added new sed subtitutions SDOTDEPENDING,
	SDOTCOUT and SDOTCERR.

	* djgpp/djgpp.c [__DJGPP__, __DJGPP_MINOR__ ]: If DJGPP >= 2.03 use
	new function Perl_DJGPP_init that takes advantage of the /dev/env/DJDIR
	functionality.  This function replaces Perl_DJGPP_init and
	djgpp_pathexp.

	* djgpp/djgpp.h [__DJGPP__, __DJGPP_MINOR__ ]: Only if DJGPP < 2.03 add
	a prototype for djgpp_pathexp.

	* dosish.h [DJGPP]: Remove function prototypes and include "djgpp.h"
	for function prototypes.

	* hints/dos_djgpp.sh: To make the configuration more generic use
	/dev/env/DJDIR instead of $DJDIR.

	* util.h [WIN32, __CYGWIN__]: Add __DJGPP__ to the sentinel defining
	PERL_FILE_IS_ABSOLUTE.





diff -aprNU5 perl-5.8.8.orig/Configure perl-5.8.8/Configure
--- perl-5.8.8.orig/Configure	2006-01-08 14:51:02 +0000
+++ perl-5.8.8/Configure	2007-05-11 03:02:16 +0000
@@ -3089,16 +3089,10 @@ EOM
 					osvers=2
 				fi
 			fi
 			tmp=''
 			;;
-		pc*)
-			if test -n "$DJGPP"; then
-				osname=dos
-				osvers=djgpp
-			fi
-			;;
 		esac
 
 		case "$1" in
 		aix) osname=aix
 			tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
@@ -3153,10 +3147,16 @@ EOM
 			*)	osvers="$3" ;;
 			esac
 			;;
 		MiNT)	osname=mint
 			;;
+		ms-dos)
+			if test -n "$DJGPP"; then
+				osname=dos
+				osvers=djgpp
+			fi
+			;;
 		netbsd*) osname=netbsd
 			osvers="$3"
 			;;
 		news-os) osvers="$3"
 			case "$3" in
diff -aprNU5 perl-5.8.8.orig/README.dos perl-5.8.8/README.dos
--- perl-5.8.8.orig/README.dos	2006-01-31 23:40:14 +0000
+++ perl-5.8.8/README.dos	2007-05-11 03:02:16 +0000
@@ -44,26 +44,26 @@ If you have questions about DJGPP, try p
 comp.os.msdos.djgpp, or use the email gateway djgpp@delorie.com.
 
 You can find the full DJGPP distribution on any SimTel.Net mirror all over
 the world. Like:
 
-        ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2*
+        ftp://ftp.delorie.com/pub/djgpp/current/v2*
 
 You need the following files to build perl (or add new modules):
 
         v2/djdev203.zip
-        v2gnu/bnu2112b.zip
-        v2gnu/gcc2953b.zip
-        v2gnu/bsh204b.zip
+        v2gnu/bnu217b.zip
+        v2gnu/gcc412b.zip
+        v2gnu/bsh205bb.zip
         v2gnu/mak3791b.zip
         v2gnu/fil40b.zip
-        v2gnu/sed3028b.zip
+        v2gnu/sed415b.zip
         v2gnu/txt20b.zip
-        v2gnu/dif272b.zip
+        v2gnu/dif287b.zip
         v2gnu/grep24b.zip
         v2gnu/shl20jb.zip
-        v2gnu/gwk306b.zip
+        v2gnu/gwk315b.zip
         v2misc/csdpmi5b.zip
 
 or possibly any newer version.
 
 =item Pthreads
diff -aprNU5 perl-5.8.8.orig/djgpp/config.over perl-5.8.8/djgpp/config.over
--- perl-5.8.8.orig/djgpp/config.over	2002-07-09 21:05:56 +0000
+++ perl-5.8.8/djgpp/config.over	2007-05-11 03:02:16 +0000
@@ -1,7 +1,7 @@
 ln='cp'
-pager='${DJDIR}/bin/less.exe'
+pager='/dev/env/DJDIR/bin/less.exe'
 
 # fix extension names under DOS 
 repair()
 {
     echo "$1" | \
diff -aprNU5 perl-5.8.8.orig/djgpp/djgpp.c perl-5.8.8/djgpp/djgpp.c
--- perl-5.8.8.orig/djgpp/djgpp.c	2005-07-08 15:56:16 +0000
+++ perl-5.8.8/djgpp/djgpp.c	2007-05-11 03:02:16 +0000
@@ -398,10 +398,17 @@ Perl_init_os_extras(pTHX)
     /* install my File System Extension for globbing */
     __FSEXT_add_open_handler (glob_handler);
     memset (myglobs,-1,sizeof (myglobs));
 }
 
+#if (__DJGPP__ < 2 || (__DJGPP__ == 2 && __DJGPP_MINOR__ < 3))
+
+/* 
+ *  We only need this on DJGPP < 2.03; with 2.03, using /dev/env/DJDIR
+ *  as prefix solves all this in a clean and portable way.
+ */
+
 static char *perlprefix;
 
 #define PERL5 "/perl5"
 
 char *
@@ -439,10 +446,48 @@ Perl_DJGPP_init (int *argcp,char ***argv
     }
     else
         strcpy (perlprefix,"..");
 }
 
+#else  /*  DJGPP >= 2.03  */
+
+void
+Perl_DJGPP_init (int *argcp,char ***argvp)
+{
+  char** argv = *argvp;
+
+  /* So we have SOME functionality */
+  __system_flags |= __system_allow_multiple_cmds;
+  /* Replace argv0 with the real path */
+  if (__file_exists (argv[0]))
+  {
+    char* tmp = _truename (argv[0], 0);
+    char* s = tmp;
+
+    while (s && *s)
+    {
+      if (*s == '\\')
+	*s = '/';
+      ++s;
+    }
+    if (!_USE_LFN)
+      strlwr (tmp);
+    /* Point to file name, and set argv0 to it */
+    s = rindex (tmp, '/');
+    if (s == 0)
+      s = tmp;
+    else
+      ++s;
+    free (argv[0]);
+    argv[0] = strdup (s);
+    /* FIXME: Does Perl need its full path for anything? */
+    free(tmp);
+  }
+}
+
+#endif  /*  DJGPP >= 2.03  */
+
 int
 djgpp_fflush (FILE *fp)
 {
     int res;
 
@@ -459,11 +504,12 @@ djgpp_fflush (FILE *fp)
     if (res == 0 && fp && ferror(fp) == EOF) clearerr(fp);
 
     return res;
 }
 
-int djgpp_get_stream_mode(FILE *f)
+int
+djgpp_get_stream_mode(FILE *f)
 {
     extern char *__file_handle_modes;
 
     int mode = __file_handle_modes[fileno(f)];
     if (f->_flag & _IORW)
@@ -471,5 +517,129 @@ int djgpp_get_stream_mode(FILE *f)
     if (f->_flag & _IOWRT)
         return mode | O_WRONLY;
     return mode | O_RDONLY;
 }
 
+/*
+ * Juan Manuel Guerrero, <juan.guerrero@gmx.de>:
+ *
+ * char *djgpp_realpath(const char *path, char resolved_path[MAXPATHLEN]);
+ *
+ * Find the real name of path, by removing all ".", ".." and symlink
+ * components.  Returns (resolved) on success, or (NULL) on failure,
+ * in which case the path which caused trouble is left in (resolved).
+ * MAXPATHLEN includes the terminating zero.
+ *
+ * This is a replacement for the bsd_realpath function in ext/Cwd/Cwd.xs.
+ * Because bsd_realpath is not capable to treat dos-like paths with their
+ * backslashes as directory separator and the colon as drive letter separator,
+ * a functional equivalent function is supplied instead of modifing the bsd code.
+ * It will not only check for the existance of the path but it will also canonicalize
+ * the input path.  The path is fixed by removing consecutive and trailing slashes,
+ * making the path absolute if it is relative by prepending the current drive letter
+ * and working directory, removing "." components, collapsing ".." components, adding
+ * a drive specifier if needed, and converting all slashes to '/'.  DOS-style 8+3 names
+ * of directories which are part of the pathname, as well as its final filename part,
+ * are returned lower-cased in resolved_path, but long filenames are left intact.
+ */
+
+char *
+djgpp_realpath(const char *path, char *resolved_path)
+{
+  char *base_name, *dir_name, file_name[MAXPATHLEN];
+  int serrno;
+
+  /* Save the starting point. */
+#ifdef HAS_FCHDIR
+  int fd;
+
+  if ((fd = open(".", O_RDONLY)) < 0)
+  {
+    strcpy(resolved_path, ".");
+    return NULL;
+  }
+#else
+  char working_dir[MAXPATHLEN];
+
+  if (getcwd(working_dir, MAXPATHLEN - 1) == NULL)
+  {
+    strcpy(resolved_path, ".");
+    return NULL;
+  }
+#endif
+
+  /*
+   * Find the dirname and basename from the path to be resolved.
+   * Change directory to the dirname component.
+   * Get the current directory name and append the basename.
+   */
+  _fixpath(path, resolved_path);  /*  Here is where the job is done.  */
+  resolved_path[MAXPATHLEN - 1] = '\0';
+
+  base_name = basename(resolved_path);
+  if (base_name == NULL)
+    goto err1;
+  dir_name = dirname(resolved_path);
+  if (dir_name == NULL || chdir(dir_name))
+    goto err1;
+
+  /*
+   * Save the last component name and get the full pathname of
+   * the current directory.
+   */
+  strcpy(file_name, base_name);
+  if (getcwd(resolved_path, MAXPATHLEN) == NULL)
+    goto err1;
+
+  /*
+   * Join the two strings together, ensuring that the right thing
+   * happens if the last component is empty, or the dirname is root.
+   */
+  if (*file_name)
+  {
+    if (strlen(resolved_path) + strlen(file_name) + 1 > MAXPATHLEN)
+    {
+      errno = ENAMETOOLONG;
+      goto err1;
+    }
+    strcat(resolved_path, "/");
+    strcat(resolved_path, file_name);
+  }
+
+  /* Go back to where we came from. */
+  if (dir_name)
+    free(dir_name);
+#ifdef HAS_FCHDIR
+  if (fchdir(fd) < 0)
+  {
+    serrno = errno;
+    goto err2;
+  }
+#else
+  if (chdir(working_dir) < 0)
+  {
+    serrno = errno;
+    goto err2;
+  }
+#endif
+
+  /* It's okay if the close fails, what's an fd more or less? */
+#ifdef HAS_FCHDIR
+  close(fd);
+#endif
+  return resolved_path;
+
+err1:
+  serrno = errno;
+#ifdef HAS_FCHDIR
+  fchdir(fd);
+#else
+  chdir(working_dir);
+#endif
+
+err2:
+#ifdef HAS_FCHDIR
+  close(fd);
+#endif
+  errno = serrno;
+  return NULL;
+}
diff -aprNU5 perl-5.8.8.orig/djgpp/djgpp.h perl-5.8.8/djgpp/djgpp.h
--- perl-5.8.8.orig/djgpp/djgpp.h	2001-12-04 23:47:58 +0000
+++ perl-5.8.8/djgpp/djgpp.h	2007-05-11 03:02:16 +0000
@@ -37,19 +37,33 @@ bool
 Perl_do_exec (pTHX_ char *cmd);
 
 void
 Perl_init_os_extras(pTHX);
 
-char
-*djgpp_pathexp (const char *p);
+#if (__DJGPP__ < 2 || (__DJGPP__ == 2 && __DJGPP_MINOR__ < 3))
+
+/* 
+ *  We only need this on DJGPP < 2.03; with 2.03, using /dev/env/DJDIR
+ *  as prefix solves all this in a clean and portable way.
+ */
+
+char *
+djgpp_pathexp (const char *p);
+#endif
 
 void
 Perl_DJGPP_init (int *argcp,char ***argvp);
 
 int
 djgpp_fflush (FILE *fp);
 
+int
+djgpp_get_stream_mode(FILE *f);
+
+char *
+djgpp_realpath(const char *path, char *resolved_path);
+
 /* DJGPP utility functions without prototypes? */
 
 int _is_unixy_shell(char *s);
 
 #endif
diff -aprNU5 perl-5.8.8.orig/djgpp/djgppsed.sh perl-5.8.8/djgpp/djgppsed.sh
--- perl-5.8.8.orig/djgpp/djgppsed.sh	2003-08-26 21:48:36 +0000
+++ perl-5.8.8/djgpp/djgppsed.sh	2007-05-11 17:50:38 +0000
@@ -6,10 +6,12 @@
 SCONFIG='s=\.\(config\)=_\1=g'
 SLIST='s=\.\([a-z]\+list\)=_\1=g'
 SGREPTMP='s=\.\(greptmp\)=_\1=g'
 SECHOTMP='s=\.\(echotmp\)=_\1=g'
 SDDC='s=\.\($$\.c\)=_\1=g'
+SIDDC='s=-\([a-z]\)\.\($$\.c\)=\1\2=g'
+SDDC2='s=\.\($$\.c\)=\1=g'
 SOUT='s=\([^a-z1-9?]\)\.\(out\)=\1_\2=g'
 SEXISTS='s=\.\(exists\)=_\1=g'
 SPOD2HTML='s=pod2html-=pod2html.=g'
 SCC='s=\.c\.c=.c_c=g'
 SFILEC="s=\(\$file\)\.c=\\1'_c'=g"
@@ -23,18 +25,24 @@ SDBMX='s=\.\(dbmx\)=_\1=g'
 SDBHASH='s=dbhash\.tmp=dbhash_tmp=g'
 SSTAT='s=\.\(stat\.\)=_\1=g'
 STMP2='s=tmp2=tm2=g'
 SPACKLIST='s=\.\(packlist\)=_\1=g'
 SDOTTMP='s=\.tmp=_tmp=g'
+SDOTDEPENDING='s=\.depending=_depending=g'
+SDOTCOUT='s=\.cout=_cout=g'
+SDOTCERR='s=\.cerr=_cerr=g'
+SDOTEXISTS='s=\.exists=_exists=g'
+SEQDOS="/MSWin32/s=eq=& 'dos' || $^O &="
+SMAYBECOMMAND='/^# maybe_command$/,/^#/{/chmod/s=^=# =;/(.t-/s=^=# =}'
 
 sed -e $SCONFIG -e $SGREPTMP -e $SECHOTMP -e $SDDC -e $SOUT -e 's=\.\( \./\$file\)$=sh\1=g' Configure |tr -d '\r' >s; mv -f s Configure
 sed -e $SEXISTS -e $SLIST -e $SCONFIG Makefile.SH |tr -d '\r' >s; mv -f s Makefile.SH
 sed -e $SEXISTS -e $SPACKLIST lib/ExtUtils/Install.pm |tr -d '\r' >s; mv -f s lib/ExtUtils/Install.pm
 sed -e $SEXISTS -e $SPACKLIST lib/ExtUtils/MM_Unix.pm |tr -d '\r' >s; mv -f s lib/ExtUtils/MM_Unix.pm
 sed -e $SEXISTS -e $SPACKLIST installperl >s; mv -f s installperl
 sed -e $SPOD2HTML lib/Pod/Html.pm |tr -d '\r' >s; mv -f s lib/Pod/Html.pm
-sed -e $SCC -e $SLIST -e $SFILEC -e $SCOR -e $SDEPTMP -e $SHSED makedepend.SH |tr -d '\r' >s; mv -f s makedepend.SH
+sed -e $SCC -e $SLIST -e $SFILEC -e $SCOR -e $SDEPTMP -e $SHSED -e $SDOTDEPENDING -e $SDOTCOUT -e $SDOTCERR makedepend.SH |tr -d '\r' >s; mv -f s makedepend.SH
 sed -e $SCPP t/comp/cpp.aux |tr -d '\r' >s; mv -f s t/comp/cpp.aux
 sed -e $SARGV -e $SDOTTMP t/io/argv.t >s; mv -f s t/io/argv.t
 sed -e $SABC t/io/inplace.t >s; mv -f s t/io/inplace.t
 sed -e $SDBMX -e $SDBHASH ext/GDBM_File/t/gdbm.t >s; mv -f s ext/GDBM_File/t/gdbm.t
 sed -e $SSTAT -e $STMP2 t/op/stat.t >s; mv -f s t/op/stat.t
@@ -44,6 +52,15 @@ sed -e 's=:^/:={^([a-z]:)?[\\\\/]}=g' li
 sed -e $SPACKLIST installman >s; mv -f s installman
 sed -e $SPACKLIST lib/ExtUtils/Installed.pm >s; mv -f s lib/ExtUtils/Installed.pm
 sed -e $SPACKLIST lib/ExtUtils/Packlist.pm >s; mv -f s lib/ExtUtils/Packlist.pm
 sed -e $SABC t/io/iprefix.t >s; mv -f s t/io/iprefix.t
 sed -e 's=L_ctermid==g' ext/POSIX/Makefile.PL >s; mv -f s ext/POSIX/Makefile.PL
+sed -e $SPACKLIST lib/ExtUtils/t/basic.t >s; mv -f s lib/ExtUtils/t/basic.t
 sed -e $SPACKLIST lib/ExtUtils/t/Installed.t >s; mv -f s lib/ExtUtils/t/Installed.t
+sed -e $SPACKLIST lib/ExtUtils/t/installbase.t >s; mv -f s lib/ExtUtils/t/installbase.t
+sed -e $SDOTEXISTS lib/ExtUtils/MM_Any.pm >s; mv -f s lib/ExtUtils/MM_Any.pm
+sed -e "$SEQDOS" t/pod/pod2usage2.t >s; mv -f s t/pod/pod2usage2.t
+sed -e "$SEQDOS" t/lib/warnings/mg >s; mv -f s t/lib/warnings/mg
+sed -e $SIDDC -e $SDDC2 utils/c2ph.PL >s; mv -f s utils/c2ph.PL
+sed -e "$SMAYBECOMMAND" lib/ExtUtils/t/MM_Unix.t >s; mv -f s lib/ExtUtils/t/MM_Unix.t
+sed -e "$SEQDOS" t/comp/opsubs.t >s; mv -f s t/comp/opsubs.t
+
diff -aprNU5 perl-5.8.8.orig/dosish.h perl-5.8.8/dosish.h
--- perl-5.8.8.orig/dosish.h	2004-02-17 22:37:46 +0000
+++ perl-5.8.8/dosish.h	2007-05-11 03:02:16 +0000
@@ -19,34 +19,41 @@
 #  define PERL_SYS_INIT(c,v) MALLOC_CHECK_TAINT2(*c,*v) Perl_DJGPP_init(c,v)
 #  define init_os_extras Perl_init_os_extras
 #  include <signal.h>
 #  define HAS_UTIME
 #  define HAS_KILL
-   char *djgpp_pathexp (const char*);
    void Perl_DJGPP_init (int *argcp,char ***argvp);
+   void Perl_init_os_extras(pTHX);
+   int  do_spawn (pTHX_ char *cmd);
+   int  do_aspawn (pTHX_ SV *really,SV **mark,SV **sp);
+   char *djgpp_realpath(const char *path, char *resolved_path);
+#  include <stdio.h>
+   int  djgpp_fflush (FILE *fp);
+   int  djgpp_get_stream_mode(FILE *f);
+#  include <io.h>
 #  if (DJGPP==2 && DJGPP_MINOR < 2)
 #    define NO_LOCALECONV_MON_THOUSANDS_SEP
 #  endif
 #  ifdef USE_5005THREADS
 #    define OLD_PTHREADS_API
 #  endif
 #  define PERL_FS_VER_FMT	"%d_%d_%d"
-#else	/* DJGPP */
+#else	/* !DJGPP */
 #  ifdef WIN32
 #    define PERL_SYS_INIT(c,v)	MALLOC_CHECK_TAINT2(*c,*v) Perl_win32_init(c,v)
 #    define PERL_SYS_TERM()	Perl_win32_term()
 #    define BIT_BUCKET "nul"
 #  else
-#	 ifdef NETWARE
+#    ifdef NETWARE
 #      define PERL_SYS_INIT(c,v)	MALLOC_CHECK_TAINT2(*c,*v) Perl_nw5_init(c,v)
 #      define BIT_BUCKET "nwnul"
-#    else
+#    else  /* !NETWARE */
 #      define PERL_SYS_INIT(c,v)	MALLOC_CHECK_TAINT2(*c,*v)
 #      define BIT_BUCKET "\\dev\\nul" /* "wanna be like, umm, Newlined, or somethin?" */
-#    endif /* NETWARE */
+#    endif /* !NETWARE */
 #  endif
-#endif	/* DJGPP */
+#endif	/* !DJGPP */
 
 #ifndef PERL_SYS_TERM
 #  define PERL_SYS_TERM() OP_REFCNT_TERM; MALLOC_TERM
 #endif
 #define dXSUB_SYS
diff -aprNU5 perl-5.8.8.orig/ext/Cwd/Cwd.xs perl-5.8.8/ext/Cwd/Cwd.xs
--- perl-5.8.8.orig/ext/Cwd/Cwd.xs	2005-06-17 09:52:18 +0000
+++ perl-5.8.8/ext/Cwd/Cwd.xs	2007-05-11 03:02:16 +0000
@@ -73,10 +73,12 @@ char *
 bsd_realpath(const char *path, char *resolved)
 {
 #ifdef VMS
        dTHX;
        return Perl_rmsexpand(aTHX_ (char*)path, resolved, NULL, 0);
+#elif DJGPP
+	return djgpp_realpath(path, resolved);
 #else
 	int rootd, serrno;
 	char *p, *q, wbuf[MAXPATHLEN];
 	int symlinks = 0;
 
diff -aprNU5 perl-5.8.8.orig/hints/dos_djgpp.sh perl-5.8.8/hints/dos_djgpp.sh
--- perl-5.8.8.orig/hints/dos_djgpp.sh	2003-08-24 06:48:52 +0000
+++ perl-5.8.8/hints/dos_djgpp.sh	2007-05-11 03:02:16 +0000
@@ -2,21 +2,24 @@
 # Original by Laszlo Molnar <molnarl@cdata.tvnet.hu>
 
 # 971015 - archname changed from 'djgpp' to 'dos-djgpp'
 # 971210 - threads support
 # 000222 - added -DPERL_EXTERNAL_GLOB to ccflags
+# 070427 - $DJDIR preplaced by /dev/env/DJDIR
+# 070504 - use $prefix/share/man/cat1 for man1dir and $prefix/share/man/cat3 for man3dir
+# 070504 - logic changed not only to detect gcc 3.NN.NN but also higher compiler versions
 
 archname='dos-djgpp'
 archobjs='djgpp.o'
 path_sep=\;
 startsh="#! /bin/sh"
 
 cc='gcc'
 ld='gcc'
-usrinc="$DJDIR/include"
+usrinc='/dev/env/DJDIR/include'
 
-libpth="$DJDIR/lib"
+libpth='/dev/env/DJDIR/lib'
 libc="$libpth/libc.a"
 
 so='none'
 usedl='n'
 
@@ -39,11 +42,11 @@ d_pipe='undef'
 startperl='#!perl'
 
 case "X$optimize" in
   X)
 	case `gcc -v 2>&1|grep "gcc version"` in
-	"gcc version 3."*)
+	"gcc version "[3-9].*)
 	  optimize="-O2 -falign-loops=2 -falign-jumps=2 -falign-functions=2" ;;
 	*)
 	  optimize="-O2 -malign-loops=2 -malign-jumps=2 -malign-functions=2" ;;
 	esac
 	ldflags='-s'
@@ -54,11 +57,11 @@ case "X$optimize" in
 esac
 ccflags="$ccflags -DPERL_EXTERNAL_GLOB"
 usemymalloc='n'
 timetype='time_t'
 
-prefix=$DJDIR
+prefix='/dev/env/DJDIR'
 privlib=$prefix/lib/perl5
 archlib=$privlib
 sitelib=$privlib/site
 sitearch=$sitelib
 
@@ -77,5 +80,14 @@ $define|true|[yY]*)
 esac
 EOCBU
 
 useperlio='undef'
 uselargefiles='undef'
+
+man1dir=$prefix/share/man/cat1
+man3dir=$prefix/share/man/cat3
+
+# Do not use flock even if it is available.
+d_flock='undef'
+d_flockproto='undef'
+d_fcntl_can_lock='undef'
+d_lockf='undef'
diff -aprNU5 perl-5.8.8.orig/installman perl-5.8.8/installman
--- perl-5.8.8.orig/installman	2004-05-31 14:37:46 +0000
+++ perl-5.8.8/installman	2007-05-11 03:02:16 +0000
@@ -170,10 +170,19 @@ sub pod2man {
 	# if necessary.
 	$manpage =~ s#\.p(m|od)$##;
 	if ($^O eq 'os2' || $^O eq 'amigaos' || $^O eq 'uwin' || $^O eq 'cygwin') {
 	  $manpage =~ s#/#.#g;
 	}
+	elsif ($^O eq 'dos') {
+	  # Make the path to store the man pages
+	  # the way it is required by dos.
+	  my $dirname = $manpage;
+	  if ($dirname =~ s#/[^/]*$##) {
+	    $dirname = $mandir . '/' . $dirname;
+	    mkpath($dirname, $opts{verbose}, 0777) unless $opts{notify};
+	  }
+	}
 	else {
 	  $manpage =~ s#/#::#g;
 	}
 	$tmp = "${mandir}/${manpage}.tmp";
 	$manpage = "${mandir}/${manpage}.${manext}";
diff -aprNU5 perl-5.8.8.orig/makedepend.SH perl-5.8.8/makedepend.SH
--- perl-5.8.8.orig/makedepend.SH	2003-06-05 18:11:10 +0000
+++ perl-5.8.8/makedepend.SH	2007-05-11 03:02:16 +0000
@@ -145,11 +145,12 @@ for file in `$cat .clist`; do
     if [ "$osname" = os390 -a "$file" = perly.c ]; then
         $echo '#endif' >>UU/$file.c
     fi
 
     if [ "$osname" = os390 ]; then
-        $cppstdin $finc -I. $cppflags $cppminus <UU/$file.c |
+        $cppstdin $finc -I. $cppflags $cppminus <UU/$file.c | \
+        grep -v '<built-in>' | grep -v '<command line>' | \
         $sed \
     	    -e '/^#.*<stdin>/d' \
 	    -e '/^#.*"-"/d' \
 	    -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
 	    -e 's/^[	 ]*#[	 ]*line/#/' \
diff -aprNU5 perl-5.8.8.orig/pp_sys.c perl-5.8.8/pp_sys.c
--- perl-5.8.8.orig/pp_sys.c	2006-01-13 18:15:14 +0000
+++ perl-5.8.8/pp_sys.c	2007-05-11 03:02:16 +0000
@@ -4205,18 +4205,18 @@ PP(pp_system)
 #else /* ! FORK or VMS or OS/2 */
     PL_statusvalue = 0;
     result = 0;
     if (PL_op->op_flags & OPf_STACKED) {
 	SV *really = *++MARK;
-#  if defined(WIN32) || defined(OS2) || defined(SYMBIAN)
+#  if defined(WIN32) || defined(OS2) || defined(DJGPP) || defined(SYMBIAN)
 	value = (I32)do_aspawn(really, MARK, SP);
 #  else
 	value = (I32)do_aspawn(really, (void **)MARK, (void **)SP);
 #  endif
     }
     else if (SP - MARK != 1) {
-#  if defined(WIN32) || defined(OS2) || defined(SYMBIAN)
+#  if defined(WIN32) || defined(OS2) || defined(DJGPP) || defined(SYMBIAN)
 	value = (I32)do_aspawn(Nullsv, MARK, SP);
 #  else
 	value = (I32)do_aspawn(Nullsv, (void **)MARK, (void **)SP);
 #  endif
     }
diff -aprNU5 perl-5.8.8.orig/util.h perl-5.8.8/util.h
--- perl-5.8.8.orig/util.h	2004-12-01 14:44:56 +0000
+++ perl-5.8.8/util.h	2007-05-11 03:02:16 +0000
@@ -14,11 +14,11 @@
 	 || (strchr(f,':')						\
 	     || ((*(f) == '[' || *(f) == '<')				\
 		 && (isALNUM((f)[1]) || strchr("$-_]>",(f)[1])))))
 
 #else		/* !VMS */
-#  if defined(WIN32) || defined(__CYGWIN__)
+#  if defined(WIN32) || defined(__CYGWIN__) || defined(__DJGPP__)
 #    define PERL_FILE_IS_ABSOLUTE(f) \
 	(*(f) == '/' || *(f) == '\\'		/* UNC/rooted path */	\
 	 || ((f)[0] && (f)[1] == ':'))		/* drive name */
 #  else		/* !WIN32 */
 #  ifdef NETWARE
diff -aprNU5 perl-5.8.8.orig/utils/perlbug.PL perl-5.8.8/utils/perlbug.PL
--- perl-5.8.8.orig/utils/perlbug.PL	2006-01-03 19:07:40 +0000
+++ perl-5.8.8/utils/perlbug.PL	2007-05-11 03:02:16 +0000
@@ -147,11 +147,11 @@ my $Version = "1.35";
 #       accounted for.
 #       - Test -b option
 
 my( $file, $usefile, $cc, $address, $perlbug, $testaddress, $filename, $messageid, $domain,
     $subject, $from, $verbose, $ed, $outfile, $Is_MacOS, $category, $severity,
-    $fh, $me, $Is_MSWin32, $Is_Linux, $Is_VMS, $msg, $body, $andcc, %REP, $ok,
+    $fh, $me, $Is_dos, $Is_MSWin32, $Is_Linux, $Is_VMS, $msg, $body, $andcc, %REP, $ok,
     $Is_OpenBSD);
 
 my $perl_version = $^V ? sprintf("v%vd", $^V) : $];
 
 my $config_tag2 = "$perl_version - $Config{cf_time}";
@@ -218,10 +218,11 @@ EOF
 }
 
 sub Init {
     # -------- Setup --------
 
+    $Is_dos = $^O eq 'dos';
     $Is_MSWin32 = $^O eq 'MSWin32';
     $Is_VMS = $^O eq 'VMS';
     $Is_Linux = lc($^O) eq 'linux';
     $Is_OpenBSD = lc($^O) eq 'openbsd';
     $Is_MacOS = $^O eq 'MacOS';
@@ -269,10 +270,11 @@ sub Init {
 	
     # Editor
     $ed = $::opt_e || $ENV{VISUAL} || $ENV{EDITOR} || $ENV{EDIT}
 	|| ($Is_VMS && "edit/tpu")
 	|| ($Is_MSWin32 && "notepad")
+	|| ($Is_dos && "edit")
 	|| ($Is_MacOS && '')
 	|| "vi";
 
     # Not OK - provide build failure template by finessing OK report
     if ($::opt_n) {
@@ -341,10 +343,11 @@ EOF
     $messageid = "<$::Config{'version'}_${$}_".time."\@$domain>"; 
 
     # My username
     $me = $Is_MSWin32 ? $ENV{'USERNAME'}
 	    : $^O eq 'os2' ? $ENV{'USER'} || $ENV{'LOGNAME'}
+	    : $Is_dos ? $ENV{'USER'}
 	    : $Is_MacOS ? $ENV{'USER'}
 	    : eval { getpwuid($<) };	# May be missing
 
     $from = $::Config{'cf_email'}
        if !$from && $::Config{'cf_email'} && $::Config{'cf_by'} && $me &&
