$OpenBSD: patch-configure_ac,v 1.32 2013/03/08 01:03:09 brad Exp $ --- configure.ac.orig Mon Feb 11 04:16:51 2013 +++ configure.ac Wed Feb 13 14:55:45 2013 @@ -1334,7 +1334,6 @@ if test "x$GCC" = "xyes"; then fi DEBUG_CFLAGS="-Wall $DEBUG_CFLAGS" - CFLAGS="-g $CFLAGS" fi if test "x$SUNCC" = "xyes"; then @@ -1703,6 +1702,11 @@ AM_CONDITIONAL(INSTALL_SSL_CERTIFICATES, test "x$SSL_C dnl These two are inverses of each other <-- stolen from evolution! +AC_ARG_ENABLE(openssl, + [ --enable-openssl=[yes,no] attempt to use OpenSSL for SSL support [default=yes]], + [enable_openssl="$enableval"], + [enable_openssl="yes"]) + AC_ARG_ENABLE(gnutls, [ --enable-gnutls=[yes,no] attempt to use GnuTLS for SSL support [default=yes]], [enable_gnutls="$enableval"], @@ -1713,10 +1717,98 @@ AC_ARG_ENABLE(nss, [enable_nss="$enableval"], [enable_nss="yes"]) -msg_ssl="None. MSN, Yahoo!, Novell Groupwise and Google Talk will not work without GnuTLS or NSS. OpenSSL is NOT usable!" +msg_ssl="None. MSN, Yahoo!, Novell Groupwise and Google Talk will not work without OpenSSL, GnuTLS or NSS." + + +dnl # Check for OpenSSL if it's specified. +dnl # +looked_for_openssl="no" +if test "x$enable_openssl" != "xno"; then + enable_openssl="no" + prefix=`eval echo $prefix` + looked_for_openssl="yes" + + AC_ARG_WITH(openssl-includes, + [ --with-openssl-includes=PREFIX location of OpenSSL includes.], + [ with_openssl_includes="$withval" ], + [ with_openssl_includes="$prefix/include" ]) + + have_openssl_includes="no" + + if test "x$with_openssl_includes" != "xno"; then + CPPFLAGS_save="$CPPFLAGS" + + AC_MSG_CHECKING(for OpenSSL includes) + AC_MSG_RESULT("") + + CPPFLAGS="$CPPFLAGS -I$with_openssl_includes" + AC_CHECK_HEADERS(openssl/ssl.h, [ openssl_includes="yes" ]) + CPPFLAGS="$CPPFLAGS_save" + + if test "x$openssl_includes" != "xno" -a \ + "x$openssl_includes" != "x"; then + have_openssl_includes="yes" + + OPENSSL_CFLAGS="-I$with_openssl_includes" + else + OPENSSL_CFLAGS="" + fi + else + AC_MSG_CHECKING(for OpenSSL includes) + AC_MSG_RESULT(no) + fi + + AC_ARG_WITH(openssl-libs, + [AC_HELP_STRING([--with-openssl-libs=PREFIX], [location of OpenSSL libraries.])], + [ with_openssl_libs="$withval" ]) + + if test "x$with_openssl_libs" != "xno" -a \ + "x$have_openssl_includes" != "xno"; then + + LIBS_save="$LIBS" + + case $with_openssl_libs in + ""|-L*) ;; + *) with_openssl_libs="-L$with_openssl_libs" ;; + esac + + AC_CACHE_CHECK([for OpenSSL libraries], ac_cv_openssl_libs, + [ + LIBS="$LIBS $with_openssl_libs -lssl -lcrypto" + AC_TRY_LINK_FUNC(SSL_library_init, ac_cv_openssl_libs="yes", ac_cv_openssl_libs="no") + LIBS="$LIBS_save" + ]) + + if test "x$ac_cv_openssl_libs" != "xno"; then + AC_DEFINE(HAVE_OPENSSL, 1, [Define if you have OpenSSL]) + AC_DEFINE(HAVE_SSL) + msg_openssl="OpenSSL" + OPENSSL_LIBS="$with_openssl_libs -lssl -lcrypto" + + enable_openssl="yes" + else + OPENSSL_CFLAGS="" + OPENSSL_LIBS="" + fi + else + AC_MSG_CHECKING(for OpenSSL libraries) + AC_MSG_RESULT(no) + fi +else + OPENSSL_CFLAGS="" + OPENSSL_LIBS="" +fi + +AC_SUBST(OPENSSL_CFLAGS) +AC_SUBST(OPENSSL_LIBS) + +AM_CONDITIONAL(USE_OPENSSL, test "x$enable_openssl" = "xyes") + + +dnl # looked_for_gnutls="no" dnl # -dnl # Check for GnuTLS if it's specified. +dnl # Check for GnuTLS if it's specified, or if OpenSSL checks failed. dnl # if test "x$enable_gnutls" != "xno"; then enable_gnutls="no" @@ -2114,17 +2206,32 @@ fi AM_CONDITIONAL(USE_NSS, test "x$enable_nss" = "xyes") -if test "x$msg_nss" != "x" -a "x$msg_gnutls" != "x"; then +if test "x$msg_nss" != "x" -a "x$msg_gnutls" != "x" -a "x$msg_openssl" != "x"; then + msg_ssl="$msg_nss, $msg_gnutls and $msg_openssl" +elif test "x$msg_nss" != "x" -a "x$msg_gnutls" != "x"; then msg_ssl="$msg_nss and $msg_gnutls" +elif test "x$msg_nss" != "x" -a "x$msg_openssl" != "x"; then + msg_ssl="$msg_nss and $msg_openssl" +elif test "x$msg_gnutls" != "x" -a "x$msg_openssl" != "x"; then + msg_ssl="$msg_gnutls and $msg_openssl" elif test "x$msg_nss" != "x"; then msg_ssl=$msg_nss elif test "x$msg_gnutls" != "x"; then msg_ssl=$msg_gnutls -elif test "x$looked_for_gnutls" = "xyes" -a "x$looked_for_nss" = "xyes" -a "x$force_deps" = "xyes" ; then +elif test "x$msg_openssl" != "x"; then + msg_ssl=$msg_openssl +elif test "x$looked_for_openssl" = "xyes" -a "x$looked_for_gnutls" = "xyes" -a "x$looked_for_nss" = "xyes" -a "x$force_deps" = "xyes" ; then AC_MSG_ERROR([ -Neither GnuTLS or NSS SSL development headers found. -Use --disable-nss --disable-gnutls if you do not need SSL support. -MSN, Yahoo!, Novell Groupwise and Google Talk will not work without GnuTLS or NSS. OpenSSL is NOT usable! +OpenSSL, GnuTLS or NSS SSL development headers found. +Use --disable-openssl --disable-nss --disable-gnutls if you do not need SSL support. +MSN, Yahoo!, Novell Groupwise and Google Talk will not work without OpenSSL, GnuTLS or NSS. +]) + +elif test "x$looked_for_openssl" = "xyes" -a "$force_deps" = "xyes" ; then + AC_MSG_ERROR([ +OpenSSL SSL development headers not found. +Use --disable-openssl if you do not need SSL support. +MSN, Yahoo!, Novell Groupwise and Google Talk will not work without SSL support. ]) elif test "x$looked_for_gnutls" = "xyes" -a "x$force_deps" = "xyes" ; then AC_MSG_ERROR([