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.
} | sort -u >conftest.ena
fi
} | 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 3<conftest.all
+ while read x <&3; do
+ AS_VAR_APPEND([POFILES], ["${POFILES:+ }po/$x.po"])
+ done
if test x"$USE_NLS" = x"yes"; then
if test x"$USE_NLS" = x"yes"; then
- set x $LINGUAS; shift
- case ${#} in
- 0) ;;
- *) MOFILES=`printf "po/%s.mo\n" "${@}"` ;;
- esac
+ join conftest.ena conftest.all >conftest.out
+ exec 3<conftest.out
+ while read x <&3; do
+ AS_VAR_APPEND([MOFILES], ["${MOFILES:+ }po/$x.mo"])
+ done
- rm -f conftest.all conftest.ena
+ exec 3<&-
+ rm -f conftest.all conftest.ena conftest.out
+
+AT_SETUP([DX_LINGUAS default install all])
+AT_KEYWORDS([DX_LINGUAS macro])
+
+AS_UNSET([LINGUAS])
+AT_SKIP_IF([test ${LINGUAS+y}])
+
+echo : >config.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