a2a915
diff --git a/config.h.in b/config.h.in
a2a915
index e1364dd921..1dc65cfb21 100644
a2a915
--- a/config.h.in
a2a915
+++ b/config.h.in
a2a915
@@ -588,7 +588,7 @@ int sigwait(const unsigned int *set, int *sig);
a2a915
 #undef PREFER_GOSTASN1
a2a915
 
a2a915
 /* The size of `void *', as computed by sizeof. */
a2a915
-#undef SIZEOF_VOID_P
a2a915
+/* #undef SIZEOF_VOID_P */
a2a915
 
a2a915
 /* Define to 1 if you have the ANSI C header files. */
a2a915
 #undef STDC_HEADERS
a2a915
diff --git a/configure.in b/configure.in
a2a915
index 73b1c8ccbb..129fc3f311 100644
a2a915
--- a/configure.in
a2a915
+++ b/configure.in
a2a915
@@ -3523,14 +3523,14 @@ AC_TRY_COMPILE([
a2a915
 #include <sys/socket.h>
a2a915
 #include <netdb.h>
a2a915
 int getnameinfo(const struct sockaddr *, socklen_t, char *,
a2a915
-		socklen_t, char *, socklen_t, unsigned int);],
a2a915
+		socklen_t, char *, socklen_t, int);],
a2a915
 [ return (0);],
a2a915
-	[AC_MSG_RESULT(socklen_t for buflen; u_int for flags)
a2a915
+	[AC_MSG_RESULT(socklen_t for buflen; int for flags)
a2a915
 	 AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, socklen_t,
a2a915
 		   [Define to the sockaddr length type used by getnameinfo(3).])
a2a915
 	 AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t,
a2a915
 		   [Define to the buffer length type used by getnameinfo(3).])
a2a915
-	 AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, unsigned int,
a2a915
+	 AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int,
a2a915
 		   [Define to the flags type used by getnameinfo(3).])],
a2a915
 [AC_TRY_COMPILE([
a2a915
 #include <sys/types.h>
a2a915
@@ -3557,7 +3557,7 @@ int getnameinfo(const struct sockaddr *, size_t, char *,
a2a915
 [AC_MSG_RESULT(not match any subspecies; assume standard definition)
a2a915
 AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, socklen_t)
a2a915
 AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t)
a2a915
-AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)])])])
a2a915
+AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, unsigned int)])])])
a2a915
 
a2a915
 #
a2a915
 # ...and same for gai_strerror().
a2a915
diff --git a/isc-config.sh.in b/isc-config.sh.in
a2a915
index a8a0a89e88..b5e94ed13e 100644
a2a915
--- a/isc-config.sh.in
a2a915
+++ b/isc-config.sh.in
a2a915
@@ -13,7 +13,18 @@ prefix=@prefix@
a2a915
 exec_prefix=@exec_prefix@
a2a915
 exec_prefix_set=
a2a915
 includedir=@includedir@
a2a915
-libdir=@libdir@
a2a915
+arch=$(uname -m)
a2a915
+
a2a915
+case $arch in
a2a915
+	x86_64 | amd64 | sparc64 | s390x | ppc64)
a2a915
+		libdir=/usr/lib64
a2a915
+		sec_libdir=/usr/lib
a2a915
+		;;
a2a915
+	* )
a2a915
+		libdir=/usr/lib
a2a915
+		sec_libdir=/usr/lib64
a2a915
+		;;
a2a915
+esac
a2a915
 
a2a915
 usage()
a2a915
 {
a2a915
@@ -132,6 +143,16 @@ if test x"$echo_libs" = x"true"; then
a2a915
 	if test x"${exec_prefix_set}" = x"true"; then
a2a915
 		libs="-L${exec_prefix}/lib"
a2a915
 	else
a2a915
+		if [ ! -x $libdir/libisc.so ] ; then
a2a915
+			if [ ! -x $sec_libdir/libisc.so ] ; then
a2a915
+				echo "Error: ISC libs not found in $libdir"
a2a915
+				if [ -d $sec_libdir ] ; then
a2a915
+					echo "Error: ISC libs not found in $sec_libdir"
a2a915
+				fi
a2a915
+				exit 1
a2a915
+			fi
a2a915
+			libdir=$sec_libdir
a2a915
+		fi
a2a915
 		libs="-L${libdir}"
a2a915
 	fi
a2a915
 	if test x"$libirs" = x"true" ; then