From 7286a524740df463c7653b1337a773338ac26302 Mon Sep 17 00:00:00 2001 From: Carsten Schoenert Date: Sat, 24 Jun 2017 10:36:01 +0200 Subject: [PATCH] DTLS support: export and use related flags to main Makefile To be able to use the collected CFLAGS and LIBS variables in the main Makefile substitute DTLS_CFLAGS and DTLS_LIBS with the found values from previous made checks and exporting them to autoconfigure. Also define the found development crypto library into the configuration header file 'coap_config.h. We may need to add the flags also to examples/Makefiles.am too. --- Makefile.am | 3 ++- configure.ac | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 15e4881a..5d7987e5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,7 +27,7 @@ EXTRA_DIST = \ tests/test_uri.h \ tests/test_wellknown.h -AM_CFLAGS = -I$(top_builddir)/include/coap -I$(top_srcdir)/include/coap $(WARNING_CFLAGS) -std=c99 +AM_CFLAGS = -I$(top_builddir)/include/coap -I$(top_srcdir)/include/coap $(WARNING_CFLAGS) $(DTLS_CFLAGS) -std=c99 SUBDIRS = . $(DOC_DIR) tests examples @@ -107,6 +107,7 @@ libcoap_include_HEADERS = \ libcoap_@LIBCOAP_API_VERSION@_la_LDFLAGS = \ -version-info $(LT_LIBCOAP_CURRENT):$(LT_LIBCOAP_REVISION):$(LT_LIBCOAP_AGE) \ @libcoap_SYMBOLS@ \ + $(DTLS_LIBS) \ -pie ## Collect symbols here we want to ignore while building the helper files diff --git a/configure.ac b/configure.ac index 9d552d78..08eb9739 100644 --- a/configure.ac +++ b/configure.ac @@ -363,6 +363,21 @@ if test "x$build_dtls" = "xyes"; then Install at least on of the package(s) containing the development files for GnuTLS (>= $gnutls_version_required) or OpenSSL(>= $openssl_version_required) or disable the DTLS support using '--disable-dtls'.]) fi + + # Saving the DTLS related Compiler flags. + if test "x$with_gnutls" = "xyes" -o "x$with_gnutls_auto" = "xyes"; then + DTLS_CFLAGS="$GnuTLS_CFLAGS" + DTLS_LIBS="$GnuTLS_LIBS" + AC_DEFINE(HAVE_LIBGNUTLS, [1], [Define if the system has libgnutls28]) + fi + if test "x$with_openssl" = "xyes" -o "x$with_openssl_auto" = "xyes"; then + DTLS_CFLAGS="$OpenSSL_CFLAGS" + DTLS_LIBS="$OpenSSL_LIBS" + AC_DEFINE(HAVE_OPENSSL, [1], [Define if the system has libssl1.1]) + fi + + AC_SUBST(DTLS_CFLAGS) + AC_SUBST(DTLS_LIBS) fi # configure options