This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: NLS, attribute errors via cpp during bootstrap

Here's my suggested patch for the NLS bug.  Sorry for the delay, I had
to make sure the snapshot script would cooperate, and the NLS autoconf
macros are not easy to hack up.

A side effect of this change is it's not necessary to tweak to get new catalogs installed, anymore.  Just drop them
into gcc/po, and you're done.

I've tested that "make build-po" no longer fails on a system without
the gettext tools installed, and "make install-po" does the right
thing in all three possible cases: no catalogs at all, catalogs in the
build directory, catalogs in the source directory.  I'm running a
complete bootstrap+check+install cycle with gettext present on the

OK to install?  I'd like to squeeze this in before the snapshot script


	* aclocal.m4: (AM_WITH_NLS): Don't look at ALL_LINGUAS.
	(AM_GNU_GETTEXT): Set CATALOGS to a list of .gmo files
	corresponding to the complete set of .po and .gmo files in
	the source directory's po subdir, modified by LINGUAS.  Don't
	look at ALL_LINGUAS.
	* Don't set ALL_LINGUAS.
	* configure: Regenerate.

	* ( Don't move into source directory.
	(.po.pox): Clarify comments.
	(install-po): Look for .gmo files in both srcdir and objdir;
	don't fail if a file is totally missing.
	(distclean): rmdir ada subdirectory too.

Index: aclocal.m4
--- aclocal.m4	2001/10/31 17:39:49	1.55
+++ aclocal.m4	2001/11/05 21:51:56
@@ -1593,24 +1593,16 @@ changequote([,])dnl
-    dnl These rules are solely for the distribution goal.  While doing this
-    dnl we only have to keep exactly one list of the available catalogs
-    dnl in
-    for lang in $ALL_LINGUAS; do
-      POFILES="$POFILES $lang.po"
-    done
+    dnl GCC LOCAL: GMOFILES/POFILES removed as unnecessary.
     dnl Make all variables we use known to autoconf.
 dnl GCC LOCAL: Make USE_INCLUDED_LIBINTL visible to C code.
     if test $USE_INCLUDED_LIBINTL = yes; then
@@ -1664,37 +1656,42 @@ strdup strtoul tsearch __argz_count __ar
-   if test "x$CATOBJEXT" != "x"; then
-     if test "x$ALL_LINGUAS" = "x"; then
-       LINGUAS=
-     else
-       AC_MSG_CHECKING(for catalogs to be installed)
-       NEW_LINGUAS=
-       for presentlang in $ALL_LINGUAS; do
-         useit=no
-         for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
-           # Use the presentlang catalog if desiredlang is
-           #   a. equal to presentlang, or
-           #   b. a variant of presentlang (because in this case,
-           #      presentlang can be used as a fallback for messages
-           #      which are not translated in the desiredlang catalog).
-           case "$desiredlang" in
-             "$presentlang"*) useit=yes;;
-           esac
-         done
-         if test $useit = yes; then
-           NEW_LINGUAS="$NEW_LINGUAS $presentlang"
-         fi
-       done
-     fi
-     dnl Construct list of names of catalog files to be constructed.
-     dnl GCC LOCAL: Tweak for non-recursive po directory build.
-     if test -n "$LINGUAS"; then
-       for lang in $LINGUAS; do CATALOGS="$CATALOGS po/$lang$CATOBJEXT"; done
-     fi
+   dnl GCC LOCAL: The LINGUAS/ALL_LINGUAS/CATALOGS mess that was here
+   dnl has been torn out and replaced with this more sensible scheme.
+   if test "x$CATOBJEXT" != x; then
+     AC_MSG_CHECKING(for catalogs to be installed)
+     # Look for .po and .gmo files in the source directory.
+     for cat in $srcdir/po/*$CATOBJEXT $srcdir/po/*.po; do
+	# If there aren't any .gmo files the shell will give us the
+	# literal string "../path/to/srcdir/po/*.gmo" which has to be
+	# weeded out.
+	case "$cat" in *\**)
+	    continue;;
+	esac
+	# The quadruple backslash is collapsed to a double backslash
+	# by the backticks, then collapsed again by the double quotes,
+	# leaving us with one backslash in the sed expression (right
+	# before the dot that mustn't act as a wildcard).  The dot to
+	# be escaped in the second expression is hiding inside CATOBJEXT.
+	cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!$CATOBJEXT!"`
+	lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\$CATOBJEXT!!"`
+	# The user is allowed to set LINGUAS to a list of languages to
+	# install catalogs for.  If it's empty that means "all of them."
+	if test "x$LINGUAS" = x; then
+	    XLINGUAS="$XLINGUAS $lang"
+	else
+	  case "$LINGUAS" in *$lang*)
+	    XLINGUAS="$XLINGUAS $lang"
+	    ;;
+	  esac
+	fi
+     done
    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
---	2001/10/31 17:39:50	1.551
+++	2001/11/05 21:51:57
 # Enable NLS support by default
   [  --enable-nls            use Native Language Support (default)],
---	2001/11/05 15:37:59	1.764
+++	2001/11/05 21:51:58
@@ -2449,7 +2449,7 @@ distclean: clean $(INTL_DISTCLEAN) lang.
 	-rm -f mklibgcc gccbug .gdbinit configargs.h
 	-rm -f gcov.pod
 	-rm -f fixinc/Makefile
-	-rmdir cp f java objc fixinc intl po 2>/dev/null
+	-rmdir ada cp f java objc fixinc intl po 2>/dev/null
 # Delete anything likely to be found in the source directory
 # that shouldn't be in the distribution.
@@ -3363,29 +3363,35 @@ build-po: $(CATALOGS)
 # by people who are interested in updating .po files.
 update-po: $(
-# Update files in $(srcdir) atomically.
+# N.B. We do not attempt to copy these into $(srcdir).  The snapshot
+# script does that.
 	test -d po || mkdir po
 	$(GMSGFMT) --statistics $< -o $@
-	$(SHELL) $(srcdir)/move-if-change $@ $(srcdir)/$@
-# This rule does _not_ copy into $(srcdir).  User must do this
-# by hand.  (User is a translation maintainer and is expected to
-# go through the new .po by hand anyway.)
+# The new .po has to be gone over by hand, so we deposit it into
+# build/po with a different extension.
 	test -d po || mkdir po
 	$(MSGMERGE) $< $(srcdir)/po/$(PACKAGE).pot -o $@
+# This rule has to look for .gmo modules in both srcdir and
+# the cwd, and has to check that we actually have a catalog
+# for each language, in case they weren't built or included
+# with the distribution.
 	$(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(datadir)
 	for cat in $(CATALOGS); do \
-	  cat=`basename $$cat`; \
-	  lang=`echo $$cat | sed 's/\.gmo$$//'`; \
+	  lang=`basename $$cat | sed 's/\.gmo$$//'`; \
+	  if [ -f $$cat ]; then :; \
+	  elif [ -f $(srcdir)/$$cat ]; then cat=$(srcdir)/$$cat; \
+	  else continue; \
+	  fi; \
 	  dir=$(localedir)/$$lang/LC_MESSAGES; \
 	  echo $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$$dir; \
 	  $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$$dir || exit 1; \
-	  echo $(INSTALL_DATA) $(srcdir)/po/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
-	  $(INSTALL_DATA) $(srcdir)/po/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
+	  echo $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
+	  $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
 # Rule for regenerating the message template (gcc.pot).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]