From 9ddf4c535f0c9b5b1968c9d8e21b778c66a4bf49 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Sun, 14 Feb 2021 23:57:05 -0500 Subject: [PATCH] Fix multiple language substitution in DX_LINGUAS. For some reason this macro inserts newlines between successive values in the calculated POFILES/MOFILES settings. This causes syntax errors when these get substituted into makefiles and is very, very broken. So this macro has basically never worked except for trivial cases. This happens when you don't bother to test things. So let's fix that up and add a test case to expose this issue. --- m4/linguas.m4 | 26 +++++++++++--------------- tests/macros.at | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/m4/linguas.m4 b/m4/linguas.m4 index 61613b6..c6ad973 100644 --- a/m4/linguas.m4 +++ b/m4/linguas.m4 @@ -38,25 +38,21 @@ if test -f "$srcdir/po/LINGUAS"; then } | sort -u >conftest.ena fi - ALL_LINGUAS=`cat conftest.all` - LINGUAS=`join conftest.ena conftest.all` - - # 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 + exec 3conftest.out + exec 3config.rpath +chmod +x config.rpath + +mkdir po +AT_DATA([po/LINGUAS], [[en ja # a comment ko +zh +]]) + +AT_DATA([test.in], [[POFILES = @POFILES@ +MOFILES = @MOFILES@ +]]) + +TEST_CONFIGURE_AC( +[[m4@&t@_traceoff([AM_GNU_GETTEXT]) +AM_GNU_GETTEXT([external]) +DX_LINGUAS +AC_CONFIG_FILES([test]) +]]) + +TEST_AUTORECONF +TEST_CONFIGURE + +AT_CHECK([cat test], [0], +[[POFILES = po/en.po po/ja.po po/zh.po +MOFILES = po/en.mo po/ja.mo po/zh.mo +]]) + +AT_CLEANUP -- 2.43.0