diff --git a/m4/virt-wireshark.m4 b/m4/virt-wireshark.m4
index d8cb7c8f56c9c40df53695df9e18e54a002e2b1a..f383e2baf50944fd9f253065c5c99201f48a7593 100644
--- a/m4/virt-wireshark.m4
+++ b/m4/virt-wireshark.m4
@@ -38,7 +38,7 @@ AC_DEFUN([LIBVIRT_CHECK_WIRESHARK],[
         if test "x$ws_prefix" = "x" ; then
           ws_prefix="/usr";
         fi
-        plugindir="${prefix}${plugindir#ws_prefix}"
+        plugindir="${prefix}${plugindir#$ws_prefix}"
       fi
     elif test "x$with_ws_plugindir" = "xno" || test "x$with_ws_plugindir" = "xyes"; then
       AC_MSG_ERROR([ws-plugindir must be used only with valid path])