Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit 6f38e555 authored by Alexandre Bailon's avatar Alexandre Bailon
Browse files

build: Add a way to conditionally compile the controller


Currently, there is two supported controller: TPC/IP and bluetooth.
Add some options to enable or disable them at build time.

Signed-off-by: default avatarAlexandre Bailon <abailon@baylibre.com>
parent b3cfeb28
No related merge requests found
...@@ -9,6 +9,12 @@ gbridge_SOURCES = main.c \ ...@@ -9,6 +9,12 @@ gbridge_SOURCES = main.c \
debug.c \ debug.c \
greybus.c \ greybus.c \
svc.c \ svc.c \
controller.c \ controller.c
bluetooth.c \
tcpip.c if TPCIP
\ No newline at end of file gbridge_SOURCES += tcpip.c
endif
if BLUETOOTH
gbridge_SOURCES += bluetooth.c
endif
...@@ -13,7 +13,6 @@ AC_PROG_INSTALL ...@@ -13,7 +13,6 @@ AC_PROG_INSTALL
AC_CHECK_LIB([nl-3], [nl_socket_alloc]) AC_CHECK_LIB([nl-3], [nl_socket_alloc])
AC_CHECK_LIB([nl-genl-3], [genl_register_family]) AC_CHECK_LIB([nl-genl-3], [genl_register_family])
AC_CHECK_LIB([pthread], [pthread_create]) AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([bluetooth], [hci_inquiry])
AC_CHECK_LIB([avahi-common], [main]) AC_CHECK_LIB([avahi-common], [main])
AC_CHECK_LIB([avahi-client], [main]) AC_CHECK_LIB([avahi-client], [main])
...@@ -23,6 +22,26 @@ AC_CONFIG_FILES([ ...@@ -23,6 +22,26 @@ AC_CONFIG_FILES([
Makefile Makefile
]) ])
AC_ARG_ENABLE([bluetooth],
[ --enable-bluetooth Enable bluetooth],
[case "${enableval}" in
yes) bluetooth=true ;
AC_CHECK_LIB([bluetooth], [hci_inquiry]) ;;
no) bluetooth=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-bluetooth]) ;;
esac])
AM_CONDITIONAL([BLUETOOTH], [test x$bluetooth = xtrue])
AC_ARG_ENABLE([tcpip],
[ --enable-tcpip Enable TCP/IP],
[case "${enableval}" in
yes) tcpip=true ;
AC_DEFINE([HAVE_TCPIP], [1], ["TCP/IP support"]) ;;
no) tcpip=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-tcpip]) ;;
esac])
AM_CONDITIONAL([TPCIP], [test x$tcpip = xtrue])
AC_ARG_VAR([GBDIR], ["greybus sources directory"]) AC_ARG_VAR([GBDIR], ["greybus sources directory"])
AS_IF([test "$GBDIR" = ""], [ AS_IF([test "$GBDIR" = ""], [
AC_MSG_ERROR([Environment variable GBDIR needs to be set]) AC_MSG_ERROR([Environment variable GBDIR needs to be set])
......
...@@ -364,8 +364,12 @@ static void register_controller(struct controller *controller) ...@@ -364,8 +364,12 @@ static void register_controller(struct controller *controller)
static void register_controllers(void) static void register_controllers(void)
{ {
#ifdef HAVE_LIBBLUETOOTH
register_controller(&bluetooth_controller); register_controller(&bluetooth_controller);
#endif
#ifdef HAVE_TCPIP
register_controller(&tcpip_controller); register_controller(&tcpip_controller);
#endif
} }
static void *controller_loop(void *data) static void *controller_loop(void *data)
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#ifndef _GBRIDGE_H_ #ifndef _GBRIDGE_H_
#define _GBRIDGE_H_ #define _GBRIDGE_H_
#include <config.h>
#include <stdint.h> #include <stdint.h>
#include <linux/types.h> #include <linux/types.h>
#include <sys/queue.h> #include <sys/queue.h>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment