Commit df3ca591 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

Dan Fandrich:

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.
parent 3ca4509a
Loading
Loading
Loading
Loading
+68 −47
Original line number Diff line number Diff line
@@ -433,35 +433,6 @@ AC_HELP_STRING([--disable-nonblocking],[Disable non-blocking socket detection]),
  CURL_CHECK_NONBLOCKING_SOCKET
])

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
      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
@@ -884,6 +872,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

+4 −4
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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) >> $@
+3 −0
Original line number Diff line number Diff line
@@ -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"
+0 −3
Original line number Diff line number Diff line
@@ -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

Loading