Skip to content

Commit

Permalink
Add curl easy socket backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
philljj committed Dec 6, 2023
1 parent bc7ac50 commit 2b267f6
Show file tree
Hide file tree
Showing 14 changed files with 883 additions and 4 deletions.
19 changes: 19 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,24 @@ AC_CHECK_LIB([wolfssl],[wolfCrypt_Init],,[AC_MSG_ERROR([libwolfssl is required a

fi

# libcurl support
AC_ARG_ENABLE([curl],
[AS_HELP_STRING([--enable-curl],[Enable curl easy socket backend (default: disabled)])],
[ ENABLED_CURL=$enableval ],
[ ENABLED_CURL=no ]
)

if test "x$ENABLED_CURL" = "xyes"; then
if test "x$ENABLED_TLS" = "xyes"; then
AC_MSG_ERROR([--enable-tls and --enable-curl are incompatible])
fi

AM_CFLAGS="$AM_CFLAGS -DENABLE_MQTT_CURL"

AC_CHECK_LIB([curl],[curl_easy_init],,[AC_MSG_ERROR([libcurl is required and wasn't found on the system. It can be obtained from https://curl.se/download.html.])])

fi


# Non-Blocking support
AC_ARG_ENABLE([nonblock],
Expand Down Expand Up @@ -310,6 +328,7 @@ fi


AM_CONDITIONAL([HAVE_LIBWOLFSSL], [test "x$ENABLED_TLS" = "xyes"])
AM_CONDITIONAL([HAVE_LIBCURL], [test "x$ENABLED_CURL" = "xyes"])
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$ENABLED_EXAMPLES" = "xyes"])
AM_CONDITIONAL([BUILD_STDINCAP], [test "x$ENABLED_STDINCAP" = "xyes"])
AM_CONDITIONAL([BUILD_SN], [test "x$ENABLED_SN" = "xyes"])
Expand Down
9 changes: 9 additions & 0 deletions examples/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,20 @@ noinst_HEADERS += examples/mqttclient/mqttclient.h \
if BUILD_SN
noinst_HEADERS += examples/sn-client/sn-client.h
endif
if HAVE_LIBCURL
noinst_HEADERS += examples/mqttcurl.h
endif

# MQTT Client Example
if HAVE_LIBCURL
examples_mqttclient_mqttclient_SOURCES = examples/mqttclient/mqttclient.c \
examples/mqttcurl.c \
examples/mqttexample.c
else
examples_mqttclient_mqttclient_SOURCES = examples/mqttclient/mqttclient.c \
examples/mqttnet.c \
examples/mqttexample.c
endif
examples_mqttclient_mqttclient_LDADD = src/libwolfmqtt.la
examples_mqttclient_mqttclient_DEPENDENCIES = src/libwolfmqtt.la
examples_mqttclient_mqttclient_CPPFLAGS = -I$(top_srcdir)/examples $(AM_CPPFLAGS)
Expand Down
Loading

0 comments on commit 2b267f6

Please sign in to comment.