Index: configure
===================================================================
--- configure	(revision 164769)
+++ configure	(working copy)
@@ -713,6 +713,7 @@
 EXTRA_OPTIONS
 EXTRA_LD_OPTIONS
 CLANG_SRC_ROOT
+LLVM_ANDROID_TOOLCHAIN_DIR
 BINUTILS_INCDIR
 INTERNAL_PREFIX
 NM
@@ -1453,6 +1454,8 @@
   --with-c-include-dirs   Colon separated list of directories clang will
                           search for headers
   --with-gcc-toolchain    Directory where gcc is installed.
+  --with-android-toolchain
+                          Path to the standalone Android NDK toolchain.
   --with-default-sysroot  Add --sysroot=<path> to all compiler invocations.
   --with-binutils-include Specify path to binutils/include/ containing
                           plugin-api.h file for gold plugin.
@@ -5709,6 +5712,17 @@
 
 
 
+# Check whether --with-android-toolchain was given.
+if test "${with_android_toolchain+set}" = set; then
+  withval=$with_android_toolchain;
+else
+  withval=""
+fi
+
+LLVM_ANDROID_TOOLCHAIN_DIR=$withval
+
+
+
 # Check whether --with-default-sysroot was given.
 if test "${with_default_sysroot+set}" = set; then
   withval=$with_default_sysroot;
@@ -10316,7 +10330,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10319 "configure"
+#line 10333 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -22255,6 +22269,7 @@
 EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim
 EXTRA_LD_OPTIONS!$EXTRA_LD_OPTIONS$ac_delim
 CLANG_SRC_ROOT!$CLANG_SRC_ROOT$ac_delim
+LLVM_ANDROID_TOOLCHAIN_DIR!$LLVM_ANDROID_TOOLCHAIN_DIR$ac_delim
 BINUTILS_INCDIR!$BINUTILS_INCDIR$ac_delim
 INTERNAL_PREFIX!$INTERNAL_PREFIX$ac_delim
 NM!$NM$ac_delim
@@ -22338,7 +22353,7 @@
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 95; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 96; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
@@ -22357,7 +22372,7 @@
 
 cat >>$CONFIG_STATUS <<_ACEOF
 cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
 _ACEOF
 sed '
 s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
@@ -22370,8 +22385,6 @@
 ' >>$CONFIG_STATUS <conf$$subs.sed
 rm -f conf$$subs.sed
 cat >>$CONFIG_STATUS <<_ACEOF
-:end
-s/|#_!!_#|//g
 CEOF$ac_eof
 _ACEOF
 
@@ -22619,7 +22632,7 @@
 s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
 s&@INSTALL@&$ac_INSTALL&;t t
 $ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed 's/|#_!!_#|//g' >$tmp/out
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
   { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
Index: Makefile.config.in
===================================================================
--- Makefile.config.in	(revision 164769)
+++ Makefile.config.in	(working copy)
@@ -373,3 +373,7 @@
 ifeq ($(USE_OPROFILE), 1)
   OPTIONAL_COMPONENTS += OProfileJIT
 endif
+
+# Path to the Android NDK standalone toolchain.
+LLVM_ANDROID_TOOLCHAIN_DIR := @LLVM_ANDROID_TOOLCHAIN_DIR@
+
Index: autoconf/configure.ac
===================================================================
--- autoconf/configure.ac	(revision 164769)
+++ autoconf/configure.ac	(working copy)
@@ -919,6 +919,12 @@
 AC_DEFINE_UNQUOTED(GCC_INSTALL_PREFIX,"$withval",
                    [Directory where gcc is installed.])
 
+AC_ARG_WITH(android-toolchain,
+  AS_HELP_STRING([--with-android-toolchain],
+    [Path to the standalone Android NDK toolchain.]),,
+    withval="")
+AC_SUBST(LLVM_ANDROID_TOOLCHAIN_DIR,[$withval])
+
 AC_ARG_WITH(default-sysroot,
   AS_HELP_STRING([--with-default-sysroot],
     [Add --sysroot=<path> to all compiler invocations.]),,
