diff --git a/.gitignore b/.gitignore
index 2eb2c16..af205ec 100644
--- a/.gitignore
+++ b/.gitignore
emulator/b1ee
emulator/hfp
client/bluetoothctl
+mesh/meshctl
src/bluetoothd.8
src/bluetooth.service
diff --git a/Makefile.tools b/Makefile.tools
index 15858c0..8528439 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@GLIB_LIBS@ @DBUS_LIBS@ -lreadline
endif
+if MESH
+bin_PROGRAMS += mesh/meshctl
+
+mesh_meshctl_SOURCES = mesh/main.c \
+ mesh/node.h mesh/node.c \
+ mesh/gatt.h mesh/gatt.c \
+ mesh/crypto.h mesh/crypto.c \
+ mesh/keys.h \
+ mesh/net.h mesh/net.c \
+ mesh/prov.h mesh/prov.c \
+ mesh/util.h mesh/util.c \
+ mesh/agent.h mesh/agent.c \
+ mesh/prov-db.h mesh/prov-db.c \
+ mesh/config-model.h mesh/config-client.c \
+ mesh/config-server.c \
+ mesh/onoff-model.h mesh/onoff-model.c \
+ client/display.h client/display.c \
+ monitor/uuid.h monitor/uuid.c
+mesh_meshctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
+ lib/libbluetooth-internal.la \
+ @GLIB_LIBS@ @DBUS_LIBS@ -ljson-c -lreadline
+endif
+
if MONITOR
bin_PROGRAMS += monitor/btmon
diff --git a/bootstrap-configure b/bootstrap-configure
index 47926fc..658eef2 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
--enable-android \
--enable-sixaxis \
--enable-midi \
+ --enable-mesh \
--disable-datafiles $*
diff --git a/configure.ac b/configure.ac
index 89b164b..6640351 100644
--- a/configure.ac
+++ b/configure.ac
[disable CUPS printer support]), [enable_cups=${enableval}])
AM_CONDITIONAL(CUPS, test "${enable_cups}" != "no")
+AC_ARG_ENABLE(mesh, AC_HELP_STRING([--enable-mesh],
+ [enable Mesh profile support]), [enable_mesh=${enableval}])
+AM_CONDITIONAL(MESH, test "${enable_mesh}" = "yes")
+
+if (test "${enable_mesh}" == "yes"); then
+ PKG_CHECK_MODULES(JSONC, json-c, dummy=yes,
+ AC_MSG_ERROR(json-c is required))
+ AC_SUBST(JSON_CFLAGS)
+ AC_SUBST(JSON_LIBS)
+fi
+
AC_ARG_ENABLE(midi, AC_HELP_STRING([--enable-midi],
[enable MIDI support]), [enable_midi=${enableval}])
AM_CONDITIONAL(MIDI, test "${enable_midi}" = "yes")
[disable command line client]), [enable_client=${enableval}])
AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
-if (test "${enable_client}" != "no"); then
+if (test "${enable_client}" != "no" || test "${enable_mesh}" == "yes"); then
AC_CHECK_HEADERS(readline/readline.h, enable_readline=yes,
AC_MSG_ERROR(readline header files are required))
fi