Index: configure.in
--- configure.in.orig	2009-07-27 07:26:10 +0200
+++ configure.in	2009-07-27 16:49:17 +0200
@@ -1970,14 +1970,14 @@
   AC_CHECK_PROG(PG_CONFIG, pg_config, YES, NO)
   if test $PG_CONFIG = NO; then
     # based on code from PHP
-    for i in /usr /usr/local /usr/local/pgsql; do
-      for j in include include/pgsql include/postgres include/postgresql ""; do
+    for i in @l_prefix@; do
+      for j in include/postgresql; do
 	if test -r "$i/$j/libpq-fe.h"; then
 	  PGSQL_INCLUDE=$i/$j
 	fi
       done
-      for lib in lib lib64; do
-	for j in $lib $lib/pgsql $lib/postgres $lib/postgresql ""; do
+      for lib in lib; do
+	for j in $lib; do
 	  if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then
 	    PGSQL_LIBDIR=$i/$j
 	  fi
Index: configure
--- configure.orig	2009-07-27 07:26:28 +0200
+++ configure	2009-07-27 16:50:02 +0200
@@ -29424,14 +29424,14 @@
 
   if test $PG_CONFIG = NO; then
     # based on code from PHP
-    for i in /usr /usr/local /usr/local/pgsql; do
-      for j in include include/pgsql include/postgres include/postgresql ""; do
+    for i in @l_prefix@; do
+      for j in include/postgresql; do
 	if test -r "$i/$j/libpq-fe.h"; then
 	  PGSQL_INCLUDE=$i/$j
 	fi
       done
-      for lib in lib lib64; do
-	for j in $lib $lib/pgsql $lib/postgres $lib/postgresql ""; do
+      for lib in lib; do
+	for j in $lib; do
 	  if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then
 	    PGSQL_LIBDIR=$i/$j
 	  fi
Index: src/deliver/deliver.c
--- src/deliver/deliver.c.orig	2009-06-28 01:47:56 +0200
+++ src/deliver/deliver.c	2009-07-27 16:47:39 +0200
@@ -46,7 +46,7 @@
 #include <syslog.h>
 
 #define DEFAULT_CONFIG_FILE SYSCONFDIR"/dovecot.conf"
-#define DEFAULT_SENDMAIL_PATH "/usr/lib/sendmail"
+#define DEFAULT_SENDMAIL_PATH "@l_prefix@/sbin/sendmail"
 #define DEFAULT_ENVELOPE_SENDER "MAILER-DAEMON"
 
 /* After buffer grows larger than this, create a temporary file to /tmp
