]> git.draconx.ca Git - cdecl99.git/commitdiff
Move some gettext bits to dxcommon.
authorNick Bowler <nbowler@draconx.ca>
Sat, 28 Jul 2012 20:32:18 +0000 (16:32 -0400)
committerNick Bowler <nbowler@draconx.ca>
Sat, 28 Jul 2012 20:46:07 +0000 (16:46 -0400)
Migrate the mostly-package-agnostic parts of the gettext support into
dxcommon, thus allowing these bits to be shared with other packages.

We remove the AC_CONFIG_MACRO_DIR from configure.ac because its
behaviour is not clearly specified, and it's not obvious how (if it's
even possible at all) one handles multiple directories containing macro
definitions.  Moreover, even if this macro is specified you still need
to define ACLOCAL_AMFLAGS anyway, and this definition must be kept
consistent with the AC_CONFIG_MACRO_DIR usage.

In the end, it looks like the only thing AC_CONFIG_MACRO_DIR does is
silence a single warning from libtoolize, without doing anything else
meaningful.  In light of the above, the warning seems preferable at
this time.

Makefile.am
common
configure.ac
m4/linguas.m4 [deleted file]

index f2efb18c2527e13f71fb903438ef4b94ad0aa251..137161418adc31cff5433fede42f169c6edd2d58 100644 (file)
@@ -1,11 +1,11 @@
-# Copyright © 2011 Nick Bowler
+# Copyright © 2011-2012 Nick Bowler
 #
 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
 # This is free software: you are free to do what the fuck you want to.
 # There is NO WARRANTY, to the extent permitted by law.
 
 AUTOMAKE_OPTIONS = parallel-tests color-tests
-ACLOCAL_AMFLAGS = -I m4
+ACLOCAL_AMFLAGS = -I m4 -I common/m4
 
 # For Gnulib
 MOSTLYCLEANFILES =
@@ -114,9 +114,11 @@ test/typegen.h: $(srcdir)/src/types.lst $(srcdir)/test/typegen.sh
        $(AM_V_at)mv -f $@.tmp $@
 
 # Supporting rules for gettext.
-ALL_MOFILES = $(POFILES:.po=.mo)
-EXTRA_DIST += po/$(PACKAGE).pot po/LINGUAS $(POFILES) $(ALL_MOFILES)
-MAINTAINERCLEANFILES += po/$(PACKAGE).pot $(ALL_MOFILES)
+include $(top_srcdir)/common/snippet/gettext.mk
+
+EXTRA_DIST += po/$(PACKAGE).pot
+MAINTAINERCLEANFILES += po/$(PACKAGE).pot
+
 XGETTEXT_OPTS = -D $(builddir) -D $(srcdir) --from-code=utf-8 \
        --add-comments=TRANSLATORS: --foreign-user \
        --package-name=$(PACKAGE) --package-version=$(PACKAGE_VERSION) \
@@ -130,42 +132,6 @@ po/$(PACKAGE).pot: $(SOURCES) src/errors.lst
                -ajo $@.tmp src/errors.lst
        $(AM_V_at)  mv -f $@.tmp $@
 
-.po.mo:
-       $(AM_V_at)$(MKDIR_P) $(@D)
-       $(AM_V_GEN)$(MSGFMT) -c -o $@ $<
-
-install-data-local: install-mo
-install-mo: $(MOFILES)
-       for mo in $?; do \
-               lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
-               test x"$$lang" = x"" && exit 1; \
-               inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
-               (set -x; $(MKDIR_P) "$$inst") \
-                       || exit $$?; \
-               (set -x; $(INSTALL_DATA) "$$mo" "$$inst/$(PACKAGE).mo") \
-                       || exit $$?; \
-       done
-
-installdirs-local: installdirs-mo
-installdirs-mo:
-       for mo in $(MOFILES); do \
-               lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
-               test x"$$lang" = x"" && exit 1; \
-               inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
-               (set -x; $(MKDIR_P) "$$inst") || exit $$?; \
-       done
-
-uninstall-local: uninstall-mo
-uninstall-mo:
-       for mo in $(ALL_MOFILES); do \
-               lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
-               test x"$$lang" = x"" && exit 1; \
-               inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
-               (set -x; cd "$$inst" && rm -f '$(PACKAGE).mo'); \
-       done
-
-.PHONY: install-mo installdirs-mo uninstall-mo
-
 # These are required to prevent the builtin lex/yacc rules from
 # superseding ours...
 src/scan.c src/scan.h: src/scan.stamp
diff --git a/common b/common
index 83acbb95d2f181cd67f08f1bae4572de9768b63b..ac1292661f52ce20168bb942ad207f5b935669ef 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 83acbb95d2f181cd67f08f1bae4572de9768b63b
+Subproject commit ac1292661f52ce20168bb942ad207f5b935669ef
index 538452ff5c464f1c3b31fa256a6c3e0af34c2c32..6a35936a2582ad6da11579ac670a6173ebcc3d4c 100644 (file)
@@ -1,4 +1,4 @@
-dnl Copyright © 2011 Nick Bowler
+dnl Copyright © 2011-2012 Nick Bowler
 dnl
 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
 dnl This is free software: you are free to do what the fuck you want to.
@@ -7,7 +7,6 @@ dnl There is NO WARRANTY, to the extent permitted by law.
 AC_PREREQ([2.68])
 AC_INIT([cdecl99], [0.1], [nbowler@draconx.ca])
 AC_CONFIG_HEADER([config.h])
-AC_CONFIG_MACRO_DIR([m4])
 
 AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
 AM_SILENT_RULES([yes])
diff --git a/m4/linguas.m4 b/m4/linguas.m4
deleted file mode 100644 (file)
index 2ae8a9d..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-dnl Copyright © 2011 Nick Bowler
-dnl
-dnl Computes the set of .po and .mo files based on the LINGUAS environment
-dnl variable.  The variable POFILES is set to the complete list of .po files,
-dnl according to the LINGUAS file in the po directory.  The variable MOFILES
-dnl is set to the list of .mo files that the user has requested be installed.
-dnl Both POFILES and MOFILES are AC_SUBSTed.
-dnl
-dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
-dnl This is free software: you are free to do what the fuck you want to.
-dnl There is NO WARRANTY, to the extent permitted by law.
-
-AC_DEFUN([DX_LINGUAS], [dnl
-AC_REQUIRE([AM_GNU_GETTEXT])
-
-POFILES=
-MOFILES=
-
-if test -f "$srcdir/po/LINGUAS"; then
-       ALL_LINGUAS=`sed 's/#.*$//' "$srcdir/po/LINGUAS"`
-
-       : ${LINGUAS=all}
-       if test x"$LINGUAS" != x"all"; then
-               # Replicate la_CC-style codes as la.
-               LINGUAS=`printf '%s\n' "$LINGUAS" \
-                       | [sed 's/\([^_[:space:]]*\)_[^[:space:]]*/& \1/g']`
-
-               printf '%s\n' $ALL_LINGUAS | sort > conftest.LINGUAS
-               LINGUAS=`printf '%s\n' $LINGUAS | sort \
-                       | join - conftest.LINGUAS`
-       else
-               LINGUAS=$ALL_LINGUAS
-       fi
-
-       # Note: $srcdir is not used here because these variables are for make.
-       set x $ALL_LINGUAS; shift
-       case ${#} in
-       0) ;;
-       *) POFILES=`printf "po/%s.po\n" "${@}"` ;;
-       esac
-
-       if test x"$USE_NLS" = x"yes"; then
-               set x $LINGUAS; shift
-               case ${#} in
-               0) ;;
-               *) MOFILES=`printf "po/%s.mo\n" "${@}"` ;;
-               esac
-       fi
-fi
-
-AC_SUBST([POFILES])
-AC_SUBST([MOFILES])
-])