Pārlūkot izejas kodu

Debug: add android log

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
Thomas Guillem 10 gadi atpakaļ
vecāks
revīzija
a9892a2743
3 mainītis faili ar 16 papildinājumiem un 3 dzēšanām
  1. 7 0
      configure.ac
  2. 8 2
      include/bdsm/debug.h
  3. 1 1
      libdsm.pc.in

+ 7 - 0
configure.ac

@@ -102,6 +102,13 @@ else
   AC_CONFIG_FILES([doc/Doxyfile])
 fi
 
+case "${host_os}" in
+  *android*)
+    BDSM_LIB_LOG="-llog"
+    LDFLAGS="${LDFLAGS} ${BDSM_LIB_LOG}"
+    ;;
+esac
+AC_SUBST(BDSM_LIB_LOG)
 
 AC_OUTPUT([
 Makefile

+ 8 - 2
include/bdsm/debug.h

@@ -22,8 +22,14 @@
 # include "config.h"
 
 # ifdef BDSM_DEBUG
-#  include <stdio.h>
-#  define BDSM_dbg(...) fprintf(stderr, __VA_ARGS__)
+#  ifdef __ANDROID__
+#   define LOG_TAG "libdsm"
+#   include <android/log.h>
+#   define BDSM_dbg(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
+#  else
+#   include <stdio.h>
+#   define BDSM_dbg(...) fprintf(stderr, __VA_ARGS__)
+#  endif
 # else
 #  define BDSM_dbg(...) do { } while(0)
 # endif

+ 1 - 1
libdsm.pc.in

@@ -8,4 +8,4 @@ Description: Minimalist and read-only smb client library
 Version: @BDSM_ABI_VERSION@
 Cflags: -I${includedir}
 Libs: -L${libdir} -ldsm
-Libs.private:
+Libs.private: @BDSM_LIB_LOG@