Update and re-run androidconfigure.

This patch re-runs androidconfigure for the new 7.49.1 version of the
source code. It also updates the androidconfigure script to make it
easier to merge in future releases in the following ways:
 * It sets the default CA path in the ./configure call.
 * It patches the generated header files with local changes to make
it build on Mac.

Bug: 29602883

(cherry picked from commit d5664861047812bfabfa6e161c9356a0b9fec90d)

Change-Id: Idd435126b894fb133e2703793d9769809b171265
diff --git a/androidconfigure b/androidconfigure
index 895465c..f6c1aea 100755
--- a/androidconfigure
+++ b/androidconfigure
@@ -1,7 +1,18 @@
 #!/bin/bash
 
-export CC="$(ls "${ANDROID_TOOLCHAIN}" | grep "\-gcc$")"
-export LD="$(ls "${ANDROID_TOOLCHAIN}" | grep "\-ld$")"
+set -e
+
+if [[ "${TARGET_PRODUCT}" != "aosp_arm" ]]; then
+  # Some of the include paths below assume that this is an arm 32bit configure
+  # run.
+  echo "Run 'lunch aosp_arm-eng' first." >&2
+  exit 1
+fi
+
+cd $(dirname "$0")
+
+export CC="$(ls "${ANDROID_TOOLCHAIN}" | grep "\-gcc$" | grep -v kernel)"
+export LD="$(ls "${ANDROID_TOOLCHAIN}" | grep "\-ld$" | grep -v kernel)"
 
 T="${ANDROID_BUILD_TOP}"
 CFLAGS=(
@@ -12,7 +23,6 @@
   "-isystem ${T}/bionic/libc/kernel/uapi/asm-arm/"
   "-isystem ${T}/bionic/libm/include"
   "-isystem ${T}/build/core/combo/include/arch/linux-arm/"
-  "-include ${T}/build/core/combo/include/arch/linux-arm/AndroidConfig.h"
   "-fno-exceptions"
   "-ffunction-sections"
   "-fdata-sections"
@@ -26,11 +36,19 @@
   "-nostdlib"
 )
 
-
 ./buildconf
 CFLAGS="${CFLAGS[@]}"
-./configure --host=arm-linux-androideabi --with-ssl="${T}/external/boringssl" \
-  CFLAGS="${CFLAGS}"  LIBS="-lc" CPPFLAGS="${CFLAGS} -I${T}/external/zlib/src" \
-  LDFLAGS="-L${ANDROID_PRODUCT_OUT}/obj/lib/" --disable-ntlm-wb --enable-ipv6 \
-  --with-zlib
+./configure \
+  --host=arm-linux-androideabi \
+  CFLAGS="${CFLAGS}" \
+  LIBS="-lc" \
+  CPPFLAGS="${CFLAGS} -I${T}/external/zlib/src" \
+  LDFLAGS="-L${ANDROID_PRODUCT_OUT}/obj/lib/" \
+  --disable-ntlm-wb \
+  --enable-ipv6 \
+  --with-ssl="${T}/external/boringssl" \
+  --with-zlib \
+  --with-ca-path="/system/etc/security/cacerts"
 
+# Apply local changes to the default configure output.
+patch -p1 --no-backup-if-mismatch < local-configure.patch
diff --git a/include/curl/curlbuild.h b/include/curl/curlbuild.h
index 2bf01cf..473cd8e 100644
--- a/include/curl/curlbuild.h
+++ b/include/curl/curlbuild.h
@@ -12,7 +12,7 @@
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
+ * are also available at https://curl.haxx.se/docs/copyright.html.
  *
  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  * copies of the Software, and permit persons to whom the Software is
@@ -36,7 +36,7 @@
  *
  * If you think that something actually needs to be changed, adjusted
  * or fixed in this file, then, report it on the libcurl development
- * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
+ * mailing list: https://cool.haxx.se/mailman/listinfo/curl-library/
  *
  * This header file shall only export symbols which are 'curl' or 'CURL'
  * prefixed, otherwise public name space would be polluted.
@@ -133,14 +133,14 @@
 
 /* Configure process defines this to 1 when it finds out that system */
 /* header file stdint.h must be included by the external interface.  */
-#define CURL_PULL_STDINT_H 1
+/* #undef CURL_PULL_STDINT_H */
 #ifdef CURL_PULL_STDINT_H
 #  include <stdint.h>
 #endif
 
 /* Configure process defines this to 1 when it finds out that system  */
 /* header file inttypes.h must be included by the external interface. */
-#define CURL_PULL_INTTYPES_H 1
+/* #undef CURL_PULL_INTTYPES_H */
 #ifdef CURL_PULL_INTTYPES_H
 #  include <inttypes.h>
 #endif
@@ -169,7 +169,7 @@
 typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
 
 /* Signed integral data type used for curl_off_t. */
-#define CURL_TYPEOF_CURL_OFF_T int64_t
+#define CURL_TYPEOF_CURL_OFF_T long long
 
 /* Data type definition of curl_off_t. */
 typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
diff --git a/lib/curl_config.h b/lib/curl_config.h
index 684a60d..0649de8 100644
--- a/lib/curl_config.h
+++ b/lib/curl_config.h
@@ -4,6 +4,9 @@
 /* Location of default ca bundle */
 /* #undef CURL_CA_BUNDLE */
 
+/* define "1" to use built in CA store of SSL library */
+/* #undef CURL_CA_FALLBACK */
+
 /* Location of default ca path */
 #define CURL_CA_PATH "/system/etc/security/cacerts"
 
@@ -145,15 +148,18 @@
 /* Define to 1 if you have the <crypto.h> header file. */
 /* #undef HAVE_CRYPTO_H */
 
+/* Define to 1 if you have the `CyaSSL_CTX_UseSupportedCurve' function. */
+/* #undef HAVE_CYASSL_CTX_USESUPPORTEDCURVE */
+
 /* Define to 1 if you have the <cyassl/error-ssl.h> header file. */
 /* #undef HAVE_CYASSL_ERROR_SSL_H */
 
+/* Define to 1 if you have the `CyaSSL_get_peer_certificate' function. */
+/* #undef HAVE_CYASSL_GET_PEER_CERTIFICATE */
+
 /* Define to 1 if you have the <cyassl/options.h> header file. */
 /* #undef HAVE_CYASSL_OPTIONS_H */
 
-/* Define to 1 if you have the `DES_set_odd_parity' function. */
-#define HAVE_DES_SET_ODD_PARITY 1
-
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #define HAVE_DLFCN_H 1
 
@@ -188,7 +194,7 @@
 #define HAVE_FREEADDRINFO 1
 
 /* Define to 1 if you have the freeifaddrs function. */
-/* #undef HAVE_FREEIFADDRS */
+#define HAVE_FREEIFADDRS 1
 
 /* Define to 1 if you have the fsetxattr function. */
 #define HAVE_FSETXATTR 1
@@ -248,7 +254,7 @@
 #define HAVE_GETHOSTNAME 1
 
 /* Define to 1 if you have a working getifaddrs function. */
-/* #undef HAVE_GETIFADDRS */
+#define HAVE_GETIFADDRS 1
 
 /* Define to 1 if you have the getnameinfo function. */
 #define HAVE_GETNAMEINFO 1
@@ -283,6 +289,10 @@
 /* Define to 1 if you have a working gmtime_r function. */
 #define HAVE_GMTIME_R 1
 
+/* Define to 1 if you have the `gnutls_certificate_set_x509_key_file2'
+   function. */
+/* #undef HAVE_GNUTLS_CERTIFICATE_SET_X509_KEY_FILE2 */
+
 /* if you have the function gnutls_srp_verifier */
 /* #undef HAVE_GNUTLS_SRP */
 
@@ -317,7 +327,7 @@
 /* #undef HAVE_IDN_FREE_H */
 
 /* Define to 1 if you have the <ifaddrs.h> header file. */
-/* #undef HAVE_IFADDRS_H */
+#define HAVE_IFADDRS_H 1
 
 /* Define to 1 if you have the `if_nametoindex' function. */
 #define HAVE_IF_NAMETOINDEX 1
@@ -395,9 +405,6 @@
 /* Define to 1 if you have the `idn' library (-lidn). */
 /* #undef HAVE_LIBIDN */
 
-/* Define to 1 if you have the `resolve' library (-lresolve). */
-/* #undef HAVE_LIBRESOLVE */
-
 /* Define to 1 if using libressl. */
 /* #undef HAVE_LIBRESSL */
 
@@ -524,7 +531,7 @@
 #define HAVE_PWD_H 1
 
 /* Define to 1 if you have the `RAND_egd' function. */
-/* #undef HAVE_RAND_EGD */
+#define HAVE_RAND_EGD 1
 
 /* Define to 1 if you have the `RAND_screen' function. */
 /* #undef HAVE_RAND_SCREEN */
@@ -563,7 +570,7 @@
 /* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */
 
 /* Define to 1 if you have the <sgtty.h> header file. */
-#define HAVE_SGTTY_H 1
+/* #undef HAVE_SGTTY_H */
 
 /* Define to 1 if you have the sigaction function. */
 #define HAVE_SIGACTION 1
@@ -763,6 +770,18 @@
 /* Define to 1 if you have the winsock.h header file. */
 /* #undef HAVE_WINSOCK_H */
 
+/* Define to 1 if you have the `wolfSSLv3_client_method' function. */
+/* #undef HAVE_WOLFSSLV3_CLIENT_METHOD */
+
+/* Define to 1 if you have the `wolfSSL_CTX_UseSupportedCurve' function. */
+/* #undef HAVE_WOLFSSL_CTX_USESUPPORTEDCURVE */
+
+/* Define to 1 if you have the `wolfSSL_get_peer_certificate' function. */
+/* #undef HAVE_WOLFSSL_GET_PEER_CERTIFICATE */
+
+/* Define to 1 if you have the `wolfSSL_UseALPN' function. */
+/* #undef HAVE_WOLFSSL_USEALPN */
+
 /* Define this symbol if your OS supports changing the contents of argv */
 /* #undef HAVE_WRITABLE_ARGV */
 
@@ -807,7 +826,7 @@
 #define PACKAGE "curl"
 
 /* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "a suitable curl mailing list: http://curl.haxx.se/mail/"
+#define PACKAGE_BUGREPORT "a suitable curl mailing list: https://curl.haxx.se/mail/"
 
 /* Define to the full name of this package. */
 #define PACKAGE_NAME "curl"
@@ -881,9 +900,6 @@
 /* The size of `long long', as computed by sizeof. */
 /* #undef SIZEOF_LONG_LONG */
 
-/* The size of `off_t', as computed by sizeof. */
-#define SIZEOF_OFF_T 8
-
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
 
@@ -899,7 +915,7 @@
 /* if axTLS is enabled */
 /* #undef USE_AXTLS */
 
-/* if CyaSSL is enabled */
+/* if CyaSSL/WolfSSL is enabled */
 /* #undef USE_CYASSL */
 
 /* to enable iOS/Mac OS X native SSL/TLS support */
@@ -911,6 +927,9 @@
 /* if GnuTLS uses nettle as crypto backend */
 /* #undef USE_GNUTLS_NETTLE */
 
+/* PSL support enabled */
+/* #undef USE_LIBPSL */
+
 /* if librtmp is in use */
 /* #undef USE_LIBRTMP */
 
@@ -920,6 +939,9 @@
 /* If you want to build curl with the built-in manual */
 #define USE_MANUAL 1
 
+/* if mbedTLS is enabled */
+/* #undef USE_MBEDTLS */
+
 /* Define to enable metalink support */
 /* #undef USE_METALINK */
 
diff --git a/local-configure.patch b/local-configure.patch
new file mode 100644
index 0000000..b3444fe
--- /dev/null
+++ b/local-configure.patch
@@ -0,0 +1,57 @@
+diff --git a/lib/curl_config.h b/lib/curl_config.h
+index d3d74dc..526bcf7 100644
+--- a/lib/curl_config.h
++++ b/lib/curl_config.h
+@@ -128,7 +128,10 @@
+ #define HAVE_BORINGSSL 1
+ 
+ /* Define to 1 if you have the clock_gettime function and monotonic timer. */
++#ifndef __APPLE__
++/* CLOCK_MONOTONIC is not defined in mac when building for the host. */
+ #define HAVE_CLOCK_GETTIME_MONOTONIC 1
++#endif
+ 
+ /* Define to 1 if you have the closesocket function. */
+ /* #undef HAVE_CLOSESOCKET */
+@@ -442,10 +445,14 @@
+ #define HAVE_MEMORY_H 1
+ 
+ /* Define to 1 if you have the memrchr function or macro. */
++#ifndef __APPLE__
+ #define HAVE_MEMRCHR 1
++#endif
+ 
+ /* Define to 1 if you have the MSG_NOSIGNAL flag. */
++#ifndef __APPLE__
+ #define HAVE_MSG_NOSIGNAL 1
++#endif
+ 
+ /* Define to 1 if you have the <netdb.h> header file. */
+ #define HAVE_NETDB_H 1
+@@ -858,7 +865,7 @@
+ #define RETSIGTYPE void
+ 
+ /* Define to the type qualifier of arg 5 for select. */
+-#define SELECT_QUAL_ARG5 
++#define SELECT_QUAL_ARG5
+ 
+ /* Define to the type of arg 1 for select. */
+ #define SELECT_TYPE_ARG1 int
+@@ -890,18 +897,9 @@
+ /* Define to the function return type for send. */
+ #define SEND_TYPE_RETV int
+ 
+-/* The size of `long', as computed by sizeof. */
+-#define SIZEOF_LONG 4
+-
+ /* The size of `long long', as computed by sizeof. */
+ /* #undef SIZEOF_LONG_LONG */
+ 
+-/* The size of `off_t', as computed by sizeof. */
+-#define SIZEOF_OFF_T 8
+-
+-/* The size of `void*', as computed by sizeof. */
+-#define SIZEOF_VOIDP 4
+-
+ /* Define to 1 if you have the ANSI C header files. */
+ #define STDC_HEADERS 1