Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1 | dnl === configure.ac --------------------------------------------------------=== |
| 2 | dnl The LLVM Compiler Infrastructure |
| 3 | dnl |
Chris Lattner | 234d529 | 2007-12-29 22:59:10 +0000 | [diff] [blame] | 4 | dnl This file is distributed under the University of Illinois Open Source |
| 5 | dnl License. See LICENSE.TXT for details. |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 6 | dnl |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 7 | dnl===-----------------------------------------------------------------------=== |
| 8 | dnl This is the LLVM configuration script. It is processed by the autoconf |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 9 | dnl program to produce a script named configure. This script contains the |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 10 | dnl configuration checks that LLVM needs in order to support multiple platforms. |
| 11 | dnl This file is composed of 10 sections per the recommended organization of |
| 12 | dnl autoconf input defined in the autoconf documentation. As this file evolves, |
| 13 | dnl please keep the various types of checks within their sections. The sections |
| 14 | dnl are as follows: |
| 15 | dnl |
| 16 | dnl SECTION 1: Initialization & Setup |
| 17 | dnl SECTION 2: Architecture, target, and host checks |
| 18 | dnl SECTION 3: Command line arguments for the configure script. |
| 19 | dnl SECTION 4: Check for programs we need and that they are the right version |
| 20 | dnl SECTION 5: Check for libraries |
| 21 | dnl SECTION 6: Check for header files |
| 22 | dnl SECTION 7: Check for types and structures |
| 23 | dnl SECTION 8: Check for specific functions needed |
| 24 | dnl SECTION 9: Additional checks, variables, etc. |
| 25 | dnl SECTION 10: Specify the output files and generate it |
| 26 | dnl |
| 27 | dnl===-----------------------------------------------------------------------=== |
| 28 | dnl=== |
| 29 | dnl=== SECTION 1: Initialization & Setup |
| 30 | dnl=== |
| 31 | dnl===-----------------------------------------------------------------------=== |
| 32 | dnl Initialize autoconf and define the package name, version number and |
Dylan Noblesmith | 7fe0e03 | 2011-12-18 18:50:16 +0000 | [diff] [blame] | 33 | dnl address for reporting bugs. |
Benjamin Kramer | 537d9a7 | 2012-11-17 22:01:08 +0000 | [diff] [blame] | 34 | AC_INIT([LLVM],[3.3svn],[http://llvm.org/bugs/]) |
Dylan Noblesmith | fde8237 | 2012-02-13 18:48:10 +0000 | [diff] [blame] | 35 | AC_DEFINE([LLVM_VERSION_MAJOR], [3], [Major version of the LLVM API]) |
Benjamin Kramer | 537d9a7 | 2012-11-17 22:01:08 +0000 | [diff] [blame] | 36 | AC_DEFINE([LLVM_VERSION_MINOR], [3], [Minor version of the LLVM API]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 37 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 38 | dnl Provide a copyright substitution and ensure the copyright notice is included |
| 39 | dnl in the output of --version option of the generated configure script. |
NAKAMURA Takumi | a6fdcaa | 2013-01-01 10:00:19 +0000 | [diff] [blame] | 40 | AC_SUBST(LLVM_COPYRIGHT,["Copyright (c) 2003-2013 University of Illinois at Urbana-Champaign."]) |
| 41 | AC_COPYRIGHT([Copyright (c) 2003-2013 University of Illinois at Urbana-Champaign.]) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 42 | |
Eric Christopher | d8282cd | 2011-09-23 00:53:10 +0000 | [diff] [blame] | 43 | dnl Indicate that we require autoconf 2.60 or later. |
| 44 | AC_PREREQ(2.60) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 45 | |
| 46 | dnl Verify that the source directory is valid. This makes sure that we are |
| 47 | dnl configuring LLVM and not some other package (it validates --srcdir argument) |
Chandler Carruth | 5ebee9e | 2013-01-02 09:22:59 +0000 | [diff] [blame] | 48 | AC_CONFIG_SRCDIR([lib/IR/Module.cpp]) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 49 | |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 50 | dnl Place all of the extra autoconf files into the config subdirectory. Tell |
| 51 | dnl various tools where the m4 autoconf macros are. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 52 | AC_CONFIG_AUX_DIR([autoconf]) |
| 53 | |
John Criswell | 93e1c72 | 2003-09-15 17:04:06 +0000 | [diff] [blame] | 54 | dnl Quit if the source directory has already been configured. |
John Criswell | 1b82432 | 2003-09-15 17:19:42 +0000 | [diff] [blame] | 55 | dnl NOTE: This relies upon undocumented autoconf behavior. |
Reid Spencer | c1b0d49 | 2004-09-19 23:43:52 +0000 | [diff] [blame] | 56 | if test ${srcdir} != "." ; then |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 57 | if test -f ${srcdir}/include/llvm/Config/config.h ; then |
| 58 | AC_MSG_ERROR([Already configured in ${srcdir}]) |
| 59 | fi |
John Criswell | 93e1c72 | 2003-09-15 17:04:06 +0000 | [diff] [blame] | 60 | fi |
| 61 | |
Patrik Hagglund | 6c440fc | 2013-02-04 08:15:53 +0000 | [diff] [blame] | 62 | dnl Default to empty (i.e. assigning the null string to) CFLAGS and CXXFLAGS, |
| 63 | dnl instead of the autoconf default (for example, '-g -O2' for CC=gcc). |
| 64 | ${CFLAGS=} |
| 65 | ${CXXFLAGS=} |
| 66 | |
Eric Christopher | ffee572 | 2011-09-16 20:36:25 +0000 | [diff] [blame] | 67 | dnl We need to check for the compiler up here to avoid anything else |
| 68 | dnl starting with a different one. |
| 69 | AC_PROG_CC(clang llvm-gcc gcc) |
| 70 | AC_PROG_CXX(clang++ llvm-g++ g++) |
| 71 | AC_PROG_CPP |
| 72 | |
Dmitri Gribenko | a730336 | 2013-01-09 15:25:30 +0000 | [diff] [blame] | 73 | dnl If CXX is Clang, check that it can find and parse C++ standard library |
| 74 | dnl headers. |
| 75 | if test "$CXX" = "clang++" ; then |
| 76 | AC_MSG_CHECKING([whether clang works]) |
| 77 | AC_LANG_PUSH([C++]) |
| 78 | dnl Note that space between 'include' and '(' is required. There's a broken |
| 79 | dnl regex in aclocal that otherwise will think that we call m4's include |
| 80 | dnl builtin. |
| 81 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <limits> |
| 82 | #if __has_include (<cxxabi.h>) |
| 83 | #include <cxxabi.h> |
| 84 | #endif |
| 85 | #if __has_include (<unwind.h>) |
| 86 | #include <unwind.h> |
| 87 | #endif |
| 88 | ]])], |
| 89 | [ |
| 90 | AC_MSG_RESULT([yes]) |
| 91 | ], |
| 92 | [ |
| 93 | AC_MSG_RESULT([no]) |
| 94 | AC_MSG_ERROR([Selected compiler could not find or parse C++ standard library headers. Rerun with CC=c-compiler CXX=c++-compiler ./configure ...]) |
| 95 | ]) |
| 96 | AC_LANG_POP([C++]) |
| 97 | fi |
| 98 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 99 | dnl Configure all of the projects present in our source tree. While we could |
| 100 | dnl just AC_CONFIG_SUBDIRS on the set of directories in projects that have a |
| 101 | dnl configure script, that usage of the AC_CONFIG_SUBDIRS macro is deprecated. |
| 102 | dnl Instead we match on the known projects. |
John Criswell | 0157f50 | 2010-03-19 21:31:39 +0000 | [diff] [blame] | 103 | |
| 104 | dnl |
| 105 | dnl One tricky part of doing this is that some projects depend upon other |
| 106 | dnl projects. For example, several projects rely upon the LLVM test suite. |
| 107 | dnl We want to configure those projects first so that their object trees are |
| 108 | dnl created before running the configure scripts of projects that depend upon |
| 109 | dnl them. |
| 110 | dnl |
| 111 | |
| 112 | dnl Several projects use llvm-gcc, so configure that first |
| 113 | if test -d ${srcdir}/projects/llvm-gcc ; then |
| 114 | AC_CONFIG_SUBDIRS([projects/llvm-gcc]) |
| 115 | fi |
| 116 | |
| 117 | dnl Several projects use the LLVM test suite, so configure it next. |
| 118 | if test -d ${srcdir}/projects/test-suite ; then |
| 119 | AC_CONFIG_SUBDIRS([projects/test-suite]) |
| 120 | fi |
| 121 | |
| 122 | dnl llvm-test is the old name of the test-suite, kept here for backwards |
| 123 | dnl compatibility |
| 124 | if test -d ${srcdir}/projects/llvm-test ; then |
| 125 | AC_CONFIG_SUBDIRS([projects/llvm-test]) |
| 126 | fi |
| 127 | |
| 128 | dnl Some projects use poolalloc; configure that next |
| 129 | if test -d ${srcdir}/projects/poolalloc ; then |
| 130 | AC_CONFIG_SUBDIRS([projects/poolalloc]) |
| 131 | fi |
| 132 | |
| 133 | if test -d ${srcdir}/projects/llvm-poolalloc ; then |
| 134 | AC_CONFIG_SUBDIRS([projects/llvm-poolalloc]) |
| 135 | fi |
| 136 | |
| 137 | dnl Check for all other projects |
John Criswell | 33a911a | 2003-11-25 20:36:46 +0000 | [diff] [blame] | 138 | for i in `ls ${srcdir}/projects` |
| 139 | do |
Reid Spencer | f7b2de5 | 2004-09-07 16:26:18 +0000 | [diff] [blame] | 140 | if test -d ${srcdir}/projects/${i} ; then |
| 141 | case ${i} in |
Reid Spencer | 67bb079 | 2007-01-17 02:14:46 +0000 | [diff] [blame] | 142 | sample) AC_CONFIG_SUBDIRS([projects/sample]) ;; |
| 143 | privbracket) AC_CONFIG_SUBDIRS([projects/privbracket]) ;; |
| 144 | llvm-stacker) AC_CONFIG_SUBDIRS([projects/llvm-stacker]) ;; |
Reid Spencer | 67bb079 | 2007-01-17 02:14:46 +0000 | [diff] [blame] | 145 | llvm-reopt) AC_CONFIG_SUBDIRS([projects/llvm-reopt]);; |
Reid Spencer | 67bb079 | 2007-01-17 02:14:46 +0000 | [diff] [blame] | 146 | llvm-java) AC_CONFIG_SUBDIRS([projects/llvm-java]) ;; |
| 147 | llvm-tv) AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;; |
John Criswell | 7def293 | 2010-02-25 22:57:19 +0000 | [diff] [blame] | 148 | safecode) AC_CONFIG_SUBDIRS([projects/safecode]) ;; |
Reid Spencer | 67bb079 | 2007-01-17 02:14:46 +0000 | [diff] [blame] | 149 | llvm-kernel) AC_CONFIG_SUBDIRS([projects/llvm-kernel]) ;; |
Daniel Dunbar | d45162b | 2011-12-07 22:07:03 +0000 | [diff] [blame] | 150 | compiler-rt) ;; |
John Criswell | 52c0286 | 2010-03-25 13:59:09 +0000 | [diff] [blame] | 151 | llvm-gcc) ;; |
| 152 | test-suite) ;; |
| 153 | llvm-test) ;; |
| 154 | poolalloc) ;; |
| 155 | llvm-poolalloc) ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 156 | *) |
Alkis Evlogimenos | a281b6fa | 2004-09-27 07:35:19 +0000 | [diff] [blame] | 157 | AC_MSG_WARN([Unknown project (${i}) won't be configured automatically]) |
Reid Spencer | c2186e2 | 2004-09-21 17:12:35 +0000 | [diff] [blame] | 158 | ;; |
Reid Spencer | f7b2de5 | 2004-09-07 16:26:18 +0000 | [diff] [blame] | 159 | esac |
John Criswell | 33a911a | 2003-11-25 20:36:46 +0000 | [diff] [blame] | 160 | fi |
| 161 | done |
John Criswell | 559a6c1 | 2003-09-30 16:31:48 +0000 | [diff] [blame] | 162 | |
Tobias Grosser | baaadb2 | 2010-10-30 00:54:26 +0000 | [diff] [blame] | 163 | dnl Disable the build of polly, even if it is checked out into tools/polly. |
| 164 | AC_ARG_ENABLE(polly, |
| 165 | AS_HELP_STRING([--enable-polly], |
| 166 | [Use polly if available (default is YES)]),, |
| 167 | enableval=default) |
| 168 | case "$enableval" in |
| 169 | yes) AC_SUBST(ENABLE_POLLY,[1]) ;; |
| 170 | no) AC_SUBST(ENABLE_POLLY,[0]) ;; |
| 171 | default) AC_SUBST(ENABLE_POLLY,[1]) ;; |
| 172 | *) AC_MSG_ERROR([Invalid setting for --enable-polly. Use "yes" or "no"]) ;; |
| 173 | esac |
| 174 | |
| 175 | |
| 176 | dnl Check if polly is checked out into tools/polly and configure it if |
| 177 | dnl available. |
| 178 | if (test -d ${srcdir}/tools/polly) && (test $ENABLE_POLLY -eq 1) ; then |
| 179 | AC_SUBST(LLVM_HAS_POLLY,1) |
| 180 | AC_CONFIG_SUBDIRS([tools/polly]) |
| 181 | fi |
| 182 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 183 | dnl===-----------------------------------------------------------------------=== |
| 184 | dnl=== |
| 185 | dnl=== SECTION 2: Architecture, target, and host checks |
| 186 | dnl=== |
| 187 | dnl===-----------------------------------------------------------------------=== |
John Criswell | dc76e32 | 2004-07-23 15:40:57 +0000 | [diff] [blame] | 188 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 189 | dnl Check the target for which we're compiling and the host that will do the |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 190 | dnl compilations. This will tell us which LLVM compiler will be used for |
| 191 | dnl compiling SSA into object code. This needs to be done early because |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 192 | dnl following tests depend on it. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 193 | AC_CANONICAL_TARGET |
| 194 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 195 | dnl Determine the platform type and cache its value. This helps us configure |
| 196 | dnl the System library to the correct build platform. |
Reid Spencer | e2cfe5d | 2006-07-26 21:14:56 +0000 | [diff] [blame] | 197 | AC_CACHE_CHECK([type of operating system we're going to host on], |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 198 | [llvm_cv_os_type], |
Reid Spencer | e2cfe5d | 2006-07-26 21:14:56 +0000 | [diff] [blame] | 199 | [case $host in |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 200 | *-*-aix*) |
Reid Spencer | a773bd5 | 2006-08-04 18:18:08 +0000 | [diff] [blame] | 201 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 202 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 203 | llvm_cv_os_type="AIX" |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 204 | llvm_cv_platform_type="Unix" ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 205 | *-*-irix*) |
Reid Spencer | 6ccd01a | 2006-08-22 22:21:38 +0000 | [diff] [blame] | 206 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 207 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 208 | llvm_cv_os_type="IRIX" |
Reid Spencer | 6ccd01a | 2006-08-22 22:21:38 +0000 | [diff] [blame] | 209 | llvm_cv_platform_type="Unix" ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 210 | *-*-cygwin*) |
Reid Spencer | a773bd5 | 2006-08-04 18:18:08 +0000 | [diff] [blame] | 211 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 212 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 213 | llvm_cv_os_type="Cygwin" |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 214 | llvm_cv_platform_type="Unix" ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 215 | *-*-darwin*) |
Reid Spencer | a773bd5 | 2006-08-04 18:18:08 +0000 | [diff] [blame] | 216 | llvm_cv_link_all_option="-Wl,-all_load" |
Chris Lattner | f5c9467 | 2008-02-05 19:43:40 +0000 | [diff] [blame] | 217 | llvm_cv_no_link_all_option="-Wl,-noall_load" |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 218 | llvm_cv_os_type="Darwin" |
| 219 | llvm_cv_platform_type="Unix" ;; |
Chris Lattner | 21aa347 | 2010-04-09 20:45:04 +0000 | [diff] [blame] | 220 | *-*-minix*) |
| 221 | llvm_cv_link_all_option="-Wl,-all_load" |
| 222 | llvm_cv_no_link_all_option="-Wl,-noall_load" |
| 223 | llvm_cv_os_type="Minix" |
| 224 | llvm_cv_platform_type="Unix" ;; |
Rafael Espindola | f613919 | 2011-12-22 14:01:18 +0000 | [diff] [blame] | 225 | *-*-freebsd* | *-*-kfreebsd-gnu) |
Reid Spencer | a773bd5 | 2006-08-04 18:18:08 +0000 | [diff] [blame] | 226 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 227 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 228 | llvm_cv_os_type="FreeBSD" |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 229 | llvm_cv_platform_type="Unix" ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 230 | *-*-openbsd*) |
Reid Spencer | a773bd5 | 2006-08-04 18:18:08 +0000 | [diff] [blame] | 231 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 232 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 233 | llvm_cv_os_type="OpenBSD" |
Reid Spencer | 1014ab4 | 2006-04-19 23:47:16 +0000 | [diff] [blame] | 234 | llvm_cv_platform_type="Unix" ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 235 | *-*-netbsd*) |
Reid Spencer | 377170a | 2007-01-20 20:43:35 +0000 | [diff] [blame] | 236 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 237 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 238 | llvm_cv_os_type="NetBSD" |
Reid Spencer | 377170a | 2007-01-20 20:43:35 +0000 | [diff] [blame] | 239 | llvm_cv_platform_type="Unix" ;; |
Matthijs Kooijman | f512281 | 2008-06-26 10:36:58 +0000 | [diff] [blame] | 240 | *-*-dragonfly*) |
| 241 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 242 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
| 243 | llvm_cv_os_type="DragonFly" |
| 244 | llvm_cv_platform_type="Unix" ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 245 | *-*-hpux*) |
Reid Spencer | a773bd5 | 2006-08-04 18:18:08 +0000 | [diff] [blame] | 246 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 247 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 248 | llvm_cv_os_type="HP-UX" |
Duraid Madina | 4c61d92 | 2005-05-16 05:39:00 +0000 | [diff] [blame] | 249 | llvm_cv_platform_type="Unix" ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 250 | *-*-interix*) |
Reid Spencer | a773bd5 | 2006-08-04 18:18:08 +0000 | [diff] [blame] | 251 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 252 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 253 | llvm_cv_os_type="Interix" |
| 254 | llvm_cv_platform_type="Unix" ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 255 | *-*-linux*) |
Reid Spencer | a773bd5 | 2006-08-04 18:18:08 +0000 | [diff] [blame] | 256 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 257 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 258 | llvm_cv_os_type="Linux" |
| 259 | llvm_cv_platform_type="Unix" ;; |
Rafael Espindola | f613919 | 2011-12-22 14:01:18 +0000 | [diff] [blame] | 260 | *-*-gnu*) |
| 261 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 262 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
| 263 | llvm_cv_os_type="GNU" |
| 264 | llvm_cv_platform_type="Unix" ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 265 | *-*-solaris*) |
Reid Spencer | a773bd5 | 2006-08-04 18:18:08 +0000 | [diff] [blame] | 266 | llvm_cv_link_all_option="-Wl,-z,allextract" |
| 267 | llvm_cv_no_link_all_option="-Wl,-z,defaultextract" |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 268 | llvm_cv_os_type="SunOS" |
| 269 | llvm_cv_platform_type="Unix" ;; |
Edward O'Callaghan | 2b19d69 | 2009-10-14 00:44:50 +0000 | [diff] [blame] | 270 | *-*-auroraux*) |
| 271 | llvm_cv_link_all_option="-Wl,-z,allextract" |
| 272 | llvm_cv_link_all_option="-Wl,-z,defaultextract" |
| 273 | llvm_cv_os_type="AuroraUX" |
| 274 | llvm_cv_platform_type="Unix" ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 275 | *-*-win32*) |
Reid Spencer | a773bd5 | 2006-08-04 18:18:08 +0000 | [diff] [blame] | 276 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 277 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 278 | llvm_cv_os_type="Win32" |
| 279 | llvm_cv_platform_type="Win32" ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 280 | *-*-mingw*) |
Reid Spencer | a773bd5 | 2006-08-04 18:18:08 +0000 | [diff] [blame] | 281 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 282 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 283 | llvm_cv_os_type="MingW" |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 284 | llvm_cv_platform_type="Win32" ;; |
Edward O'Callaghan | df40664 | 2009-10-12 04:57:20 +0000 | [diff] [blame] | 285 | *-*-haiku*) |
| 286 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 287 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
| 288 | llvm_cv_os_type="Haiku" |
Eric Christopher | ec27496 | 2010-03-02 05:17:21 +0000 | [diff] [blame] | 289 | llvm_cv_platform_type="Unix" ;; |
Anton Korobeynikov | e55db74 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 290 | *-unknown-eabi*) |
| 291 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 292 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
| 293 | llvm_cv_os_type="Freestanding" |
| 294 | llvm_cv_platform_type="Unix" ;; |
| 295 | *-unknown-elf*) |
| 296 | llvm_cv_link_all_option="-Wl,--whole-archive" |
| 297 | llvm_cv_no_link_all_option="-Wl,--no-whole-archive" |
| 298 | llvm_cv_os_type="Freestanding" |
| 299 | llvm_cv_platform_type="Unix" ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 300 | *) |
| 301 | llvm_cv_link_all_option="" |
Reid Spencer | a773bd5 | 2006-08-04 18:18:08 +0000 | [diff] [blame] | 302 | llvm_cv_no_link_all_option="" |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 303 | llvm_cv_os_type="Unknown" |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 304 | llvm_cv_platform_type="Unknown" ;; |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 305 | esac]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 306 | |
Anton Korobeynikov | e55db74 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 307 | AC_CACHE_CHECK([type of operating system we're going to target], |
| 308 | [llvm_cv_target_os_type], |
| 309 | [case $target in |
| 310 | *-*-aix*) |
| 311 | llvm_cv_target_os_type="AIX" ;; |
| 312 | *-*-irix*) |
| 313 | llvm_cv_target_os_type="IRIX" ;; |
| 314 | *-*-cygwin*) |
| 315 | llvm_cv_target_os_type="Cygwin" ;; |
| 316 | *-*-darwin*) |
| 317 | llvm_cv_target_os_type="Darwin" ;; |
Chris Lattner | 21aa347 | 2010-04-09 20:45:04 +0000 | [diff] [blame] | 318 | *-*-minix*) |
| 319 | llvm_cv_target_os_type="Minix" ;; |
Sylvestre Ledru | 1d7e8c6 | 2012-04-05 18:53:09 +0000 | [diff] [blame] | 320 | *-*-freebsd* | *-*-kfreebsd-gnu) |
Anton Korobeynikov | e55db74 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 321 | llvm_cv_target_os_type="FreeBSD" ;; |
| 322 | *-*-openbsd*) |
| 323 | llvm_cv_target_os_type="OpenBSD" ;; |
| 324 | *-*-netbsd*) |
| 325 | llvm_cv_target_os_type="NetBSD" ;; |
| 326 | *-*-dragonfly*) |
| 327 | llvm_cv_target_os_type="DragonFly" ;; |
| 328 | *-*-hpux*) |
| 329 | llvm_cv_target_os_type="HP-UX" ;; |
| 330 | *-*-interix*) |
| 331 | llvm_cv_target_os_type="Interix" ;; |
| 332 | *-*-linux*) |
| 333 | llvm_cv_target_os_type="Linux" ;; |
Sylvestre Ledru | 703bf84 | 2012-04-05 19:34:15 +0000 | [diff] [blame] | 334 | *-*-gnu*) |
| 335 | llvm_cv_target_os_type="GNU" ;; |
Anton Korobeynikov | e55db74 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 336 | *-*-solaris*) |
| 337 | llvm_cv_target_os_type="SunOS" ;; |
Edward O'Callaghan | 2b19d69 | 2009-10-14 00:44:50 +0000 | [diff] [blame] | 338 | *-*-auroraux*) |
| 339 | llvm_cv_target_os_type="AuroraUX" ;; |
Anton Korobeynikov | e55db74 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 340 | *-*-win32*) |
| 341 | llvm_cv_target_os_type="Win32" ;; |
| 342 | *-*-mingw*) |
| 343 | llvm_cv_target_os_type="MingW" ;; |
Edward O'Callaghan | df40664 | 2009-10-12 04:57:20 +0000 | [diff] [blame] | 344 | *-*-haiku*) |
Eric Christopher | ec27496 | 2010-03-02 05:17:21 +0000 | [diff] [blame] | 345 | llvm_cv_target_os_type="Haiku" ;; |
Douglas Gregor | 6ced1d1 | 2011-07-01 22:41:06 +0000 | [diff] [blame] | 346 | *-*-rtems*) |
| 347 | llvm_cv_target_os_type="RTEMS" ;; |
Ivan Krasin | fb23462 | 2011-08-18 22:54:21 +0000 | [diff] [blame] | 348 | *-*-nacl*) |
| 349 | llvm_cv_target_os_type="NativeClient" ;; |
Anton Korobeynikov | e55db74 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 350 | *-unknown-eabi*) |
| 351 | llvm_cv_target_os_type="Freestanding" ;; |
| 352 | *) |
| 353 | llvm_cv_target_os_type="Unknown" ;; |
| 354 | esac]) |
| 355 | |
Reid Spencer | 886e951 | 2004-08-31 01:34:10 +0000 | [diff] [blame] | 356 | dnl Make sure we aren't attempting to configure for an unknown system |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 357 | if test "$llvm_cv_os_type" = "Unknown" ; then |
| 358 | AC_MSG_ERROR([Operating system is unknown, configure can't continue]) |
Reid Spencer | 886e951 | 2004-08-31 01:34:10 +0000 | [diff] [blame] | 359 | fi |
| 360 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 361 | dnl Set the "OS" Makefile variable based on the platform type so the |
| 362 | dnl makefile can configure itself to specific build hosts |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 363 | AC_SUBST(OS,$llvm_cv_os_type) |
Anton Korobeynikov | e55db74 | 2009-08-18 00:40:33 +0000 | [diff] [blame] | 364 | AC_SUBST(HOST_OS,$llvm_cv_os_type) |
| 365 | AC_SUBST(TARGET_OS,$llvm_cv_target_os_type) |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 366 | |
Reid Spencer | a773bd5 | 2006-08-04 18:18:08 +0000 | [diff] [blame] | 367 | dnl Set the LINKALL and NOLINKALL Makefile variables based on the platform |
| 368 | AC_SUBST(LINKALL,$llvm_cv_link_all_option) |
| 369 | AC_SUBST(NOLINKALL,$llvm_cv_no_link_all_option) |
| 370 | |
Dan Gohman | 4b39384 | 2010-08-04 16:48:36 +0000 | [diff] [blame] | 371 | dnl Set the "LLVM_ON_*" variables based on llvm_cv_platform_type |
Michael J. Spencer | 1f6efa3 | 2010-11-29 18:16:10 +0000 | [diff] [blame] | 372 | dnl This is used by lib/Support to determine the basic kind of implementation |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 373 | dnl to use. |
| 374 | case $llvm_cv_platform_type in |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 375 | Unix) |
| 376 | AC_DEFINE([LLVM_ON_UNIX],[1],[Define if this is Unixish platform]) |
Reid Spencer | bbf7a8a | 2004-12-31 22:54:28 +0000 | [diff] [blame] | 377 | AC_SUBST(LLVM_ON_UNIX,[1]) |
| 378 | AC_SUBST(LLVM_ON_WIN32,[0]) |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 379 | ;; |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 380 | Win32) |
| 381 | AC_DEFINE([LLVM_ON_WIN32],[1],[Define if this is Win32ish platform]) |
Reid Spencer | bbf7a8a | 2004-12-31 22:54:28 +0000 | [diff] [blame] | 382 | AC_SUBST(LLVM_ON_UNIX,[0]) |
| 383 | AC_SUBST(LLVM_ON_WIN32,[1]) |
Reid Spencer | 7b3e851 | 2004-12-24 06:29:05 +0000 | [diff] [blame] | 384 | ;; |
| 385 | esac |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 386 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 387 | dnl Determine what our target architecture is and configure accordingly. |
| 388 | dnl This will allow Makefiles to make a distinction between the hardware and |
| 389 | dnl the OS. |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 390 | AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch], |
| 391 | [case $target in |
Reid Spencer | ee93c87 | 2004-12-23 21:08:52 +0000 | [diff] [blame] | 392 | i?86-*) llvm_cv_target_arch="x86" ;; |
Reid Spencer | 2dc6586 | 2004-12-28 07:56:14 +0000 | [diff] [blame] | 393 | amd64-* | x86_64-*) llvm_cv_target_arch="x86_64" ;; |
Reid Spencer | ee93c87 | 2004-12-23 21:08:52 +0000 | [diff] [blame] | 394 | sparc*-*) llvm_cv_target_arch="Sparc" ;; |
| 395 | powerpc*-*) llvm_cv_target_arch="PowerPC" ;; |
Nick Lewycky | fa8ffc1 | 2009-04-18 18:11:26 +0000 | [diff] [blame] | 396 | arm*-*) llvm_cv_target_arch="ARM" ;; |
Tim Northover | 72062f5 | 2013-01-31 12:12:40 +0000 | [diff] [blame] | 397 | aarch64*-*) llvm_cv_target_arch="AArch64" ;; |
Simon Atanasyan | 4830ccf | 2012-10-29 19:49:45 +0000 | [diff] [blame] | 398 | mips-* | mips64-*) llvm_cv_target_arch="Mips" ;; |
| 399 | mipsel-* | mips64el-*) llvm_cv_target_arch="Mips" ;; |
Richard Osborne | b25baef | 2008-11-07 10:59:00 +0000 | [diff] [blame] | 400 | xcore-*) llvm_cv_target_arch="XCore" ;; |
Anton Korobeynikov | f2c3e17 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 401 | msp430-*) llvm_cv_target_arch="MSP430" ;; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 402 | hexagon-*) llvm_cv_target_arch="Hexagon" ;; |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 403 | mblaze-*) llvm_cv_target_arch="MBlaze" ;; |
Justin Holewinski | 49683f3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 404 | nvptx-*) llvm_cv_target_arch="NVPTX" ;; |
Reid Spencer | ee93c87 | 2004-12-23 21:08:52 +0000 | [diff] [blame] | 405 | *) llvm_cv_target_arch="Unknown" ;; |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 406 | esac]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 407 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 408 | if test "$llvm_cv_target_arch" = "Unknown" ; then |
| 409 | AC_MSG_WARN([Configuring LLVM for an unknown target archicture]) |
| 410 | fi |
| 411 | |
Gabor Greif | f18b6fe | 2012-01-26 10:28:58 +0000 | [diff] [blame] | 412 | dnl Determine the LLVM native architecture for the target |
Douglas Gregor | 76166fc | 2009-06-17 00:42:33 +0000 | [diff] [blame] | 413 | case "$llvm_cv_target_arch" in |
| 414 | x86) LLVM_NATIVE_ARCH="X86" ;; |
| 415 | x86_64) LLVM_NATIVE_ARCH="X86" ;; |
| 416 | *) LLVM_NATIVE_ARCH="$llvm_cv_target_arch" ;; |
| 417 | esac |
Mikhail Glushenkov | 895f32c | 2009-07-03 03:52:07 +0000 | [diff] [blame] | 418 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 419 | dnl Define a substitution, ARCH, for the target architecture |
| 420 | AC_SUBST(ARCH,$llvm_cv_target_arch) |
| 421 | |
Danil Malyshev | bb8cef5 | 2012-05-17 21:07:47 +0000 | [diff] [blame] | 422 | dnl Determine what our host architecture. |
| 423 | dnl This will allow MCJIT regress tests runs only for supported |
| 424 | dnl platforms. |
| 425 | case $host in |
| 426 | i?86-*) host_arch="x86" ;; |
| 427 | amd64-* | x86_64-*) host_arch="x86_64" ;; |
| 428 | sparc*-*) host_arch="Sparc" ;; |
| 429 | powerpc*-*) host_arch="PowerPC" ;; |
| 430 | arm*-*) host_arch="ARM" ;; |
Tim Northover | 72062f5 | 2013-01-31 12:12:40 +0000 | [diff] [blame] | 431 | aarch64*-*) host_arch="AArch64" ;; |
Simon Atanasyan | 4830ccf | 2012-10-29 19:49:45 +0000 | [diff] [blame] | 432 | mips-* | mips64-*) host_arch="Mips" ;; |
| 433 | mipsel-* | mips64el-*) host_arch="Mips" ;; |
Danil Malyshev | bb8cef5 | 2012-05-17 21:07:47 +0000 | [diff] [blame] | 434 | xcore-*) host_arch="XCore" ;; |
| 435 | msp430-*) host_arch="MSP430" ;; |
| 436 | hexagon-*) host_arch="Hexagon" ;; |
| 437 | mblaze-*) host_arch="MBlaze" ;; |
Danil Malyshev | bb8cef5 | 2012-05-17 21:07:47 +0000 | [diff] [blame] | 438 | *) host_arch="Unknown" ;; |
| 439 | esac |
| 440 | |
| 441 | if test "$host_arch" = "Unknown" ; then |
| 442 | AC_MSG_WARN([Configuring LLVM for an unknown host archicture]) |
| 443 | fi |
| 444 | |
| 445 | AC_SUBST(HOST_ARCH,$host_arch) |
| 446 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 447 | dnl Check for the endianness of the target |
Duncan Sands | 67f1c49 | 2007-12-12 23:03:45 +0000 | [diff] [blame] | 448 | AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little])) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 449 | |
Gabor Greif | f18b6fe | 2012-01-26 10:28:58 +0000 | [diff] [blame] | 450 | dnl Check for build platform executable suffix if we're cross-compiling |
Reid Spencer | e2cfe5d | 2006-07-26 21:14:56 +0000 | [diff] [blame] | 451 | if test "$cross_compiling" = yes; then |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 452 | AC_SUBST(LLVM_CROSS_COMPILING, [1]) |
Reid Spencer | e2cfe5d | 2006-07-26 21:14:56 +0000 | [diff] [blame] | 453 | AC_BUILD_EXEEXT |
Jim Grosbach | 673612e | 2008-10-02 22:56:44 +0000 | [diff] [blame] | 454 | ac_build_prefix=${build_alias}- |
| 455 | AC_CHECK_PROG(BUILD_CXX, ${ac_build_prefix}g++, ${ac_build_prefix}g++) |
| 456 | if test -z "$BUILD_CXX"; then |
| 457 | AC_CHECK_PROG(BUILD_CXX, g++, g++) |
| 458 | if test -z "$BUILD_CXX"; then |
| 459 | AC_CHECK_PROG(BUILD_CXX, c++, c++, , , /usr/ucb/c++) |
| 460 | fi |
| 461 | fi |
Reid Spencer | e2cfe5d | 2006-07-26 21:14:56 +0000 | [diff] [blame] | 462 | else |
| 463 | AC_SUBST(LLVM_CROSS_COMPILING, [0]) |
| 464 | fi |
| 465 | |
Dan Gohman | 56fb5f9 | 2010-08-04 16:25:01 +0000 | [diff] [blame] | 466 | dnl Check to see if there's a .svn or .git directory indicating that this |
| 467 | dnl build is being done from a checkout. This sets up several defaults for |
| 468 | dnl the command line switches. When we build with a checkout directory, |
Nick Lewycky | d04bc73 | 2009-04-01 04:39:25 +0000 | [diff] [blame] | 469 | dnl we get a debug with assertions turned on. Without, we assume a source |
| 470 | dnl release and we get an optimized build without assertions. |
| 471 | dnl See --enable-optimized and --enable-assertions below |
Dan Gohman | 56fb5f9 | 2010-08-04 16:25:01 +0000 | [diff] [blame] | 472 | if test -d ".svn" -o -d "${srcdir}/.svn" -o -d ".git" -o -d "${srcdir}/.git"; then |
Reid Spencer | 54d1448 | 2006-04-07 16:01:51 +0000 | [diff] [blame] | 473 | cvsbuild="yes" |
| 474 | optimize="no" |
Reid Spencer | 54d1448 | 2006-04-07 16:01:51 +0000 | [diff] [blame] | 475 | AC_SUBST(CVSBUILD,[[CVSBUILD=1]]) |
| 476 | else |
| 477 | cvsbuild="no" |
| 478 | optimize="yes" |
Reid Spencer | 54d1448 | 2006-04-07 16:01:51 +0000 | [diff] [blame] | 479 | fi |
| 480 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 481 | dnl===-----------------------------------------------------------------------=== |
| 482 | dnl=== |
| 483 | dnl=== SECTION 3: Command line arguments for the configure script. |
| 484 | dnl=== |
| 485 | dnl===-----------------------------------------------------------------------=== |
| 486 | |
Eric Christopher | bee515f | 2011-11-11 22:51:42 +0000 | [diff] [blame] | 487 | dnl --enable-libcpp : check whether or not to use libc++ on the command line |
| 488 | AC_ARG_ENABLE(libcpp, |
| 489 | AS_HELP_STRING([--enable-libcpp], |
| 490 | [Use libc++ if available (default is NO)]),, |
| 491 | enableval=default) |
| 492 | case "$enableval" in |
| 493 | yes) AC_SUBST(ENABLE_LIBCPP,[1]) ;; |
| 494 | no) AC_SUBST(ENABLE_LIBCPP,[0]) ;; |
| 495 | default) AC_SUBST(ENABLE_LIBCPP,[0]);; |
| 496 | *) AC_MSG_ERROR([Invalid setting for --enable-libcpp. Use "yes" or "no"]) ;; |
| 497 | esac |
| 498 | |
Eric Christopher | 8212002 | 2012-08-03 19:47:14 +0000 | [diff] [blame] | 499 | dnl --enable-cxx11 : check whether or not to use -std=c++11 on the command line |
| 500 | AC_ARG_ENABLE(cxx11, |
| 501 | AS_HELP_STRING([--enable-cxx11], |
| 502 | [Use c++11 if available (default is NO)]),, |
| 503 | enableval=default) |
| 504 | case "$enableval" in |
| 505 | yes) AC_SUBST(ENABLE_CXX11,[1]) ;; |
| 506 | no) AC_SUBST(ENABLE_CXX11,[0]) ;; |
| 507 | default) AC_SUBST(ENABLE_CXX11,[0]);; |
| 508 | *) AC_MSG_ERROR([Invalid setting for --enable-cxx11. Use "yes" or "no"]) ;; |
| 509 | esac |
| 510 | |
Roman Divacky | d14baf4 | 2012-12-13 16:07:19 +0000 | [diff] [blame] | 511 | dnl --enable-clang-arcmt: check whether to enable clang arcmt |
| 512 | clang_arcmt="yes" |
| 513 | AC_ARG_ENABLE(clang-arcmt, |
| 514 | AS_HELP_STRING([--enable-clang-arcmt], |
| 515 | [Enable building of clang ARCMT (default is YES)]), |
| 516 | clang_arcmt="$enableval", |
| 517 | enableval="yes") |
| 518 | case "$enableval" in |
| 519 | yes) AC_SUBST(ENABLE_CLANG_ARCMT,[1]) ;; |
| 520 | no) AC_SUBST(ENABLE_CLANG_ARCMT,[0]) ;; |
| 521 | default) AC_SUBST(ENABLE_CLANG_ARCMT,[1]);; |
| 522 | *) AC_MSG_ERROR([Invalid setting for --enable-clang-arcmt. Use "yes" or "no"]) ;; |
| 523 | esac |
| 524 | |
| 525 | dnl --enable-clang-static-analyzer: check whether to enable static-analyzer |
| 526 | clang_static_analyzer="yes" |
| 527 | AC_ARG_ENABLE(clang-static-analyzer, |
| 528 | AS_HELP_STRING([--enable-clang-static-analyzer], |
| 529 | [Enable building of clang Static Analyzer (default is YES)]), |
| 530 | clang_static_analyzer="$enableval", |
| 531 | enableval="yes") |
| 532 | case "$enableval" in |
| 533 | yes) AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[1]) ;; |
| 534 | no) AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[0]) ;; |
| 535 | default) AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[1]);; |
| 536 | *) AC_MSG_ERROR([Invalid setting for --enable-clang-static-analyzer. Use "yes" or "no"]) ;; |
| 537 | esac |
| 538 | |
| 539 | dnl --enable-clang-rewriter: check whether to enable clang rewriter |
| 540 | AC_ARG_ENABLE(clang-rewriter, |
| 541 | AS_HELP_STRING([--enable-clang-rewriter], |
| 542 | [Enable building of clang rewriter (default is YES)]),, |
| 543 | enableval="yes") |
| 544 | case "$enableval" in |
| 545 | yes) AC_SUBST(ENABLE_CLANG_REWRITER,[1]) ;; |
| 546 | no) |
Benjamin Kramer | 23c5021 | 2012-12-26 10:48:49 +0000 | [diff] [blame] | 547 | if test ${clang_arcmt} != "no" ; then |
Roman Divacky | d14baf4 | 2012-12-13 16:07:19 +0000 | [diff] [blame] | 548 | AC_MSG_ERROR([Cannot enable clang ARC Migration Tool while disabling rewriter.]) |
| 549 | fi |
Benjamin Kramer | 23c5021 | 2012-12-26 10:48:49 +0000 | [diff] [blame] | 550 | if test ${clang_static_analyzer} != "no" ; then |
Roman Divacky | d14baf4 | 2012-12-13 16:07:19 +0000 | [diff] [blame] | 551 | AC_MSG_ERROR([Cannot enable clang static analyzer while disabling rewriter.]) |
| 552 | fi |
| 553 | AC_SUBST(ENABLE_CLANG_REWRITER,[0]) |
| 554 | ;; |
| 555 | default) AC_SUBST(ENABLE_CLANG_REWRITER,[1]);; |
| 556 | *) AC_MSG_ERROR([Invalid setting for --enable-clang-rewriter. Use "yes" or "no"]) ;; |
| 557 | esac |
| 558 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 559 | dnl --enable-optimized : check whether they want to do an optimized build: |
Reid Spencer | 54d1448 | 2006-04-07 16:01:51 +0000 | [diff] [blame] | 560 | AC_ARG_ENABLE(optimized, AS_HELP_STRING( |
Nick Lewycky | 84bd075 | 2009-06-06 06:24:44 +0000 | [diff] [blame] | 561 | --enable-optimized,[Compile with optimizations enabled (default is NO)]),,enableval=$optimize) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 562 | if test ${enableval} = "no" ; then |
| 563 | AC_SUBST(ENABLE_OPTIMIZED,[[]]) |
| 564 | else |
| 565 | AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]]) |
| 566 | fi |
| 567 | |
David Greene | dbefd0c | 2009-04-17 14:49:22 +0000 | [diff] [blame] | 568 | dnl --enable-profiling : check whether they want to do a profile build: |
| 569 | AC_ARG_ENABLE(profiling, AS_HELP_STRING( |
Nick Lewycky | 84bd075 | 2009-06-06 06:24:44 +0000 | [diff] [blame] | 570 | --enable-profiling,[Compile with profiling enabled (default is NO)]),,enableval="no") |
David Greene | dbefd0c | 2009-04-17 14:49:22 +0000 | [diff] [blame] | 571 | if test ${enableval} = "no" ; then |
| 572 | AC_SUBST(ENABLE_PROFILING,[[]]) |
| 573 | else |
| 574 | AC_SUBST(ENABLE_PROFILING,[[ENABLE_PROFILING=1]]) |
| 575 | fi |
| 576 | |
Reid Spencer | 54d1448 | 2006-04-07 16:01:51 +0000 | [diff] [blame] | 577 | dnl --enable-assertions : check whether they want to turn on assertions or not: |
| 578 | AC_ARG_ENABLE(assertions,AS_HELP_STRING( |
Nick Lewycky | 84bd075 | 2009-06-06 06:24:44 +0000 | [diff] [blame] | 579 | --enable-assertions,[Compile with assertion checks enabled (default is YES)]),, enableval="yes") |
Reid Spencer | c28ccd8 | 2006-04-09 20:42:14 +0000 | [diff] [blame] | 580 | if test ${enableval} = "yes" ; then |
| 581 | AC_SUBST(DISABLE_ASSERTIONS,[[]]) |
Reid Spencer | 54d1448 | 2006-04-07 16:01:51 +0000 | [diff] [blame] | 582 | else |
Reid Spencer | c28ccd8 | 2006-04-09 20:42:14 +0000 | [diff] [blame] | 583 | AC_SUBST(DISABLE_ASSERTIONS,[[DISABLE_ASSERTIONS=1]]) |
Reid Spencer | 54d1448 | 2006-04-07 16:01:51 +0000 | [diff] [blame] | 584 | fi |
| 585 | |
Eric Christopher | 09a8873 | 2012-08-03 19:58:20 +0000 | [diff] [blame] | 586 | dnl --enable-werror : check whether we want Werror on by default |
| 587 | AC_ARG_ENABLE(werror,AS_HELP_STRING( |
| 588 | --enable-werror,[Compile with -Werror enabled (default is NO)]),, enableval="no") |
| 589 | case "$enableval" in |
| 590 | yes) AC_SUBST(ENABLE_WERROR,[1]) ;; |
| 591 | no) AC_SUBST(ENABLE_WERROR,[0]) ;; |
| 592 | default) AC_SUBST(ENABLE_WERROR,[0]);; |
| 593 | *) AC_MSG_ERROR([Invalid setting for --enable-werror. Use "yes" or "no"]) ;; |
| 594 | esac |
| 595 | |
David Greene | a696d24 | 2007-06-28 19:36:08 +0000 | [diff] [blame] | 596 | dnl --enable-expensive-checks : check whether they want to turn on expensive debug checks: |
| 597 | AC_ARG_ENABLE(expensive-checks,AS_HELP_STRING( |
Nick Lewycky | 84bd075 | 2009-06-06 06:24:44 +0000 | [diff] [blame] | 598 | --enable-expensive-checks,[Compile with expensive debug checks enabled (default is NO)]),, enableval="no") |
David Greene | a696d24 | 2007-06-28 19:36:08 +0000 | [diff] [blame] | 599 | if test ${enableval} = "yes" ; then |
| 600 | AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[ENABLE_EXPENSIVE_CHECKS=1]]) |
| 601 | AC_SUBST(EXPENSIVE_CHECKS,[[yes]]) |
| 602 | else |
| 603 | AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[]]) |
| 604 | AC_SUBST(EXPENSIVE_CHECKS,[[no]]) |
| 605 | fi |
| 606 | |
Reid Spencer | 8b2e141 | 2006-11-17 03:32:33 +0000 | [diff] [blame] | 607 | dnl --enable-debug-runtime : should runtime libraries have debug symbols? |
| 608 | AC_ARG_ENABLE(debug-runtime, |
Nick Lewycky | 84bd075 | 2009-06-06 06:24:44 +0000 | [diff] [blame] | 609 | AS_HELP_STRING(--enable-debug-runtime,[Build runtime libs with debug symbols (default is NO)]),,enableval=no) |
Reid Spencer | 8b2e141 | 2006-11-17 03:32:33 +0000 | [diff] [blame] | 610 | if test ${enableval} = "no" ; then |
| 611 | AC_SUBST(DEBUG_RUNTIME,[[]]) |
| 612 | else |
| 613 | AC_SUBST(DEBUG_RUNTIME,[[DEBUG_RUNTIME=1]]) |
| 614 | fi |
| 615 | |
Jeffrey Yasskin | 7fd82e5 | 2009-09-27 17:47:29 +0000 | [diff] [blame] | 616 | dnl --enable-debug-symbols : should even optimized compiler libraries |
| 617 | dnl have debug symbols? |
| 618 | AC_ARG_ENABLE(debug-symbols, |
| 619 | AS_HELP_STRING(--enable-debug-symbols,[Build compiler with debug symbols (default is NO if optimization is on and YES if it's off)]),,enableval=no) |
| 620 | if test ${enableval} = "no" ; then |
| 621 | AC_SUBST(DEBUG_SYMBOLS,[[]]) |
| 622 | else |
| 623 | AC_SUBST(DEBUG_SYMBOLS,[[DEBUG_SYMBOLS=1]]) |
| 624 | fi |
| 625 | |
Daniel Dunbar | 8b5bee4 | 2012-08-14 18:14:20 +0000 | [diff] [blame] | 626 | dnl --enable-keep-symbols : do not strip installed executables |
| 627 | AC_ARG_ENABLE(keep-symbols, |
| 628 | AS_HELP_STRING(--enable-keep-symbols,[Do not strip installed executables)]),,enableval=no) |
| 629 | if test ${enableval} = "no" ; then |
| 630 | AC_SUBST(KEEP_SYMBOLS,[[]]) |
| 631 | else |
| 632 | AC_SUBST(KEEP_SYMBOLS,[[KEEP_SYMBOLS=1]]) |
| 633 | fi |
| 634 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 635 | dnl --enable-jit: check whether they want to enable the jit |
| 636 | AC_ARG_ENABLE(jit, |
| 637 | AS_HELP_STRING(--enable-jit, |
| 638 | [Enable Just In Time Compiling (default is YES)]),, |
| 639 | enableval=default) |
| 640 | if test ${enableval} = "no" |
| 641 | then |
| 642 | AC_SUBST(JIT,[[]]) |
| 643 | else |
Reid Spencer | efbe40a | 2004-11-25 07:28:19 +0000 | [diff] [blame] | 644 | case "$llvm_cv_target_arch" in |
Jakob Stoklund Olesen | 73b7bb7 | 2009-08-02 17:32:37 +0000 | [diff] [blame] | 645 | x86) AC_SUBST(TARGET_HAS_JIT,1) ;; |
| 646 | Sparc) AC_SUBST(TARGET_HAS_JIT,0) ;; |
| 647 | PowerPC) AC_SUBST(TARGET_HAS_JIT,1) ;; |
| 648 | x86_64) AC_SUBST(TARGET_HAS_JIT,1) ;; |
Eric Christopher | 030e5a0 | 2009-09-14 16:38:49 +0000 | [diff] [blame] | 649 | ARM) AC_SUBST(TARGET_HAS_JIT,1) ;; |
Tim Northover | 72062f5 | 2013-01-31 12:12:40 +0000 | [diff] [blame] | 650 | AArch64) AC_SUBST(TARGET_HAS_JIT,0) ;; |
Bruno Cardoso Lopes | dca6cdd | 2011-07-21 16:28:51 +0000 | [diff] [blame] | 651 | Mips) AC_SUBST(TARGET_HAS_JIT,1) ;; |
Jakob Stoklund Olesen | 73b7bb7 | 2009-08-02 17:32:37 +0000 | [diff] [blame] | 652 | XCore) AC_SUBST(TARGET_HAS_JIT,0) ;; |
| 653 | MSP430) AC_SUBST(TARGET_HAS_JIT,0) ;; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 654 | Hexagon) AC_SUBST(TARGET_HAS_JIT,0) ;; |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 655 | MBlaze) AC_SUBST(TARGET_HAS_JIT,0) ;; |
Justin Holewinski | 49683f3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 656 | NVPTX) AC_SUBST(TARGET_HAS_JIT,0) ;; |
Jakob Stoklund Olesen | 73b7bb7 | 2009-08-02 17:32:37 +0000 | [diff] [blame] | 657 | *) AC_SUBST(TARGET_HAS_JIT,0) ;; |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 658 | esac |
| 659 | fi |
| 660 | |
Rafael Espindola | 9d9ae9f | 2010-11-12 19:24:06 +0000 | [diff] [blame] | 661 | dnl Allow enablement of building and installing docs |
| 662 | AC_ARG_ENABLE(docs, |
| 663 | AS_HELP_STRING([--enable-docs], |
| 664 | [Build documents (default is YES)]),, |
| 665 | enableval=default) |
| 666 | case "$enableval" in |
| 667 | yes) AC_SUBST(ENABLE_DOCS,[1]) ;; |
| 668 | no) AC_SUBST(ENABLE_DOCS,[0]) ;; |
| 669 | default) AC_SUBST(ENABLE_DOCS,[1]) ;; |
| 670 | *) AC_MSG_ERROR([Invalid setting for --enable-docs. Use "yes" or "no"]) ;; |
| 671 | esac |
| 672 | |
Reid Spencer | 1f31942 | 2004-11-29 04:56:35 +0000 | [diff] [blame] | 673 | dnl Allow enablement of doxygen generated documentation |
| 674 | AC_ARG_ENABLE(doxygen, |
| 675 | AS_HELP_STRING([--enable-doxygen], |
| 676 | [Build doxygen documentation (default is NO)]),, |
| 677 | enableval=default) |
| 678 | case "$enableval" in |
| 679 | yes) AC_SUBST(ENABLE_DOXYGEN,[1]) ;; |
| 680 | no) AC_SUBST(ENABLE_DOXYGEN,[0]) ;; |
| 681 | default) AC_SUBST(ENABLE_DOXYGEN,[0]) ;; |
| 682 | *) AC_MSG_ERROR([Invalid setting for --enable-doxygen. Use "yes" or "no"]) ;; |
| 683 | esac |
| 684 | |
Reid Spencer | 0a262ba | 2005-08-24 10:07:20 +0000 | [diff] [blame] | 685 | dnl Allow disablement of threads |
| 686 | AC_ARG_ENABLE(threads, |
| 687 | AS_HELP_STRING([--enable-threads], |
| 688 | [Use threads if available (default is YES)]),, |
Reid Spencer | 65c5d75 | 2006-11-05 17:08:18 +0000 | [diff] [blame] | 689 | enableval=default) |
Reid Spencer | 0a262ba | 2005-08-24 10:07:20 +0000 | [diff] [blame] | 690 | case "$enableval" in |
Dylan Noblesmith | 08b73a3 | 2011-11-28 00:48:58 +0000 | [diff] [blame] | 691 | yes) AC_SUBST(LLVM_ENABLE_THREADS,[1]) ;; |
| 692 | no) AC_SUBST(LLVM_ENABLE_THREADS,[0]) ;; |
| 693 | default) AC_SUBST(LLVM_ENABLE_THREADS,[1]) ;; |
Reid Spencer | 0a262ba | 2005-08-24 10:07:20 +0000 | [diff] [blame] | 694 | *) AC_MSG_ERROR([Invalid setting for --enable-threads. Use "yes" or "no"]) ;; |
| 695 | esac |
Dylan Noblesmith | 08b73a3 | 2011-11-28 00:48:58 +0000 | [diff] [blame] | 696 | AC_DEFINE_UNQUOTED([LLVM_ENABLE_THREADS],$LLVM_ENABLE_THREADS, |
| 697 | [Define if threads enabled]) |
Reid Spencer | 0a262ba | 2005-08-24 10:07:20 +0000 | [diff] [blame] | 698 | |
NAKAMURA Takumi | 0dc8439 | 2010-12-29 03:59:03 +0000 | [diff] [blame] | 699 | dnl Allow disablement of pthread.h |
| 700 | AC_ARG_ENABLE(pthreads, |
| 701 | AS_HELP_STRING([--enable-pthreads], |
| 702 | [Use pthreads if available (default is YES)]),, |
| 703 | enableval=default) |
| 704 | case "$enableval" in |
| 705 | yes) AC_SUBST(ENABLE_PTHREADS,[1]) ;; |
| 706 | no) AC_SUBST(ENABLE_PTHREADS,[0]) ;; |
| 707 | default) AC_SUBST(ENABLE_PTHREADS,[1]) ;; |
| 708 | *) AC_MSG_ERROR([Invalid setting for --enable-pthreads. Use "yes" or "no"]) ;; |
| 709 | esac |
| 710 | |
Nick Lewycky | 7e66462 | 2009-02-19 06:18:24 +0000 | [diff] [blame] | 711 | dnl Allow building without position independent code |
Reid Spencer | 89b0d99 | 2006-12-16 22:07:52 +0000 | [diff] [blame] | 712 | AC_ARG_ENABLE(pic, |
| 713 | AS_HELP_STRING([--enable-pic], |
Nick Lewycky | 7e66462 | 2009-02-19 06:18:24 +0000 | [diff] [blame] | 714 | [Build LLVM with Position Independent Code (default is YES)]),, |
Reid Spencer | 89b0d99 | 2006-12-16 22:07:52 +0000 | [diff] [blame] | 715 | enableval=default) |
| 716 | case "$enableval" in |
| 717 | yes) AC_SUBST(ENABLE_PIC,[1]) ;; |
| 718 | no) AC_SUBST(ENABLE_PIC,[0]) ;; |
Nick Lewycky | 7e66462 | 2009-02-19 06:18:24 +0000 | [diff] [blame] | 719 | default) AC_SUBST(ENABLE_PIC,[1]) ;; |
Reid Spencer | 89b0d99 | 2006-12-16 22:07:52 +0000 | [diff] [blame] | 720 | *) AC_MSG_ERROR([Invalid setting for --enable-pic. Use "yes" or "no"]) ;; |
| 721 | esac |
| 722 | AC_DEFINE_UNQUOTED([ENABLE_PIC],$ENABLE_PIC, |
| 723 | [Define if position independent code is enabled]) |
| 724 | |
Jeffrey Yasskin | c901719 | 2010-02-25 06:34:33 +0000 | [diff] [blame] | 725 | dnl Allow building a shared library and linking tools against it. |
| 726 | AC_ARG_ENABLE(shared, |
| 727 | AS_HELP_STRING([--enable-shared], |
| 728 | [Build a shared library and link tools against it (default is NO)]),, |
| 729 | enableval=default) |
| 730 | case "$enableval" in |
| 731 | yes) AC_SUBST(ENABLE_SHARED,[1]) ;; |
| 732 | no) AC_SUBST(ENABLE_SHARED,[0]) ;; |
| 733 | default) AC_SUBST(ENABLE_SHARED,[0]) ;; |
| 734 | *) AC_MSG_ERROR([Invalid setting for --enable-shared. Use "yes" or "no"]) ;; |
| 735 | esac |
| 736 | |
NAKAMURA Takumi | 8eac886 | 2010-12-29 03:59:14 +0000 | [diff] [blame] | 737 | dnl Allow libstdc++ is embedded in LLVM.dll. |
| 738 | AC_ARG_ENABLE(embed-stdcxx, |
| 739 | AS_HELP_STRING([--enable-embed-stdcxx], |
NAKAMURA Takumi | e9d3c1c | 2011-10-13 18:04:52 +0000 | [diff] [blame] | 740 | [Build a shared library with embedded libstdc++ for Win32 DLL (default is NO)]),, |
NAKAMURA Takumi | 8eac886 | 2010-12-29 03:59:14 +0000 | [diff] [blame] | 741 | enableval=default) |
| 742 | case "$enableval" in |
| 743 | yes) AC_SUBST(ENABLE_EMBED_STDCXX,[1]) ;; |
| 744 | no) AC_SUBST(ENABLE_EMBED_STDCXX,[0]) ;; |
NAKAMURA Takumi | e9d3c1c | 2011-10-13 18:04:52 +0000 | [diff] [blame] | 745 | default) AC_SUBST(ENABLE_EMBED_STDCXX,[0]) ;; |
NAKAMURA Takumi | 8eac886 | 2010-12-29 03:59:14 +0000 | [diff] [blame] | 746 | *) AC_MSG_ERROR([Invalid setting for --enable-embed-stdcxx. Use "yes" or "no"]) ;; |
| 747 | esac |
| 748 | |
Daniel Dunbar | dd464df | 2010-05-10 20:11:56 +0000 | [diff] [blame] | 749 | dnl Enable embedding timestamp information into build. |
| 750 | AC_ARG_ENABLE(timestamps, |
| 751 | AS_HELP_STRING([--enable-timestamps], |
| 752 | [Enable embedding timestamp information in build (default is YES)]),, |
| 753 | enableval=default) |
| 754 | case "$enableval" in |
| 755 | yes) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;; |
| 756 | no) AC_SUBST(ENABLE_TIMESTAMPS,[0]) ;; |
| 757 | default) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;; |
| 758 | *) AC_MSG_ERROR([Invalid setting for --enable-timestamps. Use "yes" or "no"]) ;; |
| 759 | esac |
| 760 | AC_DEFINE_UNQUOTED([ENABLE_TIMESTAMPS],$ENABLE_TIMESTAMPS, |
Gabor Greif | c11c2ba | 2012-07-12 13:05:12 +0000 | [diff] [blame] | 761 | [Define if timestamp information (e.g., __DATE__) is allowed]) |
Daniel Dunbar | dd464df | 2010-05-10 20:11:56 +0000 | [diff] [blame] | 762 | |
Eric Christopher | c69bdad | 2012-09-21 23:03:29 +0000 | [diff] [blame] | 763 | dnl Enable embedding timestamp information into build. |
| 764 | |
| 765 | AC_ARG_ENABLE(backtraces, |
| 766 | AS_HELP_STRING([--enable-backtraces], |
| 767 | [Enable embedding backtraces on crash (default is YES)]),, |
| 768 | enableval=default) |
| 769 | case "$enableval" in |
Eric Christopher | f0b3b74 | 2012-11-19 19:31:02 +0000 | [diff] [blame] | 770 | yes) AC_SUBST(ENABLE_BACKTRACES,[1]) ;; |
| 771 | no) AC_SUBST(ENABLE_BACKTRACES,[0]) ;; |
| 772 | default) AC_SUBST(ENABLE_BACKTRACES,[1]) ;; |
Eric Christopher | c69bdad | 2012-09-21 23:03:29 +0000 | [diff] [blame] | 773 | *) AC_MSG_ERROR([Invalid setting for --enable-backtraces. Use "yes" or "no"]) ;; |
| 774 | esac |
| 775 | AC_DEFINE_UNQUOTED([ENABLE_BACKTRACES],$ENABLE_BACKTRACES, |
| 776 | [Define if you want backtraces on crash]) |
| 777 | |
Reid Spencer | 945de9b | 2005-04-22 07:27:28 +0000 | [diff] [blame] | 778 | dnl Allow specific targets to be specified for building (or not) |
| 779 | TARGETS_TO_BUILD="" |
Evan Cheng | 939ea65 | 2006-07-06 07:46:33 +0000 | [diff] [blame] | 780 | AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets], |
Jeffrey Yasskin | e04701a | 2009-09-23 17:05:42 +0000 | [diff] [blame] | 781 | [Build specific host targets: all or target1,target2,... Valid targets are: |
Tim Northover | 72062f5 | 2013-01-31 12:12:40 +0000 | [diff] [blame] | 782 | host, x86, x86_64, sparc, powerpc, arm, aarch64, mips, hexagon, |
Tom Stellard | 38cda13 | 2012-07-16 18:19:46 +0000 | [diff] [blame] | 783 | xcore, msp430, nvptx, and cpp (default=all)]),, |
Reid Spencer | 99d1fcc | 2005-04-22 17:02:18 +0000 | [diff] [blame] | 784 | enableval=all) |
Jeffrey Yasskin | e04701a | 2009-09-23 17:05:42 +0000 | [diff] [blame] | 785 | if test "$enableval" = host-only ; then |
| 786 | enableval=host |
| 787 | fi |
Reid Spencer | 99d1fcc | 2005-04-22 17:02:18 +0000 | [diff] [blame] | 788 | case "$enableval" in |
Eric Christopher | 06b4234 | 2012-11-14 22:09:20 +0000 | [diff] [blame] | 789 | all) TARGETS_TO_BUILD="X86 Sparc PowerPC ARM Mips XCore MSP430 CppBackend MBlaze NVPTX Hexagon" ;; |
Reid Spencer | 99d1fcc | 2005-04-22 17:02:18 +0000 | [diff] [blame] | 790 | *)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do |
| 791 | case "$a_target" in |
Jakob Stoklund Olesen | 73b7bb7 | 2009-08-02 17:32:37 +0000 | [diff] [blame] | 792 | x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;; |
| 793 | x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;; |
| 794 | sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;; |
| 795 | powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;; |
Joerg Sonnenberger | f841064 | 2013-02-03 17:06:49 +0000 | [diff] [blame] | 796 | aarch64) TARGETS_TO_BUILD="AArch64 $TARGETS_TO_BUILD" ;; |
Jakob Stoklund Olesen | 73b7bb7 | 2009-08-02 17:32:37 +0000 | [diff] [blame] | 797 | arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;; |
| 798 | mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; |
Rafael Espindola | 97fb69b | 2011-12-28 17:08:00 +0000 | [diff] [blame] | 799 | mipsel) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; |
Simon Atanasyan | 4830ccf | 2012-10-29 19:49:45 +0000 | [diff] [blame] | 800 | mips64) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; |
| 801 | mips64el) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; |
Jakob Stoklund Olesen | 73b7bb7 | 2009-08-02 17:32:37 +0000 | [diff] [blame] | 802 | xcore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;; |
| 803 | msp430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;; |
Jakob Stoklund Olesen | 73b7bb7 | 2009-08-02 17:32:37 +0000 | [diff] [blame] | 804 | cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 805 | hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;; |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 806 | mblaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;; |
Justin Holewinski | 49683f3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 807 | nvptx) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;; |
Jeffrey Yasskin | e04701a | 2009-09-23 17:05:42 +0000 | [diff] [blame] | 808 | host) case "$llvm_cv_target_arch" in |
| 809 | x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;; |
| 810 | x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;; |
| 811 | Sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;; |
| 812 | PowerPC) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;; |
Jeffrey Yasskin | e04701a | 2009-09-23 17:05:42 +0000 | [diff] [blame] | 813 | ARM) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;; |
| 814 | Mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; |
Wesley Peck | a70f28c | 2010-02-23 19:15:24 +0000 | [diff] [blame] | 815 | MBlaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;; |
Jeffrey Yasskin | e04701a | 2009-09-23 17:05:42 +0000 | [diff] [blame] | 816 | XCore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;; |
| 817 | MSP430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 818 | Hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;; |
Justin Holewinski | 49683f3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 819 | NVPTX) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;; |
Jeffrey Yasskin | e04701a | 2009-09-23 17:05:42 +0000 | [diff] [blame] | 820 | *) AC_MSG_ERROR([Can not set target to build]) ;; |
| 821 | esac ;; |
Reid Spencer | 99d1fcc | 2005-04-22 17:02:18 +0000 | [diff] [blame] | 822 | *) AC_MSG_ERROR([Unrecognized target $a_target]) ;; |
| 823 | esac |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 824 | done |
Reid Spencer | 99d1fcc | 2005-04-22 17:02:18 +0000 | [diff] [blame] | 825 | ;; |
| 826 | esac |
Victor Oliveira | 0e80e18 | 2012-08-09 01:13:59 +0000 | [diff] [blame] | 827 | |
| 828 | AC_ARG_ENABLE([experimental-targets],AS_HELP_STRING([--enable-experimental-targets], |
| 829 | [Build experimental host targets: disable or target1,target2,... |
| 830 | (default=disable)]),, |
| 831 | enableval=disable) |
| 832 | |
| 833 | if test ${enableval} != "disable" |
| 834 | then |
| 835 | TARGETS_TO_BUILD="$enableval $TARGETS_TO_BUILD" |
| 836 | fi |
| 837 | |
Reid Spencer | 945de9b | 2005-04-22 07:27:28 +0000 | [diff] [blame] | 838 | AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BUILD) |
| 839 | |
Gabor Greif | f18b6fe | 2012-01-26 10:28:58 +0000 | [diff] [blame] | 840 | dnl Determine whether we are building LLVM support for the native architecture. |
| 841 | dnl If so, define LLVM_NATIVE_ARCH to that LLVM target. |
Douglas Gregor | 76166fc | 2009-06-17 00:42:33 +0000 | [diff] [blame] | 842 | for a_target in $TARGETS_TO_BUILD; do |
| 843 | if test "$a_target" = "$LLVM_NATIVE_ARCH"; then |
Eric Christopher | 753f326 | 2010-08-30 18:34:48 +0000 | [diff] [blame] | 844 | AC_DEFINE_UNQUOTED(LLVM_NATIVE_ARCH, $LLVM_NATIVE_ARCH, |
Douglas Gregor | 76166fc | 2009-06-17 00:42:33 +0000 | [diff] [blame] | 845 | [LLVM architecture name for the native architecture, if available]) |
Eric Christopher | 753f326 | 2010-08-30 18:34:48 +0000 | [diff] [blame] | 846 | LLVM_NATIVE_TARGET="LLVMInitialize${LLVM_NATIVE_ARCH}Target" |
| 847 | LLVM_NATIVE_TARGETINFO="LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo" |
Evan Cheng | e78085a | 2011-07-22 21:58:54 +0000 | [diff] [blame] | 848 | LLVM_NATIVE_TARGETMC="LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC" |
Eric Christopher | 753f326 | 2010-08-30 18:34:48 +0000 | [diff] [blame] | 849 | LLVM_NATIVE_ASMPRINTER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter" |
Jan Sjödin | 6e70cc1 | 2011-03-14 22:12:35 +0000 | [diff] [blame] | 850 | if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then |
| 851 | LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser" |
| 852 | fi |
Eric Christopher | c4b2271 | 2012-03-26 21:56:56 +0000 | [diff] [blame] | 853 | if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then |
| 854 | LLVM_NATIVE_DISASSEMBLER="LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler" |
| 855 | fi |
Eric Christopher | 753f326 | 2010-08-30 18:34:48 +0000 | [diff] [blame] | 856 | AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGET, $LLVM_NATIVE_TARGET, |
| 857 | [LLVM name for the native Target init function, if available]) |
| 858 | AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETINFO, $LLVM_NATIVE_TARGETINFO, |
| 859 | [LLVM name for the native TargetInfo init function, if available]) |
Evan Cheng | e78085a | 2011-07-22 21:58:54 +0000 | [diff] [blame] | 860 | AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETMC, $LLVM_NATIVE_TARGETMC, |
| 861 | [LLVM name for the native target MC init function, if available]) |
Eric Christopher | 753f326 | 2010-08-30 18:34:48 +0000 | [diff] [blame] | 862 | AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPRINTER, $LLVM_NATIVE_ASMPRINTER, |
| 863 | [LLVM name for the native AsmPrinter init function, if available]) |
Jan Sjödin | 6e70cc1 | 2011-03-14 22:12:35 +0000 | [diff] [blame] | 864 | if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then |
| 865 | AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPARSER, $LLVM_NATIVE_ASMPARSER, |
| 866 | [LLVM name for the native AsmParser init function, if available]) |
| 867 | fi |
Eric Christopher | c4b2271 | 2012-03-26 21:56:56 +0000 | [diff] [blame] | 868 | if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then |
| 869 | AC_DEFINE_UNQUOTED(LLVM_NATIVE_DISASSEMBLER, $LLVM_NATIVE_DISASSEMBLER, |
| 870 | [LLVM name for the native Disassembler init function, if available]) |
| 871 | fi |
Douglas Gregor | 76166fc | 2009-06-17 00:42:33 +0000 | [diff] [blame] | 872 | fi |
| 873 | done |
| 874 | |
Gabor Greif | f18b6fe | 2012-01-26 10:28:58 +0000 | [diff] [blame] | 875 | dnl Build the LLVM_TARGET and LLVM_... macros for Targets.def and the individual |
| 876 | dnl target feature def files. |
Douglas Gregor | 1555a23 | 2009-06-16 20:12:29 +0000 | [diff] [blame] | 877 | LLVM_ENUM_TARGETS="" |
| 878 | LLVM_ENUM_ASM_PRINTERS="" |
Daniel Dunbar | 092a9dd | 2009-07-17 20:42:00 +0000 | [diff] [blame] | 879 | LLVM_ENUM_ASM_PARSERS="" |
Daniel Dunbar | fa3f0b9 | 2009-11-25 04:30:13 +0000 | [diff] [blame] | 880 | LLVM_ENUM_DISASSEMBLERS="" |
Douglas Gregor | 1555a23 | 2009-06-16 20:12:29 +0000 | [diff] [blame] | 881 | for target_to_build in $TARGETS_TO_BUILD; do |
| 882 | LLVM_ENUM_TARGETS="LLVM_TARGET($target_to_build) $LLVM_ENUM_TARGETS" |
Chris Lattner | e15f2e1 | 2010-11-14 19:10:47 +0000 | [diff] [blame] | 883 | if test -f ${srcdir}/lib/Target/${target_to_build}/*AsmPrinter.cpp ; then |
Eric Christopher | 14074e8 | 2010-10-12 02:42:05 +0000 | [diff] [blame] | 884 | LLVM_ENUM_ASM_PRINTERS="LLVM_ASM_PRINTER($target_to_build) $LLVM_ENUM_ASM_PRINTERS"; |
| 885 | fi |
Daniel Dunbar | 092a9dd | 2009-07-17 20:42:00 +0000 | [diff] [blame] | 886 | if test -f ${srcdir}/lib/Target/${target_to_build}/AsmParser/Makefile ; then |
| 887 | LLVM_ENUM_ASM_PARSERS="LLVM_ASM_PARSER($target_to_build) $LLVM_ENUM_ASM_PARSERS"; |
| 888 | fi |
Daniel Dunbar | fa3f0b9 | 2009-11-25 04:30:13 +0000 | [diff] [blame] | 889 | if test -f ${srcdir}/lib/Target/${target_to_build}/Disassembler/Makefile ; then |
| 890 | LLVM_ENUM_DISASSEMBLERS="LLVM_DISASSEMBLER($target_to_build) $LLVM_ENUM_DISASSEMBLERS"; |
| 891 | fi |
Douglas Gregor | 1555a23 | 2009-06-16 20:12:29 +0000 | [diff] [blame] | 892 | done |
| 893 | AC_SUBST(LLVM_ENUM_TARGETS) |
| 894 | AC_SUBST(LLVM_ENUM_ASM_PRINTERS) |
Daniel Dunbar | 092a9dd | 2009-07-17 20:42:00 +0000 | [diff] [blame] | 895 | AC_SUBST(LLVM_ENUM_ASM_PARSERS) |
Daniel Dunbar | fa3f0b9 | 2009-11-25 04:30:13 +0000 | [diff] [blame] | 896 | AC_SUBST(LLVM_ENUM_DISASSEMBLERS) |
Douglas Gregor | 1555a23 | 2009-06-16 20:12:29 +0000 | [diff] [blame] | 897 | |
Daniel Dunbar | 1fce948 | 2009-11-04 04:32:50 +0000 | [diff] [blame] | 898 | dnl Override the option to use for optimized builds. |
| 899 | AC_ARG_WITH(optimize-option, |
| 900 | AS_HELP_STRING([--with-optimize-option], |
| 901 | [Select the compiler options to use for optimized builds]),, |
| 902 | withval=default) |
| 903 | AC_MSG_CHECKING([optimization flags]) |
| 904 | case "$withval" in |
| 905 | default) |
| 906 | case "$llvm_cv_os_type" in |
Daniel Dunbar | 753b43c | 2010-04-30 17:12:23 +0000 | [diff] [blame] | 907 | FreeBSD) optimize_option=-O2 ;; |
Daniel Dunbar | 195d2de | 2010-04-10 18:56:24 +0000 | [diff] [blame] | 908 | MingW) optimize_option=-O2 ;; |
| 909 | *) optimize_option=-O3 ;; |
Daniel Dunbar | 1fce948 | 2009-11-04 04:32:50 +0000 | [diff] [blame] | 910 | esac ;; |
| 911 | *) optimize_option="$withval" ;; |
| 912 | esac |
| 913 | AC_SUBST(OPTIMIZE_OPTION,$optimize_option) |
| 914 | AC_MSG_RESULT([$optimize_option]) |
| 915 | |
Evan Cheng | cf9be26 | 2006-06-20 22:16:32 +0000 | [diff] [blame] | 916 | dnl Specify extra build options |
| 917 | AC_ARG_WITH(extra-options, |
| 918 | AS_HELP_STRING([--with-extra-options], |
Duncan Sands | e4eb2d2 | 2009-05-13 13:13:18 +0000 | [diff] [blame] | 919 | [Specify additional options to compile LLVM with]),, |
Reid Spencer | ceaf1c3 | 2006-07-28 22:50:07 +0000 | [diff] [blame] | 920 | withval=default) |
| 921 | case "$withval" in |
Evan Cheng | cf9be26 | 2006-06-20 22:16:32 +0000 | [diff] [blame] | 922 | default) EXTRA_OPTIONS= ;; |
Reid Spencer | ceaf1c3 | 2006-07-28 22:50:07 +0000 | [diff] [blame] | 923 | *) EXTRA_OPTIONS=$withval ;; |
Evan Cheng | cf9be26 | 2006-06-20 22:16:32 +0000 | [diff] [blame] | 924 | esac |
| 925 | AC_SUBST(EXTRA_OPTIONS,$EXTRA_OPTIONS) |
Reid Spencer | 945de9b | 2005-04-22 07:27:28 +0000 | [diff] [blame] | 926 | |
Daniel Dunbar | e2a91a7 | 2011-06-16 22:30:38 +0000 | [diff] [blame] | 927 | dnl Specify extra linker build options |
| 928 | AC_ARG_WITH(extra-ld-options, |
| 929 | AS_HELP_STRING([--with-extra-ld-options], |
| 930 | [Specify additional options to link LLVM with]),, |
| 931 | withval=default) |
| 932 | case "$withval" in |
| 933 | default) EXTRA_LD_OPTIONS= ;; |
| 934 | *) EXTRA_LD_OPTIONS=$withval ;; |
| 935 | esac |
| 936 | AC_SUBST(EXTRA_LD_OPTIONS,$EXTRA_LD_OPTIONS) |
| 937 | |
Gordon Henriksen | 6530e9d | 2007-10-02 09:50:18 +0000 | [diff] [blame] | 938 | dnl Allow specific bindings to be specified for building (or not) |
| 939 | AC_ARG_ENABLE([bindings],AS_HELP_STRING([--enable-bindings], |
| 940 | [Build specific language bindings: all,auto,none,{binding-name} (default=auto)]),, |
| 941 | enableval=default) |
| 942 | BINDINGS_TO_BUILD="" |
| 943 | case "$enableval" in |
Gordon Henriksen | 48c7253 | 2007-10-02 10:14:32 +0000 | [diff] [blame] | 944 | yes | default | auto) BINDINGS_TO_BUILD="auto" ;; |
Gordon Henriksen | 6530e9d | 2007-10-02 09:50:18 +0000 | [diff] [blame] | 945 | all ) BINDINGS_TO_BUILD="ocaml" ;; |
| 946 | none | no) BINDINGS_TO_BUILD="" ;; |
| 947 | *)for a_binding in `echo $enableval|sed -e 's/,/ /g' ` ; do |
| 948 | case "$a_binding" in |
| 949 | ocaml) BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" ;; |
| 950 | *) AC_MSG_ERROR([Unrecognized binding $a_binding]) ;; |
| 951 | esac |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 952 | done |
Gordon Henriksen | 6530e9d | 2007-10-02 09:50:18 +0000 | [diff] [blame] | 953 | ;; |
| 954 | esac |
| 955 | |
Gordon Henriksen | 1d4e078 | 2007-10-02 16:42:10 +0000 | [diff] [blame] | 956 | dnl Allow the ocaml libdir to be overridden. This could go in a configure |
| 957 | dnl script for bindings/ocaml/configure, except that its auto value depends on |
| 958 | dnl OCAMLC, which is found here to support tests. |
| 959 | AC_ARG_WITH([ocaml-libdir], |
| 960 | [AS_HELP_STRING([--with-ocaml-libdir], |
| 961 | [Specify install location for ocaml bindings (default is stdlib)])], |
| 962 | [], |
| 963 | [withval=auto]) |
| 964 | case "$withval" in |
| 965 | auto) with_ocaml_libdir="$withval" ;; |
| 966 | /* | [[A-Za-z]]:[[\\/]]*) with_ocaml_libdir="$withval" ;; |
| 967 | *) AC_MSG_ERROR([Invalid path for --with-ocaml-libdir. Provide full path]) ;; |
| 968 | esac |
| 969 | |
NAKAMURA Takumi | e5ab51d | 2011-10-16 02:54:26 +0000 | [diff] [blame] | 970 | AC_ARG_WITH(clang-srcdir, |
| 971 | AS_HELP_STRING([--with-clang-srcdir], |
| 972 | [Directory to the out-of-tree Clang source]),, |
| 973 | withval="-") |
| 974 | case "$withval" in |
Dylan Noblesmith | db6caea | 2012-02-02 00:17:33 +0000 | [diff] [blame] | 975 | -) clang_src_root="" ;; |
NAKAMURA Takumi | e5ab51d | 2011-10-16 02:54:26 +0000 | [diff] [blame] | 976 | /* | [[A-Za-z]]:[[\\/]]*) clang_src_root="$withval" ;; |
| 977 | *) clang_src_root="$ac_pwd/$withval" ;; |
| 978 | esac |
| 979 | AC_SUBST(CLANG_SRC_ROOT,[$clang_src_root]) |
| 980 | |
Chandler Carruth | 6b24116 | 2010-10-19 08:21:25 +0000 | [diff] [blame] | 981 | AC_ARG_WITH(clang-resource-dir, |
| 982 | AS_HELP_STRING([--with-clang-resource-dir], |
| 983 | [Relative directory from the Clang binary for resource files]),, |
| 984 | withval="") |
| 985 | AC_DEFINE_UNQUOTED(CLANG_RESOURCE_DIR,"$withval", |
| 986 | [Relative directory for resource files]) |
| 987 | |
Rafael Espindola | d6c8ec6 | 2009-12-07 00:27:35 +0000 | [diff] [blame] | 988 | AC_ARG_WITH(c-include-dirs, |
Rafael Espindola | 7f9ec91 | 2009-11-12 05:46:09 +0000 | [diff] [blame] | 989 | AS_HELP_STRING([--with-c-include-dirs], |
| 990 | [Colon separated list of directories clang will search for headers]),, |
| 991 | withval="") |
| 992 | AC_DEFINE_UNQUOTED(C_INCLUDE_DIRS,"$withval", |
| 993 | [Directories clang will search for headers]) |
| 994 | |
Rafael Espindola | 1aee22e | 2012-02-03 00:59:30 +0000 | [diff] [blame] | 995 | # Clang normally uses the system c++ headers and libraries. With this option, |
| 996 | # clang will use the ones provided by a gcc installation instead. This option should |
| 997 | # be passed the same value that was used with --prefix when configuring gcc. |
| 998 | AC_ARG_WITH(gcc-toolchain, |
| 999 | AS_HELP_STRING([--with-gcc-toolchain], |
| 1000 | [Directory where gcc is installed.]),, |
Rafael Espindola | 420d23c | 2009-11-16 19:46:55 +0000 | [diff] [blame] | 1001 | withval="") |
Rafael Espindola | 1aee22e | 2012-02-03 00:59:30 +0000 | [diff] [blame] | 1002 | AC_DEFINE_UNQUOTED(GCC_INSTALL_PREFIX,"$withval", |
| 1003 | [Directory where gcc is installed.]) |
Rafael Espindola | 420d23c | 2009-11-16 19:46:55 +0000 | [diff] [blame] | 1004 | |
Sebastian Pop | e4f1b37 | 2012-04-30 20:06:58 +0000 | [diff] [blame] | 1005 | AC_ARG_WITH(default-sysroot, |
Sebastian Pop | 7e5c316 | 2012-04-16 04:11:45 +0000 | [diff] [blame] | 1006 | AS_HELP_STRING([--with-default-sysroot], |
| 1007 | [Add --sysroot=<path> to all compiler invocations.]),, |
| 1008 | withval="") |
| 1009 | AC_DEFINE_UNQUOTED(DEFAULT_SYSROOT,"$withval", |
| 1010 | [Default <path> to all compiler invocations for --sysroot=<path>.]) |
| 1011 | |
Nick Lewycky | e2be5d5 | 2009-02-03 07:10:08 +0000 | [diff] [blame] | 1012 | dnl Allow linking of LLVM with GPLv3 binutils code. |
| 1013 | AC_ARG_WITH(binutils-include, |
| 1014 | AS_HELP_STRING([--with-binutils-include], |
| 1015 | [Specify path to binutils/include/ containing plugin-api.h file for gold plugin.]),, |
| 1016 | withval=default) |
| 1017 | case "$withval" in |
| 1018 | default) WITH_BINUTILS_INCDIR=default ;; |
| 1019 | /* | [[A-Za-z]]:[[\\/]]*) WITH_BINUTILS_INCDIR=$withval ;; |
| 1020 | *) AC_MSG_ERROR([Invalid path for --with-binutils-include. Provide full path]) ;; |
| 1021 | esac |
| 1022 | if test "x$WITH_BINUTILS_INCDIR" != xdefault ; then |
| 1023 | AC_SUBST(BINUTILS_INCDIR,$WITH_BINUTILS_INCDIR) |
| 1024 | if test ! -f "$WITH_BINUTILS_INCDIR/plugin-api.h"; then |
| 1025 | echo "$WITH_BINUTILS_INCDIR/plugin-api.h" |
| 1026 | AC_MSG_ERROR([Invalid path to directory containing plugin-api.h.]); |
| 1027 | fi |
| 1028 | fi |
| 1029 | |
Chad Rosier | 96212ad | 2011-07-15 00:37:26 +0000 | [diff] [blame] | 1030 | dnl Specify the URL where bug reports should be submitted. |
| 1031 | AC_ARG_WITH(bug-report-url, |
| 1032 | AS_HELP_STRING([--with-bug-report-url], |
Chad Rosier | 11066fb | 2011-08-02 20:53:43 +0000 | [diff] [blame] | 1033 | [Specify the URL where bug reports should be submitted (default=http://llvm.org/bugs/)]),, |
| 1034 | withval="http://llvm.org/bugs/") |
Chad Rosier | 96212ad | 2011-07-15 00:37:26 +0000 | [diff] [blame] | 1035 | AC_DEFINE_UNQUOTED(BUG_REPORT_URL,"$withval", |
| 1036 | [Bug report URL.]) |
| 1037 | |
Nick Lewycky | 84bd075 | 2009-06-06 06:24:44 +0000 | [diff] [blame] | 1038 | dnl --enable-libffi : check whether the user wants to turn off libffi: |
| 1039 | AC_ARG_ENABLE(libffi,AS_HELP_STRING( |
Jeffrey Yasskin | bc83d06 | 2010-02-09 23:03:44 +0000 | [diff] [blame] | 1040 | --enable-libffi,[Check for the presence of libffi (default is NO)]), |
| 1041 | [case "$enableval" in |
| 1042 | yes) llvm_cv_enable_libffi="yes" ;; |
| 1043 | no) llvm_cv_enable_libffi="no" ;; |
| 1044 | *) AC_MSG_ERROR([Invalid setting for --enable-libffi. Use "yes" or "no"]) ;; |
| 1045 | esac], |
| 1046 | llvm_cv_enable_libffi=no) |
Nick Lewycky | 84bd075 | 2009-06-06 06:24:44 +0000 | [diff] [blame] | 1047 | |
Bob Wilson | ae7e2a4 | 2011-11-28 07:59:52 +0000 | [diff] [blame] | 1048 | AC_ARG_WITH(internal-prefix, |
| 1049 | AS_HELP_STRING([--with-internal-prefix], |
| 1050 | [Installation directory for internal files]),, |
| 1051 | withval="") |
| 1052 | AC_SUBST(INTERNAL_PREFIX,[$withval]) |
| 1053 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1054 | dnl===-----------------------------------------------------------------------=== |
| 1055 | dnl=== |
| 1056 | dnl=== SECTION 4: Check for programs we need and that they are the right version |
| 1057 | dnl=== |
| 1058 | dnl===-----------------------------------------------------------------------=== |
Reid Spencer | 73fb548 | 2004-08-31 14:20:36 +0000 | [diff] [blame] | 1059 | |
Reid Spencer | 1bc6864 | 2006-07-27 23:00:30 +0000 | [diff] [blame] | 1060 | AC_PROG_NM |
| 1061 | AC_SUBST(NM) |
| 1062 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1063 | dnl Check for the tools that the makefiles require |
| 1064 | AC_CHECK_GNU_MAKE |
| 1065 | AC_PROG_LN_S |
Reid Spencer | 8a2d471 | 2004-12-16 17:48:14 +0000 | [diff] [blame] | 1066 | AC_PATH_PROG(CMP, [cmp], [cmp]) |
| 1067 | AC_PATH_PROG(CP, [cp], [cp]) |
Reid Spencer | 1f31942 | 2004-11-29 04:56:35 +0000 | [diff] [blame] | 1068 | AC_PATH_PROG(DATE, [date], [date]) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1069 | AC_PATH_PROG(FIND, [find], [find]) |
| 1070 | AC_PATH_PROG(GREP, [grep], [grep]) |
| 1071 | AC_PATH_PROG(MKDIR,[mkdir],[mkdir]) |
Reid Spencer | 1f31942 | 2004-11-29 04:56:35 +0000 | [diff] [blame] | 1072 | AC_PATH_PROG(MV, [mv], [mv]) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1073 | AC_PROG_RANLIB |
Torok Edwin | f6ce9ef | 2010-01-26 08:48:04 +0000 | [diff] [blame] | 1074 | AC_CHECK_TOOL(AR, ar, false) |
Reid Spencer | 1f31942 | 2004-11-29 04:56:35 +0000 | [diff] [blame] | 1075 | AC_PATH_PROG(RM, [rm], [rm]) |
| 1076 | AC_PATH_PROG(SED, [sed], [sed]) |
| 1077 | AC_PATH_PROG(TAR, [tar], [gtar]) |
Reid Spencer | aea7fe4 | 2006-07-28 05:05:00 +0000 | [diff] [blame] | 1078 | AC_PATH_PROG(BINPWD,[pwd], [pwd]) |
Reid Spencer | ecbd242 | 2006-06-02 23:13:18 +0000 | [diff] [blame] | 1079 | |
| 1080 | dnl Looking for misc. graph plotting software |
Reid Spencer | c232a65 | 2005-07-14 02:25:12 +0000 | [diff] [blame] | 1081 | AC_PATH_PROG(GRAPHVIZ, [Graphviz], [echo Graphviz]) |
| 1082 | if test "$GRAPHVIZ" != "echo Graphviz" ; then |
Reid Spencer | 8a2246f | 2005-07-13 03:20:14 +0000 | [diff] [blame] | 1083 | AC_DEFINE([HAVE_GRAPHVIZ],[1],[Define if the Graphviz program is available]) |
Reid Spencer | caf0ece | 2006-06-05 15:54:38 +0000 | [diff] [blame] | 1084 | dnl If we're targeting for mingw we should emit windows paths, not msys |
Jeff Cohen | 28783c3 | 2007-01-12 18:22:38 +0000 | [diff] [blame] | 1085 | if test "$llvm_cv_os_type" = "MingW" ; then |
Reid Spencer | caf0ece | 2006-06-05 15:54:38 +0000 | [diff] [blame] | 1086 | GRAPHVIZ=`echo $GRAPHVIZ | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` |
| 1087 | fi |
| 1088 | AC_DEFINE_UNQUOTED([LLVM_PATH_GRAPHVIZ],"$GRAPHVIZ${EXEEXT}", |
Reid Spencer | c232a65 | 2005-07-14 02:25:12 +0000 | [diff] [blame] | 1089 | [Define to path to Graphviz program if found or 'echo Graphviz' otherwise]) |
Reid Spencer | 8a2246f | 2005-07-13 03:20:14 +0000 | [diff] [blame] | 1090 | fi |
Reid Spencer | caf0ece | 2006-06-05 15:54:38 +0000 | [diff] [blame] | 1091 | AC_PATH_PROG(DOT, [dot], [echo dot]) |
| 1092 | if test "$DOT" != "echo dot" ; then |
| 1093 | AC_DEFINE([HAVE_DOT],[1],[Define if the dot program is available]) |
| 1094 | dnl If we're targeting for mingw we should emit windows paths, not msys |
Jeff Cohen | 28783c3 | 2007-01-12 18:22:38 +0000 | [diff] [blame] | 1095 | if test "$llvm_cv_os_type" = "MingW" ; then |
Reid Spencer | caf0ece | 2006-06-05 15:54:38 +0000 | [diff] [blame] | 1096 | DOT=`echo $DOT | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` |
| 1097 | fi |
| 1098 | AC_DEFINE_UNQUOTED([LLVM_PATH_DOT],"$DOT${EXEEXT}", |
| 1099 | [Define to path to dot program if found or 'echo dot' otherwise]) |
| 1100 | fi |
David Greene | 00ad26f | 2009-07-09 17:06:18 +0000 | [diff] [blame] | 1101 | AC_PATH_PROG(FDP, [fdp], [echo fdp]) |
| 1102 | if test "$FDP" != "echo fdp" ; then |
| 1103 | AC_DEFINE([HAVE_FDP],[1],[Define if the neat program is available]) |
| 1104 | dnl If we're targeting for mingw we should emit windows paths, not msys |
| 1105 | if test "$llvm_cv_os_type" = "MingW" ; then |
| 1106 | FDP=`echo $FDP | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` |
| 1107 | fi |
| 1108 | AC_DEFINE_UNQUOTED([LLVM_PATH_FDP],"$FDP${EXEEXT}", |
| 1109 | [Define to path to fdp program if found or 'echo fdp' otherwise]) |
| 1110 | fi |
| 1111 | AC_PATH_PROG(NEATO, [neato], [echo neato]) |
| 1112 | if test "$NEATO" != "echo neato" ; then |
| 1113 | AC_DEFINE([HAVE_NEATO],[1],[Define if the neat program is available]) |
| 1114 | dnl If we're targeting for mingw we should emit windows paths, not msys |
| 1115 | if test "$llvm_cv_os_type" = "MingW" ; then |
| 1116 | NEATO=`echo $NEATO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` |
| 1117 | fi |
| 1118 | AC_DEFINE_UNQUOTED([LLVM_PATH_NEATO],"$NEATO${EXEEXT}", |
| 1119 | [Define to path to neato program if found or 'echo neato' otherwise]) |
| 1120 | fi |
| 1121 | AC_PATH_PROG(TWOPI, [twopi], [echo twopi]) |
| 1122 | if test "$TWOPI" != "echo twopi" ; then |
| 1123 | AC_DEFINE([HAVE_TWOPI],[1],[Define if the neat program is available]) |
| 1124 | dnl If we're targeting for mingw we should emit windows paths, not msys |
| 1125 | if test "$llvm_cv_os_type" = "MingW" ; then |
| 1126 | TWOPI=`echo $TWOPI | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` |
| 1127 | fi |
| 1128 | AC_DEFINE_UNQUOTED([LLVM_PATH_TWOPI],"$TWOPI${EXEEXT}", |
| 1129 | [Define to path to twopi program if found or 'echo twopi' otherwise]) |
| 1130 | fi |
| 1131 | AC_PATH_PROG(CIRCO, [circo], [echo circo]) |
| 1132 | if test "$CIRCO" != "echo circo" ; then |
| 1133 | AC_DEFINE([HAVE_CIRCO],[1],[Define if the neat program is available]) |
| 1134 | dnl If we're targeting for mingw we should emit windows paths, not msys |
| 1135 | if test "$llvm_cv_os_type" = "MingW" ; then |
| 1136 | CIRCO=`echo $CIRCO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` |
| 1137 | fi |
| 1138 | AC_DEFINE_UNQUOTED([LLVM_PATH_CIRCO],"$CIRCO${EXEEXT}", |
| 1139 | [Define to path to circo program if found or 'echo circo' otherwise]) |
| 1140 | fi |
Reid Spencer | caf0ece | 2006-06-05 15:54:38 +0000 | [diff] [blame] | 1141 | AC_PATH_PROGS(GV, [gv gsview32], [echo gv]) |
Misha Brukman | ea04dfd | 2005-11-01 20:58:08 +0000 | [diff] [blame] | 1142 | if test "$GV" != "echo gv" ; then |
Reid Spencer | be13028 | 2005-07-14 05:19:12 +0000 | [diff] [blame] | 1143 | AC_DEFINE([HAVE_GV],[1],[Define if the gv program is available]) |
Reid Spencer | caf0ece | 2006-06-05 15:54:38 +0000 | [diff] [blame] | 1144 | dnl If we're targeting for mingw we should emit windows paths, not msys |
Jeff Cohen | 28783c3 | 2007-01-12 18:22:38 +0000 | [diff] [blame] | 1145 | if test "$llvm_cv_os_type" = "MingW" ; then |
Reid Spencer | caf0ece | 2006-06-05 15:54:38 +0000 | [diff] [blame] | 1146 | GV=`echo $GV | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` |
| 1147 | fi |
| 1148 | AC_DEFINE_UNQUOTED([LLVM_PATH_GV],"$GV${EXEEXT}", |
Reid Spencer | be13028 | 2005-07-14 05:19:12 +0000 | [diff] [blame] | 1149 | [Define to path to gv program if found or 'echo gv' otherwise]) |
| 1150 | fi |
Reid Spencer | ecbd242 | 2006-06-02 23:13:18 +0000 | [diff] [blame] | 1151 | AC_PATH_PROG(DOTTY, [dotty], [echo dotty]) |
| 1152 | if test "$DOTTY" != "echo dotty" ; then |
| 1153 | AC_DEFINE([HAVE_DOTTY],[1],[Define if the dotty program is available]) |
Reid Spencer | caf0ece | 2006-06-05 15:54:38 +0000 | [diff] [blame] | 1154 | dnl If we're targeting for mingw we should emit windows paths, not msys |
Jeff Cohen | 28783c3 | 2007-01-12 18:22:38 +0000 | [diff] [blame] | 1155 | if test "$llvm_cv_os_type" = "MingW" ; then |
Reid Spencer | caf0ece | 2006-06-05 15:54:38 +0000 | [diff] [blame] | 1156 | DOTTY=`echo $DOTTY | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` |
| 1157 | fi |
| 1158 | AC_DEFINE_UNQUOTED([LLVM_PATH_DOTTY],"$DOTTY${EXEEXT}", |
Reid Spencer | ecbd242 | 2006-06-02 23:13:18 +0000 | [diff] [blame] | 1159 | [Define to path to dotty program if found or 'echo dotty' otherwise]) |
| 1160 | fi |
Dan Gohman | 48fd5a7 | 2010-09-27 16:28:34 +0000 | [diff] [blame] | 1161 | AC_PATH_PROG(XDOT_PY, [xdot.py], [echo xdot.py]) |
| 1162 | if test "$XDOT_PY" != "echo xdot.py" ; then |
| 1163 | AC_DEFINE([HAVE_XDOT_PY],[1],[Define if the xdot.py program is available]) |
| 1164 | dnl If we're targeting for mingw we should emit windows paths, not msys |
| 1165 | if test "$llvm_cv_os_type" = "MingW" ; then |
| 1166 | XDOT_PY=`echo $XDOT_PY | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` |
| 1167 | fi |
| 1168 | AC_DEFINE_UNQUOTED([LLVM_PATH_XDOT_PY],"$XDOT_PY${EXEEXT}", |
| 1169 | [Define to path to xdot.py program if found or 'echo xdot.py' otherwise]) |
| 1170 | fi |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1171 | |
| 1172 | dnl Find the install program |
| 1173 | AC_PROG_INSTALL |
Eric Christopher | 86fa2f2 | 2010-07-22 21:13:40 +0000 | [diff] [blame] | 1174 | dnl Prepend src dir to install path dir if it's a relative path |
| 1175 | dnl This is a hack for installs that take place in something other |
| 1176 | dnl than the top level. |
| 1177 | case "$INSTALL" in |
| 1178 | [[\\/$]]* | ?:[[\\/]]* ) ;; |
| 1179 | *) INSTALL="\\\$(TOPSRCDIR)/$INSTALL" ;; |
| 1180 | esac |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 1181 | |
Reid Spencer | 1f31942 | 2004-11-29 04:56:35 +0000 | [diff] [blame] | 1182 | dnl Checks for documentation and testing tools that we can do without. If these |
| 1183 | dnl are not found then they are set to "true" which always succeeds but does |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1184 | dnl nothing. This just lets the build output show that we could have done |
| 1185 | dnl something if the tool was available. |
Bill Wendling | 41ef25b | 2008-03-05 09:28:02 +0000 | [diff] [blame] | 1186 | AC_PATH_PROG(BZIP2, [bzip2]) |
mike-m | 68cb319 | 2010-05-06 23:45:43 +0000 | [diff] [blame] | 1187 | AC_PATH_PROG(CAT, [cat]) |
Bill Wendling | 41ef25b | 2008-03-05 09:28:02 +0000 | [diff] [blame] | 1188 | AC_PATH_PROG(DOXYGEN, [doxygen]) |
Daniel Dunbar | f468fd8 | 2012-05-08 18:26:07 +0000 | [diff] [blame] | 1189 | AC_PATH_PROG(GROFF, [groff]) |
Eric Christopher | 031d307 | 2010-12-10 01:31:51 +0000 | [diff] [blame] | 1190 | AC_PATH_PROG(GZIPBIN, [gzip]) |
Daniel Dunbar | f468fd8 | 2012-05-08 18:26:07 +0000 | [diff] [blame] | 1191 | AC_PATH_PROG(PDFROFF, [pdfroff]) |
Bill Wendling | 41ef25b | 2008-03-05 09:28:02 +0000 | [diff] [blame] | 1192 | AC_PATH_PROG(ZIP, [zip]) |
Gordon Henriksen | 0f392e1 | 2008-10-22 12:40:40 +0000 | [diff] [blame] | 1193 | AC_PATH_PROGS(OCAMLC, [ocamlc]) |
| 1194 | AC_PATH_PROGS(OCAMLOPT, [ocamlopt]) |
| 1195 | AC_PATH_PROGS(OCAMLDEP, [ocamldep]) |
| 1196 | AC_PATH_PROGS(OCAMLDOC, [ocamldoc]) |
Daniel Dunbar | f468fd8 | 2012-05-08 18:26:07 +0000 | [diff] [blame] | 1197 | AC_PATH_PROGS(GAS, [gas as]) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1198 | |
Daniel Dunbar | ee0f32d | 2010-08-11 23:53:59 +0000 | [diff] [blame] | 1199 | dnl Get the version of the linker in use. |
| 1200 | AC_LINK_GET_VERSION |
| 1201 | |
Nick Lewycky | 18f9907 | 2009-03-05 08:20:21 +0000 | [diff] [blame] | 1202 | dnl Determine whether the linker supports the -R option. |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1203 | AC_LINK_USE_R |
| 1204 | |
Nick Lewycky | 18f9907 | 2009-03-05 08:20:21 +0000 | [diff] [blame] | 1205 | dnl Determine whether the linker supports the -export-dynamic option. |
| 1206 | AC_LINK_EXPORT_DYNAMIC |
| 1207 | |
Dan Gohman | da612d6 | 2010-06-01 14:56:56 +0000 | [diff] [blame] | 1208 | dnl Determine whether the linker supports the --version-script option. |
| 1209 | AC_LINK_VERSION_SCRIPT |
Dan Gohman | e05f609 | 2010-04-16 22:58:15 +0000 | [diff] [blame] | 1210 | |
Reid Spencer | 2bc7bd5 | 2004-11-29 12:29:58 +0000 | [diff] [blame] | 1211 | dnl Check for libtool and the library that has dlopen function (which must come |
| 1212 | dnl before the AC_PROG_LIBTOOL check in order to enable dlopening libraries with |
| 1213 | dnl libtool). |
| 1214 | AC_LIBTOOL_DLOPEN |
| 1215 | AC_LIB_LTDL |
Mikhail Glushenkov | 4558f48 | 2009-04-21 19:46:10 +0000 | [diff] [blame] | 1216 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1217 | AC_MSG_CHECKING([tool compatibility]) |
| 1218 | |
Reid Spencer | 8690180 | 2004-12-08 23:07:27 +0000 | [diff] [blame] | 1219 | dnl Ensure that compilation tools are GCC or a GNU compatible compiler such as |
| 1220 | dnl ICC; we use GCC specific options in the makefiles so the compiler needs |
| 1221 | dnl to support those options. |
| 1222 | dnl "icc" emits gcc signatures |
| 1223 | dnl "icc -no-gcc" emits no gcc signature BUT is still compatible |
| 1224 | ICC=no |
| 1225 | IXX=no |
| 1226 | case $CC in |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1227 | icc*|icpc*) |
Reid Spencer | 8690180 | 2004-12-08 23:07:27 +0000 | [diff] [blame] | 1228 | ICC=yes |
| 1229 | IXX=yes |
| 1230 | ;; |
| 1231 | *) |
| 1232 | ;; |
| 1233 | esac |
| 1234 | |
Duraid Madina | 937c60a | 2006-02-15 07:57:42 +0000 | [diff] [blame] | 1235 | if test "$GCC" != "yes" && test "$ICC" != "yes" |
| 1236 | then |
| 1237 | AC_MSG_ERROR([gcc|icc required but not found]) |
| 1238 | fi |
| 1239 | |
Daniel Dunbar | bf48816 | 2010-12-08 01:48:03 +0000 | [diff] [blame] | 1240 | dnl Ensure that compilation tools are compatible with GCC extensions |
Duraid Madina | 937c60a | 2006-02-15 07:57:42 +0000 | [diff] [blame] | 1241 | if test "$GXX" != "yes" && test "$IXX" != "yes" |
| 1242 | then |
Daniel Dunbar | bf48816 | 2010-12-08 01:48:03 +0000 | [diff] [blame] | 1243 | AC_MSG_ERROR([g++|clang++|icc required but not found]) |
Duraid Madina | 937c60a | 2006-02-15 07:57:42 +0000 | [diff] [blame] | 1244 | fi |
| 1245 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1246 | dnl Verify that GCC is version 3.0 or higher |
Reid Spencer | 8690180 | 2004-12-08 23:07:27 +0000 | [diff] [blame] | 1247 | if test "$GCC" = "yes" |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1248 | then |
NAKAMURA Takumi | a4afeef | 2013-01-30 01:37:55 +0000 | [diff] [blame] | 1249 | AC_COMPILE_IFELSE( |
| 1250 | [ |
| 1251 | AC_LANG_SOURCE([[ |
| 1252 | #if !defined(__GNUC__) || __GNUC__ < 3 |
| 1253 | #error Unsupported GCC version |
| 1254 | #endif |
| 1255 | ]]) |
| 1256 | ], |
| 1257 | [], [AC_MSG_ERROR([gcc 3.x required, but you have a lower version])]) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1258 | fi |
| 1259 | |
| 1260 | dnl Check for GNU Make. We use its extensions, so don't build without it |
| 1261 | if test -z "$llvm_cv_gnu_make_command" |
| 1262 | then |
| 1263 | AC_MSG_ERROR([GNU Make required but not found]) |
| 1264 | fi |
| 1265 | |
| 1266 | dnl Tool compatibility is okay if we make it here. |
| 1267 | AC_MSG_RESULT([ok]) |
| 1268 | |
Eric Christopher | ec27496 | 2010-03-02 05:17:21 +0000 | [diff] [blame] | 1269 | dnl Check optional compiler flags. |
Julien Lerouge | 8039e03 | 2009-10-26 19:58:44 +0000 | [diff] [blame] | 1270 | AC_MSG_CHECKING([optional compiler flags]) |
| 1271 | CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros]) |
| 1272 | CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers]) |
Richard Smith | 1983f54 | 2013-01-31 22:19:12 +0000 | [diff] [blame] | 1273 | CXX_FLAG_CHECK(NO_NESTED_ANON_TYPES, [-Wno-nested-anon-types]) |
Rafael Espindola | 9993a3a | 2012-02-28 23:32:06 +0000 | [diff] [blame] | 1274 | CXX_FLAG_CHECK(COVERED_SWITCH_DEFAULT, [-Wcovered-switch-default]) |
David Greene | d2f8216 | 2013-01-09 22:11:13 +0000 | [diff] [blame] | 1275 | dnl GCC's potential uninitialized use analysis is weak and presents lots of |
| 1276 | dnl false positives, so disable it. |
| 1277 | if test "$GXX" = "yes" |
| 1278 | then |
| 1279 | CXX_FLAG_CHECK(NO_MAYBE_UNINITIALIZED, [-Wno-maybe-uninitialized]) |
| 1280 | dnl gcc 4.7 introduced -Wmaybe-uninitialized to distinguish cases which are |
| 1281 | dnl known to be uninitialized from cases which might be uninitialized. We |
| 1282 | dnl still want to catch the first kind of errors. |
| 1283 | if test "$NO_MAYBE_UNINITIALIZED" != "-Wno-maybe-uninitialized" |
| 1284 | then |
| 1285 | CXX_FLAG_CHECK(NO_UNINITIALIZED, [-Wno-uninitialized]) |
| 1286 | else |
David Greene | 0b198ca | 2013-01-15 18:21:15 +0000 | [diff] [blame] | 1287 | dnl Some versions of gcc accept unsupported -W flags if there is |
| 1288 | dnl no warning but stop with an error when a warning is |
| 1289 | dnl encountered. If this gcc is earlier than 4.7, just use |
| 1290 | dnl -Wno-uninitialized. |
| 1291 | gxx_version=`$CXX -dumpversion` |
| 1292 | gxx_version_major=`echo $gxx_version | cut -d'.' -f1` |
| 1293 | gxx_version_minor=`echo $gxx_version | cut -d'.' -f2` |
| 1294 | gxx_version_patch=`echo $gxx_version | cut -d'.' -f3` |
| 1295 | |
| 1296 | if test "$gxx_version_major" -ge "4" \ |
| 1297 | && test "$gxx_version_minor" -ge "7"; then |
| 1298 | dnl AC_SUBST doesn't work with empty strings. |
| 1299 | NO_UNINITIALIZED= |
| 1300 | else |
| 1301 | NO_MAYBE_UNINITIALIZED= |
| 1302 | CXX_FLAG_CHECK(NO_UNINITIALIZED, [-Wno-uninitialized]) |
| 1303 | fi |
David Greene | d2f8216 | 2013-01-09 22:11:13 +0000 | [diff] [blame] | 1304 | fi |
| 1305 | else |
| 1306 | NO_UNINITIALIZED= |
| 1307 | NO_MAYBE_UNINITIALIZED= |
| 1308 | fi |
Richard Smith | 1983f54 | 2013-01-31 22:19:12 +0000 | [diff] [blame] | 1309 | AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $NO_NESTED_ANON_TYPES $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED]) |
David Greene | d2f8216 | 2013-01-09 22:11:13 +0000 | [diff] [blame] | 1310 | |
Saleem Abdulrasool | 3ef8b0a | 2013-01-30 04:07:37 +0000 | [diff] [blame] | 1311 | AC_ARG_WITH([python], |
| 1312 | [AS_HELP_STRING([--with-python], [path to python])], |
| 1313 | [PYTHON="$withval"]) |
| 1314 | |
| 1315 | if test -n "$PYTHON" && test -x "$PYTHON" ; then |
| 1316 | AC_MSG_CHECKING([for python]) |
| 1317 | AC_MSG_RESULT([user defined: $with_python]) |
| 1318 | else |
| 1319 | if test -n "$PYTHON" ; then |
| 1320 | AC_MSG_WARN([specified python ($PYTHON) is not usable, searching path]) |
| 1321 | fi |
| 1322 | |
| 1323 | AC_PATH_PROG([PYTHON], [python python2 python26], |
| 1324 | [AC_MSG_RESULT([not found]) |
| 1325 | AC_MSG_ERROR([could not find python 2.5 or higher])]) |
| 1326 | fi |
| 1327 | |
| 1328 | AC_MSG_CHECKING([for python >= 2.5]) |
| 1329 | ac_python_version=`$PYTHON -c 'import sys; print sys.version.split()[[0]]'` |
| 1330 | ac_python_version_major=`echo $ac_python_version | cut -d'.' -f1` |
| 1331 | ac_python_version_minor=`echo $ac_python_version | cut -d'.' -f2` |
| 1332 | ac_python_version_patch=`echo $ac_python_version | cut -d'.' -f3` |
| 1333 | if test "$ac_python_version_major" -eq "2" \ |
| 1334 | && test "$ac_python_version_minor" -ge "5" ; then |
| 1335 | AC_MSG_RESULT([$PYTHON ($ac_python_version)]) |
| 1336 | else |
| 1337 | AC_MSG_RESULT([not found]) |
| 1338 | AC_MSG_FAILURE([found python $ac_python_version ($PYTHON); required >= 2.5]) |
| 1339 | fi |
Julien Lerouge | 8039e03 | 2009-10-26 19:58:44 +0000 | [diff] [blame] | 1340 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1341 | dnl===-----------------------------------------------------------------------=== |
| 1342 | dnl=== |
| 1343 | dnl=== SECTION 5: Check for libraries |
| 1344 | dnl=== |
| 1345 | dnl===-----------------------------------------------------------------------=== |
| 1346 | |
Reid Spencer | 3484a99 | 2006-01-19 08:31:08 +0000 | [diff] [blame] | 1347 | AC_CHECK_LIB(m,sin) |
Jeff Cohen | 28783c3 | 2007-01-12 18:22:38 +0000 | [diff] [blame] | 1348 | if test "$llvm_cv_os_type" = "MingW" ; then |
Reid Spencer | 48fdf91 | 2006-06-01 19:03:21 +0000 | [diff] [blame] | 1349 | AC_CHECK_LIB(imagehlp, main) |
| 1350 | AC_CHECK_LIB(psapi, main) |
Reid Spencer | 484fc8e | 2006-06-01 16:55:59 +0000 | [diff] [blame] | 1351 | fi |
Reid Spencer | 9e4f701 | 2005-07-12 07:19:13 +0000 | [diff] [blame] | 1352 | |
Brian Gaeke | 4c42378 | 2003-10-07 05:03:36 +0000 | [diff] [blame] | 1353 | dnl dlopen() is required for plugin support. |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1354 | AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1], |
| 1355 | [Define if dlopen() is available on this platform.]), |
| 1356 | AC_MSG_WARN([dlopen() not found - disabling plugin support])) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 1357 | |
Chandler Carruth | 234aaf0 | 2013-01-05 00:29:06 +0000 | [diff] [blame] | 1358 | dnl Search for the clock_gettime() function. Note that we rely on the POSIX |
Chandler Carruth | 1751a73 | 2013-01-05 00:34:40 +0000 | [diff] [blame] | 1359 | dnl macros to detect whether clock_gettime is available, this just finds the |
| 1360 | dnl right libraries to link with. |
Chandler Carruth | 234aaf0 | 2013-01-05 00:29:06 +0000 | [diff] [blame] | 1361 | AC_SEARCH_LIBS(clock_gettime,rt) |
Chandler Carruth | 73c35d8 | 2013-01-04 23:19:55 +0000 | [diff] [blame] | 1362 | |
Nick Lewycky | f9c5c5c | 2009-02-04 06:26:47 +0000 | [diff] [blame] | 1363 | dnl libffi is optional; used to call external functions from the interpreter |
Nick Lewycky | 84bd075 | 2009-06-06 06:24:44 +0000 | [diff] [blame] | 1364 | if test "$llvm_cv_enable_libffi" = "yes" ; then |
| 1365 | AC_SEARCH_LIBS(ffi_call,ffi,AC_DEFINE([HAVE_FFI_CALL],[1], |
| 1366 | [Define if libffi is available on this platform.]), |
Jeffrey Yasskin | bc83d06 | 2010-02-09 23:03:44 +0000 | [diff] [blame] | 1367 | AC_MSG_ERROR([libffi not found - configure without --enable-libffi to compile without it])) |
Nick Lewycky | 84bd075 | 2009-06-06 06:24:44 +0000 | [diff] [blame] | 1368 | fi |
Nick Lewycky | f9c5c5c | 2009-02-04 06:26:47 +0000 | [diff] [blame] | 1369 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 1370 | dnl mallinfo is optional; the code can compile (minus features) without it |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1371 | AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1], |
| 1372 | [Define if mallinfo() is available on this platform.])) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 1373 | |
Brian Gaeke | 5f268f7 | 2003-12-05 19:29:01 +0000 | [diff] [blame] | 1374 | dnl pthread locking functions are optional - but llvm will not be thread-safe |
| 1375 | dnl without locks. |
Dylan Noblesmith | 08b73a3 | 2011-11-28 00:48:58 +0000 | [diff] [blame] | 1376 | if test "$LLVM_ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then |
Edward O'Callaghan | 5da6046 | 2009-10-14 11:12:33 +0000 | [diff] [blame] | 1377 | AC_CHECK_LIB(pthread, pthread_mutex_init) |
Reid Spencer | 0a262ba | 2005-08-24 10:07:20 +0000 | [diff] [blame] | 1378 | AC_SEARCH_LIBS(pthread_mutex_lock,pthread, |
| 1379 | AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1], |
| 1380 | [Have pthread_mutex_lock])) |
Owen Anderson | de8aed2 | 2009-06-16 18:20:20 +0000 | [diff] [blame] | 1381 | AC_SEARCH_LIBS(pthread_rwlock_init,pthread, |
| 1382 | AC_DEFINE([HAVE_PTHREAD_RWLOCK_INIT],[1], |
| 1383 | [Have pthread_rwlock_init])) |
Owen Anderson | 27fcfe1 | 2009-06-25 23:10:26 +0000 | [diff] [blame] | 1384 | AC_SEARCH_LIBS(pthread_getspecific,pthread, |
| 1385 | AC_DEFINE([HAVE_PTHREAD_GETSPECIFIC],[1], |
| 1386 | [Have pthread_getspecific])) |
Reid Spencer | 0a262ba | 2005-08-24 10:07:20 +0000 | [diff] [blame] | 1387 | fi |
Brian Gaeke | 5f268f7 | 2003-12-05 19:29:01 +0000 | [diff] [blame] | 1388 | |
Anton Korobeynikov | 8cd4c3e | 2007-01-19 17:25:17 +0000 | [diff] [blame] | 1389 | dnl Allow extra x86-disassembler library |
| 1390 | AC_ARG_WITH(udis86, |
| 1391 | AS_HELP_STRING([--with-udis86=<path>], |
| 1392 | [Use udis86 external x86 disassembler library]), |
| 1393 | [ |
| 1394 | AC_SUBST(USE_UDIS86, [1]) |
| 1395 | case "$withval" in |
Anton Korobeynikov | a5137f3 | 2007-01-20 07:40:26 +0000 | [diff] [blame] | 1396 | /usr/lib|yes) ;; |
Anton Korobeynikov | 8cd4c3e | 2007-01-19 17:25:17 +0000 | [diff] [blame] | 1397 | *) LDFLAGS="$LDFLAGS -L${withval}" ;; |
| 1398 | esac |
| 1399 | AC_CHECK_LIB(udis86, ud_init, [], [ |
| 1400 | echo "Error! You need to have libudis86 around." |
| 1401 | exit -1 |
| 1402 | ]) |
| 1403 | ], |
| 1404 | AC_SUBST(USE_UDIS86, [0])) |
| 1405 | AC_DEFINE_UNQUOTED([USE_UDIS86],$USE_UDIS86, |
| 1406 | [Define if use udis86 library]) |
| 1407 | |
Jeffrey Yasskin | 8f6d9a7 | 2009-07-10 21:08:20 +0000 | [diff] [blame] | 1408 | dnl Allow OProfile support for JIT output. |
| 1409 | AC_ARG_WITH(oprofile, |
| 1410 | AS_HELP_STRING([--with-oprofile=<prefix>], |
| 1411 | [Tell OProfile >= 0.9.4 how to symbolize JIT output]), |
| 1412 | [ |
| 1413 | AC_SUBST(USE_OPROFILE, [1]) |
| 1414 | case "$withval" in |
| 1415 | /usr|yes) llvm_cv_oppath=/usr/lib/oprofile ;; |
Jeffrey Yasskin | fe897b2 | 2009-10-07 23:22:42 +0000 | [diff] [blame] | 1416 | no) llvm_cv_oppath= |
| 1417 | AC_SUBST(USE_OPROFILE, [0]) ;; |
Jeffrey Yasskin | 8f6d9a7 | 2009-07-10 21:08:20 +0000 | [diff] [blame] | 1418 | *) llvm_cv_oppath="${withval}/lib/oprofile" |
Eric Christopher | 42dffa5 | 2012-08-03 17:45:31 +0000 | [diff] [blame] | 1419 | CPPFLAGS="-I${withval}/include";; |
Jeffrey Yasskin | 8f6d9a7 | 2009-07-10 21:08:20 +0000 | [diff] [blame] | 1420 | esac |
Eli Bendersky | 61b1851 | 2012-03-13 08:33:15 +0000 | [diff] [blame] | 1421 | case $llvm_cv_os_type in |
| 1422 | Linux) |
| 1423 | if test -n "$llvm_cv_oppath" ; then |
| 1424 | LIBS="$LIBS -lopagent -L${llvm_cv_oppath} -Wl,-rpath,${llvm_cv_oppath}" |
| 1425 | dnl Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537744: |
| 1426 | dnl libbfd is not included properly in libopagent in some Debian |
| 1427 | dnl versions. If libbfd isn't found at all, we assume opagent works |
| 1428 | dnl anyway. |
| 1429 | AC_SEARCH_LIBS(bfd_init, bfd, [], []) |
| 1430 | AC_SEARCH_LIBS(op_open_agent, opagent, [], [ |
| 1431 | echo "Error! You need to have libopagent around." |
| 1432 | exit -1 |
| 1433 | ]) |
| 1434 | AC_CHECK_HEADER([opagent.h], [], [ |
| 1435 | echo "Error! You need to have opagent.h around." |
| 1436 | exit -1 |
| 1437 | ]) |
| 1438 | fi ;; |
| 1439 | *) |
| 1440 | AC_MSG_ERROR([OProfile support is available on Linux only.]) ;; |
| 1441 | esac |
Jeffrey Yasskin | 8f6d9a7 | 2009-07-10 21:08:20 +0000 | [diff] [blame] | 1442 | ], |
| 1443 | [ |
Jeffrey Yasskin | fe897b2 | 2009-10-07 23:22:42 +0000 | [diff] [blame] | 1444 | AC_SUBST(USE_OPROFILE, [0]) |
Jeffrey Yasskin | 8f6d9a7 | 2009-07-10 21:08:20 +0000 | [diff] [blame] | 1445 | ]) |
Eli Bendersky | 61b1851 | 2012-03-13 08:33:15 +0000 | [diff] [blame] | 1446 | AC_DEFINE_UNQUOTED([LLVM_USE_OPROFILE],$USE_OPROFILE, |
Jeffrey Yasskin | 8f6d9a7 | 2009-07-10 21:08:20 +0000 | [diff] [blame] | 1447 | [Define if we have the oprofile JIT-support library]) |
| 1448 | |
Eli Bendersky | 61b1851 | 2012-03-13 08:33:15 +0000 | [diff] [blame] | 1449 | dnl Enable support for Intel JIT Events API. |
| 1450 | AC_ARG_WITH(intel-jitevents, |
Andrew Kaylor | 770b97b | 2012-09-28 17:35:20 +0000 | [diff] [blame] | 1451 | AS_HELP_STRING([--with-intel-jitevents Notify Intel JIT profiling API of generated code]), |
Eli Bendersky | 61b1851 | 2012-03-13 08:33:15 +0000 | [diff] [blame] | 1452 | [ |
Andrew Kaylor | 770b97b | 2012-09-28 17:35:20 +0000 | [diff] [blame] | 1453 | case "$withval" in |
| 1454 | yes) AC_SUBST(USE_INTEL_JITEVENTS,[1]);; |
| 1455 | no) AC_SUBST(USE_INTEL_JITEVENTS,[0]);; |
| 1456 | *) AC_MSG_ERROR([Invalid setting for --with-intel-jitevents. Use "yes" or "no"]);; |
| 1457 | esac |
| 1458 | |
Eli Bendersky | 61b1851 | 2012-03-13 08:33:15 +0000 | [diff] [blame] | 1459 | case $llvm_cv_os_type in |
| 1460 | Linux|Win32|Cygwin|MingW) ;; |
Andrew Kaylor | 770b97b | 2012-09-28 17:35:20 +0000 | [diff] [blame] | 1461 | *) AC_MSG_ERROR([Intel JIT API support is available on Linux and Windows only.]);; |
Eli Bendersky | 61b1851 | 2012-03-13 08:33:15 +0000 | [diff] [blame] | 1462 | esac |
| 1463 | |
Eli Bendersky | 61b1851 | 2012-03-13 08:33:15 +0000 | [diff] [blame] | 1464 | case "$llvm_cv_target_arch" in |
Andrew Kaylor | 770b97b | 2012-09-28 17:35:20 +0000 | [diff] [blame] | 1465 | x86|x86_64) ;; |
| 1466 | *) AC_MSG_ERROR([Target architecture $llvm_cv_target_arch does not support Intel JIT Events API.]);; |
Eli Bendersky | 61b1851 | 2012-03-13 08:33:15 +0000 | [diff] [blame] | 1467 | esac |
Eli Bendersky | 61b1851 | 2012-03-13 08:33:15 +0000 | [diff] [blame] | 1468 | ], |
| 1469 | [ |
| 1470 | AC_SUBST(USE_INTEL_JITEVENTS, [0]) |
| 1471 | ]) |
| 1472 | AC_DEFINE_UNQUOTED([LLVM_USE_INTEL_JITEVENTS],$USE_INTEL_JITEVENTS, |
| 1473 | [Define if we have the Intel JIT API runtime support library]) |
| 1474 | |
Eric Christopher | 46e6bcf | 2012-08-03 19:47:19 +0000 | [diff] [blame] | 1475 | dnl Check for libxml2 |
| 1476 | dnl Right now we're just checking for the existence, we could also check for a |
| 1477 | dnl particular version via --version on xml2-config |
| 1478 | AC_CHECK_PROGS(XML2CONFIG, xml2-config) |
| 1479 | |
| 1480 | AC_MSG_CHECKING(for libxml2 includes) |
| 1481 | if test "x$XML2CONFIG" = "x"; then |
| 1482 | AC_MSG_RESULT(xml2-config not found) |
| 1483 | else |
| 1484 | LIBXML2_INC=`$XML2CONFIG --cflags` |
| 1485 | AC_MSG_RESULT($LIBXML2_INC) |
| 1486 | AC_CHECK_LIB(xml2, xmlReadFile,[AC_DEFINE([CLANG_HAVE_LIBXML],1,[Define if we have libxml2]) |
| 1487 | LIBXML2_LIBS="-lxml2"]) |
| 1488 | fi |
| 1489 | AC_SUBST(LIBXML2_LIBS) |
| 1490 | AC_SUBST(LIBXML2_INC) |
| 1491 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1492 | dnl===-----------------------------------------------------------------------=== |
| 1493 | dnl=== |
| 1494 | dnl=== SECTION 6: Check for header files |
| 1495 | dnl=== |
| 1496 | dnl===-----------------------------------------------------------------------=== |
| 1497 | |
Reid Spencer | 59473af | 2004-12-25 07:31:29 +0000 | [diff] [blame] | 1498 | dnl First, use autoconf provided macros for specific headers that we need |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 1499 | dnl We don't check for ancient stuff or things that are guaranteed to be there |
| 1500 | dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers. |
Reid Spencer | 59473af | 2004-12-25 07:31:29 +0000 | [diff] [blame] | 1501 | dnl Generally we're looking for POSIX headers. |
| 1502 | AC_HEADER_DIRENT |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1503 | AC_HEADER_MMAP_ANONYMOUS |
Reid Spencer | 59473af | 2004-12-25 07:31:29 +0000 | [diff] [blame] | 1504 | AC_HEADER_STAT |
Reid Spencer | 59473af | 2004-12-25 07:31:29 +0000 | [diff] [blame] | 1505 | AC_HEADER_SYS_WAIT |
| 1506 | AC_HEADER_TIME |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 1507 | |
Reid Spencer | 59473af | 2004-12-25 07:31:29 +0000 | [diff] [blame] | 1508 | AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h]) |
Douglas Gregor | 071d73d | 2009-05-18 17:21:34 +0000 | [diff] [blame] | 1509 | AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h termios.h unistd.h]) |
| 1510 | AC_CHECK_HEADERS([utime.h windows.h]) |
Daniel Dunbar | 5cd067f | 2011-02-03 02:39:58 +0000 | [diff] [blame] | 1511 | AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/uio.h]) |
Douglas Gregor | 0174674 | 2009-05-11 18:05:52 +0000 | [diff] [blame] | 1512 | AC_CHECK_HEADERS([sys/types.h sys/ioctl.h malloc/malloc.h mach/mach.h]) |
Jeffrey Yasskin | f28411f | 2010-03-15 04:57:55 +0000 | [diff] [blame] | 1513 | AC_CHECK_HEADERS([valgrind/valgrind.h]) |
Dan Gohman | 3f2f21e | 2010-09-17 20:06:27 +0000 | [diff] [blame] | 1514 | AC_CHECK_HEADERS([fenv.h]) |
Dylan Noblesmith | 08b73a3 | 2011-11-28 00:48:58 +0000 | [diff] [blame] | 1515 | if test "$LLVM_ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then |
Reid Spencer | f8e9f7c | 2007-08-17 05:44:59 +0000 | [diff] [blame] | 1516 | AC_CHECK_HEADERS(pthread.h, |
Nick Lewycky | f9c5c5c | 2009-02-04 06:26:47 +0000 | [diff] [blame] | 1517 | AC_SUBST(HAVE_PTHREAD, 1), |
| 1518 | AC_SUBST(HAVE_PTHREAD, 0)) |
Reid Spencer | 1000b73 | 2006-12-01 00:37:14 +0000 | [diff] [blame] | 1519 | else |
| 1520 | AC_SUBST(HAVE_PTHREAD, 0) |
Reid Spencer | 0a262ba | 2005-08-24 10:07:20 +0000 | [diff] [blame] | 1521 | fi |
Brian Gaeke | 1133eaf | 2004-02-23 22:07:01 +0000 | [diff] [blame] | 1522 | |
Nick Lewycky | 93f70fc | 2009-04-13 04:26:06 +0000 | [diff] [blame] | 1523 | dnl Try to find ffi.h. |
Nick Lewycky | 84bd075 | 2009-06-06 06:24:44 +0000 | [diff] [blame] | 1524 | if test "$llvm_cv_enable_libffi" = "yes" ; then |
| 1525 | AC_CHECK_HEADERS([ffi.h ffi/ffi.h]) |
| 1526 | fi |
Nick Lewycky | f9c5c5c | 2009-02-04 06:26:47 +0000 | [diff] [blame] | 1527 | |
Eric Christopher | 481d402 | 2010-12-03 07:45:22 +0000 | [diff] [blame] | 1528 | dnl Try to find Darwin specific crash reporting libraries. |
Eric Christopher | 654dee4 | 2010-06-22 21:01:04 +0000 | [diff] [blame] | 1529 | AC_CHECK_HEADERS([CrashReporterClient.h]) |
| 1530 | |
Eric Christopher | 481d402 | 2010-12-03 07:45:22 +0000 | [diff] [blame] | 1531 | dnl Try to find Darwin specific crash reporting global. |
Eric Christopher | 51e5713 | 2010-12-07 02:05:42 +0000 | [diff] [blame] | 1532 | AC_MSG_CHECKING([__crashreporter_info__]) |
| 1533 | AC_LINK_IFELSE( |
NAKAMURA Takumi | a4afeef | 2013-01-30 01:37:55 +0000 | [diff] [blame] | 1534 | [ |
| 1535 | AC_LANG_SOURCE([[ |
| 1536 | extern const char *__crashreporter_info__; |
| 1537 | int main() { |
| 1538 | __crashreporter_info__ = "test"; |
| 1539 | return 0; |
| 1540 | } |
| 1541 | ]]) |
| 1542 | ], |
| 1543 | [ |
| 1544 | AC_MSG_RESULT([yes]) |
NAKAMURA Takumi | d749382 | 2013-01-30 01:38:03 +0000 | [diff] [blame] | 1545 | AC_DEFINE([HAVE_CRASHREPORTER_INFO], [1], [can use __crashreporter_info__]) |
NAKAMURA Takumi | a4afeef | 2013-01-30 01:37:55 +0000 | [diff] [blame] | 1546 | ], |
| 1547 | [ |
| 1548 | AC_MSG_RESULT([no]) |
NAKAMURA Takumi | d749382 | 2013-01-30 01:38:03 +0000 | [diff] [blame] | 1549 | AC_DEFINE([HAVE_CRASHREPORTER_INFO], [0], [can use __crashreporter_info__]) |
NAKAMURA Takumi | a4afeef | 2013-01-30 01:37:55 +0000 | [diff] [blame] | 1550 | ]) |
Eric Christopher | 51e5713 | 2010-12-07 02:05:42 +0000 | [diff] [blame] | 1551 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1552 | dnl===-----------------------------------------------------------------------=== |
| 1553 | dnl=== |
| 1554 | dnl=== SECTION 7: Check for types and structures |
| 1555 | dnl=== |
| 1556 | dnl===-----------------------------------------------------------------------=== |
| 1557 | |
Reid Spencer | b2ed0526 | 2006-11-03 18:04:08 +0000 | [diff] [blame] | 1558 | AC_HUGE_VAL_CHECK |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 1559 | AC_TYPE_PID_T |
| 1560 | AC_TYPE_SIZE_T |
Torok Edwin | f6ce9ef | 2010-01-26 08:48:04 +0000 | [diff] [blame] | 1561 | AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[Define as the return type of signal handlers (`int' or `void').]) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1562 | AC_STRUCT_TM |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 1563 | AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found])) |
Reid Spencer | e2c6f51 | 2004-09-02 21:38:24 +0000 | [diff] [blame] | 1564 | AC_CHECK_TYPES([uint64_t],, |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1565 | AC_CHECK_TYPES([u_int64_t],, |
| 1566 | AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found]))) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 1567 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1568 | dnl===-----------------------------------------------------------------------=== |
| 1569 | dnl=== |
| 1570 | dnl=== SECTION 8: Check for specific functions needed |
| 1571 | dnl=== |
| 1572 | dnl===-----------------------------------------------------------------------=== |
| 1573 | |
Chris Lattner | ec7a9b3 | 2006-01-23 06:24:09 +0000 | [diff] [blame] | 1574 | AC_CHECK_FUNCS([backtrace ceilf floorf roundf rintf nearbyintf getcwd ]) |
Gabor Greif | f70414f | 2007-07-13 09:48:29 +0000 | [diff] [blame] | 1575 | AC_CHECK_FUNCS([powf fmodf strtof round ]) |
| 1576 | AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ]) |
Anton Korobeynikov | 9ba8a76 | 2007-02-16 19:11:07 +0000 | [diff] [blame] | 1577 | AC_CHECK_FUNCS([isatty mkdtemp mkstemp ]) |
Benjamin Kramer | 5745fbc | 2011-11-22 12:31:53 +0000 | [diff] [blame] | 1578 | AC_CHECK_FUNCS([mktemp posix_spawn pread realpath sbrk setrlimit strdup ]) |
Daniel Dunbar | e0b0e7b | 2012-05-05 16:36:16 +0000 | [diff] [blame] | 1579 | AC_CHECK_FUNCS([strerror strerror_r setenv arc4random ]) |
Chris Lattner | 368c36f | 2005-11-14 07:24:17 +0000 | [diff] [blame] | 1580 | AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ]) |
Daniel Dunbar | 5cd067f | 2011-02-03 02:39:58 +0000 | [diff] [blame] | 1581 | AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev]) |
John Criswell | a0137d3 | 2003-10-13 16:22:01 +0000 | [diff] [blame] | 1582 | AC_C_PRINTF_A |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1583 | AC_FUNC_RAND48 |
John Criswell | a0137d3 | 2003-10-13 16:22:01 +0000 | [diff] [blame] | 1584 | |
NAKAMURA Takumi | e29b0ac | 2011-02-09 04:18:48 +0000 | [diff] [blame] | 1585 | dnl Check the declaration "Secure API" on Windows environments. |
| 1586 | AC_CHECK_DECLS([strerror_s]) |
| 1587 | |
NAKAMURA Takumi | 1f6832a | 2011-02-05 15:11:53 +0000 | [diff] [blame] | 1588 | dnl Check symbols in libgcc.a for JIT on Mingw. |
| 1589 | if test "$llvm_cv_os_type" = "MingW" ; then |
| 1590 | AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca])) |
| 1591 | AC_CHECK_LIB(gcc,__alloca,AC_DEFINE([HAVE___ALLOCA],[1],[Have host's __alloca])) |
| 1592 | AC_CHECK_LIB(gcc,__chkstk,AC_DEFINE([HAVE___CHKSTK],[1],[Have host's __chkstk])) |
| 1593 | AC_CHECK_LIB(gcc,___chkstk,AC_DEFINE([HAVE____CHKSTK],[1],[Have host's ___chkstk])) |
| 1594 | |
| 1595 | AC_CHECK_LIB(gcc,__ashldi3,AC_DEFINE([HAVE___ASHLDI3],[1],[Have host's __ashldi3])) |
| 1596 | AC_CHECK_LIB(gcc,__ashrdi3,AC_DEFINE([HAVE___ASHRDI3],[1],[Have host's __ashrdi3])) |
| 1597 | AC_CHECK_LIB(gcc,__divdi3,AC_DEFINE([HAVE___DIVDI3],[1],[Have host's __divdi3])) |
| 1598 | AC_CHECK_LIB(gcc,__fixdfdi,AC_DEFINE([HAVE___FIXDFDI],[1],[Have host's __fixdfdi])) |
| 1599 | AC_CHECK_LIB(gcc,__fixsfdi,AC_DEFINE([HAVE___FIXSFDI],[1],[Have host's __fixsfdi])) |
| 1600 | AC_CHECK_LIB(gcc,__floatdidf,AC_DEFINE([HAVE___FLOATDIDF],[1],[Have host's __floatdidf])) |
| 1601 | AC_CHECK_LIB(gcc,__lshrdi3,AC_DEFINE([HAVE___LSHRDI3],[1],[Have host's __lshrdi3])) |
| 1602 | AC_CHECK_LIB(gcc,__moddi3,AC_DEFINE([HAVE___MODDI3],[1],[Have host's __moddi3])) |
| 1603 | AC_CHECK_LIB(gcc,__udivdi3,AC_DEFINE([HAVE___UDIVDI3],[1],[Have host's __udivdi3])) |
| 1604 | AC_CHECK_LIB(gcc,__umoddi3,AC_DEFINE([HAVE___UMODDI3],[1],[Have host's __umoddi3])) |
| 1605 | |
| 1606 | AC_CHECK_LIB(gcc,__main,AC_DEFINE([HAVE___MAIN],[1],[Have host's __main])) |
| 1607 | AC_CHECK_LIB(gcc,__cmpdi2,AC_DEFINE([HAVE___CMPDI2],[1],[Have host's __cmpdi2])) |
| 1608 | fi |
| 1609 | |
NAKAMURA Takumi | 6073a05 | 2011-05-01 13:29:49 +0000 | [diff] [blame] | 1610 | dnl Check Win32 API EnumerateLoadedModules. |
| 1611 | if test "$llvm_cv_os_type" = "MingW" ; then |
| 1612 | AC_MSG_CHECKING([whether EnumerateLoadedModules() accepts new decl]) |
NAKAMURA Takumi | a4afeef | 2013-01-30 01:37:55 +0000 | [diff] [blame] | 1613 | AC_COMPILE_IFELSE( |
| 1614 | [ |
| 1615 | AC_LANG_SOURCE([[ |
| 1616 | #include <windows.h> |
| 1617 | #include <imagehlp.h> |
| 1618 | extern void foo(PENUMLOADED_MODULES_CALLBACK); |
| 1619 | extern void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID)); |
| 1620 | ]]) |
| 1621 | ], |
NAKAMURA Takumi | 6073a05 | 2011-05-01 13:29:49 +0000 | [diff] [blame] | 1622 | [ |
| 1623 | AC_MSG_RESULT([yes]) |
| 1624 | llvm_cv_win32_elmcb_pcstr="PCSTR" |
| 1625 | ], |
| 1626 | [ |
| 1627 | AC_MSG_RESULT([no]) |
| 1628 | llvm_cv_win32_elmcb_pcstr="PSTR" |
| 1629 | ]) |
| 1630 | AC_DEFINE_UNQUOTED([WIN32_ELMCB_PCSTR],$llvm_cv_win32_elmcb_pcstr,[Type of 1st arg on ELM Callback]) |
| 1631 | fi |
| 1632 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1633 | dnl Check for variations in the Standard C++ library and STL. These macros are |
| 1634 | dnl provided by LLVM in the autoconf/m4 directory. |
Brian Gaeke | 8828eb5 | 2004-06-22 23:43:04 +0000 | [diff] [blame] | 1635 | AC_FUNC_ISNAN |
Brian Gaeke | 3869b27 | 2004-07-21 03:14:51 +0000 | [diff] [blame] | 1636 | AC_FUNC_ISINF |
Brian Gaeke | 8828eb5 | 2004-06-22 23:43:04 +0000 | [diff] [blame] | 1637 | |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1638 | dnl Check for mmap support.We also need to know if /dev/zero is required to |
| 1639 | dnl be opened for allocating RWX memory. |
Anton Korobeynikov | a5137f3 | 2007-01-20 07:40:26 +0000 | [diff] [blame] | 1640 | dnl Make sure we aren't attempting to configure for an unknown system |
| 1641 | if test "$llvm_cv_platform_type" = "Unix" ; then |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1642 | AC_FUNC_MMAP |
Anton Korobeynikov | a5137f3 | 2007-01-20 07:40:26 +0000 | [diff] [blame] | 1643 | AC_FUNC_MMAP_FILE |
| 1644 | AC_NEED_DEV_ZERO_FOR_MMAP |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1645 | |
Anton Korobeynikov | a5137f3 | 2007-01-20 07:40:26 +0000 | [diff] [blame] | 1646 | if test "$ac_cv_func_mmap_fixed_mapped" = "no" |
| 1647 | then |
| 1648 | AC_MSG_WARN([mmap() of a fixed address required but not supported]) |
| 1649 | fi |
| 1650 | if test "$ac_cv_func_mmap_file" = "no" |
| 1651 | then |
| 1652 | AC_MSG_WARN([mmap() of files required but not found]) |
| 1653 | fi |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 1654 | fi |
| 1655 | |
Owen Anderson | d4b272b | 2009-05-18 23:58:51 +0000 | [diff] [blame] | 1656 | dnl atomic builtins are required for threading support. |
Owen Anderson | a860370 | 2009-05-19 22:18:56 +0000 | [diff] [blame] | 1657 | AC_MSG_CHECKING(for GCC atomic builtins) |
Eric Christopher | 475b3d3 | 2010-07-28 20:26:34 +0000 | [diff] [blame] | 1658 | dnl Since we'll be using these atomic builtins in C++ files we should test |
| 1659 | dnl the C++ compiler. |
| 1660 | AC_LANG_PUSH([C++]) |
Owen Anderson | a860370 | 2009-05-19 22:18:56 +0000 | [diff] [blame] | 1661 | AC_LINK_IFELSE( |
NAKAMURA Takumi | a4afeef | 2013-01-30 01:37:55 +0000 | [diff] [blame] | 1662 | [ |
| 1663 | AC_LANG_SOURCE([[ |
| 1664 | int main() { |
| 1665 | volatile unsigned long val = 1; |
| 1666 | __sync_synchronize(); |
| 1667 | __sync_val_compare_and_swap(&val, 1, 0); |
| 1668 | __sync_add_and_fetch(&val, 1); |
| 1669 | __sync_sub_and_fetch(&val, 1); |
| 1670 | return 0; |
| 1671 | } |
| 1672 | ]]) |
| 1673 | ], |
| 1674 | [ |
| 1675 | AC_MSG_RESULT([yes]) |
| 1676 | AC_DEFINE([LLVM_HAS_ATOMICS], [1], [Has gcc/MSVC atomic intrinsics]) |
| 1677 | ], |
| 1678 | [ |
| 1679 | AC_MSG_RESULT([no]) |
| 1680 | AC_DEFINE([LLVM_HAS_ATOMICS], [0], [Has gcc/MSVC atomic intrinsics]) |
| 1681 | AC_MSG_WARN([LLVM will be built thread-unsafe because atomic builtins are missing]) |
| 1682 | ]) |
| 1683 | AC_LANG_POP([C++]) |
Owen Anderson | d4b272b | 2009-05-18 23:58:51 +0000 | [diff] [blame] | 1684 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1685 | dnl===-----------------------------------------------------------------------=== |
| 1686 | dnl=== |
| 1687 | dnl=== SECTION 9: Additional checks, variables, etc. |
| 1688 | dnl=== |
| 1689 | dnl===-----------------------------------------------------------------------=== |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 1690 | |
Nick Lewycky | 166b2b1 | 2009-09-29 06:18:00 +0000 | [diff] [blame] | 1691 | dnl Handle 32-bit linux systems running a 64-bit kernel. |
| 1692 | dnl This has to come after section 4 because it invokes the compiler. |
| 1693 | if test "$llvm_cv_os_type" = "Linux" -a "$llvm_cv_target_arch" = "x86_64" ; then |
| 1694 | AC_IS_LINUX_MIXED |
| 1695 | if test "$llvm_cv_linux_mixed" = "yes"; then |
| 1696 | llvm_cv_target_arch="x86" |
| 1697 | ARCH="x86" |
| 1698 | fi |
| 1699 | fi |
| 1700 | |
Eric Christopher | e4b3ef4 | 2011-09-20 22:26:35 +0000 | [diff] [blame] | 1701 | dnl Check whether __dso_handle is present |
Anton Korobeynikov | 3b30a6e | 2007-07-30 20:02:02 +0000 | [diff] [blame] | 1702 | AC_CHECK_FUNCS([__dso_handle]) |
| 1703 | |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1704 | dnl Propagate the shared library extension that the libltdl checks did to |
Reid Spencer | 2bc7bd5 | 2004-11-29 12:29:58 +0000 | [diff] [blame] | 1705 | dnl the Makefiles so we can use it there too |
| 1706 | AC_SUBST(SHLIBEXT,$libltdl_cv_shlibext) |
Brian Gaeke | cea9a60 | 2004-01-21 19:38:56 +0000 | [diff] [blame] | 1707 | |
Jeffrey Yasskin | c901719 | 2010-02-25 06:34:33 +0000 | [diff] [blame] | 1708 | dnl Propagate the run-time library path variable that the libltdl |
| 1709 | dnl checks found to the Makefiles so we can use it there too |
| 1710 | AC_SUBST(SHLIBPATH_VAR,$libltdl_cv_shlibpath_var) |
| 1711 | |
Gabor Greif | f18b6fe | 2012-01-26 10:28:58 +0000 | [diff] [blame] | 1712 | dnl Translate the various configuration directories and other basic |
| 1713 | dnl information into substitutions that will end up in Makefile.config.in |
| 1714 | dnl that these configured values can be used by the makefiles |
Jeff Cohen | 28783c3 | 2007-01-12 18:22:38 +0000 | [diff] [blame] | 1715 | if test "${prefix}" = "NONE" ; then |
Reid Spencer | 0582887 | 2006-05-16 08:53:32 +0000 | [diff] [blame] | 1716 | prefix="/usr/local" |
| 1717 | fi |
Reid Spencer | a91929d | 2004-08-20 09:03:12 +0000 | [diff] [blame] | 1718 | eval LLVM_PREFIX="${prefix}"; |
| 1719 | eval LLVM_BINDIR="${prefix}/bin"; |
| 1720 | eval LLVM_LIBDIR="${prefix}/lib"; |
Reid Spencer | 1f31942 | 2004-11-29 04:56:35 +0000 | [diff] [blame] | 1721 | eval LLVM_DATADIR="${prefix}/share/llvm"; |
Eric Christopher | ec27496 | 2010-03-02 05:17:21 +0000 | [diff] [blame] | 1722 | eval LLVM_DOCSDIR="${prefix}/share/doc/llvm"; |
Reid Spencer | 1f31942 | 2004-11-29 04:56:35 +0000 | [diff] [blame] | 1723 | eval LLVM_ETCDIR="${prefix}/etc/llvm"; |
Reid Spencer | a91929d | 2004-08-20 09:03:12 +0000 | [diff] [blame] | 1724 | eval LLVM_INCLUDEDIR="${prefix}/include"; |
| 1725 | eval LLVM_INFODIR="${prefix}/info"; |
| 1726 | eval LLVM_MANDIR="${prefix}/man"; |
| 1727 | LLVM_CONFIGTIME=`date` |
| 1728 | AC_SUBST(LLVM_PREFIX) |
| 1729 | AC_SUBST(LLVM_BINDIR) |
| 1730 | AC_SUBST(LLVM_LIBDIR) |
| 1731 | AC_SUBST(LLVM_DATADIR) |
| 1732 | AC_SUBST(LLVM_DOCSDIR) |
| 1733 | AC_SUBST(LLVM_ETCDIR) |
| 1734 | AC_SUBST(LLVM_INCLUDEDIR) |
| 1735 | AC_SUBST(LLVM_INFODIR) |
| 1736 | AC_SUBST(LLVM_MANDIR) |
| 1737 | AC_SUBST(LLVM_CONFIGTIME) |
Reid Spencer | a91929d | 2004-08-20 09:03:12 +0000 | [diff] [blame] | 1738 | |
Daniel Dunbar | c70b79e | 2012-03-02 16:24:21 +0000 | [diff] [blame] | 1739 | dnl Disable embedding timestamps in the build directory, with ENABLE_TIMESTAMPS. |
| 1740 | if test "${ENABLE_TIMESTAMPS}" = "0"; then |
| 1741 | LLVM_CONFIGTIME="(timestamp not enabled)" |
| 1742 | fi |
| 1743 | |
Gabor Greif | f18b6fe | 2012-01-26 10:28:58 +0000 | [diff] [blame] | 1744 | dnl Place the various directories into the config.h file as #defines so that we |
| 1745 | dnl can know about the installation paths within LLVM. |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1746 | AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1747 | [Installation prefix directory]) |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1748 | AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1749 | [Installation directory for binary executables]) |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1750 | AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR", |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1751 | [Installation directory for libraries]) |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1752 | AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1753 | [Installation directory for data files]) |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1754 | AC_DEFINE_UNQUOTED(LLVM_DOCSDIR, "$LLVM_DOCSDIR", |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1755 | [Installation directory for documentation]) |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1756 | AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1757 | [Installation directory for config files]) |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1758 | AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1759 | [Installation directory for include files]) |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1760 | AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1761 | [Installation directory for .info files]) |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1762 | AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1763 | [Installation directory for man pages]) |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1764 | AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1765 | [Time at which LLVM was configured]) |
NAKAMURA Takumi | 2864de7 | 2012-07-22 03:04:52 +0000 | [diff] [blame] | 1766 | AC_DEFINE_UNQUOTED(LLVM_HOSTTRIPLE, "$host", |
| 1767 | [Host triple LLVM will be executed on]) |
Sebastian Pop | de2e0b5 | 2011-11-01 21:31:44 +0000 | [diff] [blame] | 1768 | AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target", |
| 1769 | [Target triple LLVM will generate code for by default]) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1770 | |
Gabor Greif | f18b6fe | 2012-01-26 10:28:58 +0000 | [diff] [blame] | 1771 | dnl Determine which bindings to build. |
Gordon Henriksen | 6530e9d | 2007-10-02 09:50:18 +0000 | [diff] [blame] | 1772 | if test "$BINDINGS_TO_BUILD" = auto ; then |
| 1773 | BINDINGS_TO_BUILD="" |
| 1774 | if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then |
| 1775 | BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" |
| 1776 | fi |
| 1777 | fi |
| 1778 | AC_SUBST(BINDINGS_TO_BUILD,$BINDINGS_TO_BUILD) |
| 1779 | |
Gabor Greif | f18b6fe | 2012-01-26 10:28:58 +0000 | [diff] [blame] | 1780 | dnl This isn't really configurey, but it avoids having to repeat the list in |
| 1781 | dnl other files. |
Gordon Henriksen | 6530e9d | 2007-10-02 09:50:18 +0000 | [diff] [blame] | 1782 | AC_SUBST(ALL_BINDINGS,ocaml) |
| 1783 | |
Gabor Greif | f18b6fe | 2012-01-26 10:28:58 +0000 | [diff] [blame] | 1784 | dnl Do any work necessary to ensure that bindings have what they need. |
Gordon Henriksen | 1d4e078 | 2007-10-02 16:42:10 +0000 | [diff] [blame] | 1785 | binding_prereqs_failed=0 |
| 1786 | for a_binding in $BINDINGS_TO_BUILD ; do |
| 1787 | case "$a_binding" in |
| 1788 | ocaml) |
| 1789 | if test "x$OCAMLC" = x ; then |
| 1790 | AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc]) |
| 1791 | binding_prereqs_failed=1 |
| 1792 | fi |
| 1793 | if test "x$OCAMLDEP" = x ; then |
| 1794 | AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep]) |
| 1795 | binding_prereqs_failed=1 |
| 1796 | fi |
| 1797 | if test "x$OCAMLOPT" = x ; then |
| 1798 | AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt]) |
Eric Christopher | 790e11c | 2007-12-01 00:34:39 +0000 | [diff] [blame] | 1799 | dnl ocamlopt is optional! |
Gordon Henriksen | 1d4e078 | 2007-10-02 16:42:10 +0000 | [diff] [blame] | 1800 | fi |
| 1801 | if test "x$with_ocaml_libdir" != xauto ; then |
| 1802 | AC_SUBST(OCAML_LIBDIR,$with_ocaml_libdir) |
| 1803 | else |
| 1804 | ocaml_stdlib="`"$OCAMLC" -where`" |
| 1805 | if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~" |
| 1806 | then |
| 1807 | # ocaml stdlib is beneath our prefix; use stdlib |
| 1808 | AC_SUBST(OCAML_LIBDIR,$ocaml_stdlib) |
| 1809 | else |
| 1810 | # ocaml stdlib is outside our prefix; use libdir/ocaml |
| 1811 | AC_SUBST(OCAML_LIBDIR,$LLVM_LIBDIR/ocaml) |
| 1812 | fi |
| 1813 | fi |
| 1814 | ;; |
| 1815 | esac |
| 1816 | done |
| 1817 | if test "$binding_prereqs_failed" = 1 ; then |
| 1818 | AC_MSG_ERROR([Prequisites for bindings not satisfied. Fix them or use configure --disable-bindings.]) |
| 1819 | fi |
| 1820 | |
Nick Lewycky | 18f9907 | 2009-03-05 08:20:21 +0000 | [diff] [blame] | 1821 | dnl Determine whether the compiler supports -fvisibility-inlines-hidden. |
Daniel Dunbar | ecfe67c | 2008-09-02 17:35:16 +0000 | [diff] [blame] | 1822 | AC_CXX_USE_VISIBILITY_INLINES_HIDDEN |
Gordon Henriksen | 1d4e078 | 2007-10-02 16:42:10 +0000 | [diff] [blame] | 1823 | |
Nick Lewycky | 1dace48 | 2009-03-03 04:55:15 +0000 | [diff] [blame] | 1824 | dnl Determine linker rpath flag |
Nick Lewycky | 18f9907 | 2009-03-05 08:20:21 +0000 | [diff] [blame] | 1825 | if test "$llvm_cv_link_use_r" = "yes" ; then |
| 1826 | RPATH="-Wl,-R" |
| 1827 | else |
| 1828 | RPATH="-Wl,-rpath" |
| 1829 | fi |
Nick Lewycky | 1dace48 | 2009-03-03 04:55:15 +0000 | [diff] [blame] | 1830 | AC_SUBST(RPATH) |
| 1831 | |
Nick Lewycky | 18f9907 | 2009-03-05 08:20:21 +0000 | [diff] [blame] | 1832 | dnl Determine linker rdynamic flag |
| 1833 | if test "$llvm_cv_link_use_export_dynamic" = "yes" ; then |
| 1834 | RDYNAMIC="-Wl,-export-dynamic" |
| 1835 | else |
| 1836 | RDYNAMIC="" |
| 1837 | fi |
| 1838 | AC_SUBST(RDYNAMIC) |
| 1839 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1840 | dnl===-----------------------------------------------------------------------=== |
| 1841 | dnl=== |
| 1842 | dnl=== SECTION 10: Specify the output files and generate it |
| 1843 | dnl=== |
| 1844 | dnl===-----------------------------------------------------------------------=== |
| 1845 | |
| 1846 | dnl Configure header files |
Reid Spencer | 755bcf0 | 2005-08-24 10:43:10 +0000 | [diff] [blame] | 1847 | dnl WARNING: dnl If you add or remove any of the following config headers, then |
Dylan Noblesmith | f214b80 | 2012-01-17 02:56:49 +0000 | [diff] [blame] | 1848 | dnl you MUST also update Makefile so that the variable FilesToConfig |
Reid Spencer | 755bcf0 | 2005-08-24 10:43:10 +0000 | [diff] [blame] | 1849 | dnl contains the same list of files as AC_CONFIG_HEADERS below. This ensures the |
| 1850 | dnl files can be updated automatically when their *.in sources change. |
Eric Christopher | eec5008 | 2010-08-08 02:44:17 +0000 | [diff] [blame] | 1851 | AC_CONFIG_HEADERS([include/llvm/Config/config.h include/llvm/Config/llvm-config.h]) |
Eric Christopher | d442d28 | 2010-08-08 09:18:29 +0000 | [diff] [blame] | 1852 | AH_TOP([#ifndef CONFIG_H |
| 1853 | #define CONFIG_H]) |
| 1854 | AH_BOTTOM([#endif]) |
| 1855 | |
Douglas Gregor | 1555a23 | 2009-06-16 20:12:29 +0000 | [diff] [blame] | 1856 | AC_CONFIG_FILES([include/llvm/Config/Targets.def]) |
| 1857 | AC_CONFIG_FILES([include/llvm/Config/AsmPrinters.def]) |
Daniel Dunbar | 8413b22 | 2009-07-17 20:56:18 +0000 | [diff] [blame] | 1858 | AC_CONFIG_FILES([include/llvm/Config/AsmParsers.def]) |
Daniel Dunbar | fa3f0b9 | 2009-11-25 04:30:13 +0000 | [diff] [blame] | 1859 | AC_CONFIG_FILES([include/llvm/Config/Disassemblers.def]) |
Michael J. Spencer | 1f6efa3 | 2010-11-29 18:16:10 +0000 | [diff] [blame] | 1860 | AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h]) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1861 | |
| 1862 | dnl Configure the makefile's configuration data |
| 1863 | AC_CONFIG_FILES([Makefile.config]) |
| 1864 | |
Reid Spencer | ea949cf | 2006-08-16 00:45:38 +0000 | [diff] [blame] | 1865 | dnl Configure the RPM spec file for LLVM |
| 1866 | AC_CONFIG_FILES([llvm.spec]) |
| 1867 | |
Peter Collingbourne | 7be3a60 | 2011-05-13 03:27:56 +0000 | [diff] [blame] | 1868 | dnl Configure doxygen's configuration file |
| 1869 | AC_CONFIG_FILES([docs/doxygen.cfg]) |
Dylan Noblesmith | 06db458 | 2012-02-01 14:06:21 +0000 | [diff] [blame] | 1870 | |
| 1871 | dnl Configure clang, if present |
Dylan Noblesmith | 3e82b4a | 2012-02-04 02:41:36 +0000 | [diff] [blame] | 1872 | if test "${clang_src_root}" = ""; then |
Dylan Noblesmith | 32cf80b | 2012-02-02 00:54:18 +0000 | [diff] [blame] | 1873 | clang_src_root="$srcdir/tools/clang" |
Dylan Noblesmith | db6caea | 2012-02-02 00:17:33 +0000 | [diff] [blame] | 1874 | fi |
Dylan Noblesmith | 8d6dd0f | 2012-02-02 00:11:14 +0000 | [diff] [blame] | 1875 | if test -f ${clang_src_root}/README.txt; then |
Dylan Noblesmith | 965a166 | 2012-02-04 03:00:50 +0000 | [diff] [blame] | 1876 | dnl Use variables to stay under 80 columns. |
| 1877 | configh="include/clang/Config/config.h" |
| 1878 | doxy="docs/doxygen.cfg" |
| 1879 | AC_CONFIG_HEADERS([tools/clang/${configh}:${clang_src_root}/${configh}.in]) |
| 1880 | AC_CONFIG_FILES([tools/clang/${doxy}:${clang_src_root}/${doxy}.in]) |
Peter Collingbourne | 7be3a60 | 2011-05-13 03:27:56 +0000 | [diff] [blame] | 1881 | fi |
| 1882 | |
Torok Edwin | 4c4b71c | 2011-10-14 20:38:02 +0000 | [diff] [blame] | 1883 | dnl OCaml findlib META file |
| 1884 | AC_CONFIG_FILES([bindings/ocaml/llvm/META.llvm]) |
| 1885 | |
Jordan Rose | 9208052 | 2012-10-01 18:40:32 +0000 | [diff] [blame] | 1886 | dnl Add --program-prefix value to Makefile.rules. Already an ARG variable. |
| 1887 | test "x$program_prefix" = "xNONE" && program_prefix="" |
| 1888 | AC_SUBST([program_prefix]) |
| 1889 | |
| 1890 | |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1891 | dnl Do special configuration of Makefiles |
Reid Spencer | 1807c1a | 2005-02-24 18:31:27 +0000 | [diff] [blame] | 1892 | AC_CONFIG_COMMANDS([setup],,[llvm_src="${srcdir}"]) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1893 | AC_CONFIG_MAKEFILE(Makefile) |
| 1894 | AC_CONFIG_MAKEFILE(Makefile.common) |
| 1895 | AC_CONFIG_MAKEFILE(examples/Makefile) |
| 1896 | AC_CONFIG_MAKEFILE(lib/Makefile) |
Reid Spencer | 8b2e141 | 2006-11-17 03:32:33 +0000 | [diff] [blame] | 1897 | AC_CONFIG_MAKEFILE(runtime/Makefile) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1898 | AC_CONFIG_MAKEFILE(test/Makefile) |
| 1899 | AC_CONFIG_MAKEFILE(test/Makefile.tests) |
Bill Wendling | 4113bd1 | 2009-01-04 23:12:21 +0000 | [diff] [blame] | 1900 | AC_CONFIG_MAKEFILE(unittests/Makefile) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1901 | AC_CONFIG_MAKEFILE(tools/Makefile) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1902 | AC_CONFIG_MAKEFILE(utils/Makefile) |
| 1903 | AC_CONFIG_MAKEFILE(projects/Makefile) |
Gordon Henriksen | 28622d6 | 2007-09-22 21:36:22 +0000 | [diff] [blame] | 1904 | AC_CONFIG_MAKEFILE(bindings/Makefile) |
| 1905 | AC_CONFIG_MAKEFILE(bindings/ocaml/Makefile.ocaml) |
Reid Spencer | 5e1d9a5 | 2004-11-25 04:51:04 +0000 | [diff] [blame] | 1906 | |
| 1907 | dnl Finally, crank out the output |
Reid Spencer | c1b0d49 | 2004-09-19 23:43:52 +0000 | [diff] [blame] | 1908 | AC_OUTPUT |