From 43f2a2f343ded5d569cd742eb8a23059f62c6e0b Mon Sep 17 00:00:00 2001
From: Vittorio Giovara <vittorio.giovara@savoirfairelinux.com>
Date: Wed, 18 Jun 2014 17:32:45 -0400
Subject: [PATCH] configure: check if we are compiling for android

Enable relevant portions of code if we are.

Change-Id: I59753a42dce1ba4fad23f6bdf1895146da92fa0e
Refs: #46972
---
 daemon/configure.ac                   | 15 +++++++++++++++
 daemon/src/client/Makefile.am         |  6 ++++++
 daemon/src/client/android/Makefile.am | 12 ++++++++++++
 3 files changed, 33 insertions(+)
 create mode 100644 daemon/src/client/android/Makefile.am

diff --git a/daemon/configure.ac b/daemon/configure.ac
index b8c234242e..271fbca2ad 100644
--- a/daemon/configure.ac
+++ b/daemon/configure.ac
@@ -74,6 +74,19 @@ AC_COMPILE_IFELSE(
 AC_MSG_RESULT([$CLANG])
 
 
+dnl Check if we are compiling for android
+AC_MSG_CHECKING([if compiling for android])
+AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([], [[
+#ifndef __ANDROID__
+       not android
+#endif
+]])],
+[ANDROID=yes], [ANDROID=no])
+
+AC_MSG_RESULT([$ANDROID])
+AM_CONDITIONAL([USE_ANDROID], test "x$ANDROID" = "xyes")
+
 dnl
 dnl  Check for the contrib directory
 dnl
@@ -475,6 +488,7 @@ AS_IF([test "x$enable_debug" = "xyes"],
 
 dnl What Makefiles to generate
 
+#TODO: split this list across where the relevant check is performed
 AC_CONFIG_FILES([Makefile \
                  src/Makefile \
                  src/sip/Makefile \
@@ -489,6 +503,7 @@ AC_CONFIG_FILES([Makefile \
                  src/audio/codecs/Makefile \
                  src/config/Makefile \
                  src/client/Makefile \
+                 src/client/android/Makefile \
                  src/hooks/Makefile \
                  src/history/Makefile \
                  src/video/Makefile \
diff --git a/daemon/src/client/Makefile.am b/daemon/src/client/Makefile.am
index 45b0783513..3c7c389495 100644
--- a/daemon/src/client/Makefile.am
+++ b/daemon/src/client/Makefile.am
@@ -18,6 +18,11 @@ VIDEO_STUB = videomanager_stub.cpp
 noinst_HEADERS += videomanager.h
 endif
 
+if USE_ANDROID
+SUBDIRS=android
+
+libclient_la_LIBADD = android/libclient_android.la
+else
 if USE_DBUS
 SUBDIRS=dbus
 
@@ -29,6 +34,7 @@ STUB_SRC = client.cpp                      \
            $(PRESENCE_STUB)                \
            $(VIDEO_STUB)
 endif
+endif # USE_ANDROID
 
 libclient_la_SOURCES = callmanager.cpp           \
                        configurationmanager.cpp  \
diff --git a/daemon/src/client/android/Makefile.am b/daemon/src/client/android/Makefile.am
new file mode 100644
index 0000000000..7f6f5e4496
--- /dev/null
+++ b/daemon/src/client/android/Makefile.am
@@ -0,0 +1,12 @@
+include $(top_srcdir)/globals.mak
+
+noinst_LTLIBRARIES = libclient_android.la
+
+libclient_android_la_SOURCES = callmanager_jni.cpp          \
+                               configurationmanager_jni.cpp
+
+if SFL_PRESENCE
+libclient_android_la_SOURCES += presencemanager_jni.cpp
+endif
+
+noinst_HEADERS = jni_callbacks.h
-- 
GitLab