Module: kamailio
Branch: master
Commit: 5182f261562c8882b9468f5209b21c9863e659bc
URL: 
https://github.com/kamailio/kamailio/commit/5182f261562c8882b9468f5209b21c9863e659bc

Author: Victor Seva <linuxman...@torreviejawireless.org>
Committer: Victor Seva <linuxman...@torreviejawireless.org>
Date: 2025-08-28T16:00:03+02:00

ndb_mongodb: support mongo-c-driver version 2

related #4378

---

Modified: src/modules/ndb_mongodb/Makefile
Modified: src/modules/ndb_mongodb/mongodb_client.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/5182f261562c8882b9468f5209b21c9863e659bc.diff
Patch: 
https://github.com/kamailio/kamailio/commit/5182f261562c8882b9468f5209b21c9863e659bc.patch

---

diff --git a/src/modules/ndb_mongodb/Makefile b/src/modules/ndb_mongodb/Makefile
index f10253c93a1..49882d7e6ed 100644
--- a/src/modules/ndb_mongodb/Makefile
+++ b/src/modules/ndb_mongodb/Makefile
@@ -9,12 +9,17 @@ ifeq ($(CROSS_COMPILE),)
 MONGODBC_BUILDER=$(shell \
        if pkg-config --exists libmongoc-1.0; then \
                echo 'pkg-config libmongoc-1.0'; \
+       elif pkg-config --exists mongoc2; then \
+               echo 'pkg-config mongoc2'; \
        fi)
 endif
 
 ifneq ($(MONGODBC_BUILDER),)
        DEFS += $(shell $(MONGODBC_BUILDER) --cflags)
        LIBS += $(shell $(MONGODBC_BUILDER) --libs)
+       ifneq ($(findstring libmongoc-1.0,$(MONGODBC_BUILDER)),)
+               DEFS += -DHAVE_LIBMONGOC1
+       endif
 else
        DEFS += -I$(LOCALBASE)/include
        LIBS= -L$(LOCALBASE)/lib -lmongoc
diff --git a/src/modules/ndb_mongodb/mongodb_client.h 
b/src/modules/ndb_mongodb/mongodb_client.h
index f6e3392b4f7..2a95b8e68fd 100644
--- a/src/modules/ndb_mongodb/mongodb_client.h
+++ b/src/modules/ndb_mongodb/mongodb_client.h
@@ -24,8 +24,13 @@
 #ifndef _MONGODB_CLIENT_H_
 #define _MONGODB_CLIENT_H_
 
+#ifdef HAVE_LIBMONGOC1
 #include <mongoc.h>
 #include <bson.h>
+#else
+#include <mongoc/mongoc.h>
+#include <bson/bson.h>
+#endif
 
 #include "../../core/str.h"
 #include "../../core/parser/parse_param.h"

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to