]> git.draconx.ca Git - dxcommon.git/blobdiff - m4/linguas.m4
Import getline helper from cdecl99.
[dxcommon.git] / m4 / linguas.m4
index c6ad9736ab5bbfbbcb62d1a5310d8170c47410ac..f1cc4b18585db578d972c517a3a6c81afa203578 100644 (file)
@@ -1,4 +1,4 @@
-dnl Copyright © 2011, 2021 Nick Bowler
+dnl Copyright © 2011, 2021-2023 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,
@@ -12,16 +12,18 @@ dnl There is NO WARRANTY, to the extent permitted by law.
 
 AC_DEFUN([DX_LINGUAS],
 [AC_REQUIRE([AM_GNU_GETTEXT])dnl
+AC_REQUIRE([DX_PROG_JOIN])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
 
 POFILES=
 MOFILES=
 
 if test -f "$srcdir/po/LINGUAS"; then
-  awk '{ sub(/#.*$/, "")
+  $AWK '{ sub(/#.*$/, "")
     for (i = 1; i <= NF; i++) {
       print $(i)
     }
-  }' "$srcdir/po/LINGUAS" | sort -u >conftest.all
+  }' "$srcdir/po/LINGUAS" | LC_ALL=C sort -u >conftest.all
 
   : "${LINGUAS=all}"
   if test x"$LINGUAS" = x"all"; then
@@ -32,10 +34,15 @@ if test -f "$srcdir/po/LINGUAS"; then
         # Ensure that if "la_CC"-style code is requested then so is plain "la".
         printf '%s\n' "$arg"
         case $arg in
-        *_*) printf '%s\n' "${arg%%_*}" ;;
+        *_*)
+          save_IFS=$IFS; IFS=_
+          set x $arg
+          IFS=$save_IFS
+          AS_ECHO(["${2}"])
+          ;;
         esac
       done
-    } | sort -u >conftest.ena
+    } | LC_ALL=C sort -u >conftest.ena
   fi
 
   exec 3<conftest.all
@@ -44,7 +51,7 @@ if test -f "$srcdir/po/LINGUAS"; then
   done
 
   if test x"$USE_NLS" = x"yes"; then
-    join conftest.ena conftest.all >conftest.out
+    LC_ALL=C $JOIN conftest.ena conftest.all >conftest.out
     exec 3<conftest.out
     while read x <&3; do
       AS_VAR_APPEND([MOFILES], ["${MOFILES:+ }po/$x.mo"])