From fa42be30ae59519c80e8f0d524bc7d841a239fd3 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Thu, 31 May 2012 12:40:26 +0000 Subject: [PATCH] Change configure.in to enable SSL by default, if libssl is present. Can still be disabled with --without-ssl. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@201 13b04d17-f746-0410-82c6-800466cd88b0 --- Changelog | 2 ++ configure.in | 45 +++++++++++++++++++++++++++++++-------------- include/defs.h.in | 5 ++++- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/Changelog b/Changelog index 59d2129..e4f6f21 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2c01] +* Enable SSL support by default, if OpenSSL is present at build time. (caf) + * Fix leak and potential crash in lame_resolv() using IPv6. (caf, snadge) * Apply patch from snadge defining BIND_4_COMPAT on OpenBSD, to allow diff --git a/configure.in b/configure.in index 9ca98ad..2545bd1 100644 --- a/configure.in +++ b/configure.in @@ -537,27 +537,44 @@ AC_MSG_RESULT(no) dnl Check for SSL support. AC_MSG_CHECKING(whether to enable SSL support) AC_ARG_WITH(ssl, -[ --with-ssl=PFX Enable SSL support (Prefix is optional)], -[ case "$withval" in +[[ --with-ssl[=PATH] Enable SSL support (enabled by default if OpenSSL found)]], +[], [with_ssl=check]) + +case "$with_ssl" in yes) AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SSL, 1, Define this is the system has SSL support.) - LIBS="$LIBS -lssl -lcrypto" - AC_CHECK_LIB(ssl, SSL_accept,,AC_MSG_ERROR(Could not find OpenSSL.)) + ;; + check) + AC_MSG_RESULT(if available) ;; no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SSL, 1, Define this is the system has SSL support.) - LIBS="$LIBS -L${withval}/lib -lssl -lcrypto" - CFLAGS="$CFLAGS -I${withval}/include" - AC_CHECK_LIB(ssl, SSL_accept,,AC_MSG_ERROR(Could not find OpenSSL.)) + CFLAGS="$CFLAGS -I${with_ssl}/include" + LDFLAGS="$LDFLAGS -L${with_ssl}/lib" + with_ssl=yes ;; - esac ], -AC_MSG_RESULT(no) -) +esac +case "$with_ssl" in + yes|check) + AC_CHECK_LIB([crypto], [SSLeay], [], [], []) + if test x"$ac_cv_lib_crypto_SSLeay" = x"yes"; then + AC_CHECK_LIB([ssl], [SSL_accept], [], [], []) + fi + if test x"$ac_cv_lib_ssl_SSL_accept" = x"yes"; then + dnl This would be unnecessary if we used HAVE_LIBSSL in the code + AC_DEFINE(HAVE_SSL, 1, Define this if the system has SSL support.) + else + if test x"$with_ssl" = x"yes"; then + AC_MSG_FAILURE([--with-ssl given, but could not find OpenSSL.]) + else + AC_MSG_WARN([OpenSSL not found, will not have SSL support.]) + fi + fi + ;; +esac dnl Now that we've checked for PM and GTK support, make sure dnl that we "#define GUI" and and that we don't build wserv or @@ -920,9 +937,9 @@ AC_MSG_RESULT(no) dnl Check for plugin support and which plugins to build. AC_MSG_CHECKING(whether to enable plugin support) AC_ARG_WITH(plugins, -[ --with-plugins[=LIST] Enable plugin support +[[ --with-plugins[=LIST] Enable plugin support LIST is a comma separated list of plugins to build - If none are specified, all available plugins are built], + If none are specified, all available plugins are built]], [ case "$withval" in yes | all) AC_MSG_RESULT(yes) diff --git a/include/defs.h.in b/include/defs.h.in index fee95a3..02d1568 100644 --- a/include/defs.h.in +++ b/include/defs.h.in @@ -129,6 +129,9 @@ /* Define to 1 if you have the `killpg' function. */ #undef HAVE_KILLPG +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#undef HAVE_LIBCRYPTO + /* Define to 1 if you have the Windows iphlpapi library */ #undef HAVE_LIBIPHLPAPI @@ -204,7 +207,7 @@ /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET -/* Define this is the system has SSL support. */ +/* Define this if the system has SSL support. */ #undef HAVE_SSL /* Define to 1 if you have the header file. */