I have PostgreSQL v8 installed from DarwinPorts on Mac OS X 10.3.9.
libpq is linked with SSL and libcrypto.  I've gotten configure to
detect, and the PostgreSQL modules to build with the following patch
to configure.ac.  But I don't much like it:
  - there's got to be a cleaner way to defeat the autocrock cache
  - I suspect there are platforms that don't need libcrypto
  - if other platforms work differently, the code is tedious to
    generalize
Suggestions welcome!
diff -rN -u old-xft-integration-new/configure.ac new-xft-integration-new/configure.ac
--- old-xft-integration-new/configure.ac	2005-11-05 00:45:09.000000000 +0900
+++ new-xft-integration-new/configure.ac	2005-11-05 00:45:17.000000000 +0900
@@ -3778,16 +3778,33 @@
                     libpq_fe_h_file=${header_dir}libpq-fe.h; break)
   done
 
-  test -n "$libpq_fe_h_file" && {
AC_CHECK_LIB(pq,PQconnectdb,have_libpq=yes) }
+  pq_libs=
+  extra_libs=
+  if test -n "$libpq_fe_h_file"; then
+dnl    for extra_libs in "" "-lssl"; do
+dnl      AC_CHECKING([for PQconnectdb in -lpq $extra_libs])
+dnl      AC_CHECK_LIB(pq, PQconnectdb,
+dnl        [pq_libs="-lpq $extra_libs"; break], [:], $extra_libs)
+dnl    done
+    AC_CHECK_LIB(pq, PQconnectdb,[pq_libs="-lpq"],[
+      unset ac_cv_lib_pq_PQconnectdb;
+      AC_CHECK_LIB(pq, PQconnectdb,[pq_libs="-lpq -lcrypto -lssl"],,
+        [-lcrypto -lssl])])
+    if test -z "$pq_libs"; then
+      have_libpq="no"
+    else
+      have_libpq="yes"
+    fi
+  fi
 
   if test -n "$libpq_fe_h_file" -a "$have_libpq" = "yes";
then
     with_postgresql=yes
     AC_DEFINE(HAVE_POSTGRESQL)
     AC_CHECK_LIB(pq,PQconnectStart, [
                  with_postgresqlv7=yes;
-                 AC_DEFINE(HAVE_POSTGRESQLV7)])
+                 AC_DEFINE(HAVE_POSTGRESQLV7)], [:], $extra_libs)
     AC_DEFINE_UNQUOTED(LIBPQ_FE_H_FILE, "$libpq_fe_h_file")
-    XE_PREPEND(-lpq, postgresql_libs)
+    XE_PREPEND([$pq_libs], postgresql_libs)
     XE_APPEND(modules/postgresql, MAKE_SUBDIR)
     need_modules_common=yes
     if test "$enable_modules" = "yes"; then
  
-- 
School of Systems and Information Engineering 
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.