2e2c49
diff --git a/contrib/dlz/config.dlz.in b/contrib/dlz/config.dlz.in
2e2c49
index 47525af..eefe3c3 100644
2e2c49
--- a/contrib/dlz/config.dlz.in
2e2c49
+++ b/contrib/dlz/config.dlz.in
2e2c49
@@ -17,6 +17,13 @@
2e2c49
 #
2e2c49
 dlzdir='${DLZ_DRIVER_DIR}'
2e2c49
 
2e2c49
+AC_MSG_CHECKING([for target libdir])
2e2c49
+AC_RUN_IFELSE([int main(void) {exit((sizeof(void *) == 8) ? 0 : 1);}],
2e2c49
+	[target_lib=lib64],
2e2c49
+	[target_lib=lib],
2e2c49
+)
2e2c49
+AC_MSG_RESULT(["$target_lib"])
2e2c49
+
2e2c49
 #
2e2c49
 # Private autoconf macro to simplify configuring drivers:
2e2c49
 #
2e2c49
@@ -292,9 +299,9 @@ case "$use_dlz_bdb" in
2e2c49
 					then
2e2c49
 						break
2e2c49
 					fi
2e2c49
-				elif test -f "$dd/lib/lib${d}.so"
2e2c49
+				elif test -f "$dd/${target_lib}/lib${d}.so"
2e2c49
 				then
2e2c49
-					dlz_bdb_libs="-L${dd}/lib -l${d}"
2e2c49
+					dlz_bdb_libs="-L${dd}/${target_lib} -l${d}"
2e2c49
 					break
2e2c49
 				fi
2e2c49
 			done
2e2c49
@@ -396,7 +403,7 @@ case "$use_dlz_ldap" in
2e2c49
 	*)
2e2c49
 		DLZ_ADD_DRIVER(LDAP, dlz_ldap_driver,
2e2c49
 				[-I$use_dlz_ldap/include],
2e2c49
-				[-L$use_dlz_ldap/lib -lldap -llber])
2e2c49
+				[-L$use_dlz_ldap/${target_lib} -lldap -llber])
2e2c49
 
2e2c49
 		AC_MSG_RESULT(
2e2c49
 [using LDAP from $use_dlz_ldap/lib and $use_dlz_ldap/include])
2e2c49
@@ -432,11 +439,11 @@ then
2e2c49
 		odbcdirs="/usr /usr/local /usr/pkg"
2e2c49
 		for d in $odbcdirs
2e2c49
 		do
2e2c49
-			if test -f $d/include/sql.h -a -f $d/lib/libodbc.a
2e2c49
+			if test -f $d/include/sql.h -a -f $d/${target_lib}/libodbc.a
2e2c49
 			then
2e2c49
 				use_dlz_odbc=$d
2e2c49
 				dlz_odbc_include="-I$use_dlz_odbc/include"
2e2c49
-				dlz_odbc_libs="-L$use_dlz_odbc/lib -lodbc"
2e2c49
+				dlz_odbc_libs="-L$use_dlz_odbc/${target_lib} -lodbc"
2e2c49
 				break
2e2c49
 			fi
2e2c49
 		done