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