diff --git a/configure b/configure
index 9d6ce4f58abe03e885b3d6c7c465e034f0fa77e8..6fe79454c46054fe3e3bb01cbacb52769b94a3ac 100755
--- a/configure
+++ b/configure
@@ -2516,7 +2516,7 @@ case "$toolchain" in
         add_ldflags -fsanitize=thread -pie
     ;;
     valgrind-massif)
-        target_exec_default="valgrind"
+        target_exec_default=${valgrind:-"valgrind"}
         target_exec_args="--tool=massif --alloc-fn=av_malloc --alloc-fn=av_mallocz"
     ;;
     valgrind-memcheck)