tls: make tls engines pluggable

- add infra for pluggable tls "engines"
- makes mbedtls specific code a plugin

Change-Id: I2c5b099e2b69d2be0038e3ef02b208ff907727e7
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/configure.ac b/src/configure.ac
index 1ee55e7..041849e 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -230,6 +230,7 @@
 PLUGIN_ENABLED(srv6am)
 PLUGIN_ENABLED(srv6as)
 PLUGIN_ENABLED(stn)
+PLUGIN_ENABLED(tlsmbedtls)
 
 ###############################################################################
 # Dependency checks
@@ -288,15 +289,24 @@
     ])
 ])
 
-AM_COND_IF([WITH_MBEDTLS],
+AM_COND_IF([WITH_MBEDTLS], [],
+[
+  AC_MSG_WARN([mbedtls not enabled. Disabling tlsmbedtls plugin])
+  enable_tlsmbedtls_plugin=no
+  AM_CONDITIONAL(ENABLE_TLSMBEDTLS_PLUGIN, false)
+])
+
+AM_COND_IF([ENABLE_TLSMBEDTLS_PLUGIN],
 [
   AC_CHECK_HEADERS([mbedtls/ssl.h], [],
     [
-      AC_MSG_WARN([mbedtls headers not found. TLS app disabled])
-      AM_CONDITIONAL(WITH_MBEDTLS, false)
+      AC_MSG_WARN([mbedtls headers not found. TLS engine implementation disabled])
+      enable_tlsmbedtls_plugin=no
+      AM_CONDITIONAL(ENABLE_TLSMBEDTLS_PLUGIN, false)
     ], [])
 ])
 
+
 ###############################################################################
 # JAVA
 ###############################################################################