Snap for 10447354 from f0e069fa0d4f7e7f14e8b27761b9bb70d0f4502f to mainline-cellbroadcast-release

Change-Id: I3008801b16ffa85ffa0087ff209e9720ff5844d1
diff --git a/Android-bionic.bp b/Android-bionic.bp
index 690f831..9cc5bd4 100644
--- a/Android-bionic.bp
+++ b/Android-bionic.bp
@@ -70,6 +70,15 @@
         "Modules/sha512module.c",
         "Modules/signalmodule.c",
         "Modules/socketmodule.c",
+        "Modules/_sqlite/cache.c",
+        "Modules/_sqlite/connection.c",
+        "Modules/_sqlite/cursor.c",
+        "Modules/_sqlite/microprotocols.c",
+        "Modules/_sqlite/module.c",
+        "Modules/_sqlite/prepare_protocol.c",
+        "Modules/_sqlite/row.c",
+        "Modules/_sqlite/statement.c",
+        "Modules/_sqlite/util.c",
         "Modules/_sre.c",
         "Modules/_stat.c",
         "Modules/_statisticsmodule.c",
diff --git a/Android-darwin_x86_64.bp b/Android-darwin.bp
similarity index 88%
copy from Android-darwin_x86_64.bp
copy to Android-darwin.bp
index a6b7c26..d00a65c 100644
--- a/Android-darwin_x86_64.bp
+++ b/Android-darwin.bp
@@ -1,6 +1,6 @@
 // Generated by android/regen.sh
 filegroup {
-    name: "py3-c-modules-darwin_x86_64",
+    name: "py3-c-modules-darwin",
     srcs: [
         "Modules/_abc.c",
         "Modules/_asynciomodule.c",
@@ -43,6 +43,15 @@
         "Modules/_randommodule.c",
         "Modules/_scproxy.c",
         "Modules/_sha3/sha3module.c",
+        "Modules/_sqlite/cache.c",
+        "Modules/_sqlite/connection.c",
+        "Modules/_sqlite/cursor.c",
+        "Modules/_sqlite/microprotocols.c",
+        "Modules/_sqlite/module.c",
+        "Modules/_sqlite/prepare_protocol.c",
+        "Modules/_sqlite/row.c",
+        "Modules/_sqlite/statement.c",
+        "Modules/_sqlite/util.c",
         "Modules/_sre.c",
         "Modules/_ssl.c",
         "Modules/_stat.c",
diff --git a/Android-darwin_x86_64.bp b/Android-linux_arm64.bp
similarity index 88%
rename from Android-darwin_x86_64.bp
rename to Android-linux_arm64.bp
index a6b7c26..fce7087 100644
--- a/Android-darwin_x86_64.bp
+++ b/Android-linux_arm64.bp
@@ -1,6 +1,6 @@
 // Generated by android/regen.sh
 filegroup {
-    name: "py3-c-modules-darwin_x86_64",
+    name: "py3-c-modules-linux_arm64",
     srcs: [
         "Modules/_abc.c",
         "Modules/_asynciomodule.c",
@@ -19,7 +19,6 @@
         "Modules/_ctypes/stgdict.c",
         "Modules/_datetimemodule.c",
         "Modules/_functoolsmodule.c",
-        "Modules/_hashopenssl.c",
         "Modules/_heapqmodule.c",
         "Modules/_io/_iomodule.c",
         "Modules/_io/bufferedio.c",
@@ -33,7 +32,6 @@
         "Modules/_lsprof.c",
         "Modules/_math.c",
         "Modules/_multiprocessing/multiprocessing.c",
-        "Modules/_multiprocessing/posixshmem.c",
         "Modules/_multiprocessing/semaphore.c",
         "Modules/_opcode.c",
         "Modules/_operator.c",
@@ -41,10 +39,17 @@
         "Modules/_posixsubprocess.c",
         "Modules/_queuemodule.c",
         "Modules/_randommodule.c",
-        "Modules/_scproxy.c",
         "Modules/_sha3/sha3module.c",
+        "Modules/_sqlite/cache.c",
+        "Modules/_sqlite/connection.c",
+        "Modules/_sqlite/cursor.c",
+        "Modules/_sqlite/microprotocols.c",
+        "Modules/_sqlite/module.c",
+        "Modules/_sqlite/prepare_protocol.c",
+        "Modules/_sqlite/row.c",
+        "Modules/_sqlite/statement.c",
+        "Modules/_sqlite/util.c",
         "Modules/_sre.c",
-        "Modules/_ssl.c",
         "Modules/_stat.c",
         "Modules/_statisticsmodule.c",
         "Modules/_struct.c",
diff --git a/Android-linux_x86_64.bp b/Android-linux_x86_64.bp
index 234b38d..fb11a39 100644
--- a/Android-linux_x86_64.bp
+++ b/Android-linux_x86_64.bp
@@ -72,6 +72,15 @@
         "Modules/sha512module.c",
         "Modules/signalmodule.c",
         "Modules/socketmodule.c",
+        "Modules/_sqlite/cache.c",
+        "Modules/_sqlite/connection.c",
+        "Modules/_sqlite/cursor.c",
+        "Modules/_sqlite/microprotocols.c",
+        "Modules/_sqlite/module.c",
+        "Modules/_sqlite/prepare_protocol.c",
+        "Modules/_sqlite/row.c",
+        "Modules/_sqlite/statement.c",
+        "Modules/_sqlite/util.c",
         "Modules/_sre.c",
         "Modules/_ssl.c",
         "Modules/_stat.c",
diff --git a/Android.bp b/Android.bp
index 26b6fe6..5154b97 100644
--- a/Android.bp
+++ b/Android.bp
@@ -19,19 +19,6 @@
     default_applicable_licenses: ["external_python_cpython3_license"],
 }
 
-// Added automatically by a large-scale-change that took the approach of
-// 'apply every license found to every target'. While this makes sure we respect
-// every license restriction, it may not be entirely correct.
-//
-// e.g. GPL in an MIT project might only apply to the contrib/ directory.
-//
-// Please consider splitting the single license below into multiple licenses,
-// taking care not to lose any license_kind information, and overriding the
-// default license using the 'licenses: [...]' property on targets as needed.
-//
-// For unused files, consider creating a 'fileGroup' with "//visibility:private"
-// to attach the license to, and including a comment whether the files may be
-// used in the current project.
 // See: http://go/android-license-faq
 license {
     name: "external_python_cpython3_license",
@@ -41,7 +28,6 @@
         "SPDX-license-identifier-Apache-2.0",
         "SPDX-license-identifier-BSD",
         "SPDX-license-identifier-CC0-1.0",
-        "SPDX-license-identifier-GPL",
         "SPDX-license-identifier-MIT",
         "SPDX-license-identifier-MS-RL", // by exception only
         "SPDX-license-identifier-PSF-2.0",
@@ -51,6 +37,7 @@
         "legacy_by_exception_only", // by exception only
         "legacy_notice",
         "legacy_unencumbered",
+        // GPL removed. All GPL code either Autoconf exception or dual-licensed PSF
     ],
     license_text: [
         "LICENSE",
@@ -59,8 +46,9 @@
 
 build = [
     "Android-bionic.bp",
+    "Android-linux_arm64.bp",
     "Android-linux_x86_64.bp",
-    "Android-darwin_x86_64.bp",
+    "Android-darwin.bp",
 ]
 
 soong_config_module_type {
@@ -113,7 +101,6 @@
         "-fwrapv",
         "-O3",
         "-Wall",
-        "-Wstrict-prototypes",
         "-DPy_BUILD_CORE",
         "-Werror",
         "-Wno-invalid-source-encoding",
@@ -156,8 +143,8 @@
             stl: "libc++_static",
         },
         // Regenerate include dirs with android_regen.sh
-        darwin_x86_64: {
-            local_include_dirs: ["android/darwin_x86_64/pyconfig"],
+        darwin: {
+            local_include_dirs: ["android/darwin/pyconfig"],
             cflags: [
                 "-Wno-deprecated-declarations",
                 "-Wno-pointer-arith",
@@ -176,6 +163,9 @@
         linux_musl_x86: {
             enabled: false,
         },
+        linux_musl_arm: {
+            enabled: false,
+        },
         linux_glibc_x86_64: {
             local_include_dirs: ["android/linux_x86_64/pyconfig"],
             cflags: ["-DSOABI=\"cpython-310android-x86_64-linux-gnu\""],
@@ -184,6 +174,10 @@
             local_include_dirs: ["android/linux_x86_64/pyconfig"],
             cflags: ["-DSOABI=\"cpython-310android-x86_64-linux-gnu\""],
         },
+        linux_musl_arm64: {
+            local_include_dirs: ["android/linux_arm64/pyconfig"],
+            cflags: ["-DSOABI=\"cpython-310android-arm64-linux-gnu\""],
+        },
         windows: {
             enabled: false,
         },
@@ -333,7 +327,7 @@
                 "-DABIFLAGS=\"\"",
             ],
         },
-        darwin_x86_64: {
+        darwin: {
             cflags: [
                 "-DPLATFORM=\"darwin\"",
                 "-DABIFLAGS=\"\"",
@@ -436,8 +430,11 @@
         musl_x86_64: {
             srcs: ["android/linux_x86_64/config.c"],
         },
+        musl_arm64: {
+            srcs: ["android/linux_arm64/config.c"],
+        },
         darwin: {
-            srcs: ["android/darwin_x86_64/config.c"],
+            srcs: ["android/darwin/config.c"],
         },
     },
 }
@@ -502,7 +499,9 @@
     cflags: [
         "-DPy_BUILD_CORE_BUILTIN",
         "-DUSE_PYEXPAT_CAPI",
+        "-DSQLITE_OMIT_LOAD_EXTENSION",
     ],
+    shared_libs: ["libsqlite"],
     static_libs: [
         "libexpat",
         "libz",
@@ -528,9 +527,16 @@
                 "libopenssl_crypto",
             ],
         },
+        musl_arm64: {
+            srcs: [":py3-c-modules-linux_arm64"],
+            static_libs: [
+                "libopenssl_ssl",
+                "libopenssl_crypto",
+            ],
+        },
         darwin: {
             cflags: ["-D__APPLE_USE_RFC_3542"],
-            srcs: [":py3-c-modules-darwin_x86_64"],
+            srcs: [":py3-c-modules-darwin"],
             static_libs: [
                 "libopenssl_ssl",
                 "libopenssl_crypto",
diff --git a/android/Setup.local b/android/Setup.local
index 0113ebb..307db34 100644
--- a/android/Setup.local
+++ b/android/Setup.local
@@ -58,3 +58,5 @@
 _sha3 _sha3/sha3module.c
 
 _struct _struct.c
+
+_sqlite3 _sqlite/cache.c _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/module.c _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c
diff --git a/android/bionic/config.c b/android/bionic/config.c
index 8cdc768..cf249dc 100644
--- a/android/bionic/config.c
+++ b/android/bionic/config.c
@@ -73,6 +73,7 @@
 extern PyObject* PyInit__sha512(void);
 extern PyObject* PyInit__sha3(void);
 extern PyObject* PyInit__struct(void);
+extern PyObject* PyInit__sqlite3(void);
 extern PyObject* PyInit_posix(void);
 extern PyObject* PyInit_errno(void);
 extern PyObject* PyInit_pwd(void);
@@ -157,6 +158,7 @@
     {"_sha512", PyInit__sha512},
     {"_sha3", PyInit__sha3},
     {"_struct", PyInit__struct},
+    {"_sqlite3", PyInit__sqlite3},
     {"posix", PyInit_posix},
     {"errno", PyInit_errno},
     {"pwd", PyInit_pwd},
diff --git a/android/darwin_x86_64/Setup.local b/android/darwin/Setup.local
similarity index 100%
rename from android/darwin_x86_64/Setup.local
rename to android/darwin/Setup.local
diff --git a/android/darwin_x86_64/config.c b/android/darwin/config.c
similarity index 98%
rename from android/darwin_x86_64/config.c
rename to android/darwin/config.c
index a120f36..c122fa1 100644
--- a/android/darwin_x86_64/config.c
+++ b/android/darwin/config.c
@@ -77,6 +77,7 @@
 extern PyObject* PyInit__sha512(void);
 extern PyObject* PyInit__sha3(void);
 extern PyObject* PyInit__struct(void);
+extern PyObject* PyInit__sqlite3(void);
 extern PyObject* PyInit_posix(void);
 extern PyObject* PyInit_errno(void);
 extern PyObject* PyInit_pwd(void);
@@ -165,6 +166,7 @@
     {"_sha512", PyInit__sha512},
     {"_sha3", PyInit__sha3},
     {"_struct", PyInit__struct},
+    {"_sqlite3", PyInit__sqlite3},
     {"posix", PyInit_posix},
     {"errno", PyInit_errno},
     {"pwd", PyInit_pwd},
diff --git a/android/darwin_x86_64/pyconfig/pyconfig.h b/android/darwin/pyconfig/pyconfig.h
similarity index 99%
rename from android/darwin_x86_64/pyconfig/pyconfig.h
rename to android/darwin/pyconfig/pyconfig.h
index 60c2c91..361392c 100644
--- a/android/darwin_x86_64/pyconfig/pyconfig.h
+++ b/android/darwin/pyconfig/pyconfig.h
@@ -367,7 +367,9 @@
 /* #undef HAVE_FEXECVE */
 
 /* Define to 1 if you have the `finite' function. */
+#ifdef __x86_64__
 #define HAVE_FINITE 1
+#endif
 
 /* Define to 1 if you have the `flock' function. */
 #define HAVE_FLOCK 1
@@ -421,17 +423,23 @@
 #define HAVE_GAI_STRERROR 1
 
 /* Define to 1 if you have the `gamma' function. */
+#ifdef __x86_64__
 #define HAVE_GAMMA 1
+#endif
 
 /* Define if we can use gcc inline assembler to get and set mc68881 fpcr */
 /* #undef HAVE_GCC_ASM_FOR_MC68881 */
 
 /* Define if we can use x64 gcc inline assembler */
+#ifdef __x86_64__
 #define HAVE_GCC_ASM_FOR_X64 1
+#endif
 
 /* Define if we can use gcc inline assembler to get and set x87 control word
    */
+#ifdef __x86_64__
 #define HAVE_GCC_ASM_FOR_X87 1
+#endif
 
 /* Define if your compiler provides __uint128_t */
 #define HAVE_GCC_UINT128_T 1
@@ -1474,7 +1482,11 @@
 #define SIZEOF_LONG 8
 
 /* The size of `long double', as computed by sizeof. */
+#ifdef __x86_64__
 #define SIZEOF_LONG_DOUBLE 16
+#else
+#define SIZEOF_LONG_DOUBLE 8
+#endif
 
 /* The size of `long long', as computed by sizeof. */
 #define SIZEOF_LONG_LONG 8
diff --git a/android/darwin_x86_64/config.c b/android/linux_arm64/config.c
similarity index 95%
copy from android/darwin_x86_64/config.c
copy to android/linux_arm64/config.c
index a120f36..cf249dc 100644
--- a/android/darwin_x86_64/config.c
+++ b/android/linux_arm64/config.c
@@ -23,10 +23,6 @@
 #endif
 
 
-extern PyObject* PyInit__posixshmem(void);
-extern PyObject* PyInit__scproxy(void);
-extern PyObject* PyInit__ssl(void);
-extern PyObject* PyInit__hashlib(void);
 extern PyObject* PyInit_array(void);
 extern PyObject* PyInit_cmath(void);
 extern PyObject* PyInit_math(void);
@@ -77,6 +73,7 @@
 extern PyObject* PyInit__sha512(void);
 extern PyObject* PyInit__sha3(void);
 extern PyObject* PyInit__struct(void);
+extern PyObject* PyInit__sqlite3(void);
 extern PyObject* PyInit_posix(void);
 extern PyObject* PyInit_errno(void);
 extern PyObject* PyInit_pwd(void);
@@ -111,10 +108,6 @@
 
 struct _inittab _PyImport_Inittab[] = {
 
-    {"_posixshmem", PyInit__posixshmem},
-    {"_scproxy", PyInit__scproxy},
-    {"_ssl", PyInit__ssl},
-    {"_hashlib", PyInit__hashlib},
     {"array", PyInit_array},
     {"cmath", PyInit_cmath},
     {"math", PyInit_math},
@@ -165,6 +158,7 @@
     {"_sha512", PyInit__sha512},
     {"_sha3", PyInit__sha3},
     {"_struct", PyInit__struct},
+    {"_sqlite3", PyInit__sqlite3},
     {"posix", PyInit_posix},
     {"errno", PyInit_errno},
     {"pwd", PyInit_pwd},
diff --git a/android/darwin_x86_64/pyconfig/pyconfig.h b/android/linux_arm64/pyconfig/pyconfig.h
similarity index 92%
copy from android/darwin_x86_64/pyconfig/pyconfig.h
copy to android/linux_arm64/pyconfig/pyconfig.h
index 60c2c91..5ae2d26 100644
--- a/android/darwin_x86_64/pyconfig/pyconfig.h
+++ b/android/linux_arm64/pyconfig/pyconfig.h
@@ -59,7 +59,7 @@
 /* #undef GETPGRP_HAVE_ARG */
 
 /* Define to 1 if you have the `accept4' function. */
-/* #undef HAVE_ACCEPT4 */
+#define HAVE_ACCEPT4 1
 
 /* Define to 1 if you have the `acosh' function. */
 #define HAVE_ACOSH 1
@@ -83,13 +83,13 @@
 #define HAVE_ASINH 1
 
 /* Define to 1 if you have the <asm/types.h> header file. */
-/* #undef HAVE_ASM_TYPES_H */
+#define HAVE_ASM_TYPES_H 1
 
 /* Define to 1 if you have the `atanh' function. */
 #define HAVE_ATANH 1
 
 /* Define to 1 if you have the `bind_textdomain_codeset' function. */
-/* #undef HAVE_BIND_TEXTDOMAIN_CODESET */
+#define HAVE_BIND_TEXTDOMAIN_CODESET 1
 
 /* Define to 1 if you have the <bluetooth/bluetooth.h> header file. */
 /* #undef HAVE_BLUETOOTH_BLUETOOTH_H */
@@ -117,7 +117,7 @@
 /* #undef HAVE_BROKEN_PTHREAD_SIGMASK */
 
 /* define to 1 if your sem_getvalue is broken. */
-#define HAVE_BROKEN_SEM_GETVALUE 1
+/* #undef HAVE_BROKEN_SEM_GETVALUE */
 
 /* Define if `unsetenv` does not return an int. */
 /* #undef HAVE_BROKEN_UNSETENV */
@@ -126,7 +126,7 @@
 #define HAVE_BUILTIN_ATOMIC 1
 
 /* Define to 1 if you have the 'chflags' function. */
-#define HAVE_CHFLAGS 1
+/* #undef HAVE_CHFLAGS */
 
 /* Define to 1 if you have the `chown' function. */
 #define HAVE_CHOWN 1
@@ -162,19 +162,19 @@
 #define HAVE_COPYSIGN 1
 
 /* Define to 1 if you have the `copy_file_range' function. */
-/* #undef HAVE_COPY_FILE_RANGE */
+#define HAVE_COPY_FILE_RANGE 1
 
 /* Define to 1 if you have the <crypt.h> header file. */
-/* #undef HAVE_CRYPT_H */
+#define HAVE_CRYPT_H 1
 
 /* Define if you have the crypt_r() function. */
-/* #undef HAVE_CRYPT_R */
+#define HAVE_CRYPT_R 1
 
 /* Define to 1 if you have the `ctermid' function. */
 #define HAVE_CTERMID 1
 
 /* Define if you have the 'ctermid_r' function. */
-#define HAVE_CTERMID_R 1
+/* #undef HAVE_CTERMID_R */
 
 /* Define if you have the 'filter' function. */
 #define HAVE_CURSES_FILTER 1
@@ -189,7 +189,7 @@
 #define HAVE_CURSES_IMMEDOK 1
 
 /* Define if you have the 'is_pad' function or macro. */
-/* #undef HAVE_CURSES_IS_PAD */
+#define HAVE_CURSES_IS_PAD 1
 
 /* Define if you have the 'is_term_resized' function. */
 #define HAVE_CURSES_IS_TERM_RESIZED 1
@@ -292,22 +292,22 @@
 #define HAVE_DUP2 1
 
 /* Define to 1 if you have the `dup3' function. */
-/* #undef HAVE_DUP3 */
+#define HAVE_DUP3 1
 
 /* Define if you have the '_dyld_shared_cache_contains_path' function. */
-#define HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH 1
+/* #undef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH */
 
 /* Defined when any dynamic module loading is enabled. */
 #define HAVE_DYNAMIC_LOADING 1
 
 /* Define to 1 if you have the <endian.h> header file. */
-/* #undef HAVE_ENDIAN_H */
+#define HAVE_ENDIAN_H 1
 
 /* Define if you have the 'epoll' functions. */
-/* #undef HAVE_EPOLL */
+#define HAVE_EPOLL 1
 
 /* Define if you have the 'epoll_create1' function. */
-/* #undef HAVE_EPOLL_CREATE1 */
+#define HAVE_EPOLL_CREATE1 1
 
 /* Define to 1 if you have the `erf' function. */
 #define HAVE_ERF 1
@@ -319,13 +319,13 @@
 #define HAVE_ERRNO_H 1
 
 /* Define if you have the 'eventfd' function. */
-/* #undef HAVE_EVENTFD */
+#define HAVE_EVENTFD 1
 
 /* Define to 1 if you have the `execv' function. */
 #define HAVE_EXECV 1
 
 /* Define to 1 if you have the `explicit_bzero' function. */
-/* #undef HAVE_EXPLICIT_BZERO */
+#define HAVE_EXPLICIT_BZERO 1
 
 /* Define to 1 if you have the `explicit_memset' function. */
 /* #undef HAVE_EXPLICIT_MEMSET */
@@ -355,7 +355,7 @@
 #define HAVE_FCNTL_H 1
 
 /* Define if you have the 'fdatasync' function. */
-/* #undef HAVE_FDATASYNC */
+#define HAVE_FDATASYNC 1
 
 /* Define to 1 if you have the `fdopendir' function. */
 #define HAVE_FDOPENDIR 1
@@ -364,7 +364,7 @@
 /* #undef HAVE_FDWALK */
 
 /* Define to 1 if you have the `fexecve' function. */
-/* #undef HAVE_FEXECVE */
+#define HAVE_FEXECVE 1
 
 /* Define to 1 if you have the `finite' function. */
 #define HAVE_FINITE 1
@@ -415,23 +415,23 @@
 #define HAVE_FUTIMES 1
 
 /* Define to 1 if you have the `futimesat' function. */
-/* #undef HAVE_FUTIMESAT */
+#define HAVE_FUTIMESAT 1
 
 /* Define to 1 if you have the `gai_strerror' function. */
 #define HAVE_GAI_STRERROR 1
 
 /* Define to 1 if you have the `gamma' function. */
-#define HAVE_GAMMA 1
+/* #undef HAVE_GAMMA */
 
 /* Define if we can use gcc inline assembler to get and set mc68881 fpcr */
 /* #undef HAVE_GCC_ASM_FOR_MC68881 */
 
 /* Define if we can use x64 gcc inline assembler */
-#define HAVE_GCC_ASM_FOR_X64 1
+/* #undef HAVE_GCC_ASM_FOR_X64 */
 
 /* Define if we can use gcc inline assembler to get and set x87 control word
    */
-#define HAVE_GCC_ASM_FOR_X87 1
+/* #undef HAVE_GCC_ASM_FOR_X87 */
 
 /* Define if your compiler provides __uint128_t */
 #define HAVE_GCC_UINT128_T 1
@@ -458,10 +458,10 @@
 #define HAVE_GETGROUPS 1
 
 /* Define to 1 if you have the `gethostbyname' function. */
-#define HAVE_GETHOSTBYNAME 1
+/* #undef HAVE_GETHOSTBYNAME */
 
 /* Define this if you have some version of gethostbyname_r() */
-/* #undef HAVE_GETHOSTBYNAME_R */
+#define HAVE_GETHOSTBYNAME_R 1
 
 /* Define this if you have the 3-arg version of gethostbyname_r(). */
 /* #undef HAVE_GETHOSTBYNAME_R_3_ARG */
@@ -470,7 +470,7 @@
 /* #undef HAVE_GETHOSTBYNAME_R_5_ARG */
 
 /* Define this if you have the 6-arg version of gethostbyname_r(). */
-/* #undef HAVE_GETHOSTBYNAME_R_6_ARG */
+#define HAVE_GETHOSTBYNAME_R_6_ARG 1
 
 /* Define to 1 if you have the `getitimer' function. */
 #define HAVE_GETITIMER 1
@@ -512,28 +512,28 @@
 #define HAVE_GETPWUID_R 1
 
 /* Define to 1 if the getrandom() function is available */
-/* #undef HAVE_GETRANDOM */
+#define HAVE_GETRANDOM 1
 
 /* Define to 1 if the Linux getrandom() syscall is available */
-/* #undef HAVE_GETRANDOM_SYSCALL */
+#define HAVE_GETRANDOM_SYSCALL 1
 
 /* Define to 1 if you have the `getresgid' function. */
-/* #undef HAVE_GETRESGID */
+#define HAVE_GETRESGID 1
 
 /* Define to 1 if you have the `getresuid' function. */
-/* #undef HAVE_GETRESUID */
+#define HAVE_GETRESUID 1
 
 /* Define to 1 if you have the `getsid' function. */
 #define HAVE_GETSID 1
 
 /* Define to 1 if you have the `getspent' function. */
-/* #undef HAVE_GETSPENT */
+#define HAVE_GETSPENT 1
 
 /* Define to 1 if you have the `getspnam' function. */
-/* #undef HAVE_GETSPNAM */
+#define HAVE_GETSPNAM 1
 
 /* Define to 1 if you have the `getwd' function. */
-#define HAVE_GETWD 1
+/* #undef HAVE_GETWD */
 
 /* Define if glibc has incorrect _FORTIFY_SOURCE wrappers for memmove and
    bcopy. */
@@ -546,7 +546,7 @@
 #define HAVE_HSTRERROR 1
 
 /* Define this if you have le64toh() */
-/* #undef HAVE_HTOLE64 */
+#define HAVE_HTOLE64 1
 
 /* Define to 1 if you have the `hypot' function. */
 #define HAVE_HYPOT 1
@@ -582,7 +582,7 @@
 #define HAVE_KILLPG 1
 
 /* Define if you have the 'kqueue' functions. */
-#define HAVE_KQUEUE 1
+/* #undef HAVE_KQUEUE */
 
 /* Define to 1 if you have the <langinfo.h> header file. */
 #define HAVE_LANGINFO_H 1
@@ -594,10 +594,10 @@
 /* #undef HAVE_LARGEFILE_SUPPORT */
 
 /* Define to 1 if you have the 'lchflags' function. */
-#define HAVE_LCHFLAGS 1
+/* #undef HAVE_LCHFLAGS */
 
 /* Define to 1 if you have the `lchmod' function. */
-#define HAVE_LCHMOD 1
+/* #undef HAVE_LCHMOD */
 
 /* Define to 1 if you have the `lchown' function. */
 #define HAVE_LCHOWN 1
@@ -615,10 +615,10 @@
 /* #undef HAVE_LIBIEEE */
 
 /* Define to 1 if you have the <libintl.h> header file. */
-/* #undef HAVE_LIBINTL_H */
+#define HAVE_LIBINTL_H 1
 
 /* Define to build the readline module. */
-#define HAVE_LIBREADLINE 1
+/* #undef HAVE_LIBREADLINE */
 
 /* Define to 1 if you have the `resolv' library (-lresolv). */
 /* #undef HAVE_LIBRESOLV */
@@ -639,46 +639,46 @@
 #define HAVE_LINKAT 1
 
 /* Define to 1 if you have the <linux/auxvec.h> header file. */
-/* #undef HAVE_LINUX_AUXVEC_H */
+#define HAVE_LINUX_AUXVEC_H 1
 
 /* Define to 1 if you have the <linux/can/bcm.h> header file. */
-/* #undef HAVE_LINUX_CAN_BCM_H */
+#define HAVE_LINUX_CAN_BCM_H 1
 
 /* Define to 1 if you have the <linux/can.h> header file. */
-/* #undef HAVE_LINUX_CAN_H */
+#define HAVE_LINUX_CAN_H 1
 
 /* Define to 1 if you have the <linux/can/j1939.h> header file. */
-/* #undef HAVE_LINUX_CAN_J1939_H */
+#define HAVE_LINUX_CAN_J1939_H 1
 
 /* Define if compiling using Linux 3.6 or later. */
-/* #undef HAVE_LINUX_CAN_RAW_FD_FRAMES */
+#define HAVE_LINUX_CAN_RAW_FD_FRAMES 1
 
 /* Define to 1 if you have the <linux/can/raw.h> header file. */
-/* #undef HAVE_LINUX_CAN_RAW_H */
+#define HAVE_LINUX_CAN_RAW_H 1
 
 /* Define if compiling using Linux 4.1 or later. */
-/* #undef HAVE_LINUX_CAN_RAW_JOIN_FILTERS */
+#define HAVE_LINUX_CAN_RAW_JOIN_FILTERS 1
 
 /* Define to 1 if you have the <linux/memfd.h> header file. */
-/* #undef HAVE_LINUX_MEMFD_H */
+#define HAVE_LINUX_MEMFD_H 1
 
 /* Define to 1 if you have the <linux/netlink.h> header file. */
-/* #undef HAVE_LINUX_NETLINK_H */
+#define HAVE_LINUX_NETLINK_H 1
 
 /* Define to 1 if you have the <linux/qrtr.h> header file. */
-/* #undef HAVE_LINUX_QRTR_H */
+#define HAVE_LINUX_QRTR_H 1
 
 /* Define to 1 if you have the <linux/random.h> header file. */
-/* #undef HAVE_LINUX_RANDOM_H */
+#define HAVE_LINUX_RANDOM_H 1
 
 /* Define to 1 if you have the <linux/tipc.h> header file. */
-/* #undef HAVE_LINUX_TIPC_H */
+#define HAVE_LINUX_TIPC_H 1
 
 /* Define to 1 if you have the <linux/vm_sockets.h> header file. */
-/* #undef HAVE_LINUX_VM_SOCKETS_H */
+#define HAVE_LINUX_VM_SOCKETS_H 1
 
 /* Define to 1 if you have the <linux/wait.h> header file. */
-/* #undef HAVE_LINUX_WAIT_H */
+#define HAVE_LINUX_WAIT_H 1
 
 /* Define to 1 if you have the `lockf' function. */
 #define HAVE_LOCKF 1
@@ -708,13 +708,13 @@
 #define HAVE_MBRTOWC 1
 
 /* Define if you have the 'memfd_create' function. */
-/* #undef HAVE_MEMFD_CREATE */
+#define HAVE_MEMFD_CREATE 1
 
 /* Define to 1 if you have the <memory.h> header file. */
 #define HAVE_MEMORY_H 1
 
 /* Define to 1 if you have the `memrchr' function. */
-/* #undef HAVE_MEMRCHR */
+#define HAVE_MEMRCHR 1
 
 /* Define to 1 if you have the `mkdirat' function. */
 #define HAVE_MKDIRAT 1
@@ -723,13 +723,13 @@
 #define HAVE_MKFIFO 1
 
 /* Define to 1 if you have the `mkfifoat' function. */
-/* #undef HAVE_MKFIFOAT */
+#define HAVE_MKFIFOAT 1
 
 /* Define to 1 if you have the `mknod' function. */
 #define HAVE_MKNOD 1
 
 /* Define to 1 if you have the `mknodat' function. */
-/* #undef HAVE_MKNODAT */
+#define HAVE_MKNODAT 1
 
 /* Define to 1 if you have the `mktime' function. */
 #define HAVE_MKTIME 1
@@ -738,7 +738,7 @@
 #define HAVE_MMAP 1
 
 /* Define to 1 if you have the `mremap' function. */
-/* #undef HAVE_MREMAP */
+#define HAVE_MREMAP 1
 
 /* Define to 1 if you have the <ncurses.h> header file. */
 #define HAVE_NCURSES_H 1
@@ -747,7 +747,7 @@
 /* #undef HAVE_NDIR_H */
 
 /* Define to 1 if you have the <netpacket/packet.h> header file. */
-/* #undef HAVE_NETPACKET_PACKET_H */
+#define HAVE_NETPACKET_PACKET_H 1
 
 /* Define to 1 if you have the <net/if.h> header file. */
 #define HAVE_NET_IF_H 1
@@ -772,7 +772,7 @@
 #define HAVE_PAUSE 1
 
 /* Define to 1 if you have the `pipe2' function. */
-/* #undef HAVE_PIPE2 */
+#define HAVE_PIPE2 1
 
 /* Define to 1 if you have the `plock' function. */
 /* #undef HAVE_PLOCK */
@@ -784,10 +784,10 @@
 #define HAVE_POLL_H 1
 
 /* Define to 1 if you have the `posix_fadvise' function. */
-/* #undef HAVE_POSIX_FADVISE */
+#define HAVE_POSIX_FADVISE 1
 
 /* Define to 1 if you have the `posix_fallocate' function. */
-/* #undef HAVE_POSIX_FALLOCATE */
+#define HAVE_POSIX_FALLOCATE 1
 
 /* Define to 1 if you have the `posix_spawn' function. */
 #define HAVE_POSIX_SPAWN 1
@@ -799,13 +799,13 @@
 #define HAVE_PREAD 1
 
 /* Define to 1 if you have the `preadv' function. */
-/* #undef HAVE_PREADV */
+#define HAVE_PREADV 1
 
 /* Define to 1 if you have the `preadv2' function. */
 /* #undef HAVE_PREADV2 */
 
 /* Define if you have the 'prlimit' functions. */
-/* #undef HAVE_PRLIMIT */
+#define HAVE_PRLIMIT 1
 
 /* Define to 1 if you have the <process.h> header file. */
 /* #undef HAVE_PROCESS_H */
@@ -814,13 +814,13 @@
 #define HAVE_PROTOTYPES 1
 
 /* Define to 1 if you have the `pthread_condattr_setclock' function. */
-/* #undef HAVE_PTHREAD_CONDATTR_SETCLOCK */
+#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
 
 /* Defined for Solaris 2.6 bug in pthread header. */
 /* #undef HAVE_PTHREAD_DESTRUCTOR */
 
 /* Define to 1 if you have the `pthread_getcpuclockid' function. */
-/* #undef HAVE_PTHREAD_GETCPUCLOCKID */
+#define HAVE_PTHREAD_GETCPUCLOCKID 1
 
 /* Define to 1 if you have the <pthread.h> header file. */
 #define HAVE_PTHREAD_H 1
@@ -835,13 +835,13 @@
 #define HAVE_PTHREAD_SIGMASK 1
 
 /* Define to 1 if you have the <pty.h> header file. */
-/* #undef HAVE_PTY_H */
+#define HAVE_PTY_H 1
 
 /* Define to 1 if you have the `pwrite' function. */
 #define HAVE_PWRITE 1
 
 /* Define to 1 if you have the `pwritev' function. */
-/* #undef HAVE_PWRITEV */
+#define HAVE_PWRITEV 1
 
 /* Define to 1 if you have the `pwritev2' function. */
 /* #undef HAVE_PWRITEV2 */
@@ -868,19 +868,19 @@
 /* #undef HAVE_RL_CATCH_SIGNAL */
 
 /* Define if you have readline 2.2 */
-#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1
+/* #undef HAVE_RL_COMPLETION_APPEND_CHARACTER */
 
 /* Define if you have readline 4.0 */
-#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1
+/* #undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK */
 
 /* Define if you have readline 4.2 */
-#define HAVE_RL_COMPLETION_MATCHES 1
+/* #undef HAVE_RL_COMPLETION_MATCHES */
 
 /* Define if you have rl_completion_suppress_append */
 /* #undef HAVE_RL_COMPLETION_SUPPRESS_APPEND */
 
 /* Define if you have readline 4.0 */
-#define HAVE_RL_PRE_INPUT_HOOK 1
+/* #undef HAVE_RL_PRE_INPUT_HOOK */
 
 /* Define if you have readline 4.0 */
 /* #undef HAVE_RL_RESIZE_TERMINAL */
@@ -898,16 +898,16 @@
 #define HAVE_SCHED_H 1
 
 /* Define to 1 if you have the `sched_rr_get_interval' function. */
-/* #undef HAVE_SCHED_RR_GET_INTERVAL */
+#define HAVE_SCHED_RR_GET_INTERVAL 1
 
 /* Define to 1 if you have the `sched_setaffinity' function. */
-/* #undef HAVE_SCHED_SETAFFINITY */
+#define HAVE_SCHED_SETAFFINITY 1
 
 /* Define to 1 if you have the `sched_setparam' function. */
-/* #undef HAVE_SCHED_SETPARAM */
+#define HAVE_SCHED_SETPARAM 1
 
 /* Define to 1 if you have the `sched_setscheduler' function. */
-/* #undef HAVE_SCHED_SETSCHEDULER */
+#define HAVE_SCHED_SETSCHEDULER 1
 
 /* Define to 1 if you have the `sem_clockwait' function. */
 /* #undef HAVE_SEM_CLOCKWAIT */
@@ -919,7 +919,7 @@
 #define HAVE_SEM_OPEN 1
 
 /* Define to 1 if you have the `sem_timedwait' function. */
-/* #undef HAVE_SEM_TIMEDWAIT */
+#define HAVE_SEM_TIMEDWAIT 1
 
 /* Define to 1 if you have the `sem_unlink' function. */
 #define HAVE_SEM_UNLINK 1
@@ -961,10 +961,10 @@
 #define HAVE_SETREGID 1
 
 /* Define to 1 if you have the `setresgid' function. */
-/* #undef HAVE_SETRESGID */
+#define HAVE_SETRESGID 1
 
 /* Define to 1 if you have the `setresuid' function. */
-/* #undef HAVE_SETRESUID */
+#define HAVE_SETRESUID 1
 
 /* Define to 1 if you have the `setreuid' function. */
 #define HAVE_SETREUID 1
@@ -979,7 +979,7 @@
 #define HAVE_SETVBUF 1
 
 /* Define to 1 if you have the <shadow.h> header file. */
-/* #undef HAVE_SHADOW_H */
+#define HAVE_SHADOW_H 1
 
 /* Define to 1 if you have the `shm_open' function. */
 #define HAVE_SHM_OPEN 1
@@ -1012,22 +1012,22 @@
 #define HAVE_SIGRELSE 1
 
 /* Define to 1 if you have the `sigtimedwait' function. */
-/* #undef HAVE_SIGTIMEDWAIT */
+#define HAVE_SIGTIMEDWAIT 1
 
 /* Define to 1 if you have the `sigwait' function. */
 #define HAVE_SIGWAIT 1
 
 /* Define to 1 if you have the `sigwaitinfo' function. */
-/* #undef HAVE_SIGWAITINFO */
+#define HAVE_SIGWAITINFO 1
 
 /* Define to 1 if you have the `snprintf' function. */
 #define HAVE_SNPRINTF 1
 
 /* struct sockaddr_alg (linux/if_alg.h) */
-/* #undef HAVE_SOCKADDR_ALG */
+#define HAVE_SOCKADDR_ALG 1
 
 /* Define if sockaddr has sa_len member */
-#define HAVE_SOCKADDR_SA_LEN 1
+/* #undef HAVE_SOCKADDR_SA_LEN */
 
 /* struct sockaddr_storage (sys/socket.h) */
 #define HAVE_SOCKADDR_STORAGE 1
@@ -1039,7 +1039,7 @@
 #define HAVE_SPAWN_H 1
 
 /* Define to 1 if you have the `splice' function. */
-/* #undef HAVE_SPLICE */
+#define HAVE_SPLICE 1
 
 /* Define if your compiler provides ssize_t */
 #define HAVE_SSIZE_T 1
@@ -1048,10 +1048,10 @@
 #define HAVE_STATVFS 1
 
 /* Define if you have struct stat.st_mtim.tv_nsec */
-/* #undef HAVE_STAT_TV_NSEC */
+#define HAVE_STAT_TV_NSEC 1
 
 /* Define if you have struct stat.st_mtimensec */
-#define HAVE_STAT_TV_NSEC2 1
+/* #undef HAVE_STAT_TV_NSEC2 */
 
 /* Define if your compiler supports variable length function prototypes (e.g.
    void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */
@@ -1079,7 +1079,7 @@
 #define HAVE_STRLCPY 1
 
 /* Define to 1 if you have the <stropts.h> header file. */
-/* #undef HAVE_STROPTS_H */
+#define HAVE_STROPTS_H 1
 
 /* Define to 1 if you have the `strsignal' function. */
 #define HAVE_STRSIGNAL 1
@@ -1091,7 +1091,7 @@
 #define HAVE_STRUCT_PASSWD_PW_PASSWD 1
 
 /* Define to 1 if `st_birthtime' is a member of `struct stat'. */
-#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1
+/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */
 
 /* Define to 1 if `st_blksize' is a member of `struct stat'. */
 #define HAVE_STRUCT_STAT_ST_BLKSIZE 1
@@ -1100,10 +1100,10 @@
 #define HAVE_STRUCT_STAT_ST_BLOCKS 1
 
 /* Define to 1 if `st_flags' is a member of `struct stat'. */
-#define HAVE_STRUCT_STAT_ST_FLAGS 1
+/* #undef HAVE_STRUCT_STAT_ST_FLAGS */
 
 /* Define to 1 if `st_gen' is a member of `struct stat'. */
-#define HAVE_STRUCT_STAT_ST_GEN 1
+/* #undef HAVE_STRUCT_STAT_ST_GEN */
 
 /* Define to 1 if `st_rdev' is a member of `struct stat'. */
 #define HAVE_STRUCT_STAT_ST_RDEV 1
@@ -1143,13 +1143,13 @@
 /* #undef HAVE_SYS_ENDIAN_H */
 
 /* Define to 1 if you have the <sys/epoll.h> header file. */
-/* #undef HAVE_SYS_EPOLL_H */
+#define HAVE_SYS_EPOLL_H 1
 
 /* Define to 1 if you have the <sys/eventfd.h> header file. */
-/* #undef HAVE_SYS_EVENTFD_H */
+#define HAVE_SYS_EVENTFD_H 1
 
 /* Define to 1 if you have the <sys/event.h> header file. */
-#define HAVE_SYS_EVENT_H 1
+/* #undef HAVE_SYS_EVENT_H */
 
 /* Define to 1 if you have the <sys/file.h> header file. */
 #define HAVE_SYS_FILE_H 1
@@ -1158,13 +1158,13 @@
 #define HAVE_SYS_IOCTL_H 1
 
 /* Define to 1 if you have the <sys/kern_control.h> header file. */
-#define HAVE_SYS_KERN_CONTROL_H 1
+/* #undef HAVE_SYS_KERN_CONTROL_H */
 
 /* Define to 1 if you have the <sys/loadavg.h> header file. */
 /* #undef HAVE_SYS_LOADAVG_H */
 
 /* Define to 1 if you have the <sys/lock.h> header file. */
-#define HAVE_SYS_LOCK_H 1
+/* #undef HAVE_SYS_LOCK_H */
 
 /* Define to 1 if you have the <sys/memfd.h> header file. */
 /* #undef HAVE_SYS_MEMFD_H */
@@ -1198,7 +1198,7 @@
 #define HAVE_SYS_SELECT_H 1
 
 /* Define to 1 if you have the <sys/sendfile.h> header file. */
-/* #undef HAVE_SYS_SENDFILE_H */
+#define HAVE_SYS_SENDFILE_H 1
 
 /* Define to 1 if you have the <sys/socket.h> header file. */
 #define HAVE_SYS_SOCKET_H 1
@@ -1213,10 +1213,10 @@
 #define HAVE_SYS_SYSCALL_H 1
 
 /* Define to 1 if you have the <sys/sysmacros.h> header file. */
-/* #undef HAVE_SYS_SYSMACROS_H */
+#define HAVE_SYS_SYSMACROS_H 1
 
 /* Define to 1 if you have the <sys/sys_domain.h> header file. */
-#define HAVE_SYS_SYS_DOMAIN_H 1
+/* #undef HAVE_SYS_SYS_DOMAIN_H */
 
 /* Define to 1 if you have the <sys/termio.h> header file. */
 /* #undef HAVE_SYS_TERMIO_H */
@@ -1304,10 +1304,10 @@
 /* Define if you have a useable wchar_t type defined in wchar.h; useable means
    wchar_t must be an unsigned type with at least 16 bits. (see
    Include/unicodeobject.h). */
-/* #undef HAVE_USABLE_WCHAR_T */
+#define HAVE_USABLE_WCHAR_T 1
 
 /* Define to 1 if you have the <util.h> header file. */
-#define HAVE_UTIL_H 1
+/* #undef HAVE_UTIL_H */
 
 /* Define to 1 if you have the `utimensat' function. */
 #define HAVE_UTIMENSAT 1
@@ -1331,7 +1331,7 @@
 /* #undef HAVE_UUID_H */
 
 /* Define to 1 if you have the <uuid/uuid.h> header file. */
-#define HAVE_UUID_UUID_H 1
+/* #undef HAVE_UUID_UUID_H */
 
 /* Define to 1 if you have the `vfork' function. */
 #define HAVE_VFORK 1
@@ -1382,7 +1382,7 @@
 
 /* Define to 1 if `major', `minor', and `makedev' are declared in
    <sysmacros.h>. */
-/* #undef MAJOR_IN_SYSMACROS */
+#define MAJOR_IN_SYSMACROS 1
 
 /* Define if mvwdelch in curses.h is an expression. */
 #define MVWDELCH_IS_EXPRESSION 1
@@ -1409,7 +1409,7 @@
 /* #undef POSIX_SEMAPHORES_NOT_ENABLED */
 
 /* Define if pthread_key_t is compatible with int. */
-/* #undef PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT */
+#define PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT 1
 
 /* Defined if PTHREAD_SCOPE_SYSTEM supported. */
 #define PTHREAD_SYSTEM_SCHED_SUPPORTED 1
@@ -1465,7 +1465,7 @@
 #define SIZEOF_FLOAT 4
 
 /* The size of `fpos_t', as computed by sizeof. */
-#define SIZEOF_FPOS_T 8
+#define SIZEOF_FPOS_T 16
 
 /* The size of `int', as computed by sizeof. */
 #define SIZEOF_INT 4
@@ -1486,7 +1486,7 @@
 #define SIZEOF_PID_T 4
 
 /* The size of `pthread_key_t', as computed by sizeof. */
-#define SIZEOF_PTHREAD_KEY_T 8
+#define SIZEOF_PTHREAD_KEY_T 4
 
 /* The size of `pthread_t', as computed by sizeof. */
 #define SIZEOF_PTHREAD_T 8
@@ -1520,7 +1520,7 @@
 #define SYS_SELECT_WITH_SYS_TIME 1
 
 /* Custom thread stack size depending on chosen sanitizer runtimes. */
-#define THREAD_STACK_SIZE 0x1000000
+/* #undef THREAD_STACK_SIZE */
 
 /* Library needed by timemodule.c: librt may be needed for clock_gettime() */
 /* #undef TIMEMODULE_LIB */
@@ -1572,7 +1572,7 @@
 /* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic
    linker (dyld) instead of the old-style (NextStep) dynamic linker (rld).
    Dyld is necessary to support frameworks. */
-#define WITH_DYLD 1
+/* #undef WITH_DYLD */
 
 /* Define to build the readline module against Editline. */
 /* #undef WITH_EDITLINE */
@@ -1637,7 +1637,7 @@
 /* #undef _POSIX_1_SOURCE */
 
 /* Define to activate features from IEEE Stds 1003.1-2008 */
-/* #undef _POSIX_C_SOURCE */
+#define _POSIX_C_SOURCE 200809L
 
 /* Define to 1 if you need to in order for `stat' and other things to work. */
 /* #undef _POSIX_SOURCE */
@@ -1652,10 +1652,10 @@
 #define _REENTRANT 1
 
 /* Define to the level of X/Open that your system supports */
-/* #undef _XOPEN_SOURCE */
+#define _XOPEN_SOURCE 700
 
 /* Define to activate Unix95-and-earlier features */
-/* #undef _XOPEN_SOURCE_EXTENDED */
+#define _XOPEN_SOURCE_EXTENDED 1
 
 /* Define on FreeBSD to activate all library features */
 #define __BSD_VISIBLE 1
diff --git a/android/linux_x86_64/config.c b/android/linux_x86_64/config.c
index 7889efe..c97555f 100644
--- a/android/linux_x86_64/config.c
+++ b/android/linux_x86_64/config.c
@@ -76,6 +76,7 @@
 extern PyObject* PyInit__sha512(void);
 extern PyObject* PyInit__sha3(void);
 extern PyObject* PyInit__struct(void);
+extern PyObject* PyInit__sqlite3(void);
 extern PyObject* PyInit_posix(void);
 extern PyObject* PyInit_errno(void);
 extern PyObject* PyInit_pwd(void);
@@ -163,6 +164,7 @@
     {"_sha512", PyInit__sha512},
     {"_sha3", PyInit__sha3},
     {"_struct", PyInit__struct},
+    {"_sqlite3", PyInit__sqlite3},
     {"posix", PyInit_posix},
     {"errno", PyInit_errno},
     {"pwd", PyInit_pwd},
diff --git a/android/regen.sh b/android/regen.sh
index ea04076..04d7e70 100755
--- a/android/regen.sh
+++ b/android/regen.sh
@@ -20,7 +20,15 @@
 
 ANDROID_BUILD_TOP=$(cd ../../../..; pwd)
 
-DIR=`uname | tr 'A-Z' 'a-z'`_x86_64
+if [ $(uname) == 'Darwin' ]; then
+  DIR=darwin
+else
+  if [ $(uname -m) == 'aarch64' ]; then
+      DIR=linux_arm64
+  else
+      DIR=linux_x86_64
+  fi
+fi
 mkdir -p $DIR/pyconfig
 cd $DIR
 
@@ -30,6 +38,11 @@
   export CC="$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/$CLANG_VERSION/bin/clang"
   export CFLAGS="--sysroot=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot"
   export LDFLAGS="--sysroot=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -B$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/lib/gcc/x86_64-linux/4.8.3 -L$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/lib/gcc/x86_64-linux/4.8.3 -L$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/x86_64-linux/lib64"
+elif [ $DIR == "linux_arm64" ]; then
+  #export CC="$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/$CLANG_VERSION/bin/clang"
+  export CC=clang
+  export CFLAGS="--sysroot=$ANDROID_BUILD_TOP/prebuilts/build-tools/sysroots/aarch64-linux-musl"
+  export LDFLAGS="--sysroot=$ANDROID_BUILD_TOP/prebuilts/build-tools/sysroots/aarch64-linux-musl -rtlib=compiler-rt -fuse-ld=lld --unwindlib=none"
 fi
 
 #
@@ -40,10 +53,25 @@
 cd tmp
 ../../../configure
 
-if [ $DIR == "darwin_x86_64" ]; then
+if [ $DIR == "darwin" ]; then
   # preadv and pwritev are not safe on <11, which we still target
   sed -ibak "s%#define HAVE_PREADV 1%/* #undef HAVE_PREADV */%" pyconfig.h
   sed -ibak "s%#define HAVE_PWRITEV 1%/* #undef HAVE_PWRITEV */%" pyconfig.h
+  # mkfifoat and mknodat are not safe on <13, which we still target
+  sed -ibak "s%#define HAVE_MKNODAT 1%/* #undef HAVE_MKNODAT */%" pyconfig.h
+  sed -ibak "s%#define HAVE_MKFIFOAT 1%/* #undef HAVE_MKFIFOAT */%" pyconfig.h
+
+  if [ $(machine) != "x86_64h" ]; then
+    echo "This script expects to be run on an X86_64 machine"
+    exit 1
+  fi
+
+  # Changes to support darwin_arm64
+  sed -ibak 's%#define HAVE_FINITE 1%#ifdef __x86_64__\n#define HAVE_FINITE 1\n#endif%' pyconfig.h
+  sed -ibak 's%#define HAVE_GAMMA 1%#ifdef __x86_64__\n#define HAVE_GAMMA 1\n#endif%' pyconfig.h
+  sed -ibak 's%#define HAVE_GCC_ASM_FOR_X64 1%#ifdef __x86_64__\n#define HAVE_GCC_ASM_FOR_X64 1\n#endif%' pyconfig.h
+  sed -ibak 's%#define HAVE_GCC_ASM_FOR_X87 1%#ifdef __x86_64__\n#define HAVE_GCC_ASM_FOR_X87 1\n#endif%' pyconfig.h
+  sed -ibak 's%#define SIZEOF_LONG_DOUBLE .*%#ifdef __x86_64__\n#define SIZEOF_LONG_DOUBLE 16\n#else\n#define SIZEOF_LONG_DOUBLE 8\n#endif%' pyconfig.h
 fi
 
 if [ $DIR == "linux_x86_64" ]; then
diff --git a/kokoro/build.py b/kokoro/build.py
index cde1a8d..86080a8 100755
--- a/kokoro/build.py
+++ b/kokoro/build.py
@@ -42,6 +42,7 @@
         os.path.join(python_src, 'configure'),
         '--prefix={}'.format(install_dir),
         '--enable-shared',
+        '--with-ensurepip=install',
     ]
     env = dict(os.environ)
     if host == Host.Darwin:
@@ -136,8 +137,6 @@
       "tkinter", "turtledemo",
       # IDLE_DIRS_ONLY
       "idlelib",
-      # VENV_DIRS_ONLY
-      "ensurepip",
       # TCLTK_FILES_ONLY
       "turtle.py",
       # BDIST_WININST_FILES_ONLY