From cf1eb94eb581d73c3079a71955f5d2d9a307a5ca Mon Sep 17 00:00:00 2001
From: Peter Williams <peter@newton.cx>
Date: Mon, 3 Sep 2018 17:39:00 -0400
Subject: [PATCH 6/8] Work around Unixisms in libgettextpo

There's a complicated bit of shell magic here that relies on redirecting
program output to file descriptor #5. That seems not to work on Windows. Just
use a temporary file instead.
---
 gettext-tools/libgettextpo/Makefile.am | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gettext-tools/libgettextpo/Makefile.am b/gettext-tools/libgettextpo/Makefile.am
index 98d65cc..9cfb6ce 100644
--- a/gettext-tools/libgettextpo/Makefile.am
+++ b/gettext-tools/libgettextpo/Makefile.am
@@ -174,7 +174,7 @@ config.h: $(BUILT_SOURCES)
 	  echo '#endif /* GTPO_CONFIG_H */'; \
 	} > config.h && \
 	if test -n "$(HAVE_GLOBAL_SYMBOL_PIPE)"; then \
-	  { \
+	  { rm -f CONFIG_H_LISTING.txt; \
 	    for f in $(libgettextpo_la_AUXSOURCES) $(libgnu_la_SOURCES) $(libgnu_la_LIBADD); do \
 	      case $$f in \
 	        *.c | *.$(OBJEXT) | *.lo ) \
@@ -182,12 +182,12 @@ config.h: $(BUILT_SOURCES)
 	          test -f $$sf || sf=$(srcdir)/$$sf; \
 	          of=`echo "$$f" | sed -e 's,^.*/,,' -e 's,\\.[^.]*$$,,'`.$(OBJEXT); \
 	          $(COMPILE) $(DEFS) $(GL_CFLAG_INHIBIT_WARNINGS) -c $$sf || { rm -f config.h; exit 1; }; \
-	          sh ./exported.sh $$of 1>&5; \
+	          sh ./exported.sh $$of >>CONFIG_H_LISTING.txt; \
 	          rm -f $$of `echo "$$of" | sed -e 's,\\.$(OBJEXT)$$,.lo,'`; \
 	          ;; \
 	      esac; \
 	    done; \
-	  } 5>&1 1>&2 \
+	  }; cat CONFIG_H_LISTING.txt \
 	    | sed -e 's,.* ,,' | grep -v '@' | LC_ALL=C sort | LC_ALL=C uniq \
 	    | sed -e 's,^obstack_free$$,__obstack_free,' \
 	    | sed -e 's,^\(.*\)$$,#define \1 libgettextpo_\1,' > config.h-t && \
