Index: quilt-sendmail/aclocal.m4
===================================================================
--- quilt-sendmail.orig/aclocal.m4
+++ quilt-sendmail/aclocal.m4
@@ -16,7 +16,23 @@ AC_DEFUN([QUILT_COMPAT_PROG_PATH],[
       COMPAT_SYMLINKS="$COMPAT_SYMLINKS $2"
     fi
   ],[
-    AC_PATH_PROG($1, m4_if([$3],[],[$2],[$3]))
+    m4_if([$3],[],[
+      AC_PATH_PROGS($1,$2,,$PATH:$4)
+    ],[
+      AC_PATH_PROG($1,$3,,$PATH:$4)
+    ])
+    m4_if([$4],[],[],[
+      if test -n "$$1"; then
+	as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+        for dir in "$4"; do
+          if test "`dirname $$1`" = "$dir"; then
+            COMPAT_SYMLINKS="$COMPAT_SYMLINKS $2"
+	    break
+	  fi
+        done
+	IFS="$as_save_IFS"
+      fi
+    ])
   ])
   if test -z "$$1"; then
     m4_if(internal_$2_cmd,[],[
Index: quilt-sendmail/compat/mta.in
===================================================================
--- quilt-sendmail.orig/compat/mta.in
+++ /dev/null
@@ -1,4 +0,0 @@
-#! @BASH@
-
-echo "No mail transfer agent configured for \`quilt mail'" >&2
-exit 1
Index: quilt-sendmail/compat/sendmail.in
===================================================================
--- /dev/null
+++ quilt-sendmail/compat/sendmail.in
@@ -0,0 +1,4 @@
+#! @BASH@
+
+echo "No mail transfer agent configured for \`quilt mail'" >&2
+exit 1
Index: quilt-sendmail/configure.ac
===================================================================
--- quilt-sendmail.orig/configure.ac
+++ quilt-sendmail/configure.ac
@@ -187,19 +187,7 @@ will not work correctly until a newer ve
     fi
 fi
 
-dnl Check for sendmail
-old_PATH=$PATH
-PATH="$PATH:/usr/sbin"
-QUILT_COMPAT_PROG_PATH(MTA, mta, [sendmail])
-PATH=$old_PATH
-
-if test -n "$MTA" ; then
-    COMPAT_SYMLINKS="$COMPAT_SYMLINKS mta"
-else
-    if ! echo $COMPAT_PROGRAMS $COMPAT_SYMLINKS | grep -q mta; then
-	COMPAT_PROGRAMS="$COMPAT_PROGRAMS mta"
-    fi
-fi
+QUILT_COMPAT_PROG_PATH(SENDMAIL, [sendmail], [], [/usr/sbin])
 
 AC_ARG_ENABLE(nls, AC_HELP_STRING(
     [--enable-nls], [include natural language support]))
Index: quilt-sendmail/quilt/mail.in
===================================================================
--- quilt-sendmail.orig/quilt/mail.in
+++ quilt-sendmail/quilt/mail.in
@@ -66,10 +66,10 @@ process_mail()
 				  --extract-recipients Bcc \
 				  < $tmpfile)
 	if [ -n "$opt_send" ]; then
-		echo mta "$@"
+		echo sendmail "$@"
 		@SCRIPTS@/edmail --charset $opt_charset \
 				 --remove-header Bcc "$@" < $tmpfile \
-		| mta "$@"
+		| sendmail "$@"
 	else
 		local from_date=$(date "+%a %b %e %H:%M:%S %Y")
 		echo "From ${LOGNAME:-$(whoami)}@$(hostname -f) $from_date"
Index: quilt-sendmail/Makefile.in
===================================================================
--- quilt-sendmail.orig/Makefile.in
+++ quilt-sendmail/Makefile.in
@@ -33,7 +33,7 @@ MKTEMP :=	@MKTEMP@
 MSGFMT :=	@MSGFMT@
 DIFFSTAT :=	@DIFFSTAT@
 RPMBUILD :=	@RPMBUILD@
-MTA :=		@MTA@
+SENDMAIL :=	@SENDMAIL@
 
 COMPAT_SYMLINKS	:= @COMPAT_SYMLINKS@
 COMPAT_PROGRAMS	:= @COMPAT_PROGRAMS@
