--- /dev/null
+#!/bin/sh
+#
+# Copyright © 2023 Nick Bowler
+#
+# Fake msgfmt program for testing.
+#
+# 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.
+
+outfile=messages.mo
+for arg
+do
+ arg=${lastarg:+"$lastarg="}$arg
+ lastarg=
+
+ save_IFS=$IFS; IFS='='
+ set x $arg; shift; shift; optarg=$*
+ IFS=$save_IFS
+
+ case $arg in
+ -o|--output-file) lastarg=--output-file ;;
+ --output-file=*) outfile=$optarg ;;
+ esac
+done
+
+exec 1>"$outfile"
-dnl Copyright © 2021-2022 Nick Bowler
+dnl Copyright © 2021-2023 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.
AT_CHECK([test ! -d lib/.deps && test ! -d lib/_deps && cat lib/glconfig.h])
AT_CLEANUP
+
+AT_SETUP([gettext.mk .mo installation])
+
+cp "$srcdir/snippet/gettext.mk" "$srcdir/t/msgfmt.sh" .
+touch a.po b.po
+TEST_CONFIGURE_AC(
+[[AM_INIT_AUTOMAKE([foreign])
+AC_CONFIG_FILES([Makefile])
+]])
+
+AT_DATA([Makefile.am],
+[[MSGFMT = $(SHELL) $(top_srcdir)/msgfmt.sh
+EXTRA_DIST =
+MAINTAINERCLEANFILES =
+POFILES = a.po b.po
+MOFILES = a.mo b.mo
+include $(top_srcdir)/gettext.mk
+]])
+TEST_AUTORECONF
+
+mkdir build
+(cd build && TEST_CONFIGURE([--prefix="$at_group_dir/inst"], [../configure]))
+
+AT_CHECK([cd build &&
+ make DESTDIR="$at_group_dir" localedir=/l0 install],
+ [0], [ignore], [ignore])
+AT_CHECK([test -d inst || { find l0 | LC_ALL=C sort; }], [0],
+[[l0
+l0/a
+l0/a/LC_MESSAGES
+l0/a/LC_MESSAGES/test.mo
+l0/b
+l0/b/LC_MESSAGES
+l0/b/LC_MESSAGES/test.mo
+]])
+
+AT_CHECK([cd build &&
+ make DESTDIR="$at_group_dir" localedir=/l1 installdirs],
+ [0], [ignore], [ignore])
+AT_CHECK([test -d inst || { find l1 | LC_ALL=C sort; }], [0],
+[[l1
+l1/a
+l1/a/LC_MESSAGES
+l1/b
+l1/b/LC_MESSAGES
+]])
+
+AT_CHECK([cd build &&
+ make DESTDIR="$at_group_dir" localedir=/l2 MOFILES= install installdirs],
+ [0], [ignore], [ignore])
+AT_CHECK([test ! -d inst && test ! -d l2])
+
+AT_CHECK([cd build &&
+ make DESTDIR="$at_group_dir" localedir=/l0 MOFILES= uninstall],
+ [0], [ignore], [ignore])
+AT_CHECK([test -d inst || { find l0 | LC_ALL=C sort; }], [0],
+[[l0
+l0/a
+l0/a/LC_MESSAGES
+l0/b
+l0/b/LC_MESSAGES
+]])
+
+AT_CLEANUP