apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Re: svn commit: r1394552 - in /apr/apr/trunk: Makefile.in build.conf build/crypto.m4 build/dso.m4 crypto/apr_crypto.c crypto/apr_crypto_commoncrypto.c include/apr.h.in include/apr.hnw include/apr.hw include/apr_crypto.h test/testcrypto.c
Date Fri, 05 Oct 2012 15:21:02 GMT


minfrin@apache.org wrote:
> Author: minfrin
> Date: Fri Oct  5 14:46:27 2012
> New Revision: 1394552
> 
> URL: http://svn.apache.org/viewvc?rev=1394552&view=rev
> Log:
> apr_crypto: Add a native CommonCrypto implementation for iOS and OSX
> where OpenSSL has been deprecated.
> 
> Added:
>     apr/apr/trunk/crypto/apr_crypto_commoncrypto.c
> Modified:
>     apr/apr/trunk/Makefile.in
>     apr/apr/trunk/build.conf
>     apr/apr/trunk/build/crypto.m4
>     apr/apr/trunk/build/dso.m4
>     apr/apr/trunk/crypto/apr_crypto.c
>     apr/apr/trunk/include/apr.h.in
>     apr/apr/trunk/include/apr.hnw
>     apr/apr/trunk/include/apr.hw
>     apr/apr/trunk/include/apr_crypto.h
>     apr/apr/trunk/test/testcrypto.c
> 

> Modified: apr/apr/trunk/build/crypto.m4
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/crypto.m4?rev=1394552&r1=1394551&r2=1394552&view=diff
> ==============================================================================
> --- apr/apr/trunk/build/crypto.m4 (original)
> +++ apr/apr/trunk/build/crypto.m4 Fri Oct  5 14:46:27 2012

> @@ -238,4 +240,71 @@ AC_DEFUN([APU_CHECK_CRYPTO_NSS], [
>    CPPFLAGS="$old_cppflags"
>    LDFLAGS="$old_ldflags"
>  ])
> +
> +AC_DEFUN([APU_CHECK_CRYPTO_COMMONCRYPTO], [
> +  apu_have_commoncrypto=0
> +  commoncrypto_have_headers=0
> +  commoncrypto_have_libs=0
> +
> +  old_libs="$LIBS"
> +  old_cppflags="$CPPFLAGS"
> +  old_ldflags="$LDFLAGS"
> +
> +  AC_ARG_WITH([commoncrypto], 
> +  [APR_HELP_STRING([--with-commoncrypto=DIR], [specify location of CommonCrypto])],
> +  [
> +    if test "$withval" = "yes"; then
> +      AC_CHECK_HEADERS(CommonCrypto/CommonKeyDerivation.h, [commoncrypto_have_headers=1])
> +      AC_CHECK_LIB(System, CCKeyDerivationPBKDF, AC_CHECK_LIB(System, CCCryptorCreate,
[commoncrypto_have_libs=1],,-lcrypto))
> +      if test "$commoncrypto_have_headers" != "0" && test "$commoncrypto_have_libs"
!= "0"; then
> +        apu_have_commoncrypto=1
> +      fi
> +    elif test "$withval" = "no"; then
> +      apu_have_commoncrypto=0
> +    else
> +
> +      commoncrypto_CPPFLAGS="-I$withval/include"
> +      commoncrypto_LDFLAGS="-L$withval/lib "
> +
> +      APR_ADDTO(CPPFLAGS, [$commoncrypto_CPPFLAGS])
> +      APR_ADDTO(LDFLAGS, [$commoncrypto_LDFLAGS])
> +
> +      AC_MSG_NOTICE(checking for commoncrypto in $withval)
> +      AC_CHECK_HEADERS(CommonCrypto/CommonKeyDerivation.h, [commoncrypto_have_headers=1])
> +      AC_CHECK_LIB(System, CCKeyDerivationPBKDF, AC_CHECK_LIB(System, CCCryptorCreate,
[commoncrypto_have_libs=1],,-lcrypto))
> +      if test "$commoncrypto_have_headers" != "0" && test "$commoncrypto_have_libs"
!= "0"; then
> +        apu_have_commoncrypto=1
> +        APR_ADDTO(LDFLAGS, [-L$withval/lib])
> +        APR_ADDTO(INCLUDES, [-I$withval/include])
> +      fi
> +
> +      if test "$apu_have_commoncrypto" != "1"; then
> +        AC_CHECK_HEADERS(CommonCrypto/CommonKeyDerivation.h, [commoncrypto_have_headers=1])
> +        AC_CHECK_LIB(System, CCKeyDerivationPBKDF, AC_CHECK_LIB(System, CCCryptorCreate,
[commoncrypto_have_libs=1],,-lcrypto))
> +        if test "$commoncrypto_have_headers" != "0" && test "$commoncrypto_have_libs"
!= "0"; then
> +          apu_have_commoncrypto=1
> +          APR_ADDTO(LDFLAGS, [-L$withval/lib])
> +          APR_ADDTO(INCLUDES, [-I$withval/include])
> +        fi
> +      fi

Maybe I am missing something, but why doing the same tests again if they failed?

> +
> +    fi
> +  ], [
> +    apu_have_commoncrypto=0
> +  ])
> +
> +  dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
> +  dnl we know the library is there.
> +  if test "$apu_have_commoncrypto" = "1"; then
> +    apu_have_crypto=1
> +  fi
> +  AC_SUBST(apu_have_commoncrypto)
> +  AC_SUBST(LDADD_crypto_commoncrypto)
> +  AC_SUBST(apu_have_crypto)
> +
> +  LIBS="$old_libs"
> +  CPPFLAGS="$old_cppflags"
> +  LDFLAGS="$old_ldflags"
> +])
> +
>  dnl
> 

Regards

RĂ¼diger

Mime
View raw message