apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@apache.org
Subject svn commit: r415591 - in /apr/apr-util/trunk: build/ssl.m4 configure.in
Date Tue, 20 Jun 2006 09:50:44 GMT
Author: dreid
Date: Tue Jun 20 02:50:43 2006
New Revision: 415591

URL: http://svn.apache.org/viewvc?rev=415591&view=rev
Log:
This is the start of allowing SSL usage within apr-util. This is essentially
the configure glue from my patch of a while ago. I'm adding it now so that
any issues can be flagged up before the code starts to land. Presently
this will detect and set appropriate defines but won't do much more :-)


Added:
    apr/apr-util/trunk/build/ssl.m4
Modified:
    apr/apr-util/trunk/configure.in

Added: apr/apr-util/trunk/build/ssl.m4
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/build/ssl.m4?rev=415591&view=auto
==============================================================================
--- apr/apr-util/trunk/build/ssl.m4 (added)
+++ apr/apr-util/trunk/build/ssl.m4 Tue Jun 20 02:50:43 2006
@@ -0,0 +1,128 @@
+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
+dnl SSL module
+dnl
+
+dnl
+dnl APU_FIND_SSL: look for ssl libraries and headers
+dnl
+AC_DEFUN([APU_FIND_SSL], [
+  apu_have_ssl=0
+
+  APU_CHECK_OPENSSL
+  dnl add checks for other varieties of ssl here
+
+
+  if test "$apu_have_ssl" = "1"; then
+    AC_DEFINE([APU_HAVE_SSL], 1, [Define that we have SSL capability])
+  fi
+
+])
+dnl
+
+AC_DEFUN([APU_CHECK_OPENSSL], [
+  apu_have_openssl=0
+  openssl_have_headers=0
+  openssl_have_libs=0
+
+  AC_ARG_WITH([openssl], [
+    --with-openssl=DIR 
+  ], [
+    if test "$withval" = "yes"; then
+      old_cppflags="$CPPFLAGS"
+      old_ldflags="$LDFLAGS"
+
+      openssl_CPPFLAGS="-I$withval/include"
+      openssl_LDFLAGS="-L$withval/lib "
+
+      APR_ADDTO(CPPFLAGS, [$openssl_CPPFLAGS])
+      APR_ADDTO(LDFLAGS, [$openssl_LDFLAGS])
+
+      AC_MSG_NOTICE(checking for openssl in $withval)
+      AC_CHECK_HEADERS(openssl/x509.h, [openssl_have_headers=1])
+      AC_CHECK_LIB(crypto, BN_init, AC_CHECK_LIB(ssl, SSL_accept, [openssl_have_libs=1]))
+      if test "$openssl_have_headers" != "0" && test "$openssl_have_libs" != "0";
then
+        apu_have_openssl=1
+        APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
+        APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
+      fi
+
+      CPPFLAGS="$old_cppflags"
+      LDFLAGS="$old_ldflags"
+    elif test "$withval" = "no"; then
+      apu_have_openssl=0
+    else
+      old_cppflags="$CPPFLAGS"
+      old_ldflags="$LDFLAGS"
+
+      openssl_CPPFLAGS="-I$withval/include"
+      openssl_LDFLAGS="-L$withval/lib "
+
+      APR_ADDTO(CPPFLAGS, [$openssl_CPPFLAGS])
+      APR_ADDTO(LDFLAGS, [$openssl_LDFLAGS])
+
+      AC_MSG_NOTICE(checking for openssl in $withval)
+      AC_CHECK_HEADERS(openssl/x509.h, [openssl_have_headers=1])
+      AC_CHECK_LIB(crypto, BN_init, AC_CHECK_LIB(ssl, SSL_accept, [openssl_have_libs=1]))
+      if test "$openssl_have_headers" != "0" && test "$openssl_have_libs" != "0";
then
+        apu_have_openssl=1
+        APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
+        APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
+      fi
+
+      if test "$apu_have_openssl" != "1"; then
+        AC_CHECK_HEADERS(openssl/x509.h, [openssl_have_headers=1])
+        AC_CHECK_LIB(crypto, BN_init, AC_CHECK_LIB(ssl, SSL_accept, [openssl_have_libs=1]))
+        if test "$openssl_have_headers" != "0" && test "$openssl_have_libs" != "0";
then
+          apu_have_openssl=1
+          APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
+          APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
+        fi
+      fi
+
+      CPPFLAGS="$old_cppflags"
+      LDFLAGS="$old_ldflags"
+    fi
+  ], [
+    old_cppflags="$CPPFLAGS"
+    old_ldflags="$LDFLAGS"
+
+    AC_CHECK_HEADERS(openssl/x509.h, [openssl_have_headers=1])
+    AC_CHECK_LIB(crypto, BN_init, AC_CHECK_LIB(ssl, SSL_accept, [openssl_have_libs=1]))
+    if test "$openssl_have_headers" != "0" && test "$openssl_have_libs" != "0"; then
+      apu_have_openssl=1
+      APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
+      APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
+    fi
+
+    CPPFLAGS="$old_cppflags"
+    LDFLAGS="$old_ldflags"
+  ])
+
+
+  AC_SUBST(apu_have_openssl)
+
+  dnl Add the libraries we will need now that we have set apu_have_openssl correctly
+  if test "$apu_have_openssl" = "1"; then
+    AC_DEFINE([APU_HAVE_OPENSSL], 1, [Define that we have OpenSSL available])
+    APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lcrypto -lssl])
+    APR_ADDTO(APRUTIL_LIBS,[-lcrypto -lssl])
+    apu_have_ssl=1
+  fi
+])
+dnl

Modified: apr/apr-util/trunk/configure.in
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/configure.in?rev=415591&r1=415590&r2=415591&view=diff
==============================================================================
--- apr/apr-util/trunk/configure.in (original)
+++ apr/apr-util/trunk/configure.in Tue Jun 20 02:50:43 2006
@@ -15,6 +15,7 @@
 sinclude(build/find_apr.m4)
 sinclude(build/dbm.m4)
 sinclude(build/dbd.m4)
+sinclude(build/ssl.m4)
 
 dnl Generate ./config.nice for reproducing runs of configure
 dnl 
@@ -157,6 +158,8 @@
 if test "$crypt_r" = "1"; then
   APU_CHECK_CRYPT_R_STYLE
 fi
+
+APU_FIND_SSL
 
 so_ext=$APR_SO_EXT
 lib_target=$APR_LIB_TARGET



Mime
View raw message