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