llvm.org GIT mirror llvm / 9851567
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 Daniel Dunbar 9 years ago
3 changed file(s) with 193 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
189189 LLVMCC1PLUS := @LLVMCC1PLUS@
190190 LLVMGCC_LANGS := @LLVMGCC_LANGS@
191191
192 # Information on Clang, if configured.
193 CLANGPATH := @CLANGPATH@
194 CLANGXXPATH := @CLANGXXPATH@
195 ENABLE_BUILT_CLANG := @ENABLE_BUILT_CLANG@
196
197 # The LLVM capable compiler to use.
198 LLVMCC_OPTION := @LLVMCC_OPTION@
199
192200 # Path to directory where object files should be stored during a build.
193201 # Set OBJ_ROOT to "." if you do not want to use a separate place for
194202 # object files.
611611 AC_MSG_ERROR([Invalid llvm-gcc. Use --with-llvmgcc when --with-llvmgxx is used]);
612612 fi
613613
614 dnl Allow a specific Clang compiler to be used with this LLVM config.
615 AC_ARG_WITH(clang,
616 AS_HELP_STRING([--with-clang],
617 [Specify location of clang compiler (default is --with-built-clang)]),
618 [],[with_clang=default])
619
620 dnl Enable use of the built Clang.
621 AC_ARG_WITH(built-clang,
622 AS_HELP_STRING([--with-built-clang],
623 [Use the compiled Clang as the LLVM compiler (default=check)]),
624 [],[with_built_clang=check])
625
626 dnl Select the Clang compiler option.
627 dnl
628 dnl If --with-clang is given, always honor that; otherwise honor
629 dnl --with-built-clang, or check if we have the clang sources.
630 AC_MSG_CHECKING([clang compiler])
631 WITH_CLANGPATH=""
632 WITH_BUILT_CLANG=0
633 if test "$with_clang" != "default"; then
634 WITH_CLANGPATH="$with_clang"
635 if ! test -x "$WITH_CLANGPATH"; then
636 AC_MSG_ERROR([invalid --with-clang, path does not specify an executable])
637 fi
638 elif test "$with_built_clang" = "yes"; then
639 WITH_BUILT_CLANG=1
640 elif test "$with_built_clang" = "no"; then
641 WITH_BUILT_CLANG=0
642 else
643 if test "$with_built_clang" != "check"; then
644 AC_MSG_ERROR([invalid value for --with-built-clang.])
645 fi
646
647 if test -f ${srcdir}/tools/clang/README.txt; then
648 WITH_BUILT_CLANG=1
649 fi
650 fi
651
652 if ! test -z "$WITH_CLANGPATH"; then
653 AC_MSG_RESULT([$WITH_CLANGPATH])
654 WITH_CLANGXXPATH=`"$WITH_CLANGPATH" --print-prog-name=clang++`
655 elif test "$WITH_BUILT_CLANG" = "1"; then
656 AC_MSG_RESULT([built])
657 else
658 AC_MSG_RESULT([none])
659 fi
660 AC_SUBST(CLANGPATH,$WITH_CLANGPATH)
661 AC_SUBST(CLANGXXPATH,$WITH_CLANGXXPATH)
662 AC_SUBST(ENABLE_BUILT_CLANG,$WITH_BUILT_CLANG)
663
614664 dnl Override the option to use for optimized builds.
615665 AC_ARG_WITH(optimize-option,
616666 AS_HELP_STRING([--with-optimize-option],
945995 AC_SUBST(LLVMGXXCOMMAND,$LLVMGXXCOMMAND)
946996 fi
947997
998 dnl Select the LLVM capable compiler to use, we default to using llvm-gcc if
999 dnl found, otherwise clang if available.
1000 AC_ARG_WITH(llvmcc,
1001 AS_HELP_STRING([--with-llvmcc=],
1002 [Choose the LLVM capable compiler to use (llvm-gcc, clang, or none; default=check)]),
1003 [],[with_llvmcc=check])
1004 AC_MSG_CHECKING([LLVM capable compiler])
1005 if test "$with_llvmcc" != "check"; then
1006 if (test "$with_llvmcc" != "llvm-gcc" &&
1007 test "$with_llvmcc" != "clang" &&
1008 test "$with_llvmcc" != "none"); then
1009 AC_MSG_ERROR([invalid value for --with-llvmcc, expected 'llvm-gcc', 'clang', or 'none'.])
1010 fi
1011 WITH_LLVMCC="$with_llvmcc"
1012 elif test -n "$LLVMGCC"; then
1013 WITH_LLVMCC=llvm-gcc
1014 elif test -n "$WITH_CLANGPATH" || test "$WITH_BUILT_CLANG" -ne "0"; then
1015 WITH_LLVMCC=clang
1016 else
1017 WITH_LLVMCC=none
1018 fi
1019 AC_MSG_RESULT([$WITH_LLVMCC])
1020 AC_SUBST(LLVMCC_OPTION,$WITH_LLVMCC)
9481021
9491022 AC_MSG_CHECKING([tool compatibility])
9501023
694694 LLVM_ENUM_ASM_PARSERS
695695 LLVM_ENUM_DISASSEMBLERS
696696 ENABLE_CBE_PRINTF_A
697 CLANGPATH
698 CLANGXXPATH
699 ENABLE_BUILT_CLANG
697700 OPTIMIZE_OPTION
698701 EXTRA_OPTIONS
699702 BINUTILS_INCDIR
753756 LLVMGXXCOMMAND
754757 LLVMGCC
755758 LLVMGXX
759 LLVMCC_OPTION
756760 NO_VARIADIC_MACROS
757761 NO_MISSING_FIELD_INITIALIZERS
758762 USE_UDIS86
14221426 searches PATH)
14231427 --with-llvmgxx Specify location of llvm-g++ driver (default
14241428 searches PATH)
1429 --with-clang Specify location of clang compiler (default is
1430 --with-built-clang)
1431 --with-built-clang Use the compiled Clang as the LLVM compiler
1432 (default=check)
14251433 --with-optimize-option Select the compiler options to use for optimized
14261434 builds
14271435 --with-extra-options Specify additional options to compile LLVM with
14381446 --with-binutils-include Specify path to binutils/include/ containing
14391447 plugin-api.h file for gold plugin.
14401448 --with-tclinclude directory where tcl headers are
1449 --with-llvmcc= Choose the LLVM capable compiler to use (llvm-gcc,
1450 clang, or none; default=check)
14411451 --with-udis86= Use udis86 external x86 disassembler library
14421452 --with-oprofile=
14431453 Tell OProfile >= 0.9.4 how to symbolize JIT output
50255035 fi
50265036
50275037
5038 # Check whether --with-clang was given.
5039 if test "${with_clang+set}" = set; then
5040 withval=$with_clang;
5041 else
5042 with_clang=default
5043 fi
5044
5045
5046
5047 # Check whether --with-built-clang was given.
5048 if test "${with_built_clang+set}" = set; then
5049 withval=$with_built_clang;
5050 else
5051 with_built_clang=check
5052 fi
5053
5054
5055 { echo "$as_me:$LINENO: checking clang compiler" >&5
5056 echo $ECHO_N "checking clang compiler... $ECHO_C" >&6; }
5057 WITH_CLANGPATH=""
5058 WITH_BUILT_CLANG=0
5059 if test "$with_clang" != "default"; then
5060 WITH_CLANGPATH="$with_clang"
5061 if ! test -x "$WITH_CLANGPATH"; then
5062 { { echo "$as_me:$LINENO: error: invalid --with-clang, path does not specify an executable" >&5
5063 echo "$as_me: error: invalid --with-clang, path does not specify an executable" >&2;}
5064 { (exit 1); exit 1; }; }
5065 fi
5066 elif test "$with_built_clang" = "yes"; then
5067 WITH_BUILT_CLANG=1
5068 elif test "$with_built_clang" = "no"; then
5069 WITH_BUILT_CLANG=0
5070 else
5071 if test "$with_built_clang" != "check"; then
5072 { { echo "$as_me:$LINENO: error: invalid value for --with-built-clang." >&5
5073 echo "$as_me: error: invalid value for --with-built-clang." >&2;}
5074 { (exit 1); exit 1; }; }
5075 fi
5076
5077 if test -f ${srcdir}/tools/clang/README.txt; then
5078 WITH_BUILT_CLANG=1
5079 fi
5080 fi
5081
5082 if ! test -z "$WITH_CLANGPATH"; then
5083 { echo "$as_me:$LINENO: result: $WITH_CLANGPATH" >&5
5084 echo "${ECHO_T}$WITH_CLANGPATH" >&6; }
5085 WITH_CLANGXXPATH=`"$WITH_CLANGPATH" --print-prog-name=clang++`
5086 elif test "$WITH_BUILT_CLANG" = "1"; then
5087 { echo "$as_me:$LINENO: result: built" >&5
5088 echo "${ECHO_T}built" >&6; }
5089 else
5090 { echo "$as_me:$LINENO: result: none" >&5
5091 echo "${ECHO_T}none" >&6; }
5092 fi
5093 CLANGPATH=$WITH_CLANGPATH
5094
5095 CLANGXXPATH=$WITH_CLANGXXPATH
5096
5097 ENABLE_BUILT_CLANG=$WITH_BUILT_CLANG
5098
5099
5100
50285101 # Check whether --with-optimize-option was given.
50295102 if test "${with_optimize_option+set}" = set; then
50305103 withval=$with_optimize_option;
1103111104 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1103211105 lt_status=$lt_dlunknown
1103311106 cat > conftest.$ac_ext <
11034 #line 11035 "configure"
11107 #line 11108 "configure"
1103511108 #include "confdefs.h"
1103611109
1103711110 #if HAVE_DLFCN_H
1279912872 LLVMGXXCOMMAND=$LLVMGXXCOMMAND
1280012873
1280112874 fi
12875
12876
12877 # Check whether --with-llvmcc was given.
12878 if test "${with_llvmcc+set}" = set; then
12879 withval=$with_llvmcc;
12880 else
12881 with_llvmcc=check
12882 fi
12883
12884 { echo "$as_me:$LINENO: checking LLVM capable compiler" >&5
12885 echo $ECHO_N "checking LLVM capable compiler... $ECHO_C" >&6; }
12886 if test "$with_llvmcc" != "check"; then
12887 if (test "$with_llvmcc" != "llvm-gcc" &&
12888 test "$with_llvmcc" != "clang" &&
12889 test "$with_llvmcc" != "none"); then
12890 { { echo "$as_me:$LINENO: error: invalid value for --with-llvmcc, expected 'llvm-gcc', 'clang', or 'none'." >&5
12891 echo "$as_me: error: invalid value for --with-llvmcc, expected 'llvm-gcc', 'clang', or 'none'." >&2;}
12892 { (exit 1); exit 1; }; }
12893 fi
12894 WITH_LLVMCC="$with_llvmcc"
12895 elif test -n "$LLVMGCC"; then
12896 WITH_LLVMCC=llvm-gcc
12897 elif test -n "$WITH_CLANGPATH" || test "$WITH_BUILT_CLANG" -ne "0"; then
12898 WITH_LLVMCC=clang
12899 else
12900 WITH_LLVMCC=none
12901 fi
12902 { echo "$as_me:$LINENO: result: $WITH_LLVMCC" >&5
12903 echo "${ECHO_T}$WITH_LLVMCC" >&6; }
12904 LLVMCC_OPTION=$WITH_LLVMCC
1280212905
1280312906
1280412907 { echo "$as_me:$LINENO: checking tool compatibility" >&5
2064520748 LLVM_ENUM_ASM_PARSERS!$LLVM_ENUM_ASM_PARSERS$ac_delim
2064620749 LLVM_ENUM_DISASSEMBLERS!$LLVM_ENUM_DISASSEMBLERS$ac_delim
2064720750 ENABLE_CBE_PRINTF_A!$ENABLE_CBE_PRINTF_A$ac_delim
20751 CLANGPATH!$CLANGPATH$ac_delim
20752 CLANGXXPATH!$CLANGXXPATH$ac_delim
20753 ENABLE_BUILT_CLANG!$ENABLE_BUILT_CLANG$ac_delim
2064820754 OPTIMIZE_OPTION!$OPTIMIZE_OPTION$ac_delim
20649 EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim
20650 BINUTILS_INCDIR!$BINUTILS_INCDIR$ac_delim
20651 ENABLE_LLVMC_DYNAMIC!$ENABLE_LLVMC_DYNAMIC$ac_delim
2065220755 _ACEOF
2065320756
2065420757 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
2069020793 ac_delim='%!_!# '
2069120794 for ac_last_try in false false false false false :; do
2069220795 cat >conf$$subs.sed <<_ACEOF
20796 EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim
20797 BINUTILS_INCDIR!$BINUTILS_INCDIR$ac_delim
20798 ENABLE_LLVMC_DYNAMIC!$ENABLE_LLVMC_DYNAMIC$ac_delim
2069320799 ENABLE_LLVMC_DYNAMIC_PLUGINS!$ENABLE_LLVMC_DYNAMIC_PLUGINS$ac_delim
2069420800 CXX!$CXX$ac_delim
2069520801 CXXFLAGS!$CXXFLAGS$ac_delim
2074520851 LLVMGXXCOMMAND!$LLVMGXXCOMMAND$ac_delim
2074620852 LLVMGCC!$LLVMGCC$ac_delim
2074720853 LLVMGXX!$LLVMGXX$ac_delim
20854 LLVMCC_OPTION!$LLVMCC_OPTION$ac_delim
2074820855 NO_VARIADIC_MACROS!$NO_VARIADIC_MACROS$ac_delim
2074920856 NO_MISSING_FIELD_INITIALIZERS!$NO_MISSING_FIELD_INITIALIZERS$ac_delim
2075020857 USE_UDIS86!$USE_UDIS86$ac_delim
2077720884 LTLIBOBJS!$LTLIBOBJS$ac_delim
2077820885 _ACEOF
2077920886
20780 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 85; then
20887 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 89; then
2078120888 break
2078220889 elif $ac_last_try; then
2078320890 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5