summaryrefslogtreecommitdiff
path: root/autoconf
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-02-23 10:00:49 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-02-23 10:00:49 +0000
commit9851567a106ef1907cca715fc5e3e4e498b2df81 (patch)
treeeb1cac3fbd3ffc570c1d2671a1028c81d881bcea /autoconf
parent9e7d90bcfc1eb291118627dcc87ad79f6bc3fb20 (diff)
downloadllvm-9851567a106ef1907cca715fc5e3e4e498b2df81.tar.gz
llvm-9851567a106ef1907cca715fc5e3e4e498b2df81.tar.bz2
llvm-9851567a106ef1907cca715fc5e3e4e498b2df81.tar.xz
Initial configure support for using Clang as the LLVM capable compiler.
Comes in two parts: 1. Use --with-clang=path/to/clang/compiler to select an installed clang, or --with-built-clang to have the makefiles use the clang which will be built as the LLVM capable compiler. If neither is given, --with-built-clang will be used if the Clang sources are checked out into the standard location (tools/clang). 2. Use --with-llvmcc={llvm-gcc,clang,none} to specify which LLVM capable compiler to use. If not given, then llvm-gcc will be used if available, otherwise Clang. Makefile support still to come. Eric, Doug, Chris, seem reasonable? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96934 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'autoconf')
-rw-r--r--autoconf/configure.ac73
1 files changed, 73 insertions, 0 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 762c41e1cc..9e8cdfc226 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -612,6 +612,56 @@ if test -n "$LLVMGXX" && test -z "$LLVMGCC"; then
AC_MSG_ERROR([Invalid llvm-gcc. Use --with-llvmgcc when --with-llvmgxx is used]);
fi
+dnl Allow a specific Clang compiler to be used with this LLVM config.
+AC_ARG_WITH(clang,
+ AS_HELP_STRING([--with-clang],
+ [Specify location of clang compiler (default is --with-built-clang)]),
+ [],[with_clang=default])
+
+dnl Enable use of the built Clang.
+AC_ARG_WITH(built-clang,
+ AS_HELP_STRING([--with-built-clang],
+ [Use the compiled Clang as the LLVM compiler (default=check)]),
+ [],[with_built_clang=check])
+
+dnl Select the Clang compiler option.
+dnl
+dnl If --with-clang is given, always honor that; otherwise honor
+dnl --with-built-clang, or check if we have the clang sources.
+AC_MSG_CHECKING([clang compiler])
+WITH_CLANGPATH=""
+WITH_BUILT_CLANG=0
+if test "$with_clang" != "default"; then
+ WITH_CLANGPATH="$with_clang"
+ if ! test -x "$WITH_CLANGPATH"; then
+ AC_MSG_ERROR([invalid --with-clang, path does not specify an executable])
+ fi
+elif test "$with_built_clang" = "yes"; then
+ WITH_BUILT_CLANG=1
+elif test "$with_built_clang" = "no"; then
+ WITH_BUILT_CLANG=0
+else
+ if test "$with_built_clang" != "check"; then
+ AC_MSG_ERROR([invalid value for --with-built-clang.])
+ fi
+
+ if test -f ${srcdir}/tools/clang/README.txt; then
+ WITH_BUILT_CLANG=1
+ fi
+fi
+
+if ! test -z "$WITH_CLANGPATH"; then
+ AC_MSG_RESULT([$WITH_CLANGPATH])
+ WITH_CLANGXXPATH=`"$WITH_CLANGPATH" --print-prog-name=clang++`
+elif test "$WITH_BUILT_CLANG" = "1"; then
+ AC_MSG_RESULT([built])
+else
+ AC_MSG_RESULT([none])
+fi
+AC_SUBST(CLANGPATH,$WITH_CLANGPATH)
+AC_SUBST(CLANGXXPATH,$WITH_CLANGXXPATH)
+AC_SUBST(ENABLE_BUILT_CLANG,$WITH_BUILT_CLANG)
+
dnl Override the option to use for optimized builds.
AC_ARG_WITH(optimize-option,
AS_HELP_STRING([--with-optimize-option],
@@ -946,6 +996,29 @@ else
AC_SUBST(LLVMGXXCOMMAND,$LLVMGXXCOMMAND)
fi
+dnl Select the LLVM capable compiler to use, we default to using llvm-gcc if
+dnl found, otherwise clang if available.
+AC_ARG_WITH(llvmcc,
+ AS_HELP_STRING([--with-llvmcc=<name>],
+ [Choose the LLVM capable compiler to use (llvm-gcc, clang, or none; default=check)]),
+ [],[with_llvmcc=check])
+AC_MSG_CHECKING([LLVM capable compiler])
+if test "$with_llvmcc" != "check"; then
+ if (test "$with_llvmcc" != "llvm-gcc" &&
+ test "$with_llvmcc" != "clang" &&
+ test "$with_llvmcc" != "none"); then
+ AC_MSG_ERROR([invalid value for --with-llvmcc, expected 'llvm-gcc', 'clang', or 'none'.])
+ fi
+ WITH_LLVMCC="$with_llvmcc"
+elif test -n "$LLVMGCC"; then
+ WITH_LLVMCC=llvm-gcc
+elif test -n "$WITH_CLANGPATH" || test "$WITH_BUILT_CLANG" -ne "0"; then
+ WITH_LLVMCC=clang
+else
+ WITH_LLVMCC=none
+fi
+AC_MSG_RESULT([$WITH_LLVMCC])
+AC_SUBST(LLVMCC_OPTION,$WITH_LLVMCC)
AC_MSG_CHECKING([tool compatibility])