mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 12:19:53 +00:00
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
This commit is contained in:
parent
9e7d90bcfc
commit
9851567a10
@ -190,6 +190,14 @@ LLVMCC1 := @LLVMCC1@
|
||||
LLVMCC1PLUS := @LLVMCC1PLUS@
|
||||
LLVMGCC_LANGS := @LLVMGCC_LANGS@
|
||||
|
||||
# Information on Clang, if configured.
|
||||
CLANGPATH := @CLANGPATH@
|
||||
CLANGXXPATH := @CLANGXXPATH@
|
||||
ENABLE_BUILT_CLANG := @ENABLE_BUILT_CLANG@
|
||||
|
||||
# The LLVM capable compiler to use.
|
||||
LLVMCC_OPTION := @LLVMCC_OPTION@
|
||||
|
||||
# Path to directory where object files should be stored during a build.
|
||||
# Set OBJ_ROOT to "." if you do not want to use a separate place for
|
||||
# object files.
|
||||
|
@ -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])
|
||||
|
||||
|
117
configure
vendored
117
configure
vendored
@ -695,6 +695,9 @@ LLVM_ENUM_ASM_PRINTERS
|
||||
LLVM_ENUM_ASM_PARSERS
|
||||
LLVM_ENUM_DISASSEMBLERS
|
||||
ENABLE_CBE_PRINTF_A
|
||||
CLANGPATH
|
||||
CLANGXXPATH
|
||||
ENABLE_BUILT_CLANG
|
||||
OPTIMIZE_OPTION
|
||||
EXTRA_OPTIONS
|
||||
BINUTILS_INCDIR
|
||||
@ -754,6 +757,7 @@ LLVMGCCCOMMAND
|
||||
LLVMGXXCOMMAND
|
||||
LLVMGCC
|
||||
LLVMGXX
|
||||
LLVMCC_OPTION
|
||||
NO_VARIADIC_MACROS
|
||||
NO_MISSING_FIELD_INITIALIZERS
|
||||
USE_UDIS86
|
||||
@ -1423,6 +1427,10 @@ Optional Packages:
|
||||
searches PATH)
|
||||
--with-llvmgxx Specify location of llvm-g++ driver (default
|
||||
searches PATH)
|
||||
--with-clang Specify location of clang compiler (default is
|
||||
--with-built-clang)
|
||||
--with-built-clang Use the compiled Clang as the LLVM compiler
|
||||
(default=check)
|
||||
--with-optimize-option Select the compiler options to use for optimized
|
||||
builds
|
||||
--with-extra-options Specify additional options to compile LLVM with
|
||||
@ -1439,6 +1447,8 @@ Optional Packages:
|
||||
--with-binutils-include Specify path to binutils/include/ containing
|
||||
plugin-api.h file for gold plugin.
|
||||
--with-tclinclude directory where tcl headers are
|
||||
--with-llvmcc=<name> Choose the LLVM capable compiler to use (llvm-gcc,
|
||||
clang, or none; default=check)
|
||||
--with-udis86=<path> Use udis86 external x86 disassembler library
|
||||
--with-oprofile=<prefix>
|
||||
Tell OProfile >= 0.9.4 how to symbolize JIT output
|
||||
@ -5026,6 +5036,69 @@ echo "$as_me: error: Invalid llvm-gcc. Use --with-llvmgcc when --with-llvmgxx is
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-clang was given.
|
||||
if test "${with_clang+set}" = set; then
|
||||
withval=$with_clang;
|
||||
else
|
||||
with_clang=default
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Check whether --with-built-clang was given.
|
||||
if test "${with_built_clang+set}" = set; then
|
||||
withval=$with_built_clang;
|
||||
else
|
||||
with_built_clang=check
|
||||
fi
|
||||
|
||||
|
||||
{ echo "$as_me:$LINENO: checking clang compiler" >&5
|
||||
echo $ECHO_N "checking clang compiler... $ECHO_C" >&6; }
|
||||
WITH_CLANGPATH=""
|
||||
WITH_BUILT_CLANG=0
|
||||
if test "$with_clang" != "default"; then
|
||||
WITH_CLANGPATH="$with_clang"
|
||||
if ! test -x "$WITH_CLANGPATH"; then
|
||||
{ { echo "$as_me:$LINENO: error: invalid --with-clang, path does not specify an executable" >&5
|
||||
echo "$as_me: error: invalid --with-clang, path does not specify an executable" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
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
|
||||
{ { echo "$as_me:$LINENO: error: invalid value for --with-built-clang." >&5
|
||||
echo "$as_me: error: invalid value for --with-built-clang." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
if test -f ${srcdir}/tools/clang/README.txt; then
|
||||
WITH_BUILT_CLANG=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! test -z "$WITH_CLANGPATH"; then
|
||||
{ echo "$as_me:$LINENO: result: $WITH_CLANGPATH" >&5
|
||||
echo "${ECHO_T}$WITH_CLANGPATH" >&6; }
|
||||
WITH_CLANGXXPATH=`"$WITH_CLANGPATH" --print-prog-name=clang++`
|
||||
elif test "$WITH_BUILT_CLANG" = "1"; then
|
||||
{ echo "$as_me:$LINENO: result: built" >&5
|
||||
echo "${ECHO_T}built" >&6; }
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: none" >&5
|
||||
echo "${ECHO_T}none" >&6; }
|
||||
fi
|
||||
CLANGPATH=$WITH_CLANGPATH
|
||||
|
||||
CLANGXXPATH=$WITH_CLANGXXPATH
|
||||
|
||||
ENABLE_BUILT_CLANG=$WITH_BUILT_CLANG
|
||||
|
||||
|
||||
|
||||
# Check whether --with-optimize-option was given.
|
||||
if test "${with_optimize_option+set}" = set; then
|
||||
withval=$with_optimize_option;
|
||||
@ -11032,7 +11105,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 11035 "configure"
|
||||
#line 11108 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -12802,6 +12875,36 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-llvmcc was given.
|
||||
if test "${with_llvmcc+set}" = set; then
|
||||
withval=$with_llvmcc;
|
||||
else
|
||||
with_llvmcc=check
|
||||
fi
|
||||
|
||||
{ echo "$as_me:$LINENO: checking LLVM capable compiler" >&5
|
||||
echo $ECHO_N "checking LLVM capable compiler... $ECHO_C" >&6; }
|
||||
if test "$with_llvmcc" != "check"; then
|
||||
if (test "$with_llvmcc" != "llvm-gcc" &&
|
||||
test "$with_llvmcc" != "clang" &&
|
||||
test "$with_llvmcc" != "none"); then
|
||||
{ { echo "$as_me:$LINENO: error: invalid value for --with-llvmcc, expected 'llvm-gcc', 'clang', or 'none'." >&5
|
||||
echo "$as_me: error: invalid value for --with-llvmcc, expected 'llvm-gcc', 'clang', or 'none'." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
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
|
||||
{ echo "$as_me:$LINENO: result: $WITH_LLVMCC" >&5
|
||||
echo "${ECHO_T}$WITH_LLVMCC" >&6; }
|
||||
LLVMCC_OPTION=$WITH_LLVMCC
|
||||
|
||||
|
||||
{ echo "$as_me:$LINENO: checking tool compatibility" >&5
|
||||
echo $ECHO_N "checking tool compatibility... $ECHO_C" >&6; }
|
||||
|
||||
@ -20646,10 +20749,10 @@ LLVM_ENUM_ASM_PRINTERS!$LLVM_ENUM_ASM_PRINTERS$ac_delim
|
||||
LLVM_ENUM_ASM_PARSERS!$LLVM_ENUM_ASM_PARSERS$ac_delim
|
||||
LLVM_ENUM_DISASSEMBLERS!$LLVM_ENUM_DISASSEMBLERS$ac_delim
|
||||
ENABLE_CBE_PRINTF_A!$ENABLE_CBE_PRINTF_A$ac_delim
|
||||
CLANGPATH!$CLANGPATH$ac_delim
|
||||
CLANGXXPATH!$CLANGXXPATH$ac_delim
|
||||
ENABLE_BUILT_CLANG!$ENABLE_BUILT_CLANG$ac_delim
|
||||
OPTIMIZE_OPTION!$OPTIMIZE_OPTION$ac_delim
|
||||
EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim
|
||||
BINUTILS_INCDIR!$BINUTILS_INCDIR$ac_delim
|
||||
ENABLE_LLVMC_DYNAMIC!$ENABLE_LLVMC_DYNAMIC$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
|
||||
@ -20691,6 +20794,9 @@ _ACEOF
|
||||
ac_delim='%!_!# '
|
||||
for ac_last_try in false false false false false :; do
|
||||
cat >conf$$subs.sed <<_ACEOF
|
||||
EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim
|
||||
BINUTILS_INCDIR!$BINUTILS_INCDIR$ac_delim
|
||||
ENABLE_LLVMC_DYNAMIC!$ENABLE_LLVMC_DYNAMIC$ac_delim
|
||||
ENABLE_LLVMC_DYNAMIC_PLUGINS!$ENABLE_LLVMC_DYNAMIC_PLUGINS$ac_delim
|
||||
CXX!$CXX$ac_delim
|
||||
CXXFLAGS!$CXXFLAGS$ac_delim
|
||||
@ -20746,6 +20852,7 @@ LLVMGCCCOMMAND!$LLVMGCCCOMMAND$ac_delim
|
||||
LLVMGXXCOMMAND!$LLVMGXXCOMMAND$ac_delim
|
||||
LLVMGCC!$LLVMGCC$ac_delim
|
||||
LLVMGXX!$LLVMGXX$ac_delim
|
||||
LLVMCC_OPTION!$LLVMCC_OPTION$ac_delim
|
||||
NO_VARIADIC_MACROS!$NO_VARIADIC_MACROS$ac_delim
|
||||
NO_MISSING_FIELD_INITIALIZERS!$NO_MISSING_FIELD_INITIALIZERS$ac_delim
|
||||
USE_UDIS86!$USE_UDIS86$ac_delim
|
||||
@ -20778,7 +20885,7 @@ LIBOBJS!$LIBOBJS$ac_delim
|
||||
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 85; then
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 89; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
|
Loading…
Reference in New Issue
Block a user