Index: bin/pg_dump/pg_dump.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v
retrieving revision 1.472
diff -u -r1.472 pg_dump.c
--- bin/pg_dump/pg_dump.c	3 Sep 2007 00:39:19 -0000	1.472
+++ bin/pg_dump/pg_dump.c	28 Sep 2007 14:09:59 -0000
@@ -197,6 +197,18 @@
 static void check_sql_result(PGresult *res, PGconn *conn, const char *query,
 				 ExecStatusType expected);

+/*
+ * We need to include OpenSSL's applink code with OpenSSL 0.9.8+ on Windows
+ * It needs to be included in every .exe so we include it here.
+ */
+#ifdef WIN32
+#ifdef USE_SSL
+#include <openssl/opensslv.h>
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+#include <openssl/applink.c>
+#endif
+#endif
+#endif

 int
 main(int argc, char **argv)
Index: bin/pg_dump/pg_dumpall.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v
retrieving revision 1.92
diff -u -r1.92 pg_dumpall.c
--- bin/pg_dump/pg_dumpall.c	8 Jul 2007 19:07:38 -0000	1.92
+++ bin/pg_dump/pg_dumpall.c	28 Sep 2007 14:09:59 -0000
@@ -71,6 +71,19 @@
 static FILE	*OPF;
 static char	*filename = NULL;

+/*
+ * We need to include OpenSSL's applink code with OpenSSL 0.9.8+ on Windows
+ * It needs to be included in every .exe so we include it here.
+ */
+#ifdef WIN32
+#ifdef USE_SSL
+#include <openssl/opensslv.h>
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+#include <openssl/applink.c>
+#endif
+#endif
+#endif
+
 int
 main(int argc, char *argv[])
 {
Index: bin/pg_dump/pg_restore.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v
retrieving revision 1.84
diff -u -r1.84 pg_restore.c
--- bin/pg_dump/pg_restore.c	14 Oct 2006 23:07:22 -0000	1.84
+++ bin/pg_dump/pg_restore.c	28 Sep 2007 14:09:59 -0000
@@ -64,6 +64,19 @@

 typedef struct option optType;

+/*
+ * We need to include OpenSSL's applink code with OpenSSL 0.9.8+ on Windows
+ * It needs to be included in every .exe so we include it here.
+ */
+#ifdef WIN32
+#ifdef USE_SSL
+#include <openssl/opensslv.h>
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+#include <openssl/applink.c>
+#endif
+#endif
+#endif
+
 int
 main(int argc, char **argv)
 {
Index: bin/psql/startup.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/startup.c,v
retrieving revision 1.141
diff -u -r1.141 startup.c
--- bin/psql/startup.c	8 Jul 2007 19:07:38 -0000	1.141
+++ bin/psql/startup.c	28 Sep 2007 14:07:02 -0000
@@ -95,6 +95,18 @@
 #endif

 /*
+ * We need to include OpenSSL's applink code with OpenSSL 0.9.8+ on Windows
+ */
+#ifdef WIN32
+#ifdef USE_SSL
+#include <openssl/opensslv.h>
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+#include <openssl/applink.c>
+#endif
+#endif
+#endif
+
+/*
  *
  * main
  *
Index: bin/scripts/clusterdb.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/scripts/clusterdb.c,v
retrieving revision 1.18
diff -u -r1.18 clusterdb.c
--- bin/scripts/clusterdb.c	4 Jun 2007 10:02:40 -0000	1.18
+++ bin/scripts/clusterdb.c	28 Sep 2007 14:11:03 -0000
@@ -24,6 +24,18 @@

 static void help(const char *progname);

+/*
+ * We need to include OpenSSL's applink code with OpenSSL 0.9.8+ on Windows
+ * It needs to be included in every .exe so we include it here.
+ */
+#ifdef WIN32
+#ifdef USE_SSL
+#include <openssl/opensslv.h>
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+#include <openssl/applink.c>
+#endif
+#endif
+#endif

 int
 main(int argc, char *argv[])
Index: bin/scripts/createdb.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/scripts/createdb.c,v
retrieving revision 1.23
diff -u -r1.23 createdb.c
--- bin/scripts/createdb.c	4 Jun 2007 10:02:40 -0000	1.23
+++ bin/scripts/createdb.c	28 Sep 2007 14:11:03 -0000
@@ -19,6 +19,18 @@

 static void help(const char *progname);

+/*
+ * We need to include OpenSSL's applink code with OpenSSL 0.9.8+ on Windows
+ * It needs to be included in every .exe so we include it here.
+ */
+#ifdef WIN32
+#ifdef USE_SSL
+#include <openssl/opensslv.h>
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+#include <openssl/applink.c>
+#endif
+#endif
+#endif

 int
 main(int argc, char *argv[])
Index: bin/scripts/createlang.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/scripts/createlang.c,v
retrieving revision 1.26
diff -u -r1.26 createlang.c
--- bin/scripts/createlang.c	10 Aug 2007 00:39:31 -0000	1.26
+++ bin/scripts/createlang.c	28 Sep 2007 14:11:03 -0000
@@ -16,6 +16,18 @@

 static void help(const char *progname);

+/*
+ * We need to include OpenSSL's applink code with OpenSSL 0.9.8+ on Windows
+ * It needs to be included in every .exe so we include it here.
+ */
+#ifdef WIN32
+#ifdef USE_SSL
+#include <openssl/opensslv.h>
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+#include <openssl/applink.c>
+#endif
+#endif
+#endif

 int
 main(int argc, char *argv[])
Index: bin/scripts/createuser.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/scripts/createuser.c,v
retrieving revision 1.36
diff -u -r1.36 createuser.c
--- bin/scripts/createuser.c	4 Jun 2007 10:02:40 -0000	1.36
+++ bin/scripts/createuser.c	28 Sep 2007 14:11:03 -0000
@@ -24,6 +24,19 @@
 	TRI_YES
 };

+/*
+ * We need to include OpenSSL's applink code with OpenSSL 0.9.8+ on Windows
+ * It needs to be included in every .exe so we include it here.
+ */
+#ifdef WIN32
+#ifdef USE_SSL
+#include <openssl/opensslv.h>
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+#include <openssl/applink.c>
+#endif
+#endif
+#endif
+
 int
 main(int argc, char *argv[])
 {
Index: bin/scripts/dropdb.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/scripts/dropdb.c,v
retrieving revision 1.20
diff -u -r1.20 dropdb.c
--- bin/scripts/dropdb.c	4 Jun 2007 10:02:40 -0000	1.20
+++ bin/scripts/dropdb.c	28 Sep 2007 14:11:03 -0000
@@ -17,6 +17,18 @@

 static void help(const char *progname);

+/*
+ * We need to include OpenSSL's applink code with OpenSSL 0.9.8+ on Windows
+ * It needs to be included in every .exe so we include it here.
+ */
+#ifdef WIN32
+#ifdef USE_SSL
+#include <openssl/opensslv.h>
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+#include <openssl/applink.c>
+#endif
+#endif
+#endif

 int
 main(int argc, char *argv[])
Index: bin/scripts/droplang.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/scripts/droplang.c,v
retrieving revision 1.23
diff -u -r1.23 droplang.c
--- bin/scripts/droplang.c	10 Aug 2007 00:39:31 -0000	1.23
+++ bin/scripts/droplang.c	28 Sep 2007 14:11:03 -0000
@@ -19,6 +19,18 @@

 static void help(const char *progname);

+/*
+ * We need to include OpenSSL's applink code with OpenSSL 0.9.8+ on Windows
+ * It needs to be included in every .exe so we include it here.
+ */
+#ifdef WIN32
+#ifdef USE_SSL
+#include <openssl/opensslv.h>
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+#include <openssl/applink.c>
+#endif
+#endif
+#endif

 int
 main(int argc, char *argv[])
Index: bin/scripts/dropuser.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/scripts/dropuser.c,v
retrieving revision 1.21
diff -u -r1.21 dropuser.c
--- bin/scripts/dropuser.c	4 Jun 2007 10:02:40 -0000	1.21
+++ bin/scripts/dropuser.c	28 Sep 2007 14:11:03 -0000
@@ -17,6 +17,18 @@

 static void help(const char *progname);

+/*
+ * We need to include OpenSSL's applink code with OpenSSL 0.9.8+ on Windows
+ * It needs to be included in every .exe so we include it here.
+ */
+#ifdef WIN32
+#ifdef USE_SSL
+#include <openssl/opensslv.h>
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+#include <openssl/applink.c>
+#endif
+#endif
+#endif

 int
 main(int argc, char *argv[])
Index: bin/scripts/reindexdb.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/scripts/reindexdb.c,v
retrieving revision 1.11
diff -u -r1.11 reindexdb.c
--- bin/scripts/reindexdb.c	4 Jun 2007 10:02:40 -0000	1.11
+++ bin/scripts/reindexdb.c	28 Sep 2007 14:11:03 -0000
@@ -29,6 +29,19 @@
 						const char *progname, bool echo);
 static void help(const char *progname);

+/*
+ * We need to include OpenSSL's applink code with OpenSSL 0.9.8+ on Windows
+ * It needs to be included in every .exe so we include it here.
+ */
+#ifdef WIN32
+#ifdef USE_SSL
+#include <openssl/opensslv.h>
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+#include <openssl/applink.c>
+#endif
+#endif
+#endif
+
 int
 main(int argc, char *argv[])
 {
Index: bin/scripts/vacuumdb.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/scripts/vacuumdb.c,v
retrieving revision 1.18
diff -u -r1.18 vacuumdb.c
--- bin/scripts/vacuumdb.c	4 Jun 2007 10:02:40 -0000	1.18
+++ bin/scripts/vacuumdb.c	28 Sep 2007 14:11:03 -0000
@@ -26,6 +26,18 @@

 static void help(const char *progname);

+/*
+ * We need to include OpenSSL's applink code with OpenSSL 0.9.8+ on Windows
+ * It needs to be included in every .exe so we include it here.
+ */
+#ifdef WIN32
+#ifdef USE_SSL
+#include <openssl/opensslv.h>
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+#include <openssl/applink.c>
+#endif
+#endif
+#endif

 int
 main(int argc, char *argv[])
