cb2172
diff --git a/contrib/dlz/config.dlz.in b/contrib/dlz/config.dlz.in
cb2172
index 5d65a85..2677b26 100644
cb2172
--- a/contrib/dlz/config.dlz.in
cb2172
+++ b/contrib/dlz/config.dlz.in
Adam Tkac e93ead
@@ -17,6 +17,13 @@
Adam Tkac e93ead
 #
Adam Tkac e93ead
 dlzdir='${DLZ_DRIVER_DIR}'
Adam Tkac e93ead
 
Adam Tkac e93ead
+AC_MSG_CHECKING([for target libdir])
Adam Tkac e93ead
+AC_RUN_IFELSE([int main(void) {exit((sizeof(void *) == 8) ? 0 : 1);}],
Adam Tkac e93ead
+	[target_lib=lib64],
Adam Tkac e93ead
+	[target_lib=lib],
Adam Tkac e93ead
+)
Adam Tkac e93ead
+AC_MSG_RESULT(["$target_lib"])
Adam Tkac e93ead
+
Adam Tkac e93ead
 #
Adam Tkac e93ead
 # Private autoconf macro to simplify configuring drivers:
Adam Tkac e93ead
 #
cb2172
@@ -152,23 +159,11 @@ then
Adam Tkac 3471a1
 			then
cb2172
 				use_dlz_mysql=$d
cb2172
 				mysql_include=$d/include/mysql
cb2172
-			if test -d $d/lib/mysql
cb2172
-				then
Adam Tkac 3471a1
-				mysql_lib=$d/lib/mysql
cb2172
-				else
cb2172
-					mysql_lib=$d/lib
cb2172
-				fi
cb2172
 				break
cb2172
 			elif test -f $d/include/mysql.h
cb2172
 			then
cb2172
 				use_dlz_mysql=$d
cb2172
 				mysql_include=$d/include
cb2172
-				if test -d $d/lib/mysql
cb2172
-				then
cb2172
-					mysql_lib=$d/lib/mysql
cb2172
-				else
cb2172
-					mysql_lib=$d/lib
cb2172
-				fi
cb2172
 				break
Adam Tkac 3471a1
 			fi
cb2172
 		done
cb2172
@@ -179,21 +174,9 @@ then
cb2172
 	if test -f $d/include/mysql/mysql.h
cb2172
 	then
cb2172
 		mysql_include=$d/include/mysql
cb2172
-		if test -d $d/lib/mysql
cb2172
-		then
cb2172
-			mysql_lib=$d/lib/mysql
cb2172
-		else
cb2172
-			mysql_lib=$d/lib
cb2172
-		fi
cb2172
 	elif test -f $d/include/mysql.h
cb2172
 	then
cb2172
 		mysql_include=$d/include
cb2172
-		if test -d $d/lib/mysql
cb2172
-		then
cb2172
-			mysql_lib=$d/lib/mysql
cb2172
-		else
cb2172
-			mysql_lib=$d/lib
cb2172
-		fi
cb2172
 	fi
cb2172
 fi
cb2172
 
cb2172
@@ -217,6 +200,12 @@ case "$use_dlz_mysql" in
cb2172
 [using mysql with libs ${mysql_lib} and includes ${mysql_include}])
cb2172
 		;;
cb2172
 	*)
cb2172
+		if test -d $use_dlz_mysql/${target_lib}/mysql
cb2172
+		then
cb2172
+			mysql_lib=$use_dlz_mysql/${target_lib}/mysql
cb2172
+		else
cb2172
+			mysql_lib=$use_dlz_mysql/${target_lib}
cb2172
+		fi
cb2172
 		DLZ_ADD_DRIVER(MYSQL, dlz_mysql_driver,
cb2172
 				[-I${mysql_include}],
cb2172
 				[-L${mysql_lib} -lmysqlclient -lz -lcrypt -lm])
cb2172
@@ -310,9 +299,9 @@ case "$use_dlz_bdb" in
Adam Tkac 0e5b5a
 					then
Tomas Hozza b74606
 						break
Adam Tkac 0e5b5a
 					fi
Tomas Hozza b74606
-				elif test -f "$dd/lib/lib${d}.so"
Tomas Hozza b74606
+				elif test -f "$dd/${target_lib}/lib${d}.so"
Tomas Hozza b74606
 				then
Tomas Hozza b74606
-					dlz_bdb_libs="-L${dd}/lib -l${d}"
Tomas Hozza b74606
+					dlz_bdb_libs="-L${dd}/${target_lib} -l${d}"
Tomas Hozza b74606
 					break
Tomas Hozza b74606
 				fi
Tomas Hozza b74606
 			done
cb2172
@@ -414,7 +403,7 @@ case "$use_dlz_ldap" in
Adam Tkac e93ead
 	*)
Adam Tkac e93ead
 		DLZ_ADD_DRIVER(LDAP, dlz_ldap_driver,
Adam Tkac e93ead
 				[-I$use_dlz_ldap/include],
Adam Tkac e93ead
-				[-L$use_dlz_ldap/lib -lldap -llber])
Adam Tkac e93ead
+				[-L$use_dlz_ldap/${target_lib} -lldap -llber])
Adam Tkac e93ead
 
Adam Tkac e93ead
 		AC_MSG_RESULT(
Adam Tkac 3471a1
 [using LDAP from $use_dlz_ldap/lib and $use_dlz_ldap/include])
cb2172
@@ -450,11 +439,11 @@ then
Tomas Hozza b74606
 		odbcdirs="/usr /usr/local /usr/pkg"
Tomas Hozza b74606
 		for d in $odbcdirs
Tomas Hozza b74606
 		do
Tomas Hozza b74606
-			if test -f $d/include/sql.h -a -f $d/lib/libodbc.a
Tomas Hozza b74606
+			if test -f $d/include/sql.h -a -f $d/${target_lib}/libodbc.a
Tomas Hozza b74606
 			then
Tomas Hozza b74606
 				use_dlz_odbc=$d
Tomas Hozza b74606
 				dlz_odbc_include="-I$use_dlz_odbc/include"
Tomas Hozza b74606
-				dlz_odbc_libs="-L$use_dlz_odbc/lib -lodbc"
Tomas Hozza b74606
+				dlz_odbc_libs="-L$use_dlz_odbc/${target_lib} -lodbc"
Tomas Hozza b74606
 				break
Tomas Hozza b74606
 			fi
Tomas Hozza b74606
 		done