Add the minilzo/ directory to the list of source files for the libsigrok
build. Have the minilzo library use the project's config.h file, extend
the set of autoconf checks. This approach follows the documentation in
the README.LZO file. It avoids the dependency on an external library and
its version or configuration.
Reflect the minilzo version in the libsigrok version output. The example
application which ships with the library suggests that failed init calls
typically originate from compile issues. Present the same error message
to sigrok users as the example application does.
# The tests CFLAGS are a superset of the libsigrok CFLAGS, and the
# python bindings CFLAGS are a superset of the C++ bindings CFLAGS.
# The tests CFLAGS are a superset of the libsigrok CFLAGS, and the
# python bindings CFLAGS are a superset of the C++ bindings CFLAGS.
-AM_CFLAGS = $(SR_EXTRA_CFLAGS) $(SR_WFLAGS) $(TESTS_CFLAGS)
+SR_MINILZO_CFLAGS = -DMINILZO_HAVE_CONFIG_H
+AM_CFLAGS = $(SR_EXTRA_CFLAGS) $(SR_WFLAGS) $(SR_MINILZO_CFLAGS) $(TESTS_CFLAGS)
AM_CXXFLAGS = $(SR_WXXFLAGS) $(LIBSIGROKCXX_CFLAGS)
lib_LTLIBRARIES = libsigrok.la
AM_CXXFLAGS = $(SR_WXXFLAGS) $(LIBSIGROKCXX_CFLAGS)
lib_LTLIBRARIES = libsigrok.la
src/std.c \
src/sw_limits.c
src/std.c \
src/sw_limits.c
+# Support code, shared among input and driver modules
+libsigrok_la_SOURCES += \
+ src/minilzo/minilzo.c
+
# Input modules
libsigrok_la_SOURCES += \
src/input/input.c \
# Input modules
libsigrok_la_SOURCES += \
src/input/input.c \
# Check for compiler support of 128 bit integers
AC_CHECK_TYPES([__int128_t, __uint128_t], [], [], [])
# Check for compiler support of 128 bit integers
AC_CHECK_TYPES([__int128_t, __uint128_t], [], [], [])
+
+#######################
+## miniLZO related ##
+#######################
+# These were taken from the README.LZO file in the miniLZO archive.
+
+AC_CHECK_TYPE(ptrdiff_t,long)
+AC_TYPE_SIZE_T
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
+AC_CHECK_SIZEOF(__int64)
+AC_CHECK_SIZEOF(void *)
+AC_CHECK_SIZEOF(size_t)
+AC_CHECK_SIZEOF(ptrdiff_t)
+
+AC_C_CONST
+
+AC_CHECK_FUNCS(memcmp memcpy memmove memset)
+
########################
## Hardware drivers ##
########################
########################
## Hardware drivers ##
########################
#endif
#include <libsigrok/libsigrok.h>
#include "libsigrok-internal.h"
#endif
#include <libsigrok/libsigrok.h>
#include "libsigrok-internal.h"
+#include "minilzo/minilzo.h"
/** @cond PRIVATE */
#define LOG_PREFIX "backend"
/** @cond PRIVATE */
#define LOG_PREFIX "backend"
m = g_slist_append(m, g_strdup_printf("%s", CONF_LIBZIP_VERSION));
l = g_slist_append(l, m);
m = g_slist_append(m, g_strdup_printf("%s", CONF_LIBZIP_VERSION));
l = g_slist_append(l, m);
+ m = g_slist_append(NULL, g_strdup("minilzo"));
+ m = g_slist_append(m, g_strdup_printf("%s", lzo_version_string()));
+ l = g_slist_append(l, m);
+
#ifdef HAVE_LIBSERIALPORT
m = g_slist_append(NULL, g_strdup("libserialport"));
m = g_slist_append(m, g_strdup_printf("%s/%s (rt: %s/%s)",
#ifdef HAVE_LIBSERIALPORT
m = g_slist_append(NULL, g_strdup("libserialport"));
m = g_slist_append(m, g_strdup_printf("%s/%s (rt: %s/%s)",
+ if ((ret = lzo_init()) != LZO_E_OK) {
+ sr_err("lzo_init() failed with return code %d.", ret);
+ sr_err("This usually indicates a compiler bug. Recompile without");
+ sr_err("optimizations, and enable '-DLZO_DEBUG' for diagnostics.");
+ ret = SR_ERR;
+ goto done;
+ }
+
#ifdef HAVE_LIBUSB_1_0
ret = libusb_init(&context->libusb_ctx);
if (LIBUSB_SUCCESS != ret) {
#ifdef HAVE_LIBUSB_1_0
ret = libusb_init(&context->libusb_ctx);
if (LIBUSB_SUCCESS != ret) {