From e287361d35cef81ceee2b6cf538455d93e8e3beb Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Sat, 28 Jul 2012 16:32:18 -0400 Subject: [PATCH] Move some gettext bits to dxcommon. 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 | 48 +++++++--------------------------------------- common | 2 +- configure.ac | 3 +-- m4/linguas.m4 | 53 --------------------------------------------------- 4 files changed, 9 insertions(+), 97 deletions(-) delete mode 100644 m4/linguas.m4 diff --git a/Makefile.am b/Makefile.am index f2efb18..1371614 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 83acbb9..ac12926 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 83acbb95d2f181cd67f08f1bae4572de9768b63b +Subproject commit ac1292661f52ce20168bb942ad207f5b935669ef diff --git a/configure.ac b/configure.ac index 538452f..6a35936 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index 2ae8a9d..0000000 --- a/m4/linguas.m4 +++ /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]) -]) -- 2.43.0