From baaadb2672e70916eb7e35b48b5ca34bec772fb8 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Sat, 30 Oct 2010 00:54:26 +0000 Subject: Add polly support to the build system. Update the cmake and autoconf build system to compile polly as a shared library if it is checked out into tools/polly. In case polly is not checked out, nothing changes. This models the way clang can be added to llvm if checked out to tools/clang. Also rebuild configure. Patch contributed by ether. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117755 91177308-0d34-0410-b5e6-96231b3b80d8 --- Makefile.config.in | 2 ++ autoconf/configure.ac | 20 ++++++++++++++++++++ configure | 49 ++++++++++++++++++++++++++++++++++++++++--------- tools/CMakeLists.txt | 8 ++++++++ tools/Makefile | 4 ++++ 5 files changed, 74 insertions(+), 9 deletions(-) diff --git a/Makefile.config.in b/Makefile.config.in index 5ebd80384f..662e57f514 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -341,6 +341,8 @@ NO_MISSING_FIELD_INITIALIZERS = @NO_MISSING_FIELD_INITIALIZERS@ # -Wno-variadic-macros NO_VARIADIC_MACROS = @NO_VARIADIC_MACROS@ +# Was polly found in tools/polly? +LLVM_HAS_POLLY = @LLVM_HAS_POLLY@ # Flags supported by the linker. # bfd ld / gold --version-script=file HAVE_LINK_VERSION_SCRIPT = @HAVE_LINK_VERSION_SCRIPT@ diff --git a/autoconf/configure.ac b/autoconf/configure.ac index ec360527db..5fa85d0ab5 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -121,6 +121,26 @@ do fi done +dnl Disable the build of polly, even if it is checked out into tools/polly. +AC_ARG_ENABLE(polly, + AS_HELP_STRING([--enable-polly], + [Use polly if available (default is YES)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(ENABLE_POLLY,[1]) ;; + no) AC_SUBST(ENABLE_POLLY,[0]) ;; + default) AC_SUBST(ENABLE_POLLY,[1]) ;; + *) AC_MSG_ERROR([Invalid setting for --enable-polly. Use "yes" or "no"]) ;; +esac + + +dnl Check if polly is checked out into tools/polly and configure it if +dnl available. +if (test -d ${srcdir}/tools/polly) && (test $ENABLE_POLLY -eq 1) ; then + AC_SUBST(LLVM_HAS_POLLY,1) + AC_CONFIG_SUBDIRS([tools/polly]) +fi + dnl===-----------------------------------------------------------------------=== dnl=== dnl=== SECTION 2: Architecture, target, and host checks diff --git a/configure b/configure index e76a0b32f3..e9945224b5 100755 --- a/configure +++ b/configure @@ -641,6 +641,8 @@ host_alias target_alias LLVM_COPYRIGHT subdirs +ENABLE_POLLY +LLVM_HAS_POLLY build build_cpu build_vendor @@ -817,7 +819,8 @@ projects/llvm-reopt projects/llvm-java projects/llvm-tv projects/safecode -projects/llvm-kernel' +projects/llvm-kernel +tools/polly' # Initialize some variables set by options. ac_init_help= @@ -1392,6 +1395,7 @@ if test -n "$ac_init_help"; then Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-polly Use polly if available (default is YES) --enable-optimized Compile with optimizations enabled (default is NO) --enable-profiling Compile with profiling enabled (default is NO) --enable-assertions Compile with assertion checks enabled (default is @@ -2015,6 +2019,33 @@ echo "$as_me: WARNING: Unknown project (${i}) won't be configured automatically" fi done +# Check whether --enable-polly was given. +if test "${enable_polly+set}" = set; then + enableval=$enable_polly; +else + enableval=default +fi + +case "$enableval" in + yes) ENABLE_POLLY=1 + ;; + no) ENABLE_POLLY=0 + ;; + default) ENABLE_POLLY=1 + ;; + *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-polly. Use \"yes\" or \"no\"" >&5 +echo "$as_me: error: Invalid setting for --enable-polly. Use \"yes\" or \"no\"" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + +if (test -d ${srcdir}/tools/polly) && (test $ENABLE_POLLY -eq 1) ; then + LLVM_HAS_POLLY=1 + + subdirs="$subdirs tools/polly" + +fi + # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || @@ -11467,7 +11498,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <conf$$subs.sed <<_ACEOF +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 @@ -21779,7 +21812,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` = 94; 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 @@ -21798,7 +21831,7 @@ fi 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 @@ -21811,8 +21844,6 @@ N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -:end -s/|#_!!_#|//g CEOF$ac_eof _ACEOF @@ -22060,7 +22091,7 @@ s&@abs_builddir@&$ac_abs_builddir&;t t 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"; } && diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 7ed10e9729..89d858c4e7 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -2,6 +2,14 @@ # large and three small executables. This is done to minimize memory load # in parallel builds. Please retain this ordering. +# If polly exists and is not disabled compile it and add it to the LLVM tools. +option(LLVM_BUILD_POLLY "Compile polly" ON) +if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/polly/CMakeLists.txt ) + if (LLVM_BUILD_POLLY) + add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/polly) + endif (LLVM_BUILD_POLLY) +endif( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/polly/CMakeLists.txt ) + if( NOT WIN32 OR MSYS OR CYGWIN ) # It is useful to build llvm-config before the other tools, so we # have a fresh LibDeps.txt for regenerating the hard-coded library diff --git a/tools/Makefile b/tools/Makefile index aa07a2b1b7..84ffa064ae 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -57,4 +57,8 @@ ifeq ($(ENABLE_PIC),1) endif endif +ifdef LLVM_HAS_POLLY + PARALLEL_DIRS += polly +endif + include $(LEVEL)/Makefile.common -- cgit v1.2.3