Changeset 14441


Ignore:
Timestamp:
Jan 7, 2015, 1:19:00 PM (6 years ago)
Author:
mikedld
Message:

Add PolarSSL support

Location:
trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CMakeLists.txt

    r14437 r14441  
    3030tr_auto_option(USE_SYSTEM_UTP       "Use system utp library" AUTO)
    3131tr_auto_option(USE_SYSTEM_B64       "Use system b64 library" AUTO)
    32 tr_list_option(WITH_CRYPTO          "Use specified crypto library" AUTO openssl cyassl)
     32tr_list_option(WITH_CRYPTO          "Use specified crypto library" AUTO openssl cyassl polarssl)
    3333tr_auto_option(WITH_INOTIFY         "Enable inotify support (on systems that support it)" AUTO)
    3434tr_auto_option(WITH_KQUEUE          "Enable kqueue support (on systems that support it)" AUTO)
     
    9797set(OPENSSL_MINIMUM         0.9.4)
    9898set(CYASSL_MINIMUM          3.0)
     99set(POLARSSL_MINIMUM        1.3)
    99100set(ZLIB_MINIMUM            1.2.3)
    100101set(GTK_MINIMUM             3.4.0)
     
    156157        set(CRYPTO_INCLUDE_DIRS ${CYASSL_INCLUDE_DIRS})
    157158        set(CRYPTO_LIBRARIES ${CYASSL_LIBRARIES})
     159    endif()
     160endif()
     161if(WITH_CRYPTO STREQUAL "AUTO" OR WITH_CRYPTO STREQUAL "polarssl")
     162    tr_get_required_flag(WITH_CRYPTO POLARSSL_IS_REQUIRED)
     163    find_package(PolarSSL ${POLARSSL_MINIMUM} ${POLARSSL_IS_REQUIRED})
     164    tr_fixup_list_option(WITH_CRYPTO "polarssl" POLARSSL_FOUND "AUTO" POLARSSL_IS_REQUIRED)
     165    if(WITH_CRYPTO STREQUAL "polarssl")
     166        set(CRYPTO_PKG "polarssl")
     167        set(CRYPTO_INCLUDE_DIRS ${POLARSSL_INCLUDE_DIRS})
     168        set(CRYPTO_LIBRARIES ${POLARSSL_LIBRARIES})
    158169    endif()
    159170endif()
  • trunk/configure.ac

    r14436 r14441  
    5151CYASSL_MINIMUM=3.0
    5252AC_SUBST(CYASSL_MINIMUM)
     53POLARSSL_MINIMUM=0x01030000 # 1.3
     54AC_SUBST(POLARSSL_MINIMUM)
    5355
    5456##
     
    124126
    125127AC_ARG_WITH([crypto], AS_HELP_STRING([--with-crypto=PKG],
    126             [Use specified crypto library: auto (default), openssl, cyassl]),
     128            [Use specified crypto library: auto (default), openssl, cyassl, polarssl]),
    127129            [want_crypto=$withval], [want_crypto=auto])
    128130
     
    140142        [AS_IF([test "x$want_crypto" = "xcyassl"],
    141143            [AC_MSG_ERROR([CyaSSL support requested, but library not found.])]
     144        )]
     145    )
     146])
     147AS_IF([test "x$want_crypto" = "xauto" -o "x$want_crypto" = "xpolarssl"], [
     148    AC_CHECK_HEADER([polarssl/version.h],
     149        [AC_EGREP_CPP([version_ok], [#include <polarssl/version.h>
     150                                     #if defined (POLARSSL_VERSION_NUMBER) && POLARSSL_VERSION_NUMBER >= $POLARSSL_MINIMUM
     151                                     version_ok
     152                                     #endif],
     153            [AC_CHECK_LIB([polarssl], [dhm_init],
     154                [want_crypto="polarssl"; CRYPTO_PKG="polarssl"; CRYPTO_CFLAGS=""; CRYPTO_LIBS="-lpolarssl"],
     155                [AS_IF([test "x$want_crypto" = "xpolarssl"],
     156                    [AC_MSG_ERROR([PolarSSL support requested, but library not found.])]
     157                )]
     158            )],
     159            [AS_IF([test "x$want_crypto" = "xpolarssl"],
     160                [AC_MSG_ERROR([PolarSSL support requested, but version not suitable.])]
     161            )]
     162        )],
     163        [AS_IF([test "x$want_crypto" = "xpolarssl"],
     164            [AC_MSG_ERROR([PolarSSL support requested, but headers not found.])]
    142165        )]
    143166    )
Note: See TracChangeset for help on using the changeset viewer.