dnl **************************************************************************
dnl * Initialize
dnl **************************************************************************
AC_INIT([[[SAMPLE]]],[[[x.xx]]],[bugs@yourdomain])
dnl Identify where LLVM source tree is
LLVM_SRC_ROOT="../.."
LLVM_OBJ_ROOT="../.."
dnl Find absolute paths to LLVM source and object trees
LLVM_ABS_SRC_ROOT="`cd $srcdir ; cd $LLVM_SRC_ROOT ; pwd`"
LLVM_ABS_OBJ_ROOT="`cd $LLVM_OBJ_ROOT ; pwd`"
dnl Tell autoconf that this is an LLVM project being configured
dnl This provides the --with-llvmsrc and --with-llvmobj options
LLVM_CONFIG_PROJECT($LLVM_ABS_SRC_ROOT,$LLVM_ABS_OBJ_ROOT)
dnl Try and find an llvm-config in the build directory. We are only using this
dnl to detect the package level LLVM information (currently just the version),
dnl so we just whatever one we find regardless of build mode.
AC_MSG_CHECKING([llvm-config])
llvm_config_path="`ls -1 $llvm_obj/*/bin/llvm-config 2> /dev/null | head -1`"
if ! test -f "$llvm_config_path" ; then
llvm_config_path="no"
fi
AC_MSG_RESULT([$llvm_config_path])
dnl Determine the LLVM version, which may be required by the current Makefile
dnl rules.
AC_MSG_CHECKING([LLVM package version])
if test "$llvm_config_path" != no ; then
llvm_package_version=`$llvm_config_path --version`
else
llvm_package_version="unknown";
fi
AC_MSG_RESULT([$llvm_package_version])
AC_SUBST(LLVM_VERSION, [$llvm_package_version])
dnl Verify that the source directory is valid
AC_CONFIG_SRCDIR(["Makefile.common.in"])
dnl Place all of the extra autoconf files into the config subdirectory. Tell
dnl various tools where the m4 autoconf macros are.
AC_CONFIG_AUX_DIR([autoconf])
dnl **************************************************************************
dnl Begin LLVM configure.ac Import
dnl **************************************************************************
dnl
dnl Derived from LLVM's configure.ac. This was imported directly here so that we
dnl could reuse LLVM's build infrastructure without introducing a direct source
dnl dependency on the LLVM files.
dnl We need to check for the compiler up here to avoid anything else
dnl starting with a different one.
AC_PROG_CC(clang llvm-gcc gcc)
AC_PROG_CXX(clang++ llvm-g++ g++)
AC_PROG_CPP
dnl Configure all of the projects present in our source tree. While we could
dnl just AC_CONFIG_SUBDIRS on the set of directories in projects that have a
dnl configure script, that usage of the AC_CONFIG_SUBDIRS macro is deprecated.
dnl Instead we match on the known projects.
dnl
dnl One tricky part of doing this is that some projects depend upon other
dnl projects. For example, several projects rely upon the LLVM test suite.
dnl We want to configure those projects first so that their object trees are
dnl created before running the configure scripts of projects that depend upon
dnl them.
dnl
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
dnl===
dnl===-----------------------------------------------------------------------===
dnl Check the target for which we're compiling and the host that will do the
dnl compilations. This will tell us which LLVM compiler will be used for
dnl compiling SSA into object code. This needs to be done early because
dnl following tests depend on it.
AC_CANONICAL_TARGET
dnl Determine the platform type and cache its value. This helps us configure
dnl the System library to the correct build platform.
AC_CACHE_CHECK([type of operating system we're going to host on],
[llvm_cv_os_type],
[case $host in
*-*-aix*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="AIX"
llvm_cv_platform_type="Unix" ;;
*-*-irix*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="IRIX"
llvm_cv_platform_type="Unix" ;;
*-*-cygwin*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="Cygwin"
llvm_cv_platform_type="Unix" ;;
*-*-darwin*)
llvm_cv_link_all_option="-Wl,-all_load"
llvm_cv_no_link_all_option="-Wl,-noall_load"
llvm_cv_os_type="Darwin"
llvm_cv_platform_type="Unix" ;;
*-*-minix*)
llvm_cv_link_all_option="-Wl,-all_load"
llvm_cv_no_link_all_option="-Wl,-noall_load"