diff --git a/po/update_linguas.sh b/po/update_linguas.sh
index a1d3612b69956e9fbc508c6624dd7fe4cf10e6df..a4ecbd38c12cf9cc0d019b3ecf9bb7f36d22f6c9 100755
--- a/po/update_linguas.sh
+++ b/po/update_linguas.sh
@@ -17,3 +17,7 @@ fi
 
 echo "Regenerating POT file and remerging and recompiling PO files..."
 make update-po
+
+# If needed, fix a problem in the Makefile template.
+grep -q '^datarootdir' Makefile.in.in || \
+	sed -i 's/^\(datadir.*\)/datarootdir = @datarootdir@\n\1/' Makefile.in.in