Support --with-llvmgccdir and friends in llvmc, take 2.

Should now work when building with objdir != srcdir and when llvm-gcc is not
available.

Thanks to Duncan Sands for testing and advice!

llvm-svn: 69700
This commit is contained in:
Mikhail Glushenkov 2009-04-21 19:46:10 +00:00
parent fa9ab53d95
commit 2c332fec97
4 changed files with 62 additions and 9 deletions

View File

@ -1466,7 +1466,8 @@ endif # TARGET
ifdef LLVMC_BUILD_AUTOGENERATED_INC
LLVMCPluginSrc := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td))
LLVMCPluginSrc := $(sort $(strip $(wildcard $(PROJ_SRC_DIR)/*.td)) \
$(strip $(wildcard $(PROJ_OBJ_DIR)/*.td)))
TDFiles := $(LLVMCPluginSrc) \
$(strip $(wildcard $(LLVM_SRC_ROOT)/include/llvm/CompilerDriver/*.td))

View File

@ -472,6 +472,14 @@ AC_ARG_WITH(llvmgxx,
LLVMGXX=$with_llvmgxx
WITH_LLVMGCCDIR="",)
if test -n "$LLVMGCC"; then
LLVMGCCCOMMAND="$LLVMGCC"
fi
if test -n "$LLVMGXX"; then
LLVMGXXCOMMAND="$LLVMGXX"
fi
if test -n "$LLVMGCC" && test -z "$LLVMGXX"; then
AC_MSG_ERROR([Invalid llvm-g++. Use --with-llvmgxx when --with-llvmgcc is used]);
fi
@ -663,22 +671,33 @@ if test "$lt_cv_dlopen_self" = "yes" ; then
[Define if dlopen(0) will open the symbols of the program])
fi
if test "$WITH_LLVMGCCDIR" = "default" ; then
LLVMGCC="llvm-gcc${EXEEXT}"
LLVMGXX="llvm-g++${EXEEXT}"
LLVMGCCCOMMAND="$LLVMGCC"
LLVMGXXCOMMAND="$LLVMGXX"
AC_SUBST(LLVMGCCCOMMAND,$LLVMGCCCOMMAND)
AC_SUBST(LLVMGXXCOMMAND,$LLVMGXXCOMMAND)
AC_PATH_PROG(LLVMGCC, $LLVMGCC, [])
AC_PATH_PROG(LLVMGXX, $LLVMGXX, [])
else
if test -z "$LLVMGCC"; then
LLVMGCC="$WITH_LLVMGCCDIR/bin/llvm-gcc${EXEEXT}"
LLVMGCCCOMMAND="$LLVMGCC"
fi
if test -z "$LLVMGXX"; then
LLVMGXX="$WITH_LLVMGCCDIR/bin/llvm-g++${EXEEXT}"
LLVMGXXCOMMAND="$LLVMGXX"
fi
AC_SUBST(LLVMGCC,$LLVMGCC)
AC_SUBST(LLVMGXX,$LLVMGXX)
AC_SUBST(LLVMGCCCOMMAND,$LLVMGCCCOMMAND)
AC_SUBST(LLVMGXXCOMMAND,$LLVMGXXCOMMAND)
fi
AC_MSG_CHECKING([tool compatibility])
dnl Ensure that compilation tools are GCC or a GNU compatible compiler such as
@ -1065,6 +1084,9 @@ AC_CONFIG_FILES([llvm.spec])
dnl Configure doxygen's configuration file
AC_CONFIG_FILES([docs/doxygen.cfg])
dnl Configure llvmc's Base plugin
AC_CONFIG_FILES([tools/llvmc/plugins/Base/Base.td])
dnl Do the first stage of configuration for llvm-config.in.
AC_CONFIG_FILES([tools/llvm-config/llvm-config.in])

32
llvm/configure vendored
View File

@ -899,6 +899,8 @@ ac_ct_F77
LIBTOOL
LLVMGCC
LLVMGXX
LLVMGCCCOMMAND
LLVMGXXCOMMAND
USE_UDIS86
HAVE_PTHREAD
HUGE_VAL_SANITY
@ -5003,6 +5005,13 @@ if test "${with_llvmgxx+set}" = set; then
WITH_LLVMGCCDIR=""
fi
if test -n "$LLVMGCC"; then
LLVMGCCCOMMAND="$LLVMGCC"
fi
if test -n "$LLVMGXX"; then
LLVMGXXCOMMAND="$LLVMGXX"
fi
if test -n "$LLVMGCC" && test -z "$LLVMGXX"; then
{ { echo "$as_me:$LINENO: error: Invalid llvm-g++. Use --with-llvmgxx when --with-llvmgcc is used" >&5
@ -26810,6 +26819,13 @@ fi
if test "$WITH_LLVMGCCDIR" = "default" ; then
LLVMGCC="llvm-gcc${EXEEXT}"
LLVMGXX="llvm-g++${EXEEXT}"
LLVMGCCCOMMAND="$LLVMGCC"
LLVMGXXCOMMAND="$LLVMGXX"
LLVMGCCCOMMAND=$LLVMGCCCOMMAND
LLVMGXXCOMMAND=$LLVMGXXCOMMAND
# Extract the first word of "$LLVMGCC", so it can be a program name with args.
set dummy $LLVMGCC; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
@ -26893,16 +26909,24 @@ fi
else
if test -z "$LLVMGCC"; then
LLVMGCC="$WITH_LLVMGCCDIR/bin/llvm-gcc${EXEEXT}"
LLVMGCCCOMMAND="$LLVMGCC"
fi
if test -z "$LLVMGXX"; then
LLVMGXX="$WITH_LLVMGCCDIR/bin/llvm-g++${EXEEXT}"
LLVMGXXCOMMAND="$LLVMGXX"
fi
LLVMGCC=$LLVMGCC
LLVMGXX=$LLVMGXX
LLVMGCCCOMMAND=$LLVMGCCCOMMAND
LLVMGXXCOMMAND=$LLVMGXXCOMMAND
fi
{ echo "$as_me:$LINENO: checking tool compatibility" >&5
echo $ECHO_N "checking tool compatibility... $ECHO_C" >&6; }
@ -34003,6 +34027,9 @@ ac_config_files="$ac_config_files llvm.spec"
ac_config_files="$ac_config_files docs/doxygen.cfg"
ac_config_files="$ac_config_files tools/llvmc/plugins/Base/Base.td"
ac_config_files="$ac_config_files tools/llvm-config/llvm-config.in"
@ -34617,6 +34644,7 @@ do
"Makefile.config") CONFIG_FILES="$CONFIG_FILES Makefile.config" ;;
"llvm.spec") CONFIG_FILES="$CONFIG_FILES llvm.spec" ;;
"docs/doxygen.cfg") CONFIG_FILES="$CONFIG_FILES docs/doxygen.cfg" ;;
"tools/llvmc/plugins/Base/Base.td") CONFIG_FILES="$CONFIG_FILES tools/llvmc/plugins/Base/Base.td" ;;
"tools/llvm-config/llvm-config.in") CONFIG_FILES="$CONFIG_FILES tools/llvm-config/llvm-config.in" ;;
"setup") CONFIG_COMMANDS="$CONFIG_COMMANDS setup" ;;
"Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;;
@ -34878,6 +34906,8 @@ ac_ct_F77!$ac_ct_F77$ac_delim
LIBTOOL!$LIBTOOL$ac_delim
LLVMGCC!$LLVMGCC$ac_delim
LLVMGXX!$LLVMGXX$ac_delim
LLVMGCCCOMMAND!$LLVMGCCCOMMAND$ac_delim
LLVMGXXCOMMAND!$LLVMGXXCOMMAND$ac_delim
USE_UDIS86!$USE_UDIS86$ac_delim
HAVE_PTHREAD!$HAVE_PTHREAD$ac_delim
HUGE_VAL_SANITY!$HUGE_VAL_SANITY$ac_delim
@ -34911,7 +34941,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` = 77; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 79; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View File

@ -80,10 +80,10 @@ class llvm_gcc_based <string cmd_prefix, string in_lang, string E_ext> : Tool<
(sink)
]>;
def llvm_gcc_c : llvm_gcc_based<"llvm-gcc -x c", "c", "i">;
def llvm_gcc_cpp : llvm_gcc_based<"llvm-g++ -x c++", "c++", "i">;
def llvm_gcc_m : llvm_gcc_based<"llvm-gcc -x objective-c", "objective-c", "mi">;
def llvm_gcc_mxx : llvm_gcc_based<"llvm-gcc -x objective-c++",
def llvm_gcc_c : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c", "c", "i">;
def llvm_gcc_cpp : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++", "c++", "i">;
def llvm_gcc_m : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c", "objective-c", "mi">;
def llvm_gcc_mxx : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++",
"objective-c++", "mi">;
def opt : Tool<
@ -105,7 +105,7 @@ def llvm_gcc_assembler : Tool<
[(in_language "assembler"),
(out_language "object-code"),
(output_suffix "o"),
(cmd_line "llvm-gcc -c -x assembler $INFILE -o $OUTFILE"),
(cmd_line "@LLVMGCCCOMMAND@ -c -x assembler $INFILE -o $OUTFILE"),
(actions (case
(switch_on "c"), (stop_compilation),
(not_empty "Wa,"), (unpack_values "Wa,")))
@ -136,9 +136,9 @@ class llvm_gcc_based_linker <string cmd_prefix> : Tool<
]>;
// Default linker
def llvm_gcc_linker : llvm_gcc_based_linker<"llvm-gcc">;
def llvm_gcc_linker : llvm_gcc_based_linker<"@LLVMGCCCOMMAND@">;
// Alternative linker for C++
def llvm_gcc_cpp_linker : llvm_gcc_based_linker<"llvm-g++">;
def llvm_gcc_cpp_linker : llvm_gcc_based_linker<"@LLVMGXXCOMMAND@">;
// Language map