netd: Don't break build if BT is not available for the target
Signed-off-by: San Mehat <san@google.com>
diff --git a/Android.mk b/Android.mk
index 4b9b6c9..d62d1d0 100644
--- a/Android.mk
+++ b/Android.mk
@@ -28,8 +28,12 @@
$(LOCAL_PATH)/../bluetooth/bluez-clean-headers
LOCAL_CFLAGS :=
+LOCAL_SHARED_LIBRARIES := libsysutils libcutils
-LOCAL_SHARED_LIBRARIES := libsysutils libcutils libbluedroid
+ifeq ($(BOARD_HdAVE_BLUETOOTH),true)
+ LOCAL_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES) libbluedroid
+ LOCAL_CFLAGS := $(LOCAL_CFLAGS) -DHAVE_BLUETOOTH
+endif
include $(BUILD_EXECUTABLE)
diff --git a/PanController.cpp b/PanController.cpp
index f4ae8ee..e613874 100644
--- a/PanController.cpp
+++ b/PanController.cpp
@@ -33,7 +33,9 @@
#include "PanController.h"
+#ifdef HAVE_BLUETOOTH
extern "C" int bt_is_enabled();
+#endif
PanController::PanController() {
mPid = 0;
@@ -45,11 +47,17 @@
int PanController::startPan() {
pid_t pid;
+#ifdef HAVE_BLUETOOTH
if (!bt_is_enabled()) {
LOGE("Cannot start PAN services - Bluetooth not running");
errno = ENODEV;
return -1;
}
+#else
+ LOGE("Cannot start PAN services - No Bluetooth support");
+ errno = ENODEV;
+ return -1;
+#endif
if (mPid) {
LOGE("PAN already started");