--- configure.ac.orig	Sun Dec  5 18:59:57 2004
+++ configure.ac	Thu Dec  9 13:27:54 2004
@@ -434,35 +434,6 @@
 ])
 
 dnl **********************************************************************
-dnl Check for the random seed preferences 
-dnl **********************************************************************
-
-AC_ARG_WITH(egd-socket,
-AC_HELP_STRING([--with-egd-socket=FILE],
-               [Entropy Gathering Daemon socket pathname]),
-    [ EGD_SOCKET="$withval" ]
-)
-if test -n "$EGD_SOCKET" ; then
-	AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
-        [your Entropy Gathering Daemon socket pathname] )
-fi
-
-dnl Check for user-specified random device
-AC_ARG_WITH(random,
-AC_HELP_STRING([--with-random=FILE],[read randomness from FILE (default=/dev/urandom)]),
-    [ RANDOM_FILE="$withval" ],
-    [
-        dnl Check for random device
-        AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
-    ]
-)
-if test -n "$RANDOM_FILE" ; then
-	AC_SUBST(RANDOM_FILE)
-	AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
-        [a suitable file to read random data from])
-fi
-
-dnl **********************************************************************
 dnl Check if the operating system allows programs to write to their own argv[]
 dnl **********************************************************************
 
@@ -781,7 +752,10 @@
     ])
 
 
-  if test "$HAVECRYPTO" = "yes"; then
+  if test X"$HAVECRYPTO" != X"yes"; then
+      AC_MSG_WARN([crypto lib was not found; SSL will be disabled])
+
+  else
     dnl This is only reasonable to do if crypto actually is there: check for
     dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
 
@@ -815,27 +789,44 @@
         else
             AC_MSG_RESULT(yes)
         fi
-    fi
-
 
-    dnl Check for SSLeay headers
-    AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
-                     openssl/pem.h openssl/ssl.h openssl/err.h,
-      curl_ssl_msg="enabled"
-      OPENSSL_ENABLED=1)
+    else
 
-    if test $ac_cv_header_openssl_x509_h = no; then
-      AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h,
+      dnl Have the libraries--check for SSLeay/OpenSSL headers
+      AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
+                       openssl/pem.h openssl/ssl.h openssl/err.h,
         curl_ssl_msg="enabled"
-        OPENSSL_ENABLED=1)
+        OPENSSL_ENABLED=1
+        AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
+
+      if test $ac_cv_header_openssl_x509_h = no; then
+        AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h,
+          curl_ssl_msg="enabled"
+          OPENSSL_ENABLED=1)
+      fi
     fi
 
+    USE_SSLEAY="$OPENSSL_ENABLED"
+    AC_DEFINE_UNQUOTED(USE_SSLEAY, $USE_SSLEAY, [if SSL is enabled])
+    AC_SUBST(USE_SSLEAY)
+    AC_SUBST(USE_OPENSSL)
+
+    if test X"$OPT_SSL" != Xoff &&
+       test "$OPENSSL_ENABLED" != "1"; then
+      AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
+    fi
+  fi
+
+
+dnl **********************************************************************
+dnl Check for the CA bundle
+dnl **********************************************************************
+
+  if test X"$OPENSSL_ENABLED" = X"1"; then
     dnl If the ENGINE library seems to be around, check for the OpenSSL engine
     dnl header, it is kind of "separated" from the main SSL check
     AC_CHECK_FUNC(ENGINE_init, [ AC_CHECK_HEADERS(openssl/engine.h) ])
 
-    AC_SUBST(OPENSSL_ENABLED)
-
     AC_MSG_CHECKING([CA cert bundle install path])
 
     AC_ARG_WITH(ca-bundle,
@@ -869,16 +860,42 @@
 
   fi
 
-  if test X"$OPT_SSL" != Xoff &&
-     test "$OPENSSL_ENABLED" != "1"; then
-    AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
-  fi
-
 fi
 
 AM_CONDITIONAL(CABUNDLE, test x$ca != xno)
 
 dnl **********************************************************************
+dnl Check for the random seed preferences 
+dnl **********************************************************************
+
+if test X"$OPENSSL_ENABLED" = X"1"; then
+  AC_ARG_WITH(egd-socket,
+  AC_HELP_STRING([--with-egd-socket=FILE],
+                 [Entropy Gathering Daemon socket pathname]),
+      [ EGD_SOCKET="$withval" ]
+  )
+  if test -n "$EGD_SOCKET" ; then
+          AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
+          [your Entropy Gathering Daemon socket pathname] )
+  fi
+
+  dnl Check for user-specified random device
+  AC_ARG_WITH(random,
+  AC_HELP_STRING([--with-random=FILE],[read randomness from FILE (default=/dev/urandom)]),
+      [ RANDOM_FILE="$withval" ],
+      [
+          dnl Check for random device
+          AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
+      ]
+  )
+  if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
+          AC_SUBST(RANDOM_FILE)
+          AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
+          [a suitable file to read random data from])
+  fi
+fi
+
+dnl **********************************************************************
 dnl Check for the presence of ZLIB libraries and headers
 dnl **********************************************************************
 
@@ -1554,7 +1571,8 @@
            packages/EPM/curl.list \
            packages/EPM/Makefile \
            packages/vms/Makefile \
-           curl-config
+           curl-config \
+           libcurl.pc
 ])
 AC_OUTPUT
 
--- curl-config.in.orig	Mon Dec  8 02:00:21 2003
+++ curl-config.in	Thu Dec  9 12:59:07 2004
@@ -45,19 +45,19 @@
 
     case "$1" in
     --ca)
-	echo @CURL_CA_BUNDLE@
+	echo "@CURL_CA_BUNDLE@"
 	;;
 
     --cc)
-	echo @CC@
+	echo "@CC@"
 	;;
 
     --prefix)
-	echo $prefix
+	echo "$prefix"
 	;;
 
     --feature)
-	if test "@OPENSSL_ENABLED@" = "1"; then
+	if test "@USE_SSLEAY@" = "1"; then
           echo "SSL"
         fi
 	if test "@KRB4_ENABLED@" = "1"; then
--- lib/config.h.in.orig	Sun Dec  5 19:00:20 2004
+++ lib/config.h.in	Thu Dec  9 11:32:15 2004
@@ -534,6 +534,12 @@
 /* If you want to build curl with the built-in manual */
 #undef USE_MANUAL
 
+/* if OpenSSL is in use */
+#undef USE_OPENSSL
+
+/* if SSL is enabled */
+#undef USE_SSLEAY
+
 /* Version number of package */
 #undef VERSION
 
--- lib/setup.h.orig	Fri Nov 26 19:00:06 2004
+++ lib/setup.h	Thu Dec  9 11:11:04 2004
@@ -113,23 +113,6 @@
 #include <floss.h>
 #endif
 
-#if defined(HAVE_X509_H) && defined(HAVE_SSL_H) && defined(HAVE_RSA_H) && \
-defined(HAVE_PEM_H) && defined(HAVE_ERR_H) && defined(HAVE_CRYPTO_H) && \
-defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
-  /* the six important includes files all exist and so do both libs,
-     defined SSLeay usage */
-#define USE_SSLEAY 1
-#endif
-#if defined(HAVE_OPENSSL_X509_H) && defined(HAVE_OPENSSL_SSL_H) && \
-defined(HAVE_OPENSSL_RSA_H) && defined(HAVE_OPENSSL_PEM_H) && \
-defined(HAVE_OPENSSL_ERR_H) && defined(HAVE_OPENSSL_CRYPTO_H) && \
-defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
-  /* the six important includes files all exist and so do both libs,
-     defined SSLeay usage */
-#define USE_SSLEAY 1
-#define USE_OPENSSL 1
-#endif
-
 #ifndef STDC_HEADERS /* no standard C headers! */
 #include <curl/stdcheaders.h>
 #endif
--- src/config-riscos.h.orig	Sun Apr 25 08:21:16 2004
+++ src/config-riscos.h	Thu Dec  9 13:18:34 2004
@@ -39,7 +39,7 @@
 #undef NEED_REENTRANT
 
 /* Define if you have the Kerberos4 libraries (including -ldes) */
-#undef KRB4
+#undef HAVE_KRB4
 
 /* Define if you want to enable IPv6 support */
 #undef ENABLE_IPV6
@@ -56,9 +56,6 @@
 /* Define this to your Entropy Gathering Daemon socket pathname */
 #undef EGD_SOCKET
 
-/* Define if you have a working OpenSSL installation */
-#undef OPENSSL_ENABLED
-
 /* Set to explicitly specify we don't want to use thread-safe functions */
 #define DISABLED_THREADSAFE
 
--- packages/vms/config-vms.h_without_ssl.orig	Wed Nov 24 19:00:06 2004
+++ packages/vms/config-vms.h_without_ssl	Thu Dec  9 13:21:28 2004
@@ -123,8 +123,11 @@
 /* OpenSSL section starts here */
 
 /* Define if you have a working OpenSSL installation */
-#undef OPENSSL_ENABLED
-#ifdef OPENSSL_ENABLED
+#undef USE_SSLEAY
+#ifdef USE_SSLEAY
+
+/* if OpenSSL is in use */
+#define USE_OPENSSL 1
 
 /* Define if you have the crypto library (-lcrypto).  */
 #define HAVE_LIBCRYPTO 1
--- packages/vms/config-vms.h_with_ssl.orig	Wed Nov 24 19:00:06 2004
+++ packages/vms/config-vms.h_with_ssl	Thu Dec  9 13:22:28 2004
@@ -123,8 +123,11 @@
 /* OpenSSL section starts here */
 
 /* Define if you have a working OpenSSL installation */
-#define OPENSSL_ENABLED	1
-#ifdef OPENSSL_ENABLED
+#define USE_SSLEAY 1
+#ifdef USE_SSLEAY
+
+/* if OpenSSL is in use */
+#define USE_OPENSSL 1
 
 /* Define if you have the crypto library (-lcrypto).  */
 #define HAVE_LIBCRYPTO 1
diff -ur lib/orig/config-amigaos.h lib/config-amigaos.h
--- lib/orig/config-amigaos.h	Thu Jan 22 04:45:50 2004
+++ lib/config-amigaos.h	Thu Dec  9 12:45:53 2004
@@ -55,6 +55,9 @@
 #define HAVE_WRITABLE_ARGV 1
 #define HAVE_ZLIB_H 1
 
+#define USE_OPENSSL 1
+#define USE_SSLEAY 1
+
 #define OS "AmigaOS"
 
 #define PACKAGE "curl"
diff -ur lib/orig/config-riscos.h lib/config-riscos.h
--- lib/orig/config-riscos.h	Mon Jan  5 14:29:32 2004
+++ lib/config-riscos.h	Thu Dec  9 13:17:36 2004
@@ -53,9 +53,6 @@
 /* Define this to your Entropy Gathering Daemon socket pathname */
 #undef EGD_SOCKET
 
-/* Define if you have a working OpenSSL installation */
-#undef OPENSSL_ENABLED
-
 /* Set to explicitly specify we don't want to use thread-safe functions */
 #define DISABLED_THREADSAFE
 
diff -ur lib/orig/config-vms.h lib/config-vms.h
--- lib/orig/config-vms.h	Wed Oct  6 19:00:05 2004
+++ lib/config-vms.h	Thu Dec  9 13:17:30 2004
@@ -343,8 +343,11 @@
 /* Define if you have the getpass function.  */
 #undef HAVE_GETPASS
 
-/* Define if you have a working OpenSSL installation */
-#define OPENSSL_ENABLED 1
+/* if OpenSSL is in use */
+#define USE_OPENSSL 1
+
+/* if SSL is enabled */
+#define USE_SSLEAY 1
 
 /* Define if you have the `dlopen' function. */
 #undef HAVE_DLOPEN
diff -ur lib/orig/config.dj lib/config.dj
--- lib/orig/config.dj	Tue Nov 30 19:00:06 2004
+++ lib/config.dj	Thu Dec  9 12:46:54 2004
@@ -90,6 +90,7 @@
   #define HAVE_LIBSSL            1
   #define HAVE_LIBCRYPTO         1
   #define OPENSSL_NO_KRB5        1
+  #define USE_OPENSSL            1
 #endif
 
 /* Because djgpp <= 2.03 doesn't have snprintf() etc.
--- lib/Makefile.netware.orig	Fri Nov 12 14:01:51 2004
+++ lib/Makefile.netware	Thu Dec  9 13:55:47 2004
@@ -353,6 +353,7 @@
 endif
 ifdef SSL
 	@echo $(DL)#define USE_SSLEAY 1$(DL) >> $@
+	@echo $(DL)#define USE_OPENSSL 1$(DL) >> $@
 	@echo $(DL)#define HAVE_OPENSSL_X509_H 1$(DL) >> $@
 	@echo $(DL)#define HAVE_OPENSSL_SSL_H 1$(DL) >> $@
 	@echo $(DL)#define HAVE_OPENSSL_RSA_H 1$(DL) >> $@
--- /dev/null	Thu Apr 11 07:25:15 2002
+++ libcurl.pc.in	Thu Dec  9 13:46:41 2004
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libcurl
+Description: Library to transfer files with ftp, http, etc.
+Version: @VERSION@
+Libs: -L${libdir} -lcurl @LDFLAGS@ @LIBS@
+Cflags: -I${includedir}

