--- configure.in.orig	2010-11-03 15:12:17.000000000 +0100
+++ configure.in	2010-11-03 15:14:48.000000000 +0100
@@ -953,7 +953,11 @@
 			AC_MSG_ERROR(Unknown MySQL directory - unable to find mysql.h)
 		fi
    	else
-		if test -f $withval/include/mysql/mysql.h; then
+   	    # reflect MacPorts specialties...
+   	    if test -f $withval/include/mysql5/mysql/mysql.h; then
+   	        MYSQL_INCDIR=$withval/include/mysql5/mysql
+   	        MYSQL_LIBDIR=$withval/lib/mysql5/mysql
+		elif test -f $withval/include/mysql/mysql.h; then
    			MYSQL_INCDIR=$withval/include/mysql
    			MYSQL_LIBDIR=$withval/lib/mysql
 		elif test -f $withval/include/mysql.h; then
@@ -1009,8 +1013,12 @@
    	else
    		PGSQL_INCDIR=$withval/include
    		test -d $withval/include/pgsql && PGSQL_INCDIR=$withval/include/pgsql
+   		test -d $withval/include/postgresql83 && PGSQL_INCDIR=$withval/include/postgresql83
+   		test -d $withval/include/postgresql84 && PGSQL_INCDIR=$withval/include/postgresql84
    		PGSQL_LIBDIR=$withval/lib
    		test -d $withval/lib/pgsql && PGSQL_LIBDIR=$withval/lib/pgsql
+   		test -d $withval/lib/postgresql83 && PGSQL_LIBDIR=$withval/lib/postgresql83
+   		test -d $withval/lib/postgresql84 && PGSQL_LIBDIR=$withval/lib/postgresql84
    	fi
     PGSQL_INCLUDE="-I$PGSQL_INCDIR"
     PGSQL_LFLAGS="-L$PGSQL_LIBDIR -lpq"
