From 6adb3fee48899481b2915e1125d87fe9cffe323d Mon Sep 17 00:00:00 2001
From: John Zaitseff <J.Zaitseff@zap.org.au>
Date: Sat, 16 Apr 2016 06:32:57 +1000
Subject: [PATCH] Upgrade GNU Gettext to version 0.19.5

The Gnulib macros have finally caught up to this version.
---
 INSTALL           |  2 +-
 NEWS              |  3 ---
 configure.ac      |  2 +-
 po/Makefile.in.in | 59 +++++++++++++++++++++++++++++++----------------
 4 files changed, 41 insertions(+), 25 deletions(-)

diff --git a/INSTALL b/INSTALL
index cbdbdcf..398bc5c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -39,7 +39,7 @@ and installation:
     multibyte character sequences (such as UTF-8) require a wide-character
     version of Curses, such as NcursesW, to work correctly.
 
-4.  The GNU Gettext library, version 0.18.3 or later, to allow the game to
+4.  The GNU Gettext library, version 0.19.5 or later, to allow the game to
     use languages other than English;  this is also called Native Language
     Support.  If you do not have  this library (and do not wish to install
     it), you may pass "--disable-nls" to the configure script.
diff --git a/NEWS b/NEWS
index d82bca7..9ad6ae7 100644
--- a/NEWS
+++ b/NEWS
@@ -21,9 +21,6 @@ Version 7.10 (not yet released)
 Added a data directory that will contain a desktop file and appropriate
 icons.
 
-Downgraded GNU Gettext to version 0.18.3, as the current Gnulib macros are
-from that version.
-
 Added the Serbian translation, with thanks to Мирослав Николић.
 
 
diff --git a/configure.ac b/configure.ac
index 7a82dc4..f16bfa1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,7 +51,7 @@ AC_TYPE_SIZE_T
 AC_TYPE_SSIZE_T
 
 AM_GNU_GETTEXT([external])
-AM_GNU_GETTEXT_VERSION([0.18.3])
+AM_GNU_GETTEXT_VERSION([0.19.5])
 
 gl_INIT
 
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
index fabdc76..c36f1ad 100644
--- a/po/Makefile.in.in
+++ b/po/Makefile.in.in
@@ -1,15 +1,13 @@
 # Makefile for PO directory in any package using GNU gettext.
 # Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
 #
-# This file can be copied and used freely without restrictions.  It can
-# be used in projects which are not available under the GNU General Public
-# License but which still want to provide support for the GNU gettext
-# functionality.
-# Please note that the actual code of GNU gettext is covered by the GNU
-# General Public License and is *not* in the public domain.
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without any warranty.
 #
-# Origin: gettext-0.18.3
-GETTEXT_MACRO_VERSION = 0.18
+# Origin: gettext-0.19.5
+GETTEXT_MACRO_VERSION = 0.19
 
 PACKAGE = @PACKAGE@
 VERSION = @VERSION@
@@ -77,6 +75,16 @@ POTFILES = \
 
 CATALOGS = @CATALOGS@
 
+POFILESDEPS_ = $(srcdir)/$(DOMAIN).pot
+POFILESDEPS_yes = $(POFILESDEPS_)
+POFILESDEPS_no =
+POFILESDEPS = $(POFILESDEPS_$(PO_DEPENDS_ON_POT))
+
+DISTFILESDEPS_ = update-po
+DISTFILESDEPS_yes = $(DISTFILESDEPS_)
+DISTFILESDEPS_no =
+DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO))
+
 # Makevars gets inserted here. (Don't remove this line!)
 
 .SUFFIXES:
@@ -143,15 +151,25 @@ stamp-po: $(srcdir)/$(DOMAIN).pot
 # heuristic whether some file in the top level directory mentions "GNU xyz".
 # If GNU 'find' is available, we avoid grepping through monster files.
 $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
-	if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
-	       LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f -size -10000000c -exec grep 'GNU @PACKAGE@' /dev/null '{}' ';' 2>/dev/null; \
-	     else \
-	       LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
-	     fi; \
-	   } | grep -v 'libtool:' >/dev/null; then \
-	  package_gnu='GNU '; \
+	package_gnu="$(PACKAGE_GNU)"; \
+	test -n "$$package_gnu" || { \
+	  if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
+		 LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f \
+			       -size -10000000c -exec grep 'GNU @PACKAGE@' \
+			       /dev/null '{}' ';' 2>/dev/null; \
+	       else \
+		 LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
+	       fi; \
+	     } | grep -v 'libtool:' >/dev/null; then \
+	     package_gnu=yes; \
+	   else \
+	     package_gnu=no; \
+	   fi; \
+	}; \
+	if test "$$package_gnu" = "yes"; then \
+	  package_prefix='GNU '; \
 	else \
-	  package_gnu=''; \
+	  package_prefix=''; \
 	fi; \
 	if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
 	  msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
@@ -171,7 +189,7 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
 	      --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
 	      --files-from=$(srcdir)/POTFILES.in \
 	      --copyright-holder='$(COPYRIGHT_HOLDER)' \
-	      --package-name="$${package_gnu}@PACKAGE@" \
+	      --package-name="$${package_prefix}@PACKAGE@" \
 	      --package-version='@VERSION@' \
 	      --msgid-bugs-address="$$msgid_bugs_address" \
 	    ;; \
@@ -199,13 +217,14 @@ $(srcdir)/$(DOMAIN).pot:
 
 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
 # Note that a PO file is not touched if it doesn't need to be changed.
-$(POFILES): $(srcdir)/$(DOMAIN).pot
+$(POFILES): $(POFILESDEPS)
 	@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
 	if test -f "$(srcdir)/$${lang}.po"; then \
+	  test -f $(srcdir)/$(DOMAIN).pot || $(MAKE) $(srcdir)/$(DOMAIN).pot; \
 	  test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
 	  echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
 	  cd $(srcdir) \
-	    && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
+	    && { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
 	           '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
 	             $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
 	           *) \
@@ -362,7 +381,7 @@ maintainer-clean: distclean
 
 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
 dist distdir:
-	$(MAKE) update-po
+	test -z "$(DISTFILESDEPS)" || $(MAKE) $(DISTFILESDEPS)
 	@$(MAKE) dist2
 # This is a separate target because 'update-po' must be executed before.
 dist2: stamp-po $(DISTFILES)