Switch to side-by-side view

--- a/configure.in
+++ b/configure.in
@@ -277,7 +277,10 @@
 # else we try to find them
 
 # Use mysql_config if available
-AC_PATH_PROGS(mysqlconf,mysql_config)
+AC_PATH_PROGS(mysqlconf, mysql_config)
+if test -z "$mysqlconf" ; then
+   AC_MSG_ERROR([mysql_config not found])
+fi
 
 AC_ARG_WITH(mysql-libs,
     [ --with-mysql-libs    Specify directory to search for mysql client libs.],
@@ -290,28 +293,19 @@
 if test "$mysql_libs" != "no" ; then 
     MYSQLLIBDIR=$mysql_libs
 else
-    dirs="/usr/local/lib/mysql /usr/local/mysql/lib /usr/lib/mysql /usr/lib"
-    for dir in $dirs ; do
-        if test -f $dir/libmysqlclient.a ; then
-            MYSQLLIBDIR=$dir
-            break
-        fi
-    done
+    MYSQLLIBDIR=`$mysqlconf --libs | awk '{print $1}'`
+    case A"$MYSQLLIBDIR" in
+    A-L*) MYSQLLIBDIR=`echo $MYSQLLIBDIR | sed -e 's/-L//'`;;
+    *) MYSQLLIBDIR="";;
+    esac
     if test -z "$MYSQLLIBDIR" ; then
-       echo "Sorry, can't find libmysqlclient.a"
-       echo "I searched in: $dirs"
-       echo "Check that the mysql development libraries are installed and"
-       echo "try using --with-mysql-libs"
-       exit 1
+       AC_MSG_ERROR([Sorry, can't find mysql libmysqlclient.a. 
+       Check that the mysql development libraries are installed or
+       try using --with-mysql-libs])
     fi
 fi
 
-# Library switch. If the new mysql_config utility is available, use it
-if test ! -z "$mysqlconf" ; then
-    MYSQLLIBSW=`$mysqlconf --libs`
-else 
-    MYSQLLIBSW="-L$MYSQLLIBDIR -lmysqlclient"
-fi
+MYSQLLIBSW=`$mysqlconf --libs`
 
 AC_ARG_WITH(mysql-includes,
     [ --with-mysql-includes  Specify directory to search for mysql .h files.],