From: Kees Monshouwer Date: Sat, 15 Aug 2015 17:18:05 +0000 (+0200) Subject: detect 1.3.x and 2.0.x system mbed TLS versions X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~62^2~10^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=17378ed151d9939572a7c5eb363c31aa602fc286;p=pdns detect 1.3.x and 2.0.x system mbed TLS versions --- diff --git a/m4/pdns_with_system_mbedtls.m4 b/m4/pdns_with_system_mbedtls.m4 index d93bcb7b7..92119e7a5 100644 --- a/m4/pdns_with_system_mbedtls.m4 +++ b/m4/pdns_with_system_mbedtls.m4 @@ -12,44 +12,54 @@ AC_DEFUN([PDNS_WITH_SYSTEM_MBEDTLS],[ AS_IF([test "x$with_system_mbedtls" = "xyes"],[ OLD_LIBS=$LIBS LIBS="" - AC_SEARCH_LIBS([sha1_hmac], [mbedtls polarssl],[ + AC_SEARCH_LIBS([mbedtls_sha1], [mbedcrypto],[ MBEDTLS_LIBS=$LIBS - AC_MSG_CHECKING([for mbed TLS/PolarSSL version >= 1.3]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM( - [[#include ]], - [[ - #if POLARSSL_VERSION_NUMBER < 0x01030000 - #error invalid version - #endif - ]] - )], - [have_system_mbedtls=yes], + have_system_mbedtls=yes + have_mbedtls_v2=yes + ],[ + have_mbedtls_v2=no + AC_SEARCH_LIBS([sha1_hmac], [mbedtls polarssl],[ + MBEDTLS_LIBS=$LIBS + AC_MSG_CHECKING([for mbed TLS/PolarSSL version >= 1.3.0]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM( + [[#include ]], + [[ + #if POLARSSL_VERSION_NUMBER < 0x01030000 + #error invalid version + #endif + ]] + )], + [have_system_mbedtls=yes], + [have_system_mbedtls=no] + ) + AC_MSG_RESULT([$have_system_mbedtls]) + ], [have_system_mbedtls=no] ) - AC_MSG_RESULT([$have_system_mbedtls]) - ], - [have_system_mbedtls=no] - ) + ]) LIBS=$OLD_LIBS - ], - [have_system_mbedtls=no] - ) + ],[ + have_system_mbedtls=no + have_mbedtls_v2=yes + ]) AS_IF([test "x$have_system_mbedtls" = "xyes"],[ MBEDTLS_CFLAGS= MBEDTLS_SUBDIR= AC_DEFINE([MBEDTLS_SYSTEM], [1], [Defined if system mbed TLS is used]) ],[ - AC_DEFINE([HAVE_MBEDTLS2], [1], [Defined if mbed TLS version 2.x.x is used]) AS_IF([test "x$with_system_mbedtls" = "xyes"],[ AC_MSG_ERROR([use of system mbedtls requested but not found])] )] ) + AS_IF([test "x$have_mbedtls_v2" = "xyes"],[ + AC_DEFINE([HAVE_MBEDTLS2], [1], [Defined if mbed TLS version 2.x.x is used]) + ]) + AC_SUBST(MBEDTLS_CFLAGS) AC_SUBST(MBEDTLS_LIBS) AC_SUBST(MBEDTLS_SUBDIR) ] ) -