Blob Blame History Raw
diff --git a/contrib/dlz/config.dlz.in b/contrib/dlz/config.dlz.in
index 9b1464c..d1fe16e 100644
--- a/contrib/dlz/config.dlz.in
+++ b/contrib/dlz/config.dlz.in
@@ -135,38 +135,48 @@ AC_ARG_WITH(dlz_mysql,
 			       (Required to use MySQL with DLZ)],
     use_dlz_mysql="$withval", use_dlz_mysql="no")
 
+AC_CHECK_PROGS(MYSQL_CONFIG, mysql_config)
+
 mysql_include=""
 mysql_lib=""
 if test "$use_dlz_mysql" = "yes"
 then
-	# User did not specify a path - guess it
-	mysqldirs="/usr /usr/local /usr/local/mysql /usr/pkg"
-	for d in $mysqldirs
-	do
-		if test -f $d/include/mysql/mysql.h
-		then
-			use_dlz_mysql=$d
-			mysql_include=$d/include/mysql
-			if test -d $d/${target_lib}/mysql
+	if test -n "$MYSQL_CONFIG"
+	then
+		mysql_include=`${MYSQL_CONFIG} --include`
+		mysql_lib=`${MYSQL_CONFIG} --libs`
+		use_dlz_mysql="config"
+
+	else
+		# User did not specify a path - guess it
+		mysqldirs="/usr /usr/local /usr/local/mysql /usr/pkg"
+		for d in $mysqldirs
+		do
+			if test -f $d/include/mysql/mysql.h
 			then
-				mysql_lib=$d/${target_lib}/mysql
-			else
-				mysql_lib=$d/lib
-			fi
-			break
-		elif test -f $d/include/mysql.h
-		then
-			use_dlz_mysql=$d
-			mysql_include=$d/include
-			if test -d $d/lib/mysql
+				use_dlz_mysql=$d
+				mysql_include=$d/include/mysql
+				if test -d $d/${target_lib}/mysql
+				then
+					mysql_lib=$d/${target_lib}/mysql
+				else
+					mysql_lib=$d/lib
+				fi
+				break
+			elif test -f $d/include/mysql.h
 			then
-				mysql_lib=$d/lib/mysql
-			else
-				mysql_lib=$d/lib
+				use_dlz_mysql=$d
+				mysql_include=$d/include
+				if test -d $d/lib/mysql
+				then
+					mysql_lib=$d/lib/mysql
+				else
+					mysql_lib=$d/lib
+				fi
+				break
 			fi
-			break
-		fi
-	done
+		done
+	fi
 elif test "$use_dlz_mysql" != "no"
 then
 	d=$use_dlz_mysql
@@ -202,6 +212,14 @@ case "$use_dlz_mysql" in
 	no)
 		AC_MSG_RESULT(no)
 		;;
+	config)
+		DLZ_ADD_DRIVER(MYSQL, dlz_mysql_driver,
+				[${mysql_include}],
+				[${mysql_lib}])
+
+		AC_MSG_RESULT(
+[using mysql with libs ${mysql_lib} and includes ${mysql_include}])
+		;;
 	*)
 		DLZ_ADD_DRIVER(MYSQL, dlz_mysql_driver,
 				[-I${mysql_include}],