2014-06-11  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* gettext-tools/gnulib-lib/execute.c [__DJGPP__]: DJGPP specific
	implementation of execute.

	* gettext-tools/gnulib-lib/djgpp-spawn.h: New file.  Implements DJGPP
	specific stuff.

	* gettext-tools/gnulib-lib/libxml/nanohttp.c: Define SOCKET to int if
	not defined.

	* gettext-tools/gnulib-lib/libxml/xmlIO.c: For DJGPP define _wfopen,
	_wopen and _wstat as NO-OPs.
	(__xmlIOWin32UTF8ToWChar): For DJGPP return always NULL.
	(xmlInitPlatformSpecificIo): For DJGPP return native format of stat
	and open instead of UTF8 version.

	* gettext-tools/gnulib-lib/spawn-pipe.c: DJGPP specific implementation
	of create_pipe.

	* gettext-tools/gnulib-lib/spawni.c [__DJGPP__]: DJGPP specific
	implementation of __spawni.  Still not implemented; returns ENOSYS.

	* gettext-tools/gnulib-lib/tempname.c (__path_search): For DJGPP try
	TMP and TEMP also if TMPDIR does not exist or does not point to an
	existing directory.

	* gettext-tools/gnulib-lib/wait-process.c[__DJGPP__]: Include
	djgpp-spawn.h.
	(wait_subprocess): DJGPP specific implementation of wait_subprocess.
	Removes the tmp files used to implement the pipe.

	* gettext-tools/misc/autopoint.in: Appart of TMPDIR support TMP and
	TEMP also and default to the current working directory if neither is
	set.

	* gettext-tools/misc/gettextize.in: Appart of TMPDIR support TMP and
	TEMP also and default to the current working directory if neither is
	set.

	* gnulib-local/lib/libxml/nanohttp.c: Define SOCKET to int if not
	defined.

	* gnulib-local/lib/libxml/xmlIO.c: For DJGPP define _wfopen, _wopen
	and _wstat as NO-OPs.
	(__xmlIOWin32UTF8ToWChar): For DJGPP return always NULL.
	(xmlInitPlatformSpecificIo): For DJGPP return native format of stat
	and open instead of UTF8 version.











diff -aprNU5 gettext-0.19.1.orig/gettext-tools/gnulib-lib/djgpp-spawn.h gettext-0.19.1/gettext-tools/gnulib-lib/djgpp-spawn.h
--- gettext-0.19.1.orig/gettext-tools/gnulib-lib/djgpp-spawn.h	1970-01-01 01:00:00 +0100
+++ gettext-0.19.1/gettext-tools/gnulib-lib/djgpp-spawn.h	2014-06-11 21:04:54 +0200
@@ -0,0 +1,153 @@
+#include <config.h>
+#include <stdio.h>
+#include "cloexec.h"
+#include "xalloc.h"
+
+#define prepare_spawn(argv)                                        \
+(__gnuc_extension__                                                \
+  ({                                                               \
+     size_t _argc;                                                 \
+     char **_new_argv;                                             \
+                                                                   \
+     for (_argc = 0; (argv)[_argc]; _argc++)                       \
+       ;                                                           \
+                                                                   \
+     _new_argv = xmalloc((1 + _argc + 1) * sizeof(_new_argv[0]));  \
+     *_new_argv++ = "/dev/env/DJDIR/bin/sh";                       \
+                                                                   \
+     for (_argc = 0; _new_argv[_argc] = argv[_argc]; _argc++)      \
+       ;                                                           \
+                                                                   \
+     _new_argv;                                                    \
+  })                                                               \
+)
+
+
+#define PIPE_STDIN   0
+#define PIPE_STDOUT  1
+
+
+char tmp_file_name[2][L_tmpnam];  /*  0: pipe stdin, 1: pipe stdout.  */
+
+
+#define remove_tmp_file(name)                                                \
+(__gnuc_extension__                                                          \
+  ({                                                                         \
+     if ((name))                                                             \
+     {                                                                       \
+       if (unlink((name)))                                                   \
+         error(exit_on_error ? EXIT_FAILURE : 0, errno,                      \
+               _("removing of `%s' failed"), (name));                        \
+     }                                                                       \
+     else                                                                    \
+     {                                                                       \
+       if (tmp_file_name[PIPE_STDIN][0])                                     \
+       {                                                                     \
+         if (unlink(tmp_file_name[PIPE_STDIN]))                              \
+           error(exit_on_error ? EXIT_FAILURE : 0, errno,                    \
+                 _("removing of `%s' failed"), tmp_file_name[PIPE_STDIN]);   \
+       }                                                                     \
+       if (tmp_file_name[PIPE_STDOUT][0])                                    \
+       {                                                                     \
+         if (unlink(tmp_file_name[PIPE_STDOUT]))                             \
+           error(exit_on_error ? EXIT_FAILURE : 0, errno,                    \
+                 _("removing of `%s' failed"), tmp_file_name[PIPE_STDOUT]);  \
+       }                                                                     \
+     }                                                                       \
+  })                                                                         \
+)
+
+
+/* Duplicates a file handle, making the copy uninheritable.
+   Returns -1 for a file handle that is equivalent to closed.  */
+static int
+dup_noinherit(int fd)
+{
+  fd = dup_cloexec(fd);
+  if (fd < 0 && errno == EMFILE)
+    error(EXIT_FAILURE, errno, _("fcntl failed"));
+
+  return fd;
+}
+
+/* Returns a file descriptor equivalent to FD, except that the resulting file
+   descriptor is none of STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO.
+   FD must be open and non-inheritable.  The result will be non-inheritable as
+   well.
+   If FD < 0, FD itself is returned.  */
+static int
+fd_safer_noinherit(int fd)
+{
+  if (STDIN_FILENO <= fd && fd <= STDERR_FILENO)
+  {
+    /* The recursion depth is at most 3.  */
+    int nfd = fd_safer_noinherit(dup_noinherit(fd));
+    int saved_errno = errno;
+    close(fd);
+    errno = saved_errno;
+    return nfd;
+  }
+  return fd;
+}
+
+/* Duplicates a file handle, making the copy uninheritable and ensuring the
+   result is none of STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO.
+   Returns -1 for a file handle that is equivalent to closed.  */
+static int
+dup_safer_noinherit(int fd)
+{
+  return fd_safer_noinherit(dup_noinherit(fd));
+}
+
+/* Undoes the effect of TEMPFD = dup_safer_noinherit (ORIGFD);  */
+static void
+undup_safer_noinherit(int tempfd, int origfd)
+{
+  if (tempfd >= 0)
+  {
+    if (dup2(tempfd, origfd) < 0)
+      error(EXIT_FAILURE, errno, _("cannot restore fd %d: dup2 failed"), origfd);
+    close(tempfd);
+  }
+  else
+  {
+    /* origfd was closed or open to no handle at all.  Set it to a closed
+       state.  This is (nearly) equivalent to the original state.  */
+    close(origfd);
+  }
+}
+
+#ifdef _SPAWN_PIPE_H
+static int
+djgpp_pipe(int pipe_fd[2], int pipe_end)
+{
+  int fd;
+
+  strcpy(tmp_file_name[pipe_end], "/dev/env/TMPDIR/gtXXXXXX");
+  if ((fd = mkstemp(tmp_file_name[pipe_end])) < 0)
+  {
+    strcpy(tmp_file_name[pipe_end], "/dev/env/TMP/gtXXXXXX");
+    if ((fd = mkstemp(tmp_file_name[pipe_end])) < 0)
+    {
+      strcpy(tmp_file_name[pipe_end], "/dev/env/TEMP/gtXXXXXX");
+      if ((fd = mkstemp(tmp_file_name[pipe_end])) < 0)
+        return -1;
+    }
+  }
+
+  if (pipe_end == PIPE_STDIN)
+  {
+    pipe_fd[PIPE_STDIN] = fd;
+    pipe_fd[PIPE_STDOUT] = -1;
+    tmp_file_name[PIPE_STDOUT][0] = '\0';
+  }
+  else if (pipe_end == PIPE_STDOUT)
+  {
+    pipe_fd[PIPE_STDOUT] = fd;
+    pipe_fd[PIPE_STDIN] = -1;
+    tmp_file_name[PIPE_STDIN][0] = '\0';
+  }
+
+  return 0;
+}
+#endif
diff -aprNU5 gettext-0.19.1.orig/gettext-tools/gnulib-lib/execute.c gettext-0.19.1/gettext-tools/gnulib-lib/execute.c
--- gettext-0.19.1.orig/gettext-tools/gnulib-lib/execute.c	2014-06-10 05:41:34 +0200
+++ gettext-0.19.1/gettext-tools/gnulib-lib/execute.c	2014-06-11 21:04:54 +0200
@@ -39,10 +39,16 @@
 
 /* Native Windows API.  */
 # include <process.h>
 # include "w32spawn.h"
 
+#elif defined __DJGPP__
+
+/* DJGPP API.  */
+# include <process.h>
+# include "djgpp-spawn.h"
+
 #else
 
 /* Unix API.  */
 # include <spawn.h>
 
@@ -175,10 +181,96 @@ execute (const char *progname,
     }
   if (nulloutfd >= 0)
     close (nulloutfd);
   if (nullinfd >= 0)
     close (nullinfd);
+
+  /* Restore standard file handles of parent process.  */
+  if (null_stderr)
+    undup_safer_noinherit (orig_stderr, STDERR_FILENO);
+  if (null_stdout)
+    undup_safer_noinherit (orig_stdout, STDOUT_FILENO);
+  if (null_stdin)
+    undup_safer_noinherit (orig_stdin, STDIN_FILENO);
+
+  if (termsigp != NULL)
+    *termsigp = 0;
+
+  if (exitcode == -1)
+    {
+      if (exit_on_error || !null_stderr)
+        error (exit_on_error ? EXIT_FAILURE : 0, errno,
+               _("%s subprocess failed"), progname);
+      return 127;
+    }
+
+  return exitcode;
+
+#elif defined __DJGPP__
+
+  int orig_stdin;
+  int orig_stdout;
+  int orig_stderr;
+  int exitcode;
+  int nullinfd;
+  int nulloutfd;
+
+  /* Add an element upfront that can be used when argv[0] turns out to be a
+     script, not a program.  */
+  char **new_prog_argv = prepare_spawn (prog_argv);
+
+  /* Save standard file handles of parent process.  */
+ if (null_stdin)
+    orig_stdin = dup_safer_noinherit (STDIN_FILENO);
+  if (null_stdout)
+    orig_stdout = dup_safer_noinherit (STDOUT_FILENO);
+  if (null_stderr)
+    orig_stderr = dup_safer_noinherit (STDERR_FILENO);
+  exitcode = -1;
+
+  /* Create standard file handles of child process.  */
+  nullinfd = -1;
+  nulloutfd = -1;
+  if ((!null_stdin
+       || ((nullinfd = open ("/dev/null", O_RDONLY | O_BINARY, 0)) >= 0
+           && (nullinfd == STDIN_FILENO
+               || (dup2 (nullinfd, STDIN_FILENO) >= 0
+                   && close (nullinfd) >= 0))))
+      && (!(null_stdout || null_stderr)
+          || ((nulloutfd = open ("/dev/null", O_RDWR | O_BINARY, 0)) >= 0
+              && (!null_stdout
+                  || nulloutfd == STDOUT_FILENO
+                  || dup2 (nulloutfd, STDOUT_FILENO) >= 0)
+              && (!null_stderr
+                  || nulloutfd == STDERR_FILENO
+                  || dup2 (nulloutfd, STDERR_FILENO) >= 0)
+              && ((null_stdout && nulloutfd == STDOUT_FILENO)
+                  || (null_stderr && nulloutfd == STDERR_FILENO)
+                  || close (nulloutfd) >= 0))))
+    /* Use spawnvpe and pass the environment explicitly.  This is needed if
+       the program has modified the environment using putenv() or [un]setenv().
+       On Windows, programs have two environments, one in the "environment
+       block" of the process and managed through SetEnvironmentVariable(), and
+       one inside the process, in the location retrieved by the 'environ'
+       macro.  When using spawnvp() without 'e', the child process inherits a
+       copy of the environment block - ignoring the effects of putenv() and
+       [un]setenv().  */
+    {
+      exitcode = spawnvpe (P_WAIT, prog_path, new_prog_argv, environ);
+      if (--new_prog_argv, exitcode < 0 && errno == ENOEXEC)
+        {
+          /* prog is not an native executable.  Try to execute it as a
+             shell script.  Note that prepare_spawn() has already prepended
+             a hidden element "/dev/env/DJDIR/bin/sh" to new_prog_argv.  */
+          exitcode = spawnvpe (P_WAIT, new_prog_argv[0], new_prog_argv, environ);
+        }
+      free (new_prog_argv);
+    }
+  if (nulloutfd >= 0)
+    close (nulloutfd);
+  if (nullinfd >= 0)
+    close (nullinfd);
 
   /* Restore standard file handles of parent process.  */
   if (null_stderr)
     undup_safer_noinherit (orig_stderr, STDERR_FILENO);
   if (null_stdout)
diff -aprNU5 gettext-0.19.1.orig/gettext-tools/gnulib-lib/libxml/nanohttp.c gettext-0.19.1/gettext-tools/gnulib-lib/libxml/nanohttp.c
--- gettext-0.19.1.orig/gettext-tools/gnulib-lib/libxml/nanohttp.c	2013-01-09 04:01:26 +0100
+++ gettext-0.19.1/gettext-tools/gnulib-lib/libxml/nanohttp.c	2014-06-11 21:04:54 +0200
@@ -97,12 +97,14 @@
  */
 #ifndef _WINSOCKAPI_
 #ifndef __BEOS__
 #define closesocket(s) close(s)
 #endif
+#ifndef SOCKET
 #define SOCKET int
 #endif
+#endif
 
 #ifdef __BEOS__
 #ifndef PF_INET
 #define PF_INET AF_INET
 #endif
diff -aprNU5 gettext-0.19.1.orig/gettext-tools/gnulib-lib/libxml/xmlIO.c gettext-0.19.1/gettext-tools/gnulib-lib/libxml/xmlIO.c
--- gettext-0.19.1.orig/gettext-tools/gnulib-lib/libxml/xmlIO.c	2013-01-09 04:01:26 +0100
+++ gettext-0.19.1/gettext-tools/gnulib-lib/libxml/xmlIO.c	2014-06-11 21:04:54 +0200
@@ -197,10 +197,17 @@ static const char *IOerr[] = {
     "adddress in use",		/* EADDRINUSE */
     "already in use",		/* EALREADY */
     "unknown address familly",	/* EAFNOSUPPORT */
 };
 
+#if defined (__DJGPP__)
+/*  I/O function that expect UTF-8 strings as arguments are not supported by DJGPP.  */
+# define _wfopen(filename, mode)  (NULL)
+# define _wopen(filename, omode)  (-1)
+# define _wstat(path, buffer)     (-1)
+#endif
+
 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
 /**
  * __xmlIOWin32UTF8ToWChar:
  * @u8String:  uft-8 string
  *
@@ -209,10 +216,11 @@ static const char *IOerr[] = {
 static wchar_t *
 __xmlIOWin32UTF8ToWChar(const char *u8String)
 {
     wchar_t *wString = NULL;
 
+#if !defined (__DJGPP__)
     if (u8String) {
         int wLen =
             MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, u8String,
                                 -1, NULL, 0);
         if (wLen) {
@@ -224,10 +232,11 @@ __xmlIOWin32UTF8ToWChar(const char *u8St
                     wString = NULL;
                 }
             }
         }
     }
+#endif
 
     return wString;
 }
 #endif
 
@@ -680,21 +689,24 @@ static xmlWrapOpenFunc xmlWrapOpen = xml
  */
 static void
 xmlInitPlatformSpecificIo(void)
 {
     static int xmlPlatformIoInitialized = 0;
+#if !defined (__DJGPP__)
     OSVERSIONINFO osvi;
 
     if(xmlPlatformIoInitialized)
       return;
 
     osvi.dwOSVersionInfoSize = sizeof(osvi);
 
     if(GetVersionEx(&osvi) && (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)) {
       xmlWrapStat = xmlWrapStatUtf8;
       xmlWrapOpen = xmlWrapOpenUtf8;
-    } else {
+    } else
+#endif
+    {
       xmlWrapStat = xmlWrapStatNative;
       xmlWrapOpen = xmlWrapOpenNative;
     }
 
     xmlPlatformIoInitialized = 1;
diff -aprNU5 gettext-0.19.1.orig/gettext-tools/gnulib-lib/spawn-pipe.c gettext-0.19.1/gettext-tools/gnulib-lib/spawn-pipe.c
--- gettext-0.19.1.orig/gettext-tools/gnulib-lib/spawn-pipe.c	2014-06-10 05:41:38 +0200
+++ gettext-0.19.1/gettext-tools/gnulib-lib/spawn-pipe.c	2014-06-11 21:04:54 +0200
@@ -39,10 +39,16 @@
 
 /* Native Windows API.  */
 # include <process.h>
 # include "w32spawn.h"
 
+#elif defined __DJGPP__
+
+/* DJGPP API.  */
+# include <process.h>
+# include "djgpp-spawn.h"
+
 #else
 
 /* Unix API.  */
 # include <spawn.h>
 
@@ -251,10 +257,135 @@ create_pipe (const char *progname,
     fd[0] = ifd[0];
   if (pipe_stdin)
     fd[1] = ofd[1];
   return child;
 
+#elif defined  __DJGPP__
+
+  /* DJGPP API.  */
+  int ifd[2];
+  int ofd[2];
+  int orig_stdin;
+  int orig_stdout;
+  int orig_stderr;
+  int child;
+  int nulloutfd;
+  int stdinfd;
+  int stdoutfd;
+  int saved_errno;
+
+  /* Add an element upfront that can be used when argv[0] turns out to be a
+     script, not a program.  */
+  char **new_prog_argv = prepare_spawn (prog_argv);
+
+  if (pipe_stdout)
+    if (djgpp_pipe (ifd, PIPE_STDOUT) < 0)
+      error (EXIT_FAILURE, errno, _("cannot create pipe"));
+  if (pipe_stdin)
+    if (djgpp_pipe (ofd, PIPE_STDIN) < 0)
+      error (EXIT_FAILURE, errno, _("cannot create pipe"));
+/* Data flow diagram:
+ *
+ *           write        system         read
+ *    parent  ->   ofd[1]   ->   ofd[0]   ->   child       if pipe_stdin
+ *    parent  <-   ifd[0]   <-   ifd[1]   <-   child       if pipe_stdout
+ *           read         system         write
+ *
+ */
+
+  /* Save standard file handles of parent process.  */
+  if (pipe_stdin || prog_stdin != NULL)
+    orig_stdin = dup_safer_noinherit (STDIN_FILENO);
+  if (pipe_stdout || prog_stdout != NULL)
+    orig_stdout = dup_safer_noinherit (STDOUT_FILENO);
+  if (null_stderr)
+    orig_stderr = dup_safer_noinherit (STDERR_FILENO);
+  child = -1;
+
+  /* Create standard file handles of child process.  */
+  nulloutfd = -1;
+  stdinfd = -1;
+  stdoutfd = -1;
+  if ((!pipe_stdin || dup2 (ofd[0], STDIN_FILENO) >= 0)
+      && (!pipe_stdout || dup2 (ifd[1], STDOUT_FILENO) >= 0)
+      && (!null_stderr
+	  || ((nulloutfd = open ("/dev/null", O_RDWR, 0)) >= 0
+	      && (nulloutfd == STDERR_FILENO
+		  || (dup2 (nulloutfd, STDERR_FILENO) >= 0
+		      && close (nulloutfd) >= 0))))
+      && (pipe_stdin
+	  || prog_stdin == NULL
+	  || ((stdinfd = open (prog_stdin, O_RDONLY, 0)) >= 0
+	      && (stdinfd == STDIN_FILENO
+		  || (dup2 (stdinfd, STDIN_FILENO) >= 0
+		      && close (stdinfd) >= 0))))
+      && (pipe_stdout
+	  || prog_stdout == NULL
+	  || ((stdoutfd = open (prog_stdout, O_WRONLY, 0)) >= 0
+	      && (stdoutfd == STDOUT_FILENO
+		  || (dup2 (stdoutfd, STDOUT_FILENO) >= 0
+		      && close (stdoutfd) >= 0)))))
+    /* The child process doesn't inherit ifd[0], ifd[1], ofd[0], ofd[1],
+       but it inherits all open()ed or dup2()ed file handles (which is what
+       we want in the case of STD*_FILENO) and also orig_stdin,
+       orig_stdout, orig_stderr (which is not explicitly wanted but
+       harmless).  */
+    /* Use spawnvpe and pass the environment explicitly.  This is needed if
+       the program has modified the environment using putenv() or [un]setenv().
+       On Windows, programs have two environments, one in the "environment
+       block" of the process and managed through SetEnvironmentVariable(), and
+       one inside the process, in the location retrieved by the 'environ'
+       macro.  When using spawnvp() without 'e', the child process inherits a
+       copy of the environment block - ignoring the effects of putenv() and
+       [un]setenv().  */
+    {
+      child = spawnvpe (P_WAIT, prog_path, prog_argv, environ);
+      if (child < 0 && errno == ENOEXEC)
+	{
+	  /* prog is not an native executable.  Try to execute it as a
+	     shell script.  Note that prepare_spawn() has already prepended
+	     a hidden element "sh.exe" to prog_argv.  */
+	  --prog_argv;
+	  child = spawnvpe (P_WAIT, prog_argv[0], prog_argv, environ);
+	}
+    }
+  if (child == -1)
+    saved_errno = errno;
+  if (stdinfd >= 0)
+    close (stdinfd);
+  if (stdoutfd >= 0)
+    close (stdoutfd);
+  if (nulloutfd >= 0)
+    close (nulloutfd);
+
+  /* Restore standard file handles of parent process.  */
+  if (null_stderr)
+    dup2 (orig_stderr, STDERR_FILENO), close (orig_stderr);
+  if (pipe_stdout || prog_stdout != NULL)
+    dup2 (orig_stdout, STDOUT_FILENO), close (orig_stdout);
+  if (pipe_stdin || prog_stdin != NULL)
+    dup2 (orig_stdin, STDIN_FILENO), close (orig_stdin);
+
+  if (pipe_stdin)
+    close (ofd[0]);
+  if (pipe_stdout)
+    close (ifd[1]);
+  if (child == -1)
+    {
+      if (exit_on_error || !null_stderr)
+	error (exit_on_error ? EXIT_FAILURE : 0, errno,
+	       _("%s subprocess failed"), progname);
+      errno = saved_errno;
+      return -1;
+    }
+
+  if (pipe_stdout)
+    fd[0] = open (tmp_file_name[PIPE_STDOUT], O_RDONLY, S_IRUSR);
+  if (pipe_stdin)
+    fd[1] = open (tmp_file_name[PIPE_STDIN], O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR);
+  return child;
+
 #else
 
   /* Unix API.  */
   int ifd[2];
   int ofd[2];
diff -aprNU5 gettext-0.19.1.orig/gettext-tools/gnulib-lib/spawni.c gettext-0.19.1/gettext-tools/gnulib-lib/spawni.c
--- gettext-0.19.1.orig/gettext-tools/gnulib-lib/spawni.c	2014-06-10 05:41:38 +0200
+++ gettext-0.19.1/gettext-tools/gnulib-lib/spawni.c	2014-06-11 21:04:54 +0200
@@ -38,10 +38,17 @@
 #include <signal.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
+#ifdef __DJGPP__
+/*  Provide DJGPP specific prototypes of setresgid and setresuid.
+    These are placebos and do nothing but are required for porting.  */
+int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
+int setresuid(uid_t ruid, uid_t euid, uid_t suid);
+#endif
+
 #if _LIBC
 # include <not-cancel.h>
 #else
 # define close_not_cancel close
 # define open_not_cancel open
@@ -100,10 +107,23 @@ __spawni (pid_t *pid, const char *file,
 {
   /* Not yet implemented.  */
   return ENOSYS;
 }
 
+#elif defined __DJGPP__
+
+/* MSDOS/DJGPP API.  */
+int
+__spawni (pid_t *pid, const char *file,
+	  const posix_spawn_file_actions_t *file_actions,
+	  const posix_spawnattr_t *attrp, char *const argv[],
+	  char *const envp[], int use_path)
+{
+  /* Not yet implemented.  */
+  return ENOSYS;
+}
+
 #else
 
 
 /* The file is accessible but it is not an executable file.  Invoke
    the shell to interpret it as a script.  */
diff -aprNU5 gettext-0.19.1.orig/gettext-tools/gnulib-lib/tempname.c gettext-0.19.1/gettext-tools/gnulib-lib/tempname.c
--- gettext-0.19.1.orig/gettext-tools/gnulib-lib/tempname.c	2014-06-10 05:41:38 +0200
+++ gettext-0.19.1/gettext-tools/gnulib-lib/tempname.c	2014-06-11 21:04:54 +0200
@@ -28,10 +28,16 @@
 #include <errno.h>
 #ifndef __set_errno
 # define __set_errno(Val) errno = (Val)
 #endif
 
+#ifdef MSDOS
+# define HAVE_DIFFERENT_TMPDIR  1
+#else
+# define HAVE_DIFFERENT_TMPDIR  0
+#endif
+
 #include <stdio.h>
 #ifndef P_tmpdir
 # define P_tmpdir "/tmp"
 #endif
 #ifndef TMP_MAX
@@ -136,30 +142,41 @@ __path_search (char *tmpl, size_t tmpl_l
   if (try_tmpdir)
     {
       d = __secure_getenv ("TMPDIR");
       if (d != NULL && direxists (d))
         dir = d;
+#if HAVE_DIFFERENT_TMPDIR
+      else if ((d = __secure_getenv ("TMP")) && direxists (d))
+	dir = d;
+      else if ((d = __secure_getenv ("TEMP")) && direxists (d))
+	dir = d;
+#endif
       else if (dir != NULL && direxists (dir))
         /* nothing */ ;
       else
         dir = NULL;
     }
   if (dir == NULL)
     {
       if (direxists (P_tmpdir))
         dir = P_tmpdir;
+#if !HAVE_DIFFERENT_TMPDIR
       else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
         dir = "/tmp";
+#else
+      else if (strcmp (P_tmpdir, ".") != 0 && direxists ("."))
+	dir = "./";
+#endif
       else
         {
           __set_errno (ENOENT);
           return -1;
         }
     }
 
   dlen = strlen (dir);
-  while (dlen > 1 && dir[dlen - 1] == '/')
+  while (dlen > 1 && ISSLASH (dir[dlen - 1]))
     dlen--;                     /* remove trailing slashes */
 
   /* check we have room for "${dir}/${pfx}XXXXXX\0" */
   if (tmpl_len < dlen + 1 + plen + 6 + 1)
     {
diff -aprNU5 gettext-0.19.1.orig/gettext-tools/gnulib-lib/wait-process.c gettext-0.19.1/gettext-tools/gnulib-lib/wait-process.c
--- gettext-0.19.1.orig/gettext-tools/gnulib-lib/wait-process.c	2014-06-10 05:41:38 +0200
+++ gettext-0.19.1/gettext-tools/gnulib-lib/wait-process.c	2014-06-11 21:04:54 +0200
@@ -46,10 +46,14 @@
 
 /* The return value of spawnvp() is really a process handle as returned
    by CreateProcess().  Therefore we can kill it using TerminateProcess.  */
 #define kill(pid,sig) TerminateProcess ((HANDLE) (pid), sig)
 
+#elif defined __DJGPP__
+
+# include "djgpp-spawn.h"
+
 #endif
 
 
 /* Type of an entry in the slaves array.
    The 'used' bit determines whether this entry is currently in use.
@@ -291,10 +295,25 @@ wait_subprocess (pid_t child, const char
   int status;
 
   if (termsigp != NULL)
     *termsigp = 0;
   status = 0;
+# ifdef __DJGPP__
+  /* Child process already finished.  */
+
+  remove_tmp_file(NULL);
+  if (child == -1)
+    {
+      if (exit_on_error || !null_stderr)
+        error (exit_on_error ? EXIT_FAILURE : 0, errno,
+               _("%s subprocess failed"), progname);
+      return 127;
+    }
+
+  return WEXITSTATUS (child);
+
+# else
   for (;;)
     {
       int result = waitpid (child, &status, 0);
 
       if (result != child)
@@ -355,7 +374,8 @@ wait_subprocess (pid_t child, const char
         error (exit_on_error ? EXIT_FAILURE : 0, 0,
                _("%s subprocess failed"), progname);
       return 127;
     }
   return WEXITSTATUS (status);
+# endif
 #endif
 }
diff -aprNU5 gettext-0.19.1.orig/gettext-tools/misc/autopoint.in gettext-0.19.1/gettext-tools/misc/autopoint.in
--- gettext-0.19.1.orig/gettext-tools/misc/autopoint.in	2014-06-10 03:13:58 +0200
+++ gettext-0.19.1/gettext-tools/misc/autopoint.in	2014-06-11 21:04:54 +0200
@@ -37,11 +37,11 @@ datarootdir="@datarootdir@"
 func_tmpdir ()
 {
   # Use the environment variable TMPDIR, falling back to /tmp. This allows
   # users to specify a different temporary directory, for example, if their
   # /tmp is filled up or too small.
-  : ${TMPDIR=/tmp}
+  : ${TMPDIR=${TMP=${TEMP=.}}}
   {
     # Use the mktemp program if available. If not available, hide the error
     # message.
     tmp=`(umask 077 && mktemp -d "$TMPDIR/gtXXXXXX") 2>/dev/null` &&
     test -n "$tmp" && test -d "$tmp"
diff -aprNU5 gettext-0.19.1.orig/gettext-tools/misc/gettextize.in gettext-0.19.1/gettext-tools/misc/gettextize.in
--- gettext-0.19.1.orig/gettext-tools/misc/gettextize.in	2014-04-23 02:57:42 +0200
+++ gettext-0.19.1/gettext-tools/misc/gettextize.in	2014-06-11 21:04:54 +0200
@@ -37,11 +37,11 @@ datarootdir="@datarootdir@"
 func_tmpdir ()
 {
   # Use the environment variable TMPDIR, falling back to /tmp. This allows
   # users to specify a different temporary directory, for example, if their
   # /tmp is filled up or too small.
-  : ${TMPDIR=/tmp}
+  : ${TMPDIR=${TMP=${TEMP=.}}}
   {
     # Use the mktemp program if available. If not available, hide the error
     # message.
     tmp=`(umask 077 && mktemp -d "$TMPDIR/gtXXXXXX") 2>/dev/null` &&
     test -n "$tmp" && test -d "$tmp"
diff -aprNU5 gettext-0.19.1.orig/gnulib-local/lib/libxml/nanohttp.c gettext-0.19.1/gnulib-local/lib/libxml/nanohttp.c
--- gettext-0.19.1.orig/gnulib-local/lib/libxml/nanohttp.c	2013-01-09 04:01:26 +0100
+++ gettext-0.19.1/gnulib-local/lib/libxml/nanohttp.c	2014-06-11 21:04:54 +0200
@@ -97,12 +97,14 @@
  */
 #ifndef _WINSOCKAPI_
 #ifndef __BEOS__
 #define closesocket(s) close(s)
 #endif
+#ifndef SOCKET
 #define SOCKET int
 #endif
+#endif
 
 #ifdef __BEOS__
 #ifndef PF_INET
 #define PF_INET AF_INET
 #endif
diff -aprNU5 gettext-0.19.1.orig/gnulib-local/lib/libxml/xmlIO.c gettext-0.19.1/gnulib-local/lib/libxml/xmlIO.c
--- gettext-0.19.1.orig/gnulib-local/lib/libxml/xmlIO.c	2013-01-09 04:01:26 +0100
+++ gettext-0.19.1/gnulib-local/lib/libxml/xmlIO.c	2014-06-11 21:04:54 +0200
@@ -197,10 +197,17 @@ static const char *IOerr[] = {
     "adddress in use",		/* EADDRINUSE */
     "already in use",		/* EALREADY */
     "unknown address familly",	/* EAFNOSUPPORT */
 };
 
+#if defined (__DJGPP__)
+/*  I/O function that expect UTF-8 strings as arguments are not supported by DJGPP.  */
+# define _wfopen(filename, mode)  (NULL)
+# define _wopen(filename, omode)  (-1)
+# define _wstat(path, buffer)     (-1)
+#endif
+
 #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__)
 /**
  * __xmlIOWin32UTF8ToWChar:
  * @u8String:  uft-8 string
  *
@@ -209,10 +216,11 @@ static const char *IOerr[] = {
 static wchar_t *
 __xmlIOWin32UTF8ToWChar(const char *u8String)
 {
     wchar_t *wString = NULL;
 
+#if !defined (__DJGPP__)
     if (u8String) {
         int wLen =
             MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, u8String,
                                 -1, NULL, 0);
         if (wLen) {
@@ -224,10 +232,11 @@ __xmlIOWin32UTF8ToWChar(const char *u8St
                     wString = NULL;
                 }
             }
         }
     }
+#endif
 
     return wString;
 }
 #endif
 
@@ -680,21 +689,24 @@ static xmlWrapOpenFunc xmlWrapOpen = xml
  */
 static void
 xmlInitPlatformSpecificIo(void)
 {
     static int xmlPlatformIoInitialized = 0;
+#if !defined (__DJGPP__)
     OSVERSIONINFO osvi;
 
     if(xmlPlatformIoInitialized)
       return;
 
     osvi.dwOSVersionInfoSize = sizeof(osvi);
 
     if(GetVersionEx(&osvi) && (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)) {
       xmlWrapStat = xmlWrapStatUtf8;
       xmlWrapOpen = xmlWrapOpenUtf8;
-    } else {
+    } else
+#endif
+    {
       xmlWrapStat = xmlWrapStatNative;
       xmlWrapOpen = xmlWrapOpenNative;
     }
 
     xmlPlatformIoInitialized = 1;
