$OpenBSD: patch-configure_ac,v 1.26 2011/07/09 12:46:31 dcoppa Exp $ --- configure.ac.orig Fri Mar 11 03:20:27 2011 +++ configure.ac Fri Jul 8 16:15:02 2011 @@ -972,7 +972,7 @@ else if test "$ac_silc_libs" != "no"; then SILC_LIBS="-L$ac_silc_libs" fi - SILC_LIBS="$SILC_LIBS -lsilc -lsilcclient -lpthread $LIBDL" + SILC_LIBS="$SILC_LIBS -lsilc -lsilcclient -pthread $LIBDL" AC_CHECK_LIB(silcclient, silc_client_init, [silcclient=yes], , $SILC_LIBS) if test "x$silcincludes" = "xyes" -a "x$silcclient" = "xyes"; then @@ -1328,7 +1328,6 @@ if test "x$GCC" = "xyes"; then fi DEBUG_CFLAGS="-Wall $DEBUG_CFLAGS" - CFLAGS="-g $CFLAGS" fi if test "x$SUNCC" = "xyes"; then @@ -1495,7 +1494,17 @@ if test "x$enable_consoleui" = "xyes" -a ! -z "$PYTHON changequote([, ])dnl if test -f $PY_PREFIX/include/python$PY_VERSION/Python.h -a "$PY_MAJOR" = "2."; then AC_MSG_RESULT() - AC_CHECK_LIB(pthread, pthread_create, ) + AC_CHECK_HEADER(pthread.h, have_pthread_h=yes) + if test "X$have_pthread_h" = "Xyes" ; then + LDFLAGS_save="${LDFLAGS}"; + LDFLAGS="${LDFLAGS} -pthread" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + pthread_t thr;]], + [pthread_create(&thr, NULL, NULL, NULL);])],, + [LDFLAGS="${LDFLAGS_save}"]) + fi AC_CHECK_LIB(util, openpty, ) AC_CHECK_LIB(db, dbopen, ) PY_LIBS="-L$PY_EXEC_PREFIX/lib/python$PY_VERSION/config -lpython$PY_VERSION" @@ -1697,6 +1706,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"], @@ -1707,10 +1721,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" @@ -2108,17 +2210,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([