Merge "Disable ICU in static libxml2 on Android"
diff --git a/Android.bp b/Android.bp
index a09eeb4..fde421f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -106,15 +106,23 @@
"-Wno-unused-parameter",
],
static: {
- cflags: ["-fvisibility=hidden"],
+ cflags: [
+ "-fvisibility=hidden",
+ "-DSTATIC_LIBXML=1",
+ ],
+ },
+ shared: {
+ shared_libs: ["libandroidicu"],
+ export_shared_lib_headers: ["libandroidicu"],
},
target: {
vendor: {
exclude_shared_libs: ["libandroidicu"],
},
+ host: {
+ shared_libs: ["libandroidicu"],
+ },
},
- shared_libs: ["libandroidicu"],
- export_shared_lib_headers: ["libandroidicu"],
}
cc_binary_host {
diff --git a/include/libxml/xmlversion.h b/include/libxml/xmlversion.h
index af022db..9f8978d 100644
--- a/include/libxml/xmlversion.h
+++ b/include/libxml/xmlversion.h
@@ -281,9 +281,19 @@
* LIBXML_ICU_ENABLED:
*
* Whether icu support is available
+ *
+ * This is disabled when libxml2 is
+ * 1. built for the VNDK.
+ * libicuuc.so isn't available in the VNDK.
+ * 2. built as an static library on Android
+ * libicuuc.so isn't available for static linking.
*/
#undef LIBXML_ICU_ENABLED
-#ifndef __ANDROID_VNDK__
+#ifdef __ANDROID_VNDK__
+#undef LIBXML_ICU_ENABLED
+#elif defined(__ANDROID__) && defined(STATIC_LIBXML)
+#undef LIBXML_ICU_ENABLED
+#else
#define LIBXML_ICU_ENABLED
#endif