switch sqlite3 to single-threaded mode

Looking at 'perf top' of osmo-msc under load shows that there's a
significant amount of time spent in terms of locking (mutex,...)
which is useless as osmo-msc is a single-threaded application.

Unfortunately libdbi doesn't provide a mechanism to perform
sqlite3_config(), so we have to do it directly here, introducing an
explicit build-time dependency (and linkage) to libsqlite3.

Related: OS#5559
Change-Id: I5bbea90d28b6d73b64b9e5124ff59304b90a8a75
diff --git a/src/libmsc/db.c b/src/libmsc/db.c
index a1683be..d3d37c7 100644
--- a/src/libmsc/db.c
+++ b/src/libmsc/db.c
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <errno.h>
 #include <time.h>
+#include <sqlite3.h>
 #include <dbi/dbi.h>
 
 #include <osmocom/msc/gsm_data.h>
@@ -637,6 +638,8 @@
 
 int db_init(const char *name)
 {
+	sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
+
 	dbi_initialize_r(NULL, &inst);
 
 	LOGP(DDB, LOGL_NOTICE, "Init database connection to '%s' using %s\n",