--- lib/Makefile.m32.orig	Wed Sep 11 07:53:45 2002
+++ lib/Makefile.m32	Mon Oct 28 13:23:10 2002
@@ -2,3 +2,3 @@
 #
-## Makefile for building libcurl.a with MingW32 (GCC-2.95) and
+## Makefile for building libcurl.a with MingW32 (GCC-3.2) and
 ## optionally OpenSSL (0.9.6)
@@ -11,5 +11,6 @@
 AR = ar
+RM = rm -f 
 RANLIB = ranlib
 STRIP = strip -g
-OPENSSL_PATH = ../../openssl-0.9.6d
+OPENSSL_PATH = ../../openssl-0.9.6g
 ZLIB_PATH = ../../zlib-1.1.3
@@ -62,3 +63,3 @@
 libcurl.a: $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
-	-@erase libcurl.a
+	$(RM) libcurl.a
 	$(AR) cru libcurl.a $(libcurl_a_OBJECTS)
@@ -70,3 +71,3 @@
 libcurl.dll libcurldll.a: libcurl.a libcurl.def dllinit.o
-	-@erase $@
+	$(RM) $@
 	dllwrap --dllname $@ --output-lib libcurldll.a --export-all --def libcurl.def $(libcurl_a_LIBRARIES) dllinit.o $(DLL_LIBS) -lwsock32 -lws2_32 -lwinmm
@@ -86,3 +87,3 @@
 clean:
-	-@erase $(libcurl_a_OBJECTS)
+	$(RM) $(libcurl_a_OBJECTS)
 
@@ -90,3 +91,3 @@
 
-	-@erase $(libcurl_a_LIBRARIES)
+	$(RM) $(libcurl_a_LIBRARIES)
 
--- src/Makefile.m32.orig	Wed Sep 11 07:54:48 2002
+++ src/Makefile.m32	Mon Oct 28 13:26:24 2002
@@ -3,3 +3,3 @@
 #
-## Makefile for building curl.exe with MingW32 (GCC-2.95) and
+## Makefile for building curl.exe with MingW32 (GCC-3.2) and
 ## optionally OpenSSL (0.9.6)
@@ -12,4 +12,5 @@
 CC = gcc
+RM = rm -f
 STRIP = strip -s
-OPENSSL_PATH = ../../openssl-0.9.6d
+OPENSSL_PATH = ../../openssl-0.9.6g
 ZLIB_PATH = ../../zlib-1.1.3
@@ -25,2 +26,5 @@
 CFLAGS = -g -O2 -DMINGW32
+ifdef SSL
+  CFLAGS += -DUSE_SSLEAY
+endif
 LDFLAGS = 
@@ -54,3 +58,3 @@
 curl.exe: $(curl_OBJECTS) $(curl_DEPENDENCIES)
-	-@erase $@
+	$(RM) $@
 	$(LINK) $(curl_OBJECTS) $(curl_LDADD)
@@ -60,3 +64,3 @@
 # hugehelp.c: ../README.curl ../curl.1 mkhelp.pl
-# 	-@erase hugehelp.c
+# 	$(RM) hugehelp.c
 # 	$(NROFF) -man ../curl.1 | $(PERL) mkhelp.pl ../README.curl > hugehelp.c
@@ -73,5 +77,5 @@
 clean:
-	-@erase $(curl_OBJECTS)
+	$(RM) $(curl_OBJECTS)
 
 distrib: clean
-	-@erase $(curl_PROGRAMS)
+	$(RM) $(curl_PROGRAMS)
--- src/main.c.orig	Mon Oct 28 13:22:42 2002
+++ src/main.c	Mon Oct 28 13:22:50 2002
@@ -2246,6 +2246,32 @@
 }
 
 
+/* Function to find CACert bundle on a Win32 platform using SearchPath.
+ * (SearchPath is defined in windows.h, which is #included into libcurl)
+ * (Use the ASCII version instead of the unicode one!)
+ * The order of the directories it searches is:
+ *  1. application's directory
+ *  2. current working directory
+ *  3. Windows System directory (e.g. C:\windows\system32)
+ *  4. Windows Directory (e.g. C:\windows)
+ *  5. all directories along %PATH%
+ */
+static void FindWin32CACert(struct Configurable *config, 
+                            const char *bundle_file)
+{
+  DWORD buflen;
+  char *ptr = NULL;
+  char *retval = (char *) malloc(sizeof (TCHAR) * (MAX_PATH + 1));
+  if (!retval)
+    return;
+  retval[0] = '\0';
+  buflen = SearchPathA(NULL, bundle_file, NULL, MAX_PATH+2, retval, &ptr);
+  if (buflen > 0) {
+    GetStr(&config->cacert, retval);
+  }
+  free(retval);
+}
+
 static int 
 operate(struct Configurable *config, int argc, char *argv[])
 {
@@ -2280,9 +2306,9 @@
   int res = 0;
   int i;
 
+  char *env;
 #ifdef MALLOCDEBUG
   /* this sends all memory debug messages to a logfile named memdump */
-  char *env;
   env = curl_getenv("CURL_MEMDEBUG");
   if(env) {
     free(env);
@@ -2383,6 +2409,24 @@
   }
   else
     allocuseragent = TRUE;
+
+#if defined(USE_SSLEAY) && defined(WIN32) && !defined(__CYGWIN32__)
+  /* On WIN32 (non-cygwin), we can't set the path to curl-ca-bundle.crt
+   * at compile time. So we look here for the file in two ways:
+   * 1: look at the environment variable CURL_CA_BUNDLE for a path
+   * 2: if #1 isn't found, use the windows API function SearchPath()
+   *    to find it along the app's path (includes app's dir and CWD)
+   */
+  if (! config->cacert) {
+    env = curl_getenv("CURL_CA_BUNDLE");
+    if(env) {
+      GetStr(&config->cacert, env);
+      free(env);
+    }
+  }
+  if (! config->cacert)
+    FindWin32CACert(config, "curl-ca-bundle.crt");
+#endif
 
   if (config->postfields) {
     if (config->use_httpget) {
