diff --git a/lib/am/texi-vers.am b/lib/am/texi-vers.am
index b3a8d12..09fdef0 100644
--- a/lib/am/texi-vers.am
+++ b/lib/am/texi-vers.am
@@ -32,6 +32,13 @@ DIST_COMMON += %VTEXI% %STAMPVTI%
 ## should never be dependent upon a non-distributed built file.
 ## Therefore we ensure that %DIRSTAMP% exists in the rule.
 ?DIRSTAMP?	@test -f %DIRSTAMP% || $(MAKE) $(AM_MAKEFLAGS) %DIRSTAMP%
+## During parallel builds the recipe could be called twice.
+## Then one process might already have deleted the tmp file while
+## the other tries to copy the tmp file. The following line works as a
+## semaphore such that only one process at a time can use the tmp file.
+## When the following waiting process executes nothing will happen,
+## because then the texi file is already up to date.
+	trap 'rm -rf %VTI%.lck' 1 2 13 15; while ! mkdir %VTI%.lck 2>/dev/null; do sleep 1; done;
 	@(dir=.; test -f ./%TEXI% || dir=$(srcdir); \
 	set `$(SHELL) %MDDIR%mdate-sh $$dir/%TEXI%`; \
 	echo "@set UPDATED $$1 $$2 $$3"; \
@@ -45,11 +52,13 @@ DIST_COMMON += %VTEXI% %STAMPVTI%
 	  || (echo "Updating %VTEXI%"; \
 	      cp %VTI%.tmp %VTEXI%)
 	-@rm -f %VTI%.tmp
+	-@rm -rf %VTI%.lck
 	@cp %VTEXI% $@
 
 mostlyclean-am: mostlyclean-%VTI%
 mostlyclean-%VTI%:
 	-rm -f %VTI%.tmp
+	-rm -f %VTI%.lck
 
 maintainer-clean-am: maintainer-clean-%VTI%
 maintainer-clean-%VTI%:
