From df25871684f08fda7b784c8af1f9dd2f32ec91ae Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@cs.stanford.edu>
Date: Tue, 24 Dec 2013 08:18:53 -0800
Subject: [PATCH] Makefile: Use C locale for checking files to distribute.

Otherwise a bad report can result if the two targets are run in different
locales (in different runs of "make").

Reported by John Darrington.
---
 Makefile.am | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 803ad08e2a..51c2f226b9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -116,9 +116,9 @@ ALL_LOCAL += dist-hook-git
 dist-hook-git: distfiles
 	@if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
 	  (cd $(srcdir) && git ls-files)				    \
-	    | grep -vE '\.gitignore|README.Git|Smake' 			    \
-	    | sort -u > gitfiles;					    \
-	  comm -1 -3 distfiles gitfiles > missing-distfiles;		    \
+	    | grep -vE '\.gitignore|README.Git|Smake'			    \
+	    | LC_ALL=C sort -u > gitfiles;				    \
+	  LC_ALL=C comm -1 -3 distfiles gitfiles > missing-distfiles;	    \
 	  if test -s missing-distfiles; then				    \
 	    echo "The distribution is missing the following files:";	    \
 	    cat missing-distfiles;					    \
@@ -132,6 +132,7 @@ distfiles: Makefile
 	list='$(DISTFILES)'; \
 	for file in $$list; do echo $$file; done | \
 	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | sort -u > $@
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" \
+	  | LC_ALL=C sort -u > $@
 CLEANFILES += distfiles gitfiles missing-distfiles
 .PHONY: dist-hook-git
-- 
2.30.2