Track update to ToT libxml2.

Change-Id: Idf5a11c607dc397721ec95846dc819f85a646c37
diff --git a/.gitignore b/.gitignore
index 995094d..a7baf1b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,7 +15,6 @@
 autom4te.cache
 bissect*
 config.guess
-config.h
 config.h.in
 config.h.in~
 config.log
diff --git a/Android.mk b/Android.mk
index b189c97..ba0cec7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,91 +1,81 @@
-LOCAL_PATH:= $(call my-dir)
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 
-# We need to build this for both the device (as a shared library)
-# and the host (as a static library for tools to use).
+LOCAL_PATH := $(call my-dir)
 
-common_SRC_FILES := \
-	SAX.c \
-	entities.c \
-	encoding.c \
-	error.c \
-	parserInternals.c \
-	parser.c \
-	tree.c \
-	hash.c \
-	list.c \
-	xmlIO.c \
-	xmlmemory.c \
-	uri.c \
-	valid.c \
-	xlink.c \
-	HTMLparser.c \
-	HTMLtree.c \
-	debugXML.c \
-	xpath.c \
-	xpointer.c \
-	xinclude.c \
-	nanohttp.c \
-	nanoftp.c \
-	DOCBparser.c \
-	catalog.c \
-	globals.c \
-	threads.c \
-	c14n.c \
-	xmlstring.c \
-	xmlregexp.c \
-	xmlschemas.c \
-	xmlschemastypes.c \
-	xmlunicode.c \
-	xmlreader.c \
-	relaxng.c \
-	dict.c \
-	SAX2.c \
-	legacy.c \
-	chvalid.c \
-	pattern.c \
-	xmlsave.c \
-	xmlmodule.c \
-	xmlwriter.c \
-	schematron.c
+#
+# To update:
+#
+
+#  git remote add libxml2 git://git.gnome.org/libxml2
+#  git fetch libxml2
+#  git merge libxml2/master
+#  mm -j32
+#  # (Make any necessary Android.mk changes and test the new libxml2.)
+#  git push aosp HEAD:master  # Push directly, avoiding gerrit.
+#  git push aosp HEAD:refs/for/master  # Push to gerrit.
+#
+#  # Now commit any necessary Android.mk changes like normal:
+#  repo start post-sync .
+#  git commit -a
+#
+
+# This comes from the automake-generated Makefile.
+# We deliberately exclude nanoftp.c and nanohttp.c, and the trio library.
+common_SRC_FILES := SAX.c entities.c encoding.c error.c \
+        parserInternals.c parser.c tree.c hash.c list.c xmlIO.c \
+        xmlmemory.c uri.c valid.c xlink.c HTMLparser.c HTMLtree.c \
+        debugXML.c xpath.c xpointer.c xinclude.c \
+        DOCBparser.c catalog.c globals.c threads.c c14n.c xmlstring.c \
+        buf.c xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
+        xmlreader.c relaxng.c dict.c SAX2.c \
+        xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c xmlmodule.c \
+        schematron.c xzlib.c
 
 common_C_INCLUDES += \
-	$(LOCAL_PATH)/include \
-	external/icu/icu4c/source/common \
+    $(LOCAL_PATH)/include \
+    external/icu/icu4c/source/common \
+    external/zlib \
 
-# Turn off warnings to prevent log message spam
-# These warnings are not disabled because they are not supported by gcc 4.2.1
-# which is used by darwin.
-# -Wno-enum-compare
-# -Wno-array-bounds
+common_CFLAGS += -fvisibility=hidden
 
-DISABLED_WARNING_FLAGS := \
-	-Wno-format \
-	-Wno-pointer-sign \
-	-Wno-sign-compare
+common_CFLAGS += -DLIBXML_THREAD_ENABLED=1
 
-# For the device
-# =====================================================
+common_CFLAGS += \
+    -Wno-missing-field-initializers \
+    -Wno-self-assign \
+    -Wno-sign-compare \
+    -Wno-tautological-pointer-compare \
 
 include $(CLEAR_VARS)
-
 LOCAL_SRC_FILES := $(common_SRC_FILES)
 LOCAL_C_INCLUDES += $(common_C_INCLUDES)
+LOCAL_CFLAGS += $(common_CFLAGS)
 LOCAL_SHARED_LIBRARIES += $(common_SHARED_LIBRARIES)
-LOCAL_CFLAGS += -fvisibility=hidden
-LOCAL_CFLAGS += $(DISABLED_WARNING_FLAGS)
-
-LOCAL_MODULE:= libxml2
-
+LOCAL_MODULE := libxml2
+LOCAL_CLANG := true
+LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
 include $(BUILD_STATIC_LIBRARY)
 
-
-# For the host
-# ========================================================
-
 include $(CLEAR_VARS)
 LOCAL_SRC_FILES := $(common_SRC_FILES)
 LOCAL_C_INCLUDES += $(common_C_INCLUDES)
-LOCAL_CFLAGS += $(DISABLED_WARNING_FLAGS)
+LOCAL_CFLAGS += $(common_CFLAGS)
 LOCAL_SHARED_LIBRARIES += $(common_SHARED_LIBRARIES)
-LOCAL_MODULE:= libxml2
+LOCAL_MODULE := libxml2
+LOCAL_CLANG := true
+LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
 include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/config.h b/config.h
new file mode 100644
index 0000000..9543a50
--- /dev/null
+++ b/config.h
@@ -0,0 +1,336 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Type cast for the gethostbyname() argument */
+#define GETHOSTBYNAME_ARG_CAST /**/
+
+/* Define to 1 if you have the <ansidecl.h> header file. */
+/* #undef HAVE_ANSIDECL_H */
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the <arpa/nameser.h> header file. */
+#define HAVE_ARPA_NAMESER_H 1
+
+/* Whether struct sockaddr::__ss_family exists */
+/* #undef HAVE_BROKEN_SS_FAMILY */
+
+/* Define to 1 if you have the `class' function. */
+/* #undef HAVE_CLASS */
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#define HAVE_CTYPE_H 1
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#define HAVE_DIRENT_H 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Have dlopen based dso */
+#define HAVE_DLOPEN /**/
+
+/* Define to 1 if you have the <dl.h> header file. */
+/* #undef HAVE_DL_H */
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `finite' function. */
+#define HAVE_FINITE 1
+
+/* Define to 1 if you have the <float.h> header file. */
+#define HAVE_FLOAT_H 1
+
+/* Define to 1 if you have the `fpclass' function. */
+/* #undef HAVE_FPCLASS */
+
+/* Define to 1 if you have the `fprintf' function. */
+#define HAVE_FPRINTF 1
+
+/* Define to 1 if you have the `fp_class' function. */
+/* #undef HAVE_FP_CLASS */
+
+/* Define to 1 if you have the <fp_class.h> header file. */
+/* #undef HAVE_FP_CLASS_H */
+
+/* Define to 1 if you have the `ftime' function. */
+#define HAVE_FTIME 1
+
+/* Define if getaddrinfo is there */
+#define HAVE_GETADDRINFO /**/
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the <ieeefp.h> header file. */
+/* #undef HAVE_IEEEFP_H */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `isascii' function. */
+#define HAVE_ISASCII 1
+
+/* Define if isinf is there */
+#define HAVE_ISINF /**/
+
+/* Define if isnan is there */
+#define HAVE_ISNAN /**/
+
+/* Define to 1 if you have the `isnand' function. */
+/* #undef HAVE_ISNAND */
+
+/* Define if history library is there (-lhistory) */
+/* #undef HAVE_LIBHISTORY */
+
+/* Have compression library */
+/* #undef HAVE_LIBLZMA */
+
+/* Define if pthread library is there (-lpthread) */
+#define HAVE_LIBPTHREAD /**/
+
+/* Define if readline library is there (-lreadline) */
+/* #undef HAVE_LIBREADLINE */
+
+/* Have compression library */
+#define HAVE_LIBZ 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the `localtime' function. */
+#define HAVE_LOCALTIME 1
+
+/* Define to 1 if you have the <lzma.h> header file. */
+/* #undef HAVE_LZMA_H */
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#ifndef HAVE_MALLOC_H /* Already in AndroidConfig.h :-( */
+#define HAVE_MALLOC_H 1
+#endif
+
+/* Define to 1 if you have the <math.h> header file. */
+#define HAVE_MATH_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mmap' function. */
+#define HAVE_MMAP 1
+
+/* Define to 1 if you have the `munmap' function. */
+#define HAVE_MUNMAP 1
+
+/* mmap() is no good without munmap() */
+#if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP)
+#  undef /**/ HAVE_MMAP
+#endif
+
+/* Define to 1 if you have the <nan.h> header file. */
+/* #undef HAVE_NAN_H */
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+/* #undef HAVE_NDIR_H */
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#define HAVE_NETDB_H 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Define to 1 if you have the `printf' function. */
+#define HAVE_PRINTF 1
+
+/* Define if <pthread.h> is there */
+#define HAVE_PTHREAD_H /**/
+
+/* Define to 1 if you have the `putenv' function. */
+#define HAVE_PUTENV 1
+
+/* Define to 1 if you have the `rand' function. */
+#define HAVE_RAND 1
+
+/* Define to 1 if you have the `rand_r' function. */
+#define HAVE_RAND_R 1
+
+/* Define to 1 if you have the <resolv.h> header file. */
+#define HAVE_RESOLV_H 1
+
+/* Have shl_load based dso */
+/* #undef HAVE_SHLLOAD */
+
+/* Define to 1 if you have the `signal' function. */
+#define HAVE_SIGNAL 1
+
+/* Define to 1 if you have the <signal.h> header file. */
+#define HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+
+/* Define to 1 if you have the `sprintf' function. */
+#define HAVE_SPRINTF 1
+
+/* Define to 1 if you have the `srand' function. */
+#define HAVE_SRAND 1
+
+/* Define to 1 if you have the `sscanf' function. */
+#define HAVE_SSCANF 1
+
+/* Define to 1 if you have the `stat' function. */
+#define HAVE_STAT 1
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the `strftime' function. */
+#define HAVE_STRFTIME 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strndup' function. */
+#define HAVE_STRNDUP 1
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+   */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#define HAVE_SYS_MMAN_H 1
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+   */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/timeb.h> header file. */
+#define HAVE_SYS_TIMEB_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `time' function. */
+#define HAVE_TIME 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Whether va_copy() is available */
+#define HAVE_VA_COPY 1
+
+/* Define to 1 if you have the `vfprintf' function. */
+#define HAVE_VFPRINTF 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the `vsprintf' function. */
+#define HAVE_VSPRINTF 1
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#define HAVE_ZLIB_H 1
+
+/* Define to 1 if you have the `_stat' function. */
+/* #undef HAVE__STAT */
+
+/* Whether __va_copy() is available */
+/* #undef HAVE___VA_COPY */
+
+/* Define as const if the declaration of iconv() needs const. */
+/* #undef ICONV_CONST */
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "libxml2"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Type cast for the send() function 2nd arg */
+#define SEND_ARG2_CAST /**/
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Support for IPv6 */
+#define SUPPORT_IP6 /**/
+
+/* Define if va_list is an array type */
+#define VA_LIST_IS_ARRAY 1
+
+/* Version number of package */
+#define VERSION "2.9.2"
+
+/* Determine what socket length (socklen_t) data type is */
+#define XML_SOCKLEN_T socklen_t
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+/* #undef _UINT32_T */
+
+/* Using the Win32 Socket implementation */
+/* #undef _WINSOCKAPI_ */
+
+/* ss_family is not defined here, use __ss_family instead */
+/* #undef ss_family */
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef uint32_t */
diff --git a/python/setup.py b/python/setup.py
index e504323..e1ff365 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -8,7 +8,7 @@
 # Below ROOT, we expect to find include, include/libxml2, lib and bin.
 # On *nix, it is not needed (but should not harm),
 # on Windows, it is set by configure.js.
-ROOT = r'/usr'
+ROOT = r'/usr/local'
 
 # Thread-enabled libxml2
 with_threads = 1