Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 27152 invoked from network); 29 Apr 2010 23:49:42 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Apr 2010 23:49:42 -0000 Received: (qmail 6595 invoked by uid 500); 29 Apr 2010 23:49:41 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 6575 invoked by uid 500); 29 Apr 2010 23:49:41 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 6568 invoked by uid 99); 29 Apr 2010 23:49:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Apr 2010 23:49:41 +0000 X-ASF-Spam-Status: No, hits=-1234.0 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Apr 2010 23:49:40 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8173E23889B3; Thu, 29 Apr 2010 23:48:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r939512 - in /activemq/activemq-cpp/trunk/activemq-cpp: configure.ac m4/find_openssl.m4 Date: Thu, 29 Apr 2010 23:48:50 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100429234850.8173E23889B3@eris.apache.org> Author: tabish Date: Thu Apr 29 23:48:50 2010 New Revision: 939512 URL: http://svn.apache.org/viewvc?rev=939512&view=rev Log: https://issues.apache.org/activemq/browse/AMQCPP-140 Updated autoconf scripts with new Macros for locating OpenSSL if installed. Added: activemq/activemq-cpp/trunk/activemq-cpp/m4/find_openssl.m4 (with props) Modified: activemq/activemq-cpp/trunk/activemq-cpp/configure.ac Modified: activemq/activemq-cpp/trunk/activemq-cpp/configure.ac URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/configure.ac?rev=939512&r1=939511&r2=939512&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/configure.ac (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/configure.ac Thu Apr 29 23:48:50 2010 @@ -198,9 +198,22 @@ fi ## DECAF_CONFIGURE_DECAF - Future use for decaf as a standalone lib ## Flags for building the decaf cpp library ## find and configure the APR, and APR Utils +## find and configure the OpenSSL library if present + +AC_ARG_ENABLE([ssl], + [AS_HELP_STRING([--disable-ssl], + [disable SSL support (default is enabled if the OpenSSL libraries and headers are found)])], + [use_ssl=$enableval], + [use_ssl=yes]) + DECAF_CONFIGURE_APR -DECAF_CXXFLAGS="$APR_CPPFLAGS $APR_INCLUDES $APU_INCLUDES" -DECAF_LIBS="$APR_LIBS $APR_LDFLAGS $APU_LIBS $APU_LDFLAGS" + +if test "$use_ssl" = "yes"; then + DECAF_CONFIGURE_SSL +fi + +DECAF_CXXFLAGS="$APR_CPPFLAGS $APR_INCLUDES $APU_INCLUDES $OPENSSL_INCLUDES" +DECAF_LIBS="$APR_LIBS $APR_LDFLAGS $APU_LIBS $APU_LDFLAGS $OPENSSL_LIBS $OPENSSL_LDFLAGS" AC_SUBST([DECAF_CXXFLAGS]) AC_SUBST([DECAF_LIBS]) Added: activemq/activemq-cpp/trunk/activemq-cpp/m4/find_openssl.m4 URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/m4/find_openssl.m4?rev=939512&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/m4/find_openssl.m4 (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/m4/find_openssl.m4 Thu Apr 29 23:48:50 2010 @@ -0,0 +1,120 @@ +dnl -------------------------------------------------------- -*- autoconf -*- +dnl Copyright 2006 The Apache Software Foundation or its licensors, as +dnl applicable. +dnl +dnl Licensed under the Apache License, Version 2.0 (the "License"); +dnl you may not use this file except in compliance with the License. +dnl You may obtain a copy of the License at +dnl +dnl http://www.apache.org/licenses/LICENSE-2.0 +dnl +dnl Unless required by applicable law or agreed to in writing, software +dnl distributed under the License is distributed on an "AS IS" BASIS, +dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +dnl See the License for the specific language governing permissions and +dnl limitations under the License. +dnl -------------------------------------------------------- -*- autoconf -*- +dnl +dnl DECAF_CONFIGURE_SSL: look for OpenSSL libraries and headers +dnl +AC_DEFUN([DECAF_CONFIGURE_SSL], [ + decaf_have_ssl=0 + + AC_MSG_NOTICE([Checking if OpenSSL is supported on this platform...]) + + dnl We let the user define a single dir where they think OpenSSL is and we only look there + dnl but if they don't define one we search in some of the more common location. + AC_ARG_WITH([openssl], + AS_HELP_STRING([--with-openssl=PREFIX], [root of the OpenSSL installation directory]), + [ + AC_MSG_NOTICE([Checking user specified OpenSSL installation directory]) + DECAF_SEARCHFOR_OPENSSL([$withval]) + ], + [ + AC_MSG_NOTICE([Checking for OpenSSL installation directory in common locations]) + + dnl Use pkg_config if its installed and there's a .pc for OpenSSL + dnl This is our prefered scenario. + AC_PATH_PROG(PKG_CONFIG, pkg-config) + if test x"$PKG_CONFIG" != x""; then + OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null` + if test $? = 0; then + OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null` + OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null` + fi + + dnl Found it ensure no more tests are run. + decaf_have_ssl="1" + fi + + dnl No pkg_config or no .pc file so we look in some common locations. + if test "$decaf_have_ssl" = "0"; then + ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr" + DECAF_SEARCHFOR_OPENSSL([/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr /opt /opt/local]) + fi + ]) + + dnl its not an error if we can't find it, so we just let the user know to be nice. + if test "$decaf_have_ssl" = "1"; then + AC_MSG_NOTICE([OpenSSL library found, SSL is enabled in this build]) + AC_DEFINE([HAVE_OPENSSL], 1, [Define that we have SSL capability]) + else + AC_MSG_NOTICE([OpenSSL library not found, SSL is disabled in this build]) + fi + + dnl Make the configuration available to our main script. + AC_SUBST([OPENSSL_LIBS]) + AC_SUBST([OPENSSL_LDFLAGS]) + AC_SUBST([OPENSSL_INCLUDES]) +]) + +dnl DECAF_SEARCHFOR_OPENSSL +dnl +dnl Given a path(s) look for and try to compile and link against the OpenSSL lib. +dnl +AC_DEFUN([DECAF_SEARCHFOR_OPENSSL], [ + + dnl try and find the headers, then we can make some assumptions on the libs + for currentDir in $1; do + AC_MSG_CHECKING([for openssl/ssl.h in $currentDir/include]) + if test -f "$currentDir/include/openssl/ssl.h"; then + OPENSSL_INCLUDES="-I$currentDir/include" + OPENSSL_LDFLAGS="-L $currentDir/lib" + OPENSSL_LIBS="-lssl -lcrypto" + decaf_have_ssl="1" + AC_MSG_RESULT([yes]) + break + else + AC_MSG_RESULT([no]) + fi + done + + dnl Now we can try a compile of something simple and see if it compiles then + dnl we can try linking to the libs, if all goes well then we are good to go. + if test "$decaf_have_ssl" = "1"; then + AC_MSG_CHECKING([if compiling and linking against discovered OpenSSL succeeds]) + + original_LIBS="$LIBS" + original_LDFLAGS="$LDFLAGS" + original_CPPFLAGS="$CPPFLAGS" + + LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS" + LIBS="$OPENSSL_LIBS $LIBS" + CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" + + AC_LINK_IFELSE( + AC_LANG_PROGRAM([#include ], [SSL_new(NULL)]), + [ + AC_MSG_RESULT([yes]) + decaf_have_ssl="1" + ], [ + AC_MSG_RESULT([no]) + decaf_have_ssl="0" + ] + ) + + CPPFLAGS="$original_CPPFLAGS" + LDFLAGS="$original_LDFLAGS" + LIBS="$original_LIBS" + fi +]) Propchange: activemq/activemq-cpp/trunk/activemq-cpp/m4/find_openssl.m4 ------------------------------------------------------------------------------ svn:eol-style = native