From 8052dc36d962cc821269bbdfc0e49967d8facc39 Mon Sep 17 00:00:00 2001 From: Andrew Hsieh Date: Tue, 12 Mar 2013 22:48:28 -0700 Subject: [PATCH] Make libportable.a compile on host where cutils/log.h doesn't exit Change-Id: I0ed6389a28f419f90ccbc6719b72895b366bb611 --- .../android/libportable/common/include/log_portable.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ndk/sources/android/libportable/common/include/log_portable.h b/ndk/sources/android/libportable/common/include/log_portable.h index f48780a9d..27f521e62 100644 --- a/ndk/sources/android/libportable/common/include/log_portable.h +++ b/ndk/sources/android/libportable/common/include/log_portable.h @@ -81,7 +81,8 @@ static inline char *portable_tag() { _rv; /* Returned to caller */ \ }) -# include +#if !defined(HAS_NO_LOG_H) +#include # define PERROR(str) { \ ALOGE("%s: PERROR('%s'): errno:%d:'%s'", __func__, str, errno, strerror(errno)); \ @@ -89,4 +90,9 @@ static inline char *portable_tag() { # define ASSERT(cond) ALOG_ASSERT(cond, "assertion failed:(%s), file: %s, line: %d:%s", \ #cond, __FILE__, __LINE__, __func__); +#else +# define PERROR(str) fprintf(stderr, "%s: PERROR('%s'): errno:%d:'%s'", __func__, str, errno, strerror(errno)) +# define ASSERT(cond) assert(cond) + +#endif \ No newline at end of file