--- configure.org	2014-07-15 23:08:18.000000000 +0200
+++ configure	2014-07-15 23:22:03.000000000 +0200
@@ -24139,6 +24139,23 @@
                  MYSQL_LIBDIR=$withval/lib
               fi
               MYSQL_BINDIR=$withval/bin
+           ## added by macports start
+           elif test -f $withval/mysql.h; then
+              MYSQL_INCDIR=$withval
+              if [[ ${withval} == *"mysql55"* ]]; then
+                 if test -f @@PREFIX@@/lib/mysql55/mysql/libmysqlclient_r.a \
+                      -o -f @@PREFIX@@/lib/mysql55/mysql/libmysqlclient_r.so; then
+                    MYSQL_LIBDIR=@@PREFIX@@/lib/mysql55/mysql
+                 fi
+                 MYSQL_BINDIR=@@PREFIX@@/lib/mysql55/bin
+              elif [[ ${withval} == *"mysql51"* ]]; then
+                 if test -f @@PREFIX@@/lib/mysql51/mysql/libmysqlclient_r.a \
+                      -o -f @@PREFIX@@/lib/mysql51/mysql/libmysqlclient_r.so; then
+                    MYSQL_LIBDIR=@@PREFIX@@/lib/mysql51/mysql
+                 fi
+                 MYSQL_BINDIR=@@PREFIX@@/lib/mysql51/bin
+              fi
+           ## added by macports end
            else
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }