cla, mk: Fix disabling SQLite functionality

Previously it was not possible to disable SQLite because of a linker
error. Also, `sqlite3.h` was always required to be present. This adds
an example to `config.mk.example` and fixes both issues.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This commit is contained in:
Felix Walter 2024-10-07 13:18:29 +02:00
parent 4d39b9ccfa
commit fb2d0b021c
6 changed files with 19 additions and 5 deletions

View file

@ -41,7 +41,9 @@ const struct available_cla_list_entry AVAILABLE_CLAS[] = {
{ "tcpclv3", &tcpclv3_create },
{ "tcpspp", &tcpspp_create },
{ "bibe", &bibe_create },
#ifndef DISABLE_SQLITE_STORAGE
{ "sqlite", &sqlite_create },
#endif // DISABLE_SQLITE_STORAGE
};

View file

@ -46,6 +46,15 @@
#coverage ?= no
#coverage ?= yes
###############################
# Dependency-related settings #
###############################
# Some features can be disabled to reduce the number of dependencies.
# The persistent storage implementation requires SQLite.
#DISABLE_SQLITE_STORAGE := 1
#####################
# Toolchain options #
#####################

View file

@ -8,8 +8,6 @@
#include <stdint.h>
#include <sqlite3.h>
// Default Agent IDs.
#ifndef AGENT_ID_SQLITE_DTN
#define AGENT_ID_SQLITE_DTN "sqlite"
@ -21,7 +19,7 @@
struct sqlite_agent_params {
char *sink_identifier;
agent_no_t registered_agent_no;
sqlite3 *db;
struct sqlite3 *db;
QueueIdentifier_t cla_queue;
};

View file

@ -11,8 +11,6 @@
#include <stddef.h>
#include <sqlite3.h>
// Length of the SQLiteAgent queue.
#ifndef CLA_SQLITE_AGENT_QUEUE_LENGTH
#define CLA_SQLITE_AGENT_QUEUE_LENGTH 10

View file

@ -12,8 +12,13 @@
// Default options string provided to the CLA subsystem.
#ifndef DEFAULT_CLA_OPTIONS
#ifndef DISABLE_SQLITE_STORAGE
#define DEFAULT_CLA_OPTIONS \
"sqlite:file::memory:?cache=shared;tcpclv3:*,4556;smtcp:*,4222,false;mtcp:*,4224"
#else // DISABLE_SQLITE_STORAGE
#define DEFAULT_CLA_OPTIONS \
"tcpclv3:*,4556;smtcp:*,4222,false;mtcp:*,4224"
#endif // DISABLE_SQLITE_STORAGE
#endif // DEFAULT_CLA_OPTIONS
// Default TCP IP/port used for the application agent interface.

View file

@ -40,6 +40,8 @@ LDFLAGS += -lpthread
ifndef DISABLE_SQLITE_STORAGE
LDFLAGS += -lsqlite3
else
CPPFLAGS += -DDISABLE_SQLITE_STORAGE
endif
LDFLAGS_LIB += -shared