OSDN Git Service

android: Fix build error for Android
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>
Wed, 23 Oct 2013 12:49:19 +0000 (14:49 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Wed, 23 Oct 2013 12:58:29 +0000 (15:58 +0300)
Android uses functions and defines from sys/capability.h which
requires additional include. However file capability.h shows up
in bionic in version Android 4.3, therefore we do check
PLATFORM_SDK_VERSION to no break builds of previous Android versions.
In previous Android version unistd.h contain this functionality.

android/Android.mk
android/main.c

index 542c8f4..dd9c36d 100644 (file)
@@ -38,7 +38,8 @@ LOCAL_C_INCLUDES += \
        $(LOCAL_PATH)/../src \
        $(LOCAL_PATH)/../lib \
 
-LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
+LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\" \
+       -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
 
 LOCAL_SHARED_LIBRARIES := \
        libglib \
index 57b9bba..1721df8 100644 (file)
 #include "hal-msg.h"
 #include "ipc.h"
 
+/* TODO: Consider to remove PLATFORM_SDKVERSION check if requirement
+*  for minimal Android platform version increases. */
+#if defined(ANDROID) && PLATFORM_SDK_VERSION >= 18
+#include <sys/capability.h>
+#endif
+
 static GMainLoop *event_loop;
 static struct mgmt *mgmt_if = NULL;