diff --git a/ChangeLog b/ChangeLog
index 6b3e542f4e79586215fc7a95172194487cd160b9..14a8ca909896f2d9d938f9ea44bc4cb26f6e3b2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-10-06  Niels M�ller  <nisse@lysator.liu.se>
+
+	* Makefile.in (distdir): Use a loop to pick up the contents of
+	$(DISTFILES) from source and build directories. For some reason,
+	$? failed to find stamp-h.in in the source directory.
+
 2005-10-05  Niels M�ller  <nisse@lysator.liu.se>
 
 	* x86/aes-decrypt.asm: Use C_NAME(_nettle_aes_decrypt_table) when
diff --git a/Makefile.in b/Makefile.in
index 5cfc94d75547f4ae86d69b55743b9eee9247a304..427e48061f6a4be840f135d2f6746632acecd2d0 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -271,7 +271,11 @@ top_distdir = $(distdir)
 distdir: $(DISTFILES)
 	rm -rf "$(distdir)"
 	mkdir "$(distdir)"
-	cp $? "$(distdir)"
+	set -e; for f in $(DISTFILES) ; do \
+	  if [ -e "$$f" ] ; then cp "$$f" "$(distdir)" ; \
+	  else cp "$(srcdir)/$$f" "$(distdir)" ; \
+	  fi ; \
+	done
 	set -e; for d in sparc x86 ; do \
 	  mkdir "$(distdir)/$$d" ; \
 	  cp $(srcdir)/$$d/*.asm $(srcdir)/$$d/*.m4 "$(distdir)/$$d" ; \