diff --git a/configure b/configure
index 30132dbbf1f058936e0bb0d337854b7e750056d8..1ec47c47d8d900899d035faf30adf3db478560f0 100755
--- a/configure
+++ b/configure
@@ -5377,7 +5377,10 @@ if test "$ac_cv_search_shl_load" != no; then
 
 fi
 
-echo "$as_me:$LINENO: checking for library containing ldopen" >&5
+# We only use libld in port/dynloader/aix.c
+case $host_os in
+     aix*)
+	echo "$as_me:$LINENO: checking for library containing ldopen" >&5
 echo $ECHO_N "checking for library containing ldopen... $ECHO_C" >&6
 if test "${ac_cv_search_ldopen+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5503,6 +5506,8 @@ if test "$ac_cv_search_ldopen" != no; then
 
 fi
 
+	;;
+esac
 echo "$as_me:$LINENO: checking for library containing getopt_long" >&5
 echo $ECHO_N "checking for library containing getopt_long... $ECHO_C" >&6
 if test "${ac_cv_search_getopt_long+set}" = set; then
diff --git a/configure.in b/configure.in
index b867b95efefef97ec0a0417ee90d14a8ee9a37fc..9322de8cddcaa04c54ae9a4d7ea6dbe2cc95d623 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.448 2006/02/10 11:35:47 petere Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.449 2006/02/15 17:23:10 tgl Exp $
 dnl
 dnl Developers, please strive to achieve this order:
 dnl
@@ -595,7 +595,12 @@ AC_SEARCH_LIBS(pow, m)
 AC_SEARCH_LIBS(dlopen, dl)
 AC_SEARCH_LIBS(socket, [socket wsock32])
 AC_SEARCH_LIBS(shl_load, dld)
-AC_SEARCH_LIBS(ldopen, ld)
+# We only use libld in port/dynloader/aix.c
+case $host_os in
+     aix*)
+	AC_SEARCH_LIBS(ldopen, ld)
+	;;
+esac
 AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
 AC_SEARCH_LIBS(crypt, crypt)
 # Solaris: