Dan Fandrich:
authorDaniel Stenberg <daniel@haxx.se>
Sat, 11 Dec 2004 18:47:22 +0000 (18:47 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 11 Dec 2004 18:47:22 +0000 (18:47 +0000)
Here's a stab at a consolidation of the SSL detection heuristics into
configure. Source files aren't changed by this patch, except for setup.h and
the various config*.h files.  Within the configure script, OPENSSL_ENABLED is
used to determine if SSL is being used or not, and outside configure,
USE_SSLEAY means the same thing; this could be even further unified some day.

Now, when SSL is not detected, configure skips the various checks that are
dependent on SSL, speeding up the configure process and avoiding complications
with cross compiles.  I also updated all the architecture- specific config
files I could see, but I couldn't test them.

configure.ac
curl-config.in
lib/Makefile.netware
lib/config-amigaos.h
lib/config-riscos.h
lib/config-vms.h
lib/config.dj
lib/setup.h
packages/vms/config-vms.h_with_ssl
packages/vms/config-vms.h_without_ssl
src/config-riscos.h

index b204653..d7f4c1f 100644 (file)
@@ -434,35 +434,6 @@ AC_HELP_STRING([--disable-nonblocking],[Disable non-blocking socket detection]),
 ])
 
 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 @@ else
     ])
 
 
-  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
         else
             AC_MSG_RESULT(yes)
         fi
-    fi
 
+    else
 
-    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)
-
-    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,10 +860,7 @@ AC_HELP_STRING([--without-ca-bundle], [Don't install the CA bundle]),
 
   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!])
-  elif test "$OPENSSL_ENABLED" = "1"; then
+  if test "$OPENSSL_ENABLED" = "1"; then
     dnl when the ssl shared libs were found in a path that the run-time linker
     dnl doesn't search through, we need to add it to LD_LIBRARY_PATH to
     dnl prevent further configure tests to fail due to this
@@ -885,6 +873,38 @@ 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 **********************************************************************
 
@@ -1560,7 +1580,8 @@ AC_CONFIG_FILES([Makefile \
            packages/EPM/curl.list \
            packages/EPM/Makefile \
            packages/vms/Makefile \
-           curl-config
+           curl-config \
+           libcurl.pc
 ])
 AC_OUTPUT
 
index bc8a012..ef78027 100644 (file)
@@ -45,19 +45,19 @@ while test $# -gt 0; do
 
     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
index b7554ca..35c7932 100644 (file)
@@ -353,6 +353,7 @@ ifdef ZLIB_PATH
 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) >> $@
index 5d617fe..387adeb 100644 (file)
@@ -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"
index e6e44b0..85dec3e 100644 (file)
@@ -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
 
index 8375107..c9f931f 100755 (executable)
 /* 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
index bfcf9f6..f2d38d3 100644 (file)
@@ -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.
index 1c08857..8530f02 100644 (file)
@@ -113,23 +113,6 @@ typedef unsigned char bool;
 #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
index e47acbe..e3bc60d 100755 (executable)
 /* 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
index 5b87c1d..d7649bb 100755 (executable)
 /* 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
index 46de289..1660214 100644 (file)
@@ -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