--- configure.ac.orig	2011-11-07 12:24:04.962394552 +0100
+++ configure.ac	2011-11-07 12:32:59.006960210 +0100
@@ -245,7 +245,170 @@
 dnl either way, set the cmd_ssh var
 AC_SUBST(CMD_DU, "cmd_du		$DU")
 
+dnl
+dnl LVCREATE CHECK (optional program)
+dnl
+dnl if the user specified a path, try that first
+AC_ARG_WITH(lvcreate,
+        [  --with-lvcreate=PATH          Specify the path to lvcreate ],
+        [
+                if test "x$withval" != "xno"; then
+                        if test -x "$withval"; then
+                                LVCREATE=$withval
+                        else
+                                AC_MSG_ERROR(lvcreate not found)
+                        fi
+                else
+                        LVCREATE=no
+                fi
+        ]
+)
+dnl save the program for testing
+AC_SUBST(TEST_LVCREATE, "$LVCREATE")
+dnl if the user didn't specify a path, hunt for it
+if test "$LVCREATE" != "no"; then
+        if test "$LVCREATE" = ""; then
+                AC_PATH_PROG(LVCREATE, lvcreate, no)
+        fi
+fi
+dnl if we couldn't find it, provide an example
+if test "$LVCREATE" = "no"; then
+        LVCREATE=/sbin/lvcreate
+fi
+dnl either way, set the cmd_lvcreate var
+AC_SUBST(CMD_LVCREATE, "linux_lvm_cmd_lvcreate		$LVCREATE")
 
+dnl
+dnl LVREMOVE CHECK (optional program)
+dnl
+dnl if the user specified a path, try that first
+AC_ARG_WITH(lvremove,
+        [  --with-lvremove=PATH          Specify the path to lvremove ],
+        [
+                if test "x$withval" != "xno"; then
+                        if test -x "$withval"; then
+                                LVREMOVE=$withval
+                        else
+                                AC_MSG_ERROR(lvremove not found)
+                        fi
+                else
+                        LVREMOVE=no
+                fi
+        ]
+)
+dnl save the program for testing
+AC_SUBST(TEST_LVREMOVE, "$LVREMOVE")
+dnl if the user didn't specify a path, hunt for it
+if test "$LVREMOVE" != "no"; then
+        if test "$LVREMOVE" = ""; then
+                AC_PATH_PROG(LVREMOVE, lvremove, no)
+        fi
+fi
+dnl if we couldn't find it, provide an example
+if test "$LVREMOVE" = "no"; then
+        LVREMOVE=/sbin/lvremove
+fi
+dnl either way, set the cmd_lvremove var
+AC_SUBST(CMD_LVREMOVE, "linux_lvm_cmd_lvremove		$LVREMOVE")
+
+dnl
+dnl MOUNT CHECK (optional program)
+dnl
+dnl if the user specified a path, try that first
+AC_ARG_WITH(mount,
+        [  --with-mount=PATH          Specify the path to mount ],
+        [
+                if test "x$withval" != "xno"; then
+                        if test -x "$withval"; then
+                                MOUNT=$withval
+                        else
+                                AC_MSG_ERROR(mount not found)
+                        fi
+                else
+                        MOUNT=no
+                fi
+        ]
+)
+dnl save the program for testing
+AC_SUBST(TEST_MOUNT, "$MOUNT")
+dnl if the user didn't specify a path, hunt for it
+if test "$MOUNT" != "no"; then
+        if test "$MOUNT" = ""; then
+                AC_PATH_PROG(MOUNT, mount, no)
+        fi
+fi
+dnl if we couldn't find it, provide an example
+if test "$MOUNT" = "no"; then
+        MOUNT=/bin/mount
+fi
+dnl either way, set the cmd_mount var
+AC_SUBST(CMD_MOUNT, "linux_lvm_cmd_mount		$MOUNT")
+
+dnl
+dnl UMOUNT CHECK (optional program)
+dnl
+dnl if the user specified a path, try that first
+AC_ARG_WITH(umount,
+        [  --with-umount=PATH          Specify the path to umount ],
+        [
+                if test "x$withval" != "xno"; then
+                        if test -x "$withval"; then
+                                UMOUNT=$withval
+                        else
+                                AC_MSG_ERROR(umount not found)
+                        fi
+                else
+                        UMOUNT=no
+                fi
+        ]
+)
+dnl save the program for testing
+AC_SUBST(TEST_UMOUNT, "$UMOUNT")
+dnl if the user didn't specify a path, hunt for it
+if test "$UMOUNT" != "no"; then
+        if test "$UMOUNT" = ""; then
+                AC_PATH_PROG(UMOUNT, umount, no)
+        fi
+fi
+dnl if we couldn't find it, provide an example
+if test "$UMOUNT" = "no"; then
+        UMOUNT=/bin/umount
+fi
+dnl either way, set the cmd_umount var
+AC_SUBST(CMD_UMOUNT, "linux_lvm_cmd_umount		$UMOUNT")
+
+dnl
+dnl KPARTX CHECK (optional program)
+dnl
+dnl if the user specified a path, try that first
+AC_ARG_WITH(kpartx,
+        [  --with-kpartx=PATH          Specify the path to kpartx ],
+        [
+                if test "x$withval" != "xno"; then
+                        if test -x "$withval"; then
+                                KPARTX=$withval
+                        else
+                                AC_MSG_ERROR(kpartx not found)
+                        fi
+                else
+                        KPARTX=no
+                fi
+        ]
+)
+dnl save the program for testing
+AC_SUBST(TEST_KPARTX, "$KPARTX")
+dnl if the user didn't specify a path, hunt for it
+if test "$KPARTX" != "no"; then
+        if test "$KPARTX" = ""; then
+                AC_PATH_PROG(KPARTX, kpartx, no)
+        fi
+fi
+dnl if we couldn't find it, provide an example
+if test "$KPARTX" = "no"; then
+        KPARTX=/sbin/kpartx
+fi
+dnl either way, set the cmd_kpartx var
+AC_SUBST(CMD_KPARTX, "linux_lvm_cmd_kpartx		$KPARTX")
 
 dnl Combine the preamble with a normal, working script
 AC_CONFIG_FILES(rsnapshot:rsnapshot-preamble.pl:rsnapshot-program.pl)
