diff --git a/ChangeLog b/ChangeLog
index 37bbec202b868d13ba5c4509880eb5562b720f72..34f9ac436ef1bb9785d669ad15572a5e5eb65910 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2014-10-23  Niels Möller  <nisse@lysator.liu.se>
 
+	* configure.ac (IF_ASM): New substituted variable.
+	* testsuite/Makefile.in (VALGRIND): Allow partial loads only when
+	build includes assembly files.
+
 	* memxor-internal.h (READ_PARTIAL): New macro.
 	* memxor.c (memxor_different_alignment): Avoid out-of-bounds
 	reads, corresponding to valgrind's --partial-loads-ok. Use
diff --git a/configure.ac b/configure.ac
index 17e6122fff06cb7305234a8c8f6af070b8de1498..78bcce2eec92b4e8c1cf6717181aa3cf3a389d99 100644
--- a/configure.ac
+++ b/configure.ac
@@ -356,6 +356,12 @@ fi
 AC_SUBST([OPT_ASM_NETTLE_SOURCES])
 AC_SUBST([OPT_ASM_HOGWEED_SOURCES])
 AC_SUBST([ASM_RODATA])
+if test "x$enable_assembler" = xyes ; then
+  IF_ASM=''
+else
+  IF_ASM='#'
+fi
+AC_SUBST([IF_ASM])
 
 AH_VERBATIM([HAVE_NATIVE],
 [/* Define to 1 each of the following for which a native (ie. CPU specific)
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
index 96c0bc80aee9b24c239fbc1cb5c2714b6f1fd049..6bc1907c79fbea3c94eabb82f1044116842d3326 100644
--- a/testsuite/Makefile.in
+++ b/testsuite/Makefile.in
@@ -114,7 +114,7 @@ $(TARGETS) $(EXTRA_TARGETS): testutils.$(OBJEXT) ../nettle-internal.$(OBJEXT) \
 
 # --partial-loads-ok=yes is needed for memxor's handling of unaligned
 # data.
-VALGRIND = valgrind --error-exitcode=1 --leak-check=full --partial-loads-ok=yes --show-reachable=yes
+VALGRIND = valgrind --error-exitcode=1 --leak-check=full --show-reachable=yes @IF_ASM@ --partial-loads-ok=yes
 
 # The PATH update is for locating dlls on w*ndows.
 check: $(TS_ALL)