blob: 127eb6fd49f769b0aa8b280037be9a0cffb4e529 [file] [log] [blame]
Reid Spencer0241e382004-11-25 04:51:04 +00001dnl === configure.ac --------------------------------------------------------===
2dnl The LLVM Compiler Infrastructure
3dnl
Chris Lattner6787a452007-12-29 22:59:10 +00004dnl This file is distributed under the University of Illinois Open Source
5dnl License. See LICENSE.TXT for details.
Eric Christophere62b4412007-12-01 00:34:39 +00006dnl
Reid Spencer0241e382004-11-25 04:51:04 +00007dnl===-----------------------------------------------------------------------===
8dnl This is the LLVM configuration script. It is processed by the autoconf
Eric Christophere62b4412007-12-01 00:34:39 +00009dnl program to produce a script named configure. This script contains the
Reid Spencer0241e382004-11-25 04:51:04 +000010dnl configuration checks that LLVM needs in order to support multiple platforms.
11dnl This file is composed of 10 sections per the recommended organization of
12dnl autoconf input defined in the autoconf documentation. As this file evolves,
13dnl please keep the various types of checks within their sections. The sections
14dnl are as follows:
15dnl
16dnl SECTION 1: Initialization & Setup
17dnl SECTION 2: Architecture, target, and host checks
18dnl SECTION 3: Command line arguments for the configure script.
19dnl SECTION 4: Check for programs we need and that they are the right version
20dnl SECTION 5: Check for libraries
21dnl SECTION 6: Check for header files
22dnl SECTION 7: Check for types and structures
23dnl SECTION 8: Check for specific functions needed
24dnl SECTION 9: Additional checks, variables, etc.
25dnl SECTION 10: Specify the output files and generate it
26dnl
27dnl===-----------------------------------------------------------------------===
28dnl===
29dnl=== SECTION 1: Initialization & Setup
30dnl===
31dnl===-----------------------------------------------------------------------===
32dnl Initialize autoconf and define the package name, version number and
Dylan Noblesmith67c49702011-12-18 18:50:16 +000033dnl address for reporting bugs.
Bill Wendling37df82d2013-05-07 20:31:28 +000034AC_INIT([LLVM],[3.4svn],[http://llvm.org/bugs/])
Dylan Noblesmithc6c7a582012-02-13 18:48:10 +000035AC_DEFINE([LLVM_VERSION_MAJOR], [3], [Major version of the LLVM API])
Bill Wendling37df82d2013-05-07 20:31:28 +000036AC_DEFINE([LLVM_VERSION_MINOR], [4], [Minor version of the LLVM API])
John Criswell7a3334d2003-07-22 19:13:20 +000037
Reid Spencer0241e382004-11-25 04:51:04 +000038dnl Provide a copyright substitution and ensure the copyright notice is included
39dnl in the output of --version option of the generated configure script.
NAKAMURA Takumi43632a22013-01-01 10:00:19 +000040AC_SUBST(LLVM_COPYRIGHT,["Copyright (c) 2003-2013 University of Illinois at Urbana-Champaign."])
41AC_COPYRIGHT([Copyright (c) 2003-2013 University of Illinois at Urbana-Champaign.])
Reid Spencer0241e382004-11-25 04:51:04 +000042
Eric Christopherb9a11322011-09-23 00:53:10 +000043dnl Indicate that we require autoconf 2.60 or later.
44AC_PREREQ(2.60)
Reid Spencer0241e382004-11-25 04:51:04 +000045
46dnl Verify that the source directory is valid. This makes sure that we are
47dnl configuring LLVM and not some other package (it validates --srcdir argument)
Chandler Carruthfbdae1f2013-01-02 09:22:59 +000048AC_CONFIG_SRCDIR([lib/IR/Module.cpp])
Reid Spencer0241e382004-11-25 04:51:04 +000049
Eric Christophere62b4412007-12-01 00:34:39 +000050dnl Place all of the extra autoconf files into the config subdirectory. Tell
51dnl various tools where the m4 autoconf macros are.
John Criswell7a3334d2003-07-22 19:13:20 +000052AC_CONFIG_AUX_DIR([autoconf])
53
John Criswell22107a72003-09-15 17:04:06 +000054dnl Quit if the source directory has already been configured.
John Criswellf6778b62003-09-15 17:19:42 +000055dnl NOTE: This relies upon undocumented autoconf behavior.
Reid Spencer2024d0e2004-09-19 23:43:52 +000056if test ${srcdir} != "." ; then
Reid Spencer0241e382004-11-25 04:51:04 +000057 if test -f ${srcdir}/include/llvm/Config/config.h ; then
58 AC_MSG_ERROR([Already configured in ${srcdir}])
59 fi
John Criswell22107a72003-09-15 17:04:06 +000060fi
61
Patrik Hagglundd91ae4d2013-02-04 08:15:53 +000062dnl Default to empty (i.e. assigning the null string to) CFLAGS and CXXFLAGS,
63dnl instead of the autoconf default (for example, '-g -O2' for CC=gcc).
64${CFLAGS=}
65${CXXFLAGS=}
66
Eric Christopher58839712011-09-16 20:36:25 +000067dnl We need to check for the compiler up here to avoid anything else
68dnl starting with a different one.
69AC_PROG_CC(clang llvm-gcc gcc)
70AC_PROG_CXX(clang++ llvm-g++ g++)
71AC_PROG_CPP
72
Dmitri Gribenko06358bd2013-01-09 15:25:30 +000073dnl If CXX is Clang, check that it can find and parse C++ standard library
74dnl headers.
75if 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++])
97fi
98
Reid Spencer0241e382004-11-25 04:51:04 +000099dnl Configure all of the projects present in our source tree. While we could
100dnl just AC_CONFIG_SUBDIRS on the set of directories in projects that have a
101dnl configure script, that usage of the AC_CONFIG_SUBDIRS macro is deprecated.
102dnl Instead we match on the known projects.
John Criswellf369e772010-03-19 21:31:39 +0000103
104dnl
105dnl One tricky part of doing this is that some projects depend upon other
106dnl projects. For example, several projects rely upon the LLVM test suite.
107dnl We want to configure those projects first so that their object trees are
108dnl created before running the configure scripts of projects that depend upon
109dnl them.
110dnl
111
112dnl Several projects use llvm-gcc, so configure that first
113if test -d ${srcdir}/projects/llvm-gcc ; then
114 AC_CONFIG_SUBDIRS([projects/llvm-gcc])
115fi
116
117dnl Several projects use the LLVM test suite, so configure it next.
118if test -d ${srcdir}/projects/test-suite ; then
119 AC_CONFIG_SUBDIRS([projects/test-suite])
120fi
121
122dnl llvm-test is the old name of the test-suite, kept here for backwards
123dnl compatibility
124if test -d ${srcdir}/projects/llvm-test ; then
125 AC_CONFIG_SUBDIRS([projects/llvm-test])
126fi
127
128dnl Some projects use poolalloc; configure that next
129if test -d ${srcdir}/projects/poolalloc ; then
130 AC_CONFIG_SUBDIRS([projects/poolalloc])
131fi
132
133if test -d ${srcdir}/projects/llvm-poolalloc ; then
134 AC_CONFIG_SUBDIRS([projects/llvm-poolalloc])
135fi
136
137dnl Check for all other projects
John Criswell297baed2003-11-25 20:36:46 +0000138for i in `ls ${srcdir}/projects`
139do
Reid Spencer90de7fb2004-09-07 16:26:18 +0000140 if test -d ${srcdir}/projects/${i} ; then
141 case ${i} in
Reid Spencerb4e0f9b2007-01-17 02:14:46 +0000142 sample) AC_CONFIG_SUBDIRS([projects/sample]) ;;
143 privbracket) AC_CONFIG_SUBDIRS([projects/privbracket]) ;;
144 llvm-stacker) AC_CONFIG_SUBDIRS([projects/llvm-stacker]) ;;
Reid Spencerb4e0f9b2007-01-17 02:14:46 +0000145 llvm-reopt) AC_CONFIG_SUBDIRS([projects/llvm-reopt]);;
Reid Spencerb4e0f9b2007-01-17 02:14:46 +0000146 llvm-java) AC_CONFIG_SUBDIRS([projects/llvm-java]) ;;
147 llvm-tv) AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;;
John Criswell4d377d82010-02-25 22:57:19 +0000148 safecode) AC_CONFIG_SUBDIRS([projects/safecode]) ;;
Reid Spencerb4e0f9b2007-01-17 02:14:46 +0000149 llvm-kernel) AC_CONFIG_SUBDIRS([projects/llvm-kernel]) ;;
Daniel Dunbar7ce849d2011-12-07 22:07:03 +0000150 compiler-rt) ;;
John Criswell4e61b252010-03-25 13:59:09 +0000151 llvm-gcc) ;;
152 test-suite) ;;
153 llvm-test) ;;
154 poolalloc) ;;
155 llvm-poolalloc) ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000156 *)
Alkis Evlogimenos26227282004-09-27 07:35:19 +0000157 AC_MSG_WARN([Unknown project (${i}) won't be configured automatically])
Reid Spencerc6f9e0f2004-09-21 17:12:35 +0000158 ;;
Reid Spencer90de7fb2004-09-07 16:26:18 +0000159 esac
John Criswell297baed2003-11-25 20:36:46 +0000160 fi
161done
John Criswellee7ebdc2003-09-30 16:31:48 +0000162
Tobias Grosserea9dca42010-10-30 00:54:26 +0000163dnl Disable the build of polly, even if it is checked out into tools/polly.
164AC_ARG_ENABLE(polly,
165 AS_HELP_STRING([--enable-polly],
166 [Use polly if available (default is YES)]),,
167 enableval=default)
168case "$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"]) ;;
173esac
174
175
176dnl Check if polly is checked out into tools/polly and configure it if
177dnl available.
178if (test -d ${srcdir}/tools/polly) && (test $ENABLE_POLLY -eq 1) ; then
179 AC_SUBST(LLVM_HAS_POLLY,1)
180 AC_CONFIG_SUBDIRS([tools/polly])
181fi
182
Reid Spencer0241e382004-11-25 04:51:04 +0000183dnl===-----------------------------------------------------------------------===
184dnl===
185dnl=== SECTION 2: Architecture, target, and host checks
186dnl===
187dnl===-----------------------------------------------------------------------===
John Criswell9537b042004-07-23 15:40:57 +0000188
Reid Spencer0241e382004-11-25 04:51:04 +0000189dnl Check the target for which we're compiling and the host that will do the
Eric Christophere62b4412007-12-01 00:34:39 +0000190dnl compilations. This will tell us which LLVM compiler will be used for
191dnl compiling SSA into object code. This needs to be done early because
Reid Spencer0241e382004-11-25 04:51:04 +0000192dnl following tests depend on it.
John Criswell7a3334d2003-07-22 19:13:20 +0000193AC_CANONICAL_TARGET
194
Reid Spencer0241e382004-11-25 04:51:04 +0000195dnl Determine the platform type and cache its value. This helps us configure
196dnl the System library to the correct build platform.
Reid Spencer0aa9d002006-07-26 21:14:56 +0000197AC_CACHE_CHECK([type of operating system we're going to host on],
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000198 [llvm_cv_os_type],
Reid Spencer0aa9d002006-07-26 21:14:56 +0000199[case $host in
Eric Christophere62b4412007-12-01 00:34:39 +0000200 *-*-aix*)
Reid Spencer0b52e2f2006-08-04 18:18:08 +0000201 llvm_cv_link_all_option="-Wl,--whole-archive"
202 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christophere62b4412007-12-01 00:34:39 +0000203 llvm_cv_os_type="AIX"
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000204 llvm_cv_platform_type="Unix" ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000205 *-*-irix*)
Reid Spencere9a40562006-08-22 22:21:38 +0000206 llvm_cv_link_all_option="-Wl,--whole-archive"
207 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christophere62b4412007-12-01 00:34:39 +0000208 llvm_cv_os_type="IRIX"
Reid Spencere9a40562006-08-22 22:21:38 +0000209 llvm_cv_platform_type="Unix" ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000210 *-*-cygwin*)
Reid Spencer0b52e2f2006-08-04 18:18:08 +0000211 llvm_cv_link_all_option="-Wl,--whole-archive"
212 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christophere62b4412007-12-01 00:34:39 +0000213 llvm_cv_os_type="Cygwin"
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000214 llvm_cv_platform_type="Unix" ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000215 *-*-darwin*)
Reid Spencer0b52e2f2006-08-04 18:18:08 +0000216 llvm_cv_link_all_option="-Wl,-all_load"
Chris Lattner42e35d42008-02-05 19:43:40 +0000217 llvm_cv_no_link_all_option="-Wl,-noall_load"
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000218 llvm_cv_os_type="Darwin"
219 llvm_cv_platform_type="Unix" ;;
Chris Lattnerc86cdc72010-04-09 20:45:04 +0000220 *-*-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" ;;
Sylvestre Ledru93a491b2013-07-01 08:07:52 +0000225 *-*-freebsd*)
Reid Spencer0b52e2f2006-08-04 18:18:08 +0000226 llvm_cv_link_all_option="-Wl,--whole-archive"
227 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christophere62b4412007-12-01 00:34:39 +0000228 llvm_cv_os_type="FreeBSD"
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000229 llvm_cv_platform_type="Unix" ;;
Sylvestre Ledru93a491b2013-07-01 08:07:52 +0000230 *-*-kfreebsd-gnu)
231 llvm_cv_link_all_option="-Wl,--whole-archive"
232 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
233 llvm_cv_os_type="GNU/kFreeBSD"
234 llvm_cv_platform_type="Unix" ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000235 *-*-openbsd*)
Reid Spencer0b52e2f2006-08-04 18:18:08 +0000236 llvm_cv_link_all_option="-Wl,--whole-archive"
237 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christophere62b4412007-12-01 00:34:39 +0000238 llvm_cv_os_type="OpenBSD"
Reid Spencer48b92032006-04-19 23:47:16 +0000239 llvm_cv_platform_type="Unix" ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000240 *-*-netbsd*)
Reid Spencer78adb9d2007-01-20 20:43:35 +0000241 llvm_cv_link_all_option="-Wl,--whole-archive"
242 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christophere62b4412007-12-01 00:34:39 +0000243 llvm_cv_os_type="NetBSD"
Reid Spencer78adb9d2007-01-20 20:43:35 +0000244 llvm_cv_platform_type="Unix" ;;
Matthijs Kooijmanf61fd542008-06-26 10:36:58 +0000245 *-*-dragonfly*)
246 llvm_cv_link_all_option="-Wl,--whole-archive"
247 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
248 llvm_cv_os_type="DragonFly"
249 llvm_cv_platform_type="Unix" ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000250 *-*-hpux*)
Reid Spencer0b52e2f2006-08-04 18:18:08 +0000251 llvm_cv_link_all_option="-Wl,--whole-archive"
252 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christophere62b4412007-12-01 00:34:39 +0000253 llvm_cv_os_type="HP-UX"
Duraid Madina5ea2ba82005-05-16 05:39:00 +0000254 llvm_cv_platform_type="Unix" ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000255 *-*-interix*)
Reid Spencer0b52e2f2006-08-04 18:18:08 +0000256 llvm_cv_link_all_option="-Wl,--whole-archive"
257 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000258 llvm_cv_os_type="Interix"
259 llvm_cv_platform_type="Unix" ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000260 *-*-linux*)
Reid Spencer0b52e2f2006-08-04 18:18:08 +0000261 llvm_cv_link_all_option="-Wl,--whole-archive"
262 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000263 llvm_cv_os_type="Linux"
264 llvm_cv_platform_type="Unix" ;;
Rafael Espindola4977edd2011-12-22 14:01:18 +0000265 *-*-gnu*)
266 llvm_cv_link_all_option="-Wl,--whole-archive"
267 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
268 llvm_cv_os_type="GNU"
269 llvm_cv_platform_type="Unix" ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000270 *-*-solaris*)
Reid Spencer0b52e2f2006-08-04 18:18:08 +0000271 llvm_cv_link_all_option="-Wl,-z,allextract"
272 llvm_cv_no_link_all_option="-Wl,-z,defaultextract"
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000273 llvm_cv_os_type="SunOS"
274 llvm_cv_platform_type="Unix" ;;
Edward O'Callaghan153d23f2009-10-14 00:44:50 +0000275 *-*-auroraux*)
276 llvm_cv_link_all_option="-Wl,-z,allextract"
277 llvm_cv_link_all_option="-Wl,-z,defaultextract"
278 llvm_cv_os_type="AuroraUX"
279 llvm_cv_platform_type="Unix" ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000280 *-*-win32*)
Reid Spencer0b52e2f2006-08-04 18:18:08 +0000281 llvm_cv_link_all_option="-Wl,--whole-archive"
282 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000283 llvm_cv_os_type="Win32"
284 llvm_cv_platform_type="Win32" ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000285 *-*-mingw*)
Reid Spencer0b52e2f2006-08-04 18:18:08 +0000286 llvm_cv_link_all_option="-Wl,--whole-archive"
287 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christophere62b4412007-12-01 00:34:39 +0000288 llvm_cv_os_type="MingW"
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000289 llvm_cv_platform_type="Win32" ;;
Edward O'Callaghan8227b052009-10-12 04:57:20 +0000290 *-*-haiku*)
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="Haiku"
Eric Christopherb3762a02010-03-02 05:17:21 +0000294 llvm_cv_platform_type="Unix" ;;
Anton Korobeynikov90e17e72009-08-18 00:40:33 +0000295 *-unknown-eabi*)
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" ;;
300 *-unknown-elf*)
301 llvm_cv_link_all_option="-Wl,--whole-archive"
302 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
303 llvm_cv_os_type="Freestanding"
304 llvm_cv_platform_type="Unix" ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000305 *)
306 llvm_cv_link_all_option=""
Reid Spencer0b52e2f2006-08-04 18:18:08 +0000307 llvm_cv_no_link_all_option=""
Eric Christophere62b4412007-12-01 00:34:39 +0000308 llvm_cv_os_type="Unknown"
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000309 llvm_cv_platform_type="Unknown" ;;
Reid Spencer0241e382004-11-25 04:51:04 +0000310esac])
John Criswell7a3334d2003-07-22 19:13:20 +0000311
Anton Korobeynikov90e17e72009-08-18 00:40:33 +0000312AC_CACHE_CHECK([type of operating system we're going to target],
313 [llvm_cv_target_os_type],
314[case $target in
315 *-*-aix*)
316 llvm_cv_target_os_type="AIX" ;;
317 *-*-irix*)
318 llvm_cv_target_os_type="IRIX" ;;
319 *-*-cygwin*)
320 llvm_cv_target_os_type="Cygwin" ;;
321 *-*-darwin*)
322 llvm_cv_target_os_type="Darwin" ;;
Chris Lattnerc86cdc72010-04-09 20:45:04 +0000323 *-*-minix*)
324 llvm_cv_target_os_type="Minix" ;;
Sylvestre Ledru93a491b2013-07-01 08:07:52 +0000325 *-*-freebsd*)
Anton Korobeynikov90e17e72009-08-18 00:40:33 +0000326 llvm_cv_target_os_type="FreeBSD" ;;
Sylvestre Ledru93a491b2013-07-01 08:07:52 +0000327 *-*-kfreebsd-gnu)
328 llvm_cv_target_os_type="GNU/kFreeBSD" ;;
Anton Korobeynikov90e17e72009-08-18 00:40:33 +0000329 *-*-openbsd*)
330 llvm_cv_target_os_type="OpenBSD" ;;
331 *-*-netbsd*)
332 llvm_cv_target_os_type="NetBSD" ;;
333 *-*-dragonfly*)
334 llvm_cv_target_os_type="DragonFly" ;;
335 *-*-hpux*)
336 llvm_cv_target_os_type="HP-UX" ;;
337 *-*-interix*)
338 llvm_cv_target_os_type="Interix" ;;
339 *-*-linux*)
340 llvm_cv_target_os_type="Linux" ;;
Sylvestre Ledrue8235fe2012-04-05 19:34:15 +0000341 *-*-gnu*)
342 llvm_cv_target_os_type="GNU" ;;
Anton Korobeynikov90e17e72009-08-18 00:40:33 +0000343 *-*-solaris*)
344 llvm_cv_target_os_type="SunOS" ;;
Edward O'Callaghan153d23f2009-10-14 00:44:50 +0000345 *-*-auroraux*)
346 llvm_cv_target_os_type="AuroraUX" ;;
Anton Korobeynikov90e17e72009-08-18 00:40:33 +0000347 *-*-win32*)
348 llvm_cv_target_os_type="Win32" ;;
349 *-*-mingw*)
350 llvm_cv_target_os_type="MingW" ;;
Edward O'Callaghan8227b052009-10-12 04:57:20 +0000351 *-*-haiku*)
Eric Christopherb3762a02010-03-02 05:17:21 +0000352 llvm_cv_target_os_type="Haiku" ;;
Douglas Gregorde3c9262011-07-01 22:41:06 +0000353 *-*-rtems*)
354 llvm_cv_target_os_type="RTEMS" ;;
Ivan Krasin44306e22011-08-18 22:54:21 +0000355 *-*-nacl*)
356 llvm_cv_target_os_type="NativeClient" ;;
Anton Korobeynikov90e17e72009-08-18 00:40:33 +0000357 *-unknown-eabi*)
358 llvm_cv_target_os_type="Freestanding" ;;
359 *)
360 llvm_cv_target_os_type="Unknown" ;;
361esac])
362
Reid Spencer1daffa52004-08-31 01:34:10 +0000363dnl Make sure we aren't attempting to configure for an unknown system
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000364if test "$llvm_cv_os_type" = "Unknown" ; then
365 AC_MSG_ERROR([Operating system is unknown, configure can't continue])
Reid Spencer1daffa52004-08-31 01:34:10 +0000366fi
367
Reid Spencer0241e382004-11-25 04:51:04 +0000368dnl Set the "OS" Makefile variable based on the platform type so the
369dnl makefile can configure itself to specific build hosts
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000370AC_SUBST(OS,$llvm_cv_os_type)
Anton Korobeynikov90e17e72009-08-18 00:40:33 +0000371AC_SUBST(HOST_OS,$llvm_cv_os_type)
372AC_SUBST(TARGET_OS,$llvm_cv_target_os_type)
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000373
Reid Spencer0b52e2f2006-08-04 18:18:08 +0000374dnl Set the LINKALL and NOLINKALL Makefile variables based on the platform
375AC_SUBST(LINKALL,$llvm_cv_link_all_option)
376AC_SUBST(NOLINKALL,$llvm_cv_no_link_all_option)
377
Dan Gohmana3ed0712010-08-04 16:48:36 +0000378dnl Set the "LLVM_ON_*" variables based on llvm_cv_platform_type
Michael J. Spencer447762d2010-11-29 18:16:10 +0000379dnl This is used by lib/Support to determine the basic kind of implementation
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000380dnl to use.
381case $llvm_cv_platform_type in
Eric Christophere62b4412007-12-01 00:34:39 +0000382 Unix)
383 AC_DEFINE([LLVM_ON_UNIX],[1],[Define if this is Unixish platform])
Reid Spencerd7287e02004-12-31 22:54:28 +0000384 AC_SUBST(LLVM_ON_UNIX,[1])
385 AC_SUBST(LLVM_ON_WIN32,[0])
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000386 ;;
Eric Christophere62b4412007-12-01 00:34:39 +0000387 Win32)
388 AC_DEFINE([LLVM_ON_WIN32],[1],[Define if this is Win32ish platform])
Reid Spencerd7287e02004-12-31 22:54:28 +0000389 AC_SUBST(LLVM_ON_UNIX,[0])
390 AC_SUBST(LLVM_ON_WIN32,[1])
Reid Spencerd3d6d9d2004-12-24 06:29:05 +0000391 ;;
392esac
Reid Spencer0241e382004-11-25 04:51:04 +0000393
John Criswell7a3334d2003-07-22 19:13:20 +0000394dnl Determine what our target architecture is and configure accordingly.
395dnl This will allow Makefiles to make a distinction between the hardware and
396dnl the OS.
Reid Spencer0241e382004-11-25 04:51:04 +0000397AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
398[case $target in
Reid Spencer0a54a582004-12-23 21:08:52 +0000399 i?86-*) llvm_cv_target_arch="x86" ;;
Reid Spencer78d9e872004-12-28 07:56:14 +0000400 amd64-* | x86_64-*) llvm_cv_target_arch="x86_64" ;;
Reid Spencer0a54a582004-12-23 21:08:52 +0000401 sparc*-*) llvm_cv_target_arch="Sparc" ;;
402 powerpc*-*) llvm_cv_target_arch="PowerPC" ;;
Nick Lewycky13590cb2009-04-18 18:11:26 +0000403 arm*-*) llvm_cv_target_arch="ARM" ;;
Tim Northovere0e3aef2013-01-31 12:12:40 +0000404 aarch64*-*) llvm_cv_target_arch="AArch64" ;;
Simon Atanasyanc2cccd72012-10-29 19:49:45 +0000405 mips-* | mips64-*) llvm_cv_target_arch="Mips" ;;
406 mipsel-* | mips64el-*) llvm_cv_target_arch="Mips" ;;
Richard Osborneca08e062008-11-07 10:59:00 +0000407 xcore-*) llvm_cv_target_arch="XCore" ;;
Anton Korobeynikov10138002009-05-03 12:57:15 +0000408 msp430-*) llvm_cv_target_arch="MSP430" ;;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000409 hexagon-*) llvm_cv_target_arch="Hexagon" ;;
Justin Holewinskiae556d32012-05-04 20:18:50 +0000410 nvptx-*) llvm_cv_target_arch="NVPTX" ;;
Ulrich Weigand1ceebf62013-05-06 16:22:34 +0000411 s390x-*) llvm_cv_target_arch="SystemZ" ;;
Reid Spencer0a54a582004-12-23 21:08:52 +0000412 *) llvm_cv_target_arch="Unknown" ;;
Reid Spencer0241e382004-11-25 04:51:04 +0000413esac])
John Criswell7a3334d2003-07-22 19:13:20 +0000414
Reid Spencer0241e382004-11-25 04:51:04 +0000415if test "$llvm_cv_target_arch" = "Unknown" ; then
416 AC_MSG_WARN([Configuring LLVM for an unknown target archicture])
417fi
418
Gabor Greife0d58d32012-01-26 10:28:58 +0000419dnl Determine the LLVM native architecture for the target
Douglas Gregor7cbf8162009-06-17 00:42:33 +0000420case "$llvm_cv_target_arch" in
421 x86) LLVM_NATIVE_ARCH="X86" ;;
422 x86_64) LLVM_NATIVE_ARCH="X86" ;;
423 *) LLVM_NATIVE_ARCH="$llvm_cv_target_arch" ;;
424esac
Mikhail Glushenkovd871cbc2009-07-03 03:52:07 +0000425
Reid Spencer0241e382004-11-25 04:51:04 +0000426dnl Define a substitution, ARCH, for the target architecture
427AC_SUBST(ARCH,$llvm_cv_target_arch)
428
Danil Malyshev7c5db452012-05-17 21:07:47 +0000429dnl Determine what our host architecture.
430dnl This will allow MCJIT regress tests runs only for supported
431dnl platforms.
432case $host in
433 i?86-*) host_arch="x86" ;;
434 amd64-* | x86_64-*) host_arch="x86_64" ;;
435 sparc*-*) host_arch="Sparc" ;;
436 powerpc*-*) host_arch="PowerPC" ;;
437 arm*-*) host_arch="ARM" ;;
Tim Northovere0e3aef2013-01-31 12:12:40 +0000438 aarch64*-*) host_arch="AArch64" ;;
Simon Atanasyanc2cccd72012-10-29 19:49:45 +0000439 mips-* | mips64-*) host_arch="Mips" ;;
440 mipsel-* | mips64el-*) host_arch="Mips" ;;
Danil Malyshev7c5db452012-05-17 21:07:47 +0000441 xcore-*) host_arch="XCore" ;;
442 msp430-*) host_arch="MSP430" ;;
443 hexagon-*) host_arch="Hexagon" ;;
Ulrich Weigand1ceebf62013-05-06 16:22:34 +0000444 s390x-*) host_arch="SystemZ" ;;
Danil Malyshev7c5db452012-05-17 21:07:47 +0000445 *) host_arch="Unknown" ;;
446esac
447
448if test "$host_arch" = "Unknown" ; then
449 AC_MSG_WARN([Configuring LLVM for an unknown host archicture])
450fi
451
452AC_SUBST(HOST_ARCH,$host_arch)
453
Reid Spencer0241e382004-11-25 04:51:04 +0000454dnl Check for the endianness of the target
Duncan Sandsfde55672007-12-12 23:03:45 +0000455AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
Reid Spencer0241e382004-11-25 04:51:04 +0000456
Gabor Greife0d58d32012-01-26 10:28:58 +0000457dnl Check for build platform executable suffix if we're cross-compiling
Reid Spencer0aa9d002006-07-26 21:14:56 +0000458if test "$cross_compiling" = yes; then
Eric Christophere62b4412007-12-01 00:34:39 +0000459 AC_SUBST(LLVM_CROSS_COMPILING, [1])
Reid Spencer0aa9d002006-07-26 21:14:56 +0000460 AC_BUILD_EXEEXT
Jim Grosbach009db892008-10-02 22:56:44 +0000461 ac_build_prefix=${build_alias}-
462 AC_CHECK_PROG(BUILD_CXX, ${ac_build_prefix}g++, ${ac_build_prefix}g++)
463 if test -z "$BUILD_CXX"; then
464 AC_CHECK_PROG(BUILD_CXX, g++, g++)
465 if test -z "$BUILD_CXX"; then
466 AC_CHECK_PROG(BUILD_CXX, c++, c++, , , /usr/ucb/c++)
467 fi
468 fi
Reid Spencer0aa9d002006-07-26 21:14:56 +0000469else
470 AC_SUBST(LLVM_CROSS_COMPILING, [0])
471fi
472
Dan Gohmande75469c2010-08-04 16:25:01 +0000473dnl Check to see if there's a .svn or .git directory indicating that this
474dnl build is being done from a checkout. This sets up several defaults for
475dnl the command line switches. When we build with a checkout directory,
Nick Lewycky9a196c02009-04-01 04:39:25 +0000476dnl we get a debug with assertions turned on. Without, we assume a source
477dnl release and we get an optimized build without assertions.
478dnl See --enable-optimized and --enable-assertions below
Dan Gohmande75469c2010-08-04 16:25:01 +0000479if test -d ".svn" -o -d "${srcdir}/.svn" -o -d ".git" -o -d "${srcdir}/.git"; then
Reid Spencerb65ade82006-04-07 16:01:51 +0000480 cvsbuild="yes"
481 optimize="no"
Reid Spencerb65ade82006-04-07 16:01:51 +0000482 AC_SUBST(CVSBUILD,[[CVSBUILD=1]])
483else
484 cvsbuild="no"
485 optimize="yes"
Reid Spencerb65ade82006-04-07 16:01:51 +0000486fi
487
Reid Spencer0241e382004-11-25 04:51:04 +0000488dnl===-----------------------------------------------------------------------===
489dnl===
490dnl=== SECTION 3: Command line arguments for the configure script.
491dnl===
492dnl===-----------------------------------------------------------------------===
493
Eric Christopher1094ded2011-11-11 22:51:42 +0000494dnl --enable-libcpp : check whether or not to use libc++ on the command line
495AC_ARG_ENABLE(libcpp,
496 AS_HELP_STRING([--enable-libcpp],
497 [Use libc++ if available (default is NO)]),,
498 enableval=default)
499case "$enableval" in
500 yes) AC_SUBST(ENABLE_LIBCPP,[1]) ;;
501 no) AC_SUBST(ENABLE_LIBCPP,[0]) ;;
502 default) AC_SUBST(ENABLE_LIBCPP,[0]);;
503 *) AC_MSG_ERROR([Invalid setting for --enable-libcpp. Use "yes" or "no"]) ;;
504esac
505
Eric Christopher04e35972012-08-03 19:47:14 +0000506dnl --enable-cxx11 : check whether or not to use -std=c++11 on the command line
507AC_ARG_ENABLE(cxx11,
508 AS_HELP_STRING([--enable-cxx11],
509 [Use c++11 if available (default is NO)]),,
510 enableval=default)
511case "$enableval" in
512 yes) AC_SUBST(ENABLE_CXX11,[1]) ;;
513 no) AC_SUBST(ENABLE_CXX11,[0]) ;;
514 default) AC_SUBST(ENABLE_CXX11,[0]);;
515 *) AC_MSG_ERROR([Invalid setting for --enable-cxx11. Use "yes" or "no"]) ;;
516esac
517
Eric Christopherf1bd7702013-06-25 01:12:25 +0000518dnl --enable-fission : check whether or not to use -gsplit-dwarf on the command
519dnl line
520AC_ARG_ENABLE(split-dwarf,
521 AS_HELP_STRING([--enable-split-dwarf],
522 [Use split-dwarf if available (default is NO)]),,
523 enableval=default)
524case "$enableval" in
525 yes) AC_SUBST(ENABLE_SPLIT_DWARF,[1]) ;;
526 no) AC_SUBST(ENABLE_SPLIT_DWARF,[0]) ;;
527 default) AC_SUBST(ENABLE_SPLIT_DWARF,[0]);;
528 *) AC_MSG_ERROR([Invalid setting for --enable-split-dwarf. Use "yes" or "no"]) ;;
529esac
530
Roman Divackyf2bb66b2012-12-13 16:07:19 +0000531dnl --enable-clang-arcmt: check whether to enable clang arcmt
532clang_arcmt="yes"
533AC_ARG_ENABLE(clang-arcmt,
534 AS_HELP_STRING([--enable-clang-arcmt],
535 [Enable building of clang ARCMT (default is YES)]),
536 clang_arcmt="$enableval",
537 enableval="yes")
538case "$enableval" in
539 yes) AC_SUBST(ENABLE_CLANG_ARCMT,[1]) ;;
540 no) AC_SUBST(ENABLE_CLANG_ARCMT,[0]) ;;
541 default) AC_SUBST(ENABLE_CLANG_ARCMT,[1]);;
542 *) AC_MSG_ERROR([Invalid setting for --enable-clang-arcmt. Use "yes" or "no"]) ;;
543esac
544
545dnl --enable-clang-static-analyzer: check whether to enable static-analyzer
546clang_static_analyzer="yes"
547AC_ARG_ENABLE(clang-static-analyzer,
548 AS_HELP_STRING([--enable-clang-static-analyzer],
549 [Enable building of clang Static Analyzer (default is YES)]),
550 clang_static_analyzer="$enableval",
551 enableval="yes")
552case "$enableval" in
553 yes) AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[1]) ;;
554 no) AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[0]) ;;
555 default) AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[1]);;
556 *) AC_MSG_ERROR([Invalid setting for --enable-clang-static-analyzer. Use "yes" or "no"]) ;;
557esac
558
559dnl --enable-clang-rewriter: check whether to enable clang rewriter
560AC_ARG_ENABLE(clang-rewriter,
561 AS_HELP_STRING([--enable-clang-rewriter],
562 [Enable building of clang rewriter (default is YES)]),,
563 enableval="yes")
564case "$enableval" in
565 yes) AC_SUBST(ENABLE_CLANG_REWRITER,[1]) ;;
566 no)
Benjamin Kramerd14720d2012-12-26 10:48:49 +0000567 if test ${clang_arcmt} != "no" ; then
Roman Divackyf2bb66b2012-12-13 16:07:19 +0000568 AC_MSG_ERROR([Cannot enable clang ARC Migration Tool while disabling rewriter.])
569 fi
Benjamin Kramerd14720d2012-12-26 10:48:49 +0000570 if test ${clang_static_analyzer} != "no" ; then
Roman Divackyf2bb66b2012-12-13 16:07:19 +0000571 AC_MSG_ERROR([Cannot enable clang static analyzer while disabling rewriter.])
572 fi
573 AC_SUBST(ENABLE_CLANG_REWRITER,[0])
574 ;;
575 default) AC_SUBST(ENABLE_CLANG_REWRITER,[1]);;
576 *) AC_MSG_ERROR([Invalid setting for --enable-clang-rewriter. Use "yes" or "no"]) ;;
577esac
578
Reid Spencer0241e382004-11-25 04:51:04 +0000579dnl --enable-optimized : check whether they want to do an optimized build:
Reid Spencerb65ade82006-04-07 16:01:51 +0000580AC_ARG_ENABLE(optimized, AS_HELP_STRING(
Nick Lewycky9ab256ac2009-06-06 06:24:44 +0000581 --enable-optimized,[Compile with optimizations enabled (default is NO)]),,enableval=$optimize)
Reid Spencer0241e382004-11-25 04:51:04 +0000582if test ${enableval} = "no" ; then
583 AC_SUBST(ENABLE_OPTIMIZED,[[]])
584else
585 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
586fi
587
David Greene80f48bd2009-04-17 14:49:22 +0000588dnl --enable-profiling : check whether they want to do a profile build:
589AC_ARG_ENABLE(profiling, AS_HELP_STRING(
Nick Lewycky9ab256ac2009-06-06 06:24:44 +0000590 --enable-profiling,[Compile with profiling enabled (default is NO)]),,enableval="no")
David Greene80f48bd2009-04-17 14:49:22 +0000591if test ${enableval} = "no" ; then
592 AC_SUBST(ENABLE_PROFILING,[[]])
593else
594 AC_SUBST(ENABLE_PROFILING,[[ENABLE_PROFILING=1]])
595fi
596
Reid Spencerb65ade82006-04-07 16:01:51 +0000597dnl --enable-assertions : check whether they want to turn on assertions or not:
598AC_ARG_ENABLE(assertions,AS_HELP_STRING(
Nick Lewycky9ab256ac2009-06-06 06:24:44 +0000599 --enable-assertions,[Compile with assertion checks enabled (default is YES)]),, enableval="yes")
Reid Spencerfa423e92006-04-09 20:42:14 +0000600if test ${enableval} = "yes" ; then
601 AC_SUBST(DISABLE_ASSERTIONS,[[]])
Reid Spencerb65ade82006-04-07 16:01:51 +0000602else
Reid Spencerfa423e92006-04-09 20:42:14 +0000603 AC_SUBST(DISABLE_ASSERTIONS,[[DISABLE_ASSERTIONS=1]])
Reid Spencerb65ade82006-04-07 16:01:51 +0000604fi
605
Eric Christopher84864012012-08-03 19:58:20 +0000606dnl --enable-werror : check whether we want Werror on by default
607AC_ARG_ENABLE(werror,AS_HELP_STRING(
608 --enable-werror,[Compile with -Werror enabled (default is NO)]),, enableval="no")
609case "$enableval" in
610 yes) AC_SUBST(ENABLE_WERROR,[1]) ;;
611 no) AC_SUBST(ENABLE_WERROR,[0]) ;;
612 default) AC_SUBST(ENABLE_WERROR,[0]);;
613 *) AC_MSG_ERROR([Invalid setting for --enable-werror. Use "yes" or "no"]) ;;
614esac
615
David Greenecbc8ddf2007-06-28 19:36:08 +0000616dnl --enable-expensive-checks : check whether they want to turn on expensive debug checks:
617AC_ARG_ENABLE(expensive-checks,AS_HELP_STRING(
Nick Lewycky9ab256ac2009-06-06 06:24:44 +0000618 --enable-expensive-checks,[Compile with expensive debug checks enabled (default is NO)]),, enableval="no")
David Greenecbc8ddf2007-06-28 19:36:08 +0000619if test ${enableval} = "yes" ; then
620 AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[ENABLE_EXPENSIVE_CHECKS=1]])
621 AC_SUBST(EXPENSIVE_CHECKS,[[yes]])
622else
623 AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[]])
624 AC_SUBST(EXPENSIVE_CHECKS,[[no]])
625fi
626
Reid Spencer4b8067f2006-11-17 03:32:33 +0000627dnl --enable-debug-runtime : should runtime libraries have debug symbols?
628AC_ARG_ENABLE(debug-runtime,
Nick Lewycky9ab256ac2009-06-06 06:24:44 +0000629 AS_HELP_STRING(--enable-debug-runtime,[Build runtime libs with debug symbols (default is NO)]),,enableval=no)
Reid Spencer4b8067f2006-11-17 03:32:33 +0000630if test ${enableval} = "no" ; then
631 AC_SUBST(DEBUG_RUNTIME,[[]])
632else
633 AC_SUBST(DEBUG_RUNTIME,[[DEBUG_RUNTIME=1]])
634fi
635
Jeffrey Yasskinc3273dc2009-09-27 17:47:29 +0000636dnl --enable-debug-symbols : should even optimized compiler libraries
637dnl have debug symbols?
638AC_ARG_ENABLE(debug-symbols,
639 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)
640if test ${enableval} = "no" ; then
641 AC_SUBST(DEBUG_SYMBOLS,[[]])
642else
643 AC_SUBST(DEBUG_SYMBOLS,[[DEBUG_SYMBOLS=1]])
644fi
645
Daniel Dunbarc9e4ff62012-08-14 18:14:20 +0000646dnl --enable-keep-symbols : do not strip installed executables
647AC_ARG_ENABLE(keep-symbols,
648 AS_HELP_STRING(--enable-keep-symbols,[Do not strip installed executables)]),,enableval=no)
649if test ${enableval} = "no" ; then
650 AC_SUBST(KEEP_SYMBOLS,[[]])
651else
652 AC_SUBST(KEEP_SYMBOLS,[[KEEP_SYMBOLS=1]])
653fi
654
Reid Spencer0241e382004-11-25 04:51:04 +0000655dnl --enable-jit: check whether they want to enable the jit
656AC_ARG_ENABLE(jit,
657 AS_HELP_STRING(--enable-jit,
658 [Enable Just In Time Compiling (default is YES)]),,
659 enableval=default)
660if test ${enableval} = "no"
661then
662 AC_SUBST(JIT,[[]])
663else
Reid Spencer9dc4ba52004-11-25 07:28:19 +0000664 case "$llvm_cv_target_arch" in
Jakob Stoklund Olesen526e8032009-08-02 17:32:37 +0000665 x86) AC_SUBST(TARGET_HAS_JIT,1) ;;
666 Sparc) AC_SUBST(TARGET_HAS_JIT,0) ;;
667 PowerPC) AC_SUBST(TARGET_HAS_JIT,1) ;;
668 x86_64) AC_SUBST(TARGET_HAS_JIT,1) ;;
Eric Christopherd8530f32009-09-14 16:38:49 +0000669 ARM) AC_SUBST(TARGET_HAS_JIT,1) ;;
Tim Northovere0e3aef2013-01-31 12:12:40 +0000670 AArch64) AC_SUBST(TARGET_HAS_JIT,0) ;;
Bruno Cardoso Lopesd1d9c782011-07-21 16:28:51 +0000671 Mips) AC_SUBST(TARGET_HAS_JIT,1) ;;
Jakob Stoklund Olesen526e8032009-08-02 17:32:37 +0000672 XCore) AC_SUBST(TARGET_HAS_JIT,0) ;;
673 MSP430) AC_SUBST(TARGET_HAS_JIT,0) ;;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000674 Hexagon) AC_SUBST(TARGET_HAS_JIT,0) ;;
Justin Holewinskiae556d32012-05-04 20:18:50 +0000675 NVPTX) AC_SUBST(TARGET_HAS_JIT,0) ;;
Ulrich Weigand1ceebf62013-05-06 16:22:34 +0000676 SystemZ) AC_SUBST(TARGET_HAS_JIT,1) ;;
Jakob Stoklund Olesen526e8032009-08-02 17:32:37 +0000677 *) AC_SUBST(TARGET_HAS_JIT,0) ;;
Reid Spencer0241e382004-11-25 04:51:04 +0000678 esac
679fi
680
Rafael Espindola7ac506d2010-11-12 19:24:06 +0000681dnl Allow enablement of building and installing docs
682AC_ARG_ENABLE(docs,
683 AS_HELP_STRING([--enable-docs],
684 [Build documents (default is YES)]),,
685 enableval=default)
686case "$enableval" in
687 yes) AC_SUBST(ENABLE_DOCS,[1]) ;;
688 no) AC_SUBST(ENABLE_DOCS,[0]) ;;
689 default) AC_SUBST(ENABLE_DOCS,[1]) ;;
690 *) AC_MSG_ERROR([Invalid setting for --enable-docs. Use "yes" or "no"]) ;;
691esac
692
Reid Spencer0194c9a2004-11-29 04:56:35 +0000693dnl Allow enablement of doxygen generated documentation
694AC_ARG_ENABLE(doxygen,
695 AS_HELP_STRING([--enable-doxygen],
696 [Build doxygen documentation (default is NO)]),,
697 enableval=default)
698case "$enableval" in
699 yes) AC_SUBST(ENABLE_DOXYGEN,[1]) ;;
700 no) AC_SUBST(ENABLE_DOXYGEN,[0]) ;;
701 default) AC_SUBST(ENABLE_DOXYGEN,[0]) ;;
702 *) AC_MSG_ERROR([Invalid setting for --enable-doxygen. Use "yes" or "no"]) ;;
703esac
704
Reid Spencerf85fabeb2005-08-24 10:07:20 +0000705dnl Allow disablement of threads
706AC_ARG_ENABLE(threads,
707 AS_HELP_STRING([--enable-threads],
708 [Use threads if available (default is YES)]),,
Reid Spencerd549edc2006-11-05 17:08:18 +0000709 enableval=default)
Reid Spencerf85fabeb2005-08-24 10:07:20 +0000710case "$enableval" in
Dylan Noblesmithefddf202011-11-28 00:48:58 +0000711 yes) AC_SUBST(LLVM_ENABLE_THREADS,[1]) ;;
712 no) AC_SUBST(LLVM_ENABLE_THREADS,[0]) ;;
713 default) AC_SUBST(LLVM_ENABLE_THREADS,[1]) ;;
Reid Spencerf85fabeb2005-08-24 10:07:20 +0000714 *) AC_MSG_ERROR([Invalid setting for --enable-threads. Use "yes" or "no"]) ;;
715esac
Dylan Noblesmithefddf202011-11-28 00:48:58 +0000716AC_DEFINE_UNQUOTED([LLVM_ENABLE_THREADS],$LLVM_ENABLE_THREADS,
717 [Define if threads enabled])
Reid Spencerf85fabeb2005-08-24 10:07:20 +0000718
NAKAMURA Takumic6fce172010-12-29 03:59:03 +0000719dnl Allow disablement of pthread.h
720AC_ARG_ENABLE(pthreads,
721 AS_HELP_STRING([--enable-pthreads],
722 [Use pthreads if available (default is YES)]),,
723 enableval=default)
724case "$enableval" in
725 yes) AC_SUBST(ENABLE_PTHREADS,[1]) ;;
726 no) AC_SUBST(ENABLE_PTHREADS,[0]) ;;
727 default) AC_SUBST(ENABLE_PTHREADS,[1]) ;;
728 *) AC_MSG_ERROR([Invalid setting for --enable-pthreads. Use "yes" or "no"]) ;;
729esac
730
Alexey Samsonov2fb337e2013-04-23 08:28:39 +0000731dnl Allow disablement of zlib
732AC_ARG_ENABLE(zlib,
733 AS_HELP_STRING([--enable-zlib],
734 [Use zlib for compression/decompression if
735 available (default is YES)]),,
736 enableval=default)
737case "$enableval" in
738 yes) AC_SUBST(LLVM_ENABLE_ZLIB,[1]) ;;
739 no) AC_SUBST(LLVM_ENABLE_ZLIB,[0]) ;;
740 default) AC_SUBST(LLVM_ENABLE_ZLIB,[1]) ;;
741 *) AC_MSG_ERROR([Invalid setting for --enable-zlib. Use "yes" or "no"]) ;;
742esac
743AC_DEFINE_UNQUOTED([LLVM_ENABLE_ZLIB],$LLVM_ENABLE_ZLIB,
744 [Define if zlib is enabled])
745
Nick Lewycky7db7eb62009-02-19 06:18:24 +0000746dnl Allow building without position independent code
Reid Spencer05a1fe52006-12-16 22:07:52 +0000747AC_ARG_ENABLE(pic,
748 AS_HELP_STRING([--enable-pic],
Nick Lewycky7db7eb62009-02-19 06:18:24 +0000749 [Build LLVM with Position Independent Code (default is YES)]),,
Reid Spencer05a1fe52006-12-16 22:07:52 +0000750 enableval=default)
751case "$enableval" in
752 yes) AC_SUBST(ENABLE_PIC,[1]) ;;
753 no) AC_SUBST(ENABLE_PIC,[0]) ;;
Nick Lewycky7db7eb62009-02-19 06:18:24 +0000754 default) AC_SUBST(ENABLE_PIC,[1]) ;;
Reid Spencer05a1fe52006-12-16 22:07:52 +0000755 *) AC_MSG_ERROR([Invalid setting for --enable-pic. Use "yes" or "no"]) ;;
756esac
757AC_DEFINE_UNQUOTED([ENABLE_PIC],$ENABLE_PIC,
758 [Define if position independent code is enabled])
759
Jeffrey Yasskin6b718f72010-02-25 06:34:33 +0000760dnl Allow building a shared library and linking tools against it.
761AC_ARG_ENABLE(shared,
762 AS_HELP_STRING([--enable-shared],
763 [Build a shared library and link tools against it (default is NO)]),,
764 enableval=default)
765case "$enableval" in
766 yes) AC_SUBST(ENABLE_SHARED,[1]) ;;
767 no) AC_SUBST(ENABLE_SHARED,[0]) ;;
768 default) AC_SUBST(ENABLE_SHARED,[0]) ;;
769 *) AC_MSG_ERROR([Invalid setting for --enable-shared. Use "yes" or "no"]) ;;
770esac
771
NAKAMURA Takumi495afdf2010-12-29 03:59:14 +0000772dnl Allow libstdc++ is embedded in LLVM.dll.
773AC_ARG_ENABLE(embed-stdcxx,
774 AS_HELP_STRING([--enable-embed-stdcxx],
NAKAMURA Takumid5a9a3a2011-10-13 18:04:52 +0000775 [Build a shared library with embedded libstdc++ for Win32 DLL (default is NO)]),,
NAKAMURA Takumi495afdf2010-12-29 03:59:14 +0000776 enableval=default)
777case "$enableval" in
778 yes) AC_SUBST(ENABLE_EMBED_STDCXX,[1]) ;;
779 no) AC_SUBST(ENABLE_EMBED_STDCXX,[0]) ;;
NAKAMURA Takumid5a9a3a2011-10-13 18:04:52 +0000780 default) AC_SUBST(ENABLE_EMBED_STDCXX,[0]) ;;
NAKAMURA Takumi495afdf2010-12-29 03:59:14 +0000781 *) AC_MSG_ERROR([Invalid setting for --enable-embed-stdcxx. Use "yes" or "no"]) ;;
782esac
783
Daniel Dunbardac18242010-05-10 20:11:56 +0000784dnl Enable embedding timestamp information into build.
785AC_ARG_ENABLE(timestamps,
786 AS_HELP_STRING([--enable-timestamps],
787 [Enable embedding timestamp information in build (default is YES)]),,
788 enableval=default)
789case "$enableval" in
790 yes) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;;
791 no) AC_SUBST(ENABLE_TIMESTAMPS,[0]) ;;
792 default) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;;
793 *) AC_MSG_ERROR([Invalid setting for --enable-timestamps. Use "yes" or "no"]) ;;
794esac
795AC_DEFINE_UNQUOTED([ENABLE_TIMESTAMPS],$ENABLE_TIMESTAMPS,
Gabor Greif1e718962012-07-12 13:05:12 +0000796 [Define if timestamp information (e.g., __DATE__) is allowed])
Daniel Dunbardac18242010-05-10 20:11:56 +0000797
Eric Christopher9fafe072012-09-21 23:03:29 +0000798dnl Enable embedding timestamp information into build.
799
800AC_ARG_ENABLE(backtraces,
801 AS_HELP_STRING([--enable-backtraces],
802 [Enable embedding backtraces on crash (default is YES)]),,
803 enableval=default)
804case "$enableval" in
Eric Christopherc6c2b9b2012-11-19 19:31:02 +0000805 yes) AC_SUBST(ENABLE_BACKTRACES,[1]) ;;
806 no) AC_SUBST(ENABLE_BACKTRACES,[0]) ;;
807 default) AC_SUBST(ENABLE_BACKTRACES,[1]) ;;
Eric Christopher9fafe072012-09-21 23:03:29 +0000808 *) AC_MSG_ERROR([Invalid setting for --enable-backtraces. Use "yes" or "no"]) ;;
809esac
810AC_DEFINE_UNQUOTED([ENABLE_BACKTRACES],$ENABLE_BACKTRACES,
811 [Define if you want backtraces on crash])
812
Reid Spencer47428042005-04-22 07:27:28 +0000813dnl Allow specific targets to be specified for building (or not)
814TARGETS_TO_BUILD=""
Evan Cheng5df72aa2006-07-06 07:46:33 +0000815AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
Jeffrey Yasskin42a49df2009-09-23 17:05:42 +0000816 [Build specific host targets: all or target1,target2,... Valid targets are:
Tim Northovere0e3aef2013-01-31 12:12:40 +0000817 host, x86, x86_64, sparc, powerpc, arm, aarch64, mips, hexagon,
Rafael Espindolaf6474d22013-05-22 00:35:47 +0000818 xcore, msp430, nvptx, systemz, r600, and cpp (default=all)]),,
Reid Spencere482ca82005-04-22 17:02:18 +0000819 enableval=all)
Jeffrey Yasskin42a49df2009-09-23 17:05:42 +0000820if test "$enableval" = host-only ; then
821 enableval=host
822fi
Reid Spencere482ca82005-04-22 17:02:18 +0000823case "$enableval" in
Rafael Espindola72986662013-07-25 18:55:05 +0000824 all) TARGETS_TO_BUILD="X86 Sparc PowerPC AArch64 ARM Mips XCore MSP430 CppBackend NVPTX Hexagon SystemZ R600" ;;
Reid Spencere482ca82005-04-22 17:02:18 +0000825 *)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
826 case "$a_target" in
Jakob Stoklund Olesen526e8032009-08-02 17:32:37 +0000827 x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
828 x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
829 sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;;
830 powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;;
Joerg Sonnenberger981e99d2013-02-03 17:06:49 +0000831 aarch64) TARGETS_TO_BUILD="AArch64 $TARGETS_TO_BUILD" ;;
Jakob Stoklund Olesen526e8032009-08-02 17:32:37 +0000832 arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
833 mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
Rafael Espindolae46f0962011-12-28 17:08:00 +0000834 mipsel) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
Simon Atanasyanc2cccd72012-10-29 19:49:45 +0000835 mips64) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
836 mips64el) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
Jakob Stoklund Olesen526e8032009-08-02 17:32:37 +0000837 xcore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
838 msp430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;;
Jakob Stoklund Olesen526e8032009-08-02 17:32:37 +0000839 cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000840 hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;;
Justin Holewinskiae556d32012-05-04 20:18:50 +0000841 nvptx) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;;
Ulrich Weigand1ceebf62013-05-06 16:22:34 +0000842 systemz) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;;
Rafael Espindolaf6474d22013-05-22 00:35:47 +0000843 r600) TARGETS_TO_BUILD="R600 $TARGETS_TO_BUILD" ;;
Jeffrey Yasskin42a49df2009-09-23 17:05:42 +0000844 host) case "$llvm_cv_target_arch" in
845 x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
846 x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
847 Sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;;
848 PowerPC) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;;
Jia Liu43eb48e2013-04-22 16:26:15 +0000849 AArch64) TARGETS_TO_BUILD="AArch64 $TARGETS_TO_BUILD" ;;
Jeffrey Yasskin42a49df2009-09-23 17:05:42 +0000850 ARM) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
851 Mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
Jeffrey Yasskin42a49df2009-09-23 17:05:42 +0000852 XCore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
853 MSP430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;;
Tony Linthicum1213a7a2011-12-12 21:14:40 +0000854 Hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;;
Justin Holewinskiae556d32012-05-04 20:18:50 +0000855 NVPTX) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;;
Ulrich Weigand1ceebf62013-05-06 16:22:34 +0000856 SystemZ) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;;
Jeffrey Yasskin42a49df2009-09-23 17:05:42 +0000857 *) AC_MSG_ERROR([Can not set target to build]) ;;
858 esac ;;
Reid Spencere482ca82005-04-22 17:02:18 +0000859 *) AC_MSG_ERROR([Unrecognized target $a_target]) ;;
860 esac
Eric Christophere62b4412007-12-01 00:34:39 +0000861 done
Reid Spencere482ca82005-04-22 17:02:18 +0000862 ;;
863esac
Victor Oliveira9d4b8f52012-08-09 01:13:59 +0000864
865AC_ARG_ENABLE([experimental-targets],AS_HELP_STRING([--enable-experimental-targets],
866 [Build experimental host targets: disable or target1,target2,...
867 (default=disable)]),,
868 enableval=disable)
869
870if test ${enableval} != "disable"
871then
872 TARGETS_TO_BUILD="$enableval $TARGETS_TO_BUILD"
873fi
874
Reid Spencer47428042005-04-22 07:27:28 +0000875AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BUILD)
876
Gabor Greife0d58d32012-01-26 10:28:58 +0000877dnl Determine whether we are building LLVM support for the native architecture.
878dnl If so, define LLVM_NATIVE_ARCH to that LLVM target.
Douglas Gregor7cbf8162009-06-17 00:42:33 +0000879for a_target in $TARGETS_TO_BUILD; do
880 if test "$a_target" = "$LLVM_NATIVE_ARCH"; then
Eric Christophere7a9db12010-08-30 18:34:48 +0000881 AC_DEFINE_UNQUOTED(LLVM_NATIVE_ARCH, $LLVM_NATIVE_ARCH,
Douglas Gregor7cbf8162009-06-17 00:42:33 +0000882 [LLVM architecture name for the native architecture, if available])
Eric Christophere7a9db12010-08-30 18:34:48 +0000883 LLVM_NATIVE_TARGET="LLVMInitialize${LLVM_NATIVE_ARCH}Target"
884 LLVM_NATIVE_TARGETINFO="LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo"
Evan Cheng8c886a42011-07-22 21:58:54 +0000885 LLVM_NATIVE_TARGETMC="LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC"
Eric Christophere7a9db12010-08-30 18:34:48 +0000886 LLVM_NATIVE_ASMPRINTER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter"
Jan Sjödinc9a16d52011-03-14 22:12:35 +0000887 if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
888 LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser"
889 fi
Eric Christopher56079c12012-03-26 21:56:56 +0000890 if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then
891 LLVM_NATIVE_DISASSEMBLER="LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler"
892 fi
Eric Christophere7a9db12010-08-30 18:34:48 +0000893 AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGET, $LLVM_NATIVE_TARGET,
894 [LLVM name for the native Target init function, if available])
895 AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETINFO, $LLVM_NATIVE_TARGETINFO,
896 [LLVM name for the native TargetInfo init function, if available])
Evan Cheng8c886a42011-07-22 21:58:54 +0000897 AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETMC, $LLVM_NATIVE_TARGETMC,
898 [LLVM name for the native target MC init function, if available])
Eric Christophere7a9db12010-08-30 18:34:48 +0000899 AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPRINTER, $LLVM_NATIVE_ASMPRINTER,
900 [LLVM name for the native AsmPrinter init function, if available])
Jan Sjödinc9a16d52011-03-14 22:12:35 +0000901 if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
902 AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPARSER, $LLVM_NATIVE_ASMPARSER,
903 [LLVM name for the native AsmParser init function, if available])
904 fi
Eric Christopher56079c12012-03-26 21:56:56 +0000905 if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then
906 AC_DEFINE_UNQUOTED(LLVM_NATIVE_DISASSEMBLER, $LLVM_NATIVE_DISASSEMBLER,
907 [LLVM name for the native Disassembler init function, if available])
908 fi
Douglas Gregor7cbf8162009-06-17 00:42:33 +0000909 fi
910done
911
Gabor Greife0d58d32012-01-26 10:28:58 +0000912dnl Build the LLVM_TARGET and LLVM_... macros for Targets.def and the individual
913dnl target feature def files.
Douglas Gregor1b731d52009-06-16 20:12:29 +0000914LLVM_ENUM_TARGETS=""
915LLVM_ENUM_ASM_PRINTERS=""
Daniel Dunbar71475772009-07-17 20:42:00 +0000916LLVM_ENUM_ASM_PARSERS=""
Daniel Dunbarf4721292009-11-25 04:30:13 +0000917LLVM_ENUM_DISASSEMBLERS=""
Douglas Gregor1b731d52009-06-16 20:12:29 +0000918for target_to_build in $TARGETS_TO_BUILD; do
919 LLVM_ENUM_TARGETS="LLVM_TARGET($target_to_build) $LLVM_ENUM_TARGETS"
Chris Lattner28776602010-11-14 19:10:47 +0000920 if test -f ${srcdir}/lib/Target/${target_to_build}/*AsmPrinter.cpp ; then
Eric Christopheref917742010-10-12 02:42:05 +0000921 LLVM_ENUM_ASM_PRINTERS="LLVM_ASM_PRINTER($target_to_build) $LLVM_ENUM_ASM_PRINTERS";
922 fi
Daniel Dunbar71475772009-07-17 20:42:00 +0000923 if test -f ${srcdir}/lib/Target/${target_to_build}/AsmParser/Makefile ; then
924 LLVM_ENUM_ASM_PARSERS="LLVM_ASM_PARSER($target_to_build) $LLVM_ENUM_ASM_PARSERS";
925 fi
Daniel Dunbarf4721292009-11-25 04:30:13 +0000926 if test -f ${srcdir}/lib/Target/${target_to_build}/Disassembler/Makefile ; then
927 LLVM_ENUM_DISASSEMBLERS="LLVM_DISASSEMBLER($target_to_build) $LLVM_ENUM_DISASSEMBLERS";
928 fi
Douglas Gregor1b731d52009-06-16 20:12:29 +0000929done
930AC_SUBST(LLVM_ENUM_TARGETS)
931AC_SUBST(LLVM_ENUM_ASM_PRINTERS)
Daniel Dunbar71475772009-07-17 20:42:00 +0000932AC_SUBST(LLVM_ENUM_ASM_PARSERS)
Daniel Dunbarf4721292009-11-25 04:30:13 +0000933AC_SUBST(LLVM_ENUM_DISASSEMBLERS)
Douglas Gregor1b731d52009-06-16 20:12:29 +0000934
Daniel Dunbarb4a289c2009-11-04 04:32:50 +0000935dnl Override the option to use for optimized builds.
936AC_ARG_WITH(optimize-option,
937 AS_HELP_STRING([--with-optimize-option],
938 [Select the compiler options to use for optimized builds]),,
939 withval=default)
940AC_MSG_CHECKING([optimization flags])
941case "$withval" in
942 default)
943 case "$llvm_cv_os_type" in
Daniel Dunbare96fcbb2010-04-30 17:12:23 +0000944 FreeBSD) optimize_option=-O2 ;;
Daniel Dunbar4e06a5b2010-04-10 18:56:24 +0000945 MingW) optimize_option=-O2 ;;
946 *) optimize_option=-O3 ;;
Daniel Dunbarb4a289c2009-11-04 04:32:50 +0000947 esac ;;
948 *) optimize_option="$withval" ;;
949esac
950AC_SUBST(OPTIMIZE_OPTION,$optimize_option)
951AC_MSG_RESULT([$optimize_option])
952
Evan Chenga7bd00b2006-06-20 22:16:32 +0000953dnl Specify extra build options
954AC_ARG_WITH(extra-options,
955 AS_HELP_STRING([--with-extra-options],
Duncan Sandsef8c8ec2009-05-13 13:13:18 +0000956 [Specify additional options to compile LLVM with]),,
Reid Spencer84749ed2006-07-28 22:50:07 +0000957 withval=default)
958case "$withval" in
Evan Chenga7bd00b2006-06-20 22:16:32 +0000959 default) EXTRA_OPTIONS= ;;
Reid Spencer84749ed2006-07-28 22:50:07 +0000960 *) EXTRA_OPTIONS=$withval ;;
Evan Chenga7bd00b2006-06-20 22:16:32 +0000961esac
962AC_SUBST(EXTRA_OPTIONS,$EXTRA_OPTIONS)
Reid Spencer47428042005-04-22 07:27:28 +0000963
Daniel Dunbar0315d4a2011-06-16 22:30:38 +0000964dnl Specify extra linker build options
965AC_ARG_WITH(extra-ld-options,
966 AS_HELP_STRING([--with-extra-ld-options],
967 [Specify additional options to link LLVM with]),,
968 withval=default)
969case "$withval" in
970 default) EXTRA_LD_OPTIONS= ;;
971 *) EXTRA_LD_OPTIONS=$withval ;;
972esac
973AC_SUBST(EXTRA_LD_OPTIONS,$EXTRA_LD_OPTIONS)
974
Gordon Henriksend48f4592007-10-02 09:50:18 +0000975dnl Allow specific bindings to be specified for building (or not)
976AC_ARG_ENABLE([bindings],AS_HELP_STRING([--enable-bindings],
977 [Build specific language bindings: all,auto,none,{binding-name} (default=auto)]),,
978 enableval=default)
979BINDINGS_TO_BUILD=""
980case "$enableval" in
Gordon Henriksen61400d12007-10-02 10:14:32 +0000981 yes | default | auto) BINDINGS_TO_BUILD="auto" ;;
Gordon Henriksend48f4592007-10-02 09:50:18 +0000982 all ) BINDINGS_TO_BUILD="ocaml" ;;
983 none | no) BINDINGS_TO_BUILD="" ;;
984 *)for a_binding in `echo $enableval|sed -e 's/,/ /g' ` ; do
985 case "$a_binding" in
986 ocaml) BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" ;;
987 *) AC_MSG_ERROR([Unrecognized binding $a_binding]) ;;
988 esac
Eric Christophere62b4412007-12-01 00:34:39 +0000989 done
Gordon Henriksend48f4592007-10-02 09:50:18 +0000990 ;;
991esac
992
Gordon Henriksen3be1f102007-10-02 16:42:10 +0000993dnl Allow the ocaml libdir to be overridden. This could go in a configure
994dnl script for bindings/ocaml/configure, except that its auto value depends on
995dnl OCAMLC, which is found here to support tests.
996AC_ARG_WITH([ocaml-libdir],
997 [AS_HELP_STRING([--with-ocaml-libdir],
998 [Specify install location for ocaml bindings (default is stdlib)])],
999 [],
1000 [withval=auto])
1001case "$withval" in
1002 auto) with_ocaml_libdir="$withval" ;;
1003 /* | [[A-Za-z]]:[[\\/]]*) with_ocaml_libdir="$withval" ;;
1004 *) AC_MSG_ERROR([Invalid path for --with-ocaml-libdir. Provide full path]) ;;
1005esac
1006
NAKAMURA Takumi914f1922011-10-16 02:54:26 +00001007AC_ARG_WITH(clang-srcdir,
1008 AS_HELP_STRING([--with-clang-srcdir],
1009 [Directory to the out-of-tree Clang source]),,
1010 withval="-")
1011case "$withval" in
Dylan Noblesmithb5190ab2012-02-02 00:17:33 +00001012 -) clang_src_root="" ;;
NAKAMURA Takumi914f1922011-10-16 02:54:26 +00001013 /* | [[A-Za-z]]:[[\\/]]*) clang_src_root="$withval" ;;
1014 *) clang_src_root="$ac_pwd/$withval" ;;
1015esac
1016AC_SUBST(CLANG_SRC_ROOT,[$clang_src_root])
1017
Chandler Carruthffae4a62010-10-19 08:21:25 +00001018AC_ARG_WITH(clang-resource-dir,
1019 AS_HELP_STRING([--with-clang-resource-dir],
1020 [Relative directory from the Clang binary for resource files]),,
1021 withval="")
1022AC_DEFINE_UNQUOTED(CLANG_RESOURCE_DIR,"$withval",
1023 [Relative directory for resource files])
1024
Rafael Espindola662908c2009-12-07 00:27:35 +00001025AC_ARG_WITH(c-include-dirs,
Rafael Espindolad95960b2009-11-12 05:46:09 +00001026 AS_HELP_STRING([--with-c-include-dirs],
1027 [Colon separated list of directories clang will search for headers]),,
1028 withval="")
1029AC_DEFINE_UNQUOTED(C_INCLUDE_DIRS,"$withval",
1030 [Directories clang will search for headers])
1031
Rafael Espindolaec217f62012-02-03 00:59:30 +00001032# Clang normally uses the system c++ headers and libraries. With this option,
1033# clang will use the ones provided by a gcc installation instead. This option should
1034# be passed the same value that was used with --prefix when configuring gcc.
1035AC_ARG_WITH(gcc-toolchain,
1036 AS_HELP_STRING([--with-gcc-toolchain],
1037 [Directory where gcc is installed.]),,
Rafael Espindola65e9be6d2009-11-16 19:46:55 +00001038 withval="")
Rafael Espindolaec217f62012-02-03 00:59:30 +00001039AC_DEFINE_UNQUOTED(GCC_INSTALL_PREFIX,"$withval",
1040 [Directory where gcc is installed.])
Rafael Espindola65e9be6d2009-11-16 19:46:55 +00001041
Sebastian Pope29a6c72012-04-30 20:06:58 +00001042AC_ARG_WITH(default-sysroot,
Sebastian Pop5c9e1842012-04-16 04:11:45 +00001043 AS_HELP_STRING([--with-default-sysroot],
1044 [Add --sysroot=<path> to all compiler invocations.]),,
1045 withval="")
1046AC_DEFINE_UNQUOTED(DEFAULT_SYSROOT,"$withval",
1047 [Default <path> to all compiler invocations for --sysroot=<path>.])
1048
Nick Lewyckyedd8946b2009-02-03 07:10:08 +00001049dnl Allow linking of LLVM with GPLv3 binutils code.
1050AC_ARG_WITH(binutils-include,
1051 AS_HELP_STRING([--with-binutils-include],
1052 [Specify path to binutils/include/ containing plugin-api.h file for gold plugin.]),,
1053 withval=default)
1054case "$withval" in
1055 default) WITH_BINUTILS_INCDIR=default ;;
1056 /* | [[A-Za-z]]:[[\\/]]*) WITH_BINUTILS_INCDIR=$withval ;;
1057 *) AC_MSG_ERROR([Invalid path for --with-binutils-include. Provide full path]) ;;
1058esac
1059if test "x$WITH_BINUTILS_INCDIR" != xdefault ; then
1060 AC_SUBST(BINUTILS_INCDIR,$WITH_BINUTILS_INCDIR)
1061 if test ! -f "$WITH_BINUTILS_INCDIR/plugin-api.h"; then
1062 echo "$WITH_BINUTILS_INCDIR/plugin-api.h"
1063 AC_MSG_ERROR([Invalid path to directory containing plugin-api.h.]);
1064 fi
1065fi
1066
Chad Rosier445d39b2011-07-15 00:37:26 +00001067dnl Specify the URL where bug reports should be submitted.
1068AC_ARG_WITH(bug-report-url,
1069 AS_HELP_STRING([--with-bug-report-url],
Chad Rosier8c9d9b22011-08-02 20:53:43 +00001070 [Specify the URL where bug reports should be submitted (default=http://llvm.org/bugs/)]),,
1071 withval="http://llvm.org/bugs/")
Chad Rosier445d39b2011-07-15 00:37:26 +00001072AC_DEFINE_UNQUOTED(BUG_REPORT_URL,"$withval",
1073 [Bug report URL.])
1074
Chandler Carruthf11f1e42013-08-12 09:49:17 +00001075dnl --enable-terminfo: check whether the user wants to control use of terminfo:
1076AC_ARG_ENABLE(terminfo,AS_HELP_STRING(
1077 [--enable-terminfo],
1078 [Query the terminfo database if available (default is YES)]),
Chandler Carruthcad7e5e2013-08-07 08:47:36 +00001079 [case "$enableval" in
Chandler Carruthf11f1e42013-08-12 09:49:17 +00001080 yes) llvm_cv_enable_terminfo="yes" ;;
1081 no) llvm_cv_enable_terminfo="no" ;;
1082 *) AC_MSG_ERROR([Invalid setting for --enable-terminfo. Use "yes" or "no"]) ;;
Chandler Carruthcad7e5e2013-08-07 08:47:36 +00001083 esac],
Chandler Carruthf11f1e42013-08-12 09:49:17 +00001084 llvm_cv_enable_terminfo="yes")
Chandler Carruthcad7e5e2013-08-07 08:47:36 +00001085
Nick Lewycky9ab256ac2009-06-06 06:24:44 +00001086dnl --enable-libffi : check whether the user wants to turn off libffi:
1087AC_ARG_ENABLE(libffi,AS_HELP_STRING(
Jeffrey Yasskin914050b2010-02-09 23:03:44 +00001088 --enable-libffi,[Check for the presence of libffi (default is NO)]),
1089 [case "$enableval" in
1090 yes) llvm_cv_enable_libffi="yes" ;;
1091 no) llvm_cv_enable_libffi="no" ;;
1092 *) AC_MSG_ERROR([Invalid setting for --enable-libffi. Use "yes" or "no"]) ;;
1093 esac],
1094 llvm_cv_enable_libffi=no)
Nick Lewycky9ab256ac2009-06-06 06:24:44 +00001095
Bob Wilson3f354702011-11-28 07:59:52 +00001096AC_ARG_WITH(internal-prefix,
1097 AS_HELP_STRING([--with-internal-prefix],
1098 [Installation directory for internal files]),,
1099 withval="")
1100AC_SUBST(INTERNAL_PREFIX,[$withval])
1101
Reid Spencer0241e382004-11-25 04:51:04 +00001102dnl===-----------------------------------------------------------------------===
1103dnl===
1104dnl=== SECTION 4: Check for programs we need and that they are the right version
1105dnl===
1106dnl===-----------------------------------------------------------------------===
Reid Spencer67be17a2004-08-31 14:20:36 +00001107
Reid Spencereca6f732006-07-27 23:00:30 +00001108AC_PROG_NM
1109AC_SUBST(NM)
1110
Reid Spencer0241e382004-11-25 04:51:04 +00001111dnl Check for the tools that the makefiles require
1112AC_CHECK_GNU_MAKE
1113AC_PROG_LN_S
Reid Spencerd42d5d42004-12-16 17:48:14 +00001114AC_PATH_PROG(CMP, [cmp], [cmp])
1115AC_PATH_PROG(CP, [cp], [cp])
Reid Spencer0194c9a2004-11-29 04:56:35 +00001116AC_PATH_PROG(DATE, [date], [date])
Reid Spencer0241e382004-11-25 04:51:04 +00001117AC_PATH_PROG(FIND, [find], [find])
1118AC_PATH_PROG(GREP, [grep], [grep])
1119AC_PATH_PROG(MKDIR,[mkdir],[mkdir])
Reid Spencer0194c9a2004-11-29 04:56:35 +00001120AC_PATH_PROG(MV, [mv], [mv])
Reid Spencer0241e382004-11-25 04:51:04 +00001121AC_PROG_RANLIB
Torok Edwin1e86bc52010-01-26 08:48:04 +00001122AC_CHECK_TOOL(AR, ar, false)
Reid Spencer0194c9a2004-11-29 04:56:35 +00001123AC_PATH_PROG(RM, [rm], [rm])
1124AC_PATH_PROG(SED, [sed], [sed])
1125AC_PATH_PROG(TAR, [tar], [gtar])
Reid Spencer9372247e2006-07-28 05:05:00 +00001126AC_PATH_PROG(BINPWD,[pwd], [pwd])
Reid Spencer432b3152006-06-02 23:13:18 +00001127
1128dnl Looking for misc. graph plotting software
Reid Spencer0ac41942005-07-14 02:25:12 +00001129AC_PATH_PROG(GRAPHVIZ, [Graphviz], [echo Graphviz])
1130if test "$GRAPHVIZ" != "echo Graphviz" ; then
Reid Spencerf17006f2005-07-13 03:20:14 +00001131 AC_DEFINE([HAVE_GRAPHVIZ],[1],[Define if the Graphviz program is available])
Reid Spencer627023a2006-06-05 15:54:38 +00001132 dnl If we're targeting for mingw we should emit windows paths, not msys
Jeff Cohenc5e5b272007-01-12 18:22:38 +00001133 if test "$llvm_cv_os_type" = "MingW" ; then
Reid Spencer627023a2006-06-05 15:54:38 +00001134 GRAPHVIZ=`echo $GRAPHVIZ | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
1135 fi
1136 AC_DEFINE_UNQUOTED([LLVM_PATH_GRAPHVIZ],"$GRAPHVIZ${EXEEXT}",
Reid Spencer0ac41942005-07-14 02:25:12 +00001137 [Define to path to Graphviz program if found or 'echo Graphviz' otherwise])
Reid Spencerf17006f2005-07-13 03:20:14 +00001138fi
Reid Spencer627023a2006-06-05 15:54:38 +00001139AC_PATH_PROG(DOT, [dot], [echo dot])
1140if test "$DOT" != "echo dot" ; then
1141 AC_DEFINE([HAVE_DOT],[1],[Define if the dot program is available])
1142 dnl If we're targeting for mingw we should emit windows paths, not msys
Jeff Cohenc5e5b272007-01-12 18:22:38 +00001143 if test "$llvm_cv_os_type" = "MingW" ; then
Reid Spencer627023a2006-06-05 15:54:38 +00001144 DOT=`echo $DOT | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
1145 fi
1146 AC_DEFINE_UNQUOTED([LLVM_PATH_DOT],"$DOT${EXEEXT}",
1147 [Define to path to dot program if found or 'echo dot' otherwise])
1148fi
David Greene4417b4c2009-07-09 17:06:18 +00001149AC_PATH_PROG(FDP, [fdp], [echo fdp])
1150if test "$FDP" != "echo fdp" ; then
1151 AC_DEFINE([HAVE_FDP],[1],[Define if the neat program is available])
1152 dnl If we're targeting for mingw we should emit windows paths, not msys
1153 if test "$llvm_cv_os_type" = "MingW" ; then
1154 FDP=`echo $FDP | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
1155 fi
1156 AC_DEFINE_UNQUOTED([LLVM_PATH_FDP],"$FDP${EXEEXT}",
1157 [Define to path to fdp program if found or 'echo fdp' otherwise])
1158fi
1159AC_PATH_PROG(NEATO, [neato], [echo neato])
1160if test "$NEATO" != "echo neato" ; then
1161 AC_DEFINE([HAVE_NEATO],[1],[Define if the neat program is available])
1162 dnl If we're targeting for mingw we should emit windows paths, not msys
1163 if test "$llvm_cv_os_type" = "MingW" ; then
1164 NEATO=`echo $NEATO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
1165 fi
1166 AC_DEFINE_UNQUOTED([LLVM_PATH_NEATO],"$NEATO${EXEEXT}",
1167 [Define to path to neato program if found or 'echo neato' otherwise])
1168fi
1169AC_PATH_PROG(TWOPI, [twopi], [echo twopi])
1170if test "$TWOPI" != "echo twopi" ; then
1171 AC_DEFINE([HAVE_TWOPI],[1],[Define if the neat program is available])
1172 dnl If we're targeting for mingw we should emit windows paths, not msys
1173 if test "$llvm_cv_os_type" = "MingW" ; then
1174 TWOPI=`echo $TWOPI | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
1175 fi
1176 AC_DEFINE_UNQUOTED([LLVM_PATH_TWOPI],"$TWOPI${EXEEXT}",
1177 [Define to path to twopi program if found or 'echo twopi' otherwise])
1178fi
1179AC_PATH_PROG(CIRCO, [circo], [echo circo])
1180if test "$CIRCO" != "echo circo" ; then
1181 AC_DEFINE([HAVE_CIRCO],[1],[Define if the neat program is available])
1182 dnl If we're targeting for mingw we should emit windows paths, not msys
1183 if test "$llvm_cv_os_type" = "MingW" ; then
1184 CIRCO=`echo $CIRCO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
1185 fi
1186 AC_DEFINE_UNQUOTED([LLVM_PATH_CIRCO],"$CIRCO${EXEEXT}",
1187 [Define to path to circo program if found or 'echo circo' otherwise])
1188fi
Reid Spencer627023a2006-06-05 15:54:38 +00001189AC_PATH_PROGS(GV, [gv gsview32], [echo gv])
Misha Brukman2956ea72005-11-01 20:58:08 +00001190if test "$GV" != "echo gv" ; then
Reid Spencerf2842682005-07-14 05:19:12 +00001191 AC_DEFINE([HAVE_GV],[1],[Define if the gv program is available])
Reid Spencer627023a2006-06-05 15:54:38 +00001192 dnl If we're targeting for mingw we should emit windows paths, not msys
Jeff Cohenc5e5b272007-01-12 18:22:38 +00001193 if test "$llvm_cv_os_type" = "MingW" ; then
Reid Spencer627023a2006-06-05 15:54:38 +00001194 GV=`echo $GV | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
1195 fi
1196 AC_DEFINE_UNQUOTED([LLVM_PATH_GV],"$GV${EXEEXT}",
Reid Spencerf2842682005-07-14 05:19:12 +00001197 [Define to path to gv program if found or 'echo gv' otherwise])
1198fi
Reid Spencer432b3152006-06-02 23:13:18 +00001199AC_PATH_PROG(DOTTY, [dotty], [echo dotty])
1200if test "$DOTTY" != "echo dotty" ; then
1201 AC_DEFINE([HAVE_DOTTY],[1],[Define if the dotty program is available])
Reid Spencer627023a2006-06-05 15:54:38 +00001202 dnl If we're targeting for mingw we should emit windows paths, not msys
Jeff Cohenc5e5b272007-01-12 18:22:38 +00001203 if test "$llvm_cv_os_type" = "MingW" ; then
Reid Spencer627023a2006-06-05 15:54:38 +00001204 DOTTY=`echo $DOTTY | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
1205 fi
1206 AC_DEFINE_UNQUOTED([LLVM_PATH_DOTTY],"$DOTTY${EXEEXT}",
Reid Spencer432b3152006-06-02 23:13:18 +00001207 [Define to path to dotty program if found or 'echo dotty' otherwise])
1208fi
Eric Christopher72ebead2013-07-08 21:18:54 +00001209AC_PATH_PROGS(XDOT, [xdot xdot.py], [echo xdot])
Matt Arsenaultfe56cc62013-07-08 20:24:54 +00001210if test "$XDOT" != "echo xdot" ; then
1211 AC_DEFINE([HAVE_XDOT],[1],[Define if the xdot program is available])
Dan Gohmana0da8892010-09-27 16:28:34 +00001212 dnl If we're targeting for mingw we should emit windows paths, not msys
1213 if test "$llvm_cv_os_type" = "MingW" ; then
Matt Arsenaultfe56cc62013-07-08 20:24:54 +00001214 XDOT=`echo $XDOT | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
Dan Gohmana0da8892010-09-27 16:28:34 +00001215 fi
Matt Arsenaultfe56cc62013-07-08 20:24:54 +00001216 AC_DEFINE_UNQUOTED([LLVM_PATH_XDOT],"$XDOT${EXEEXT}",
1217 [Define to path to xdot program if found or 'echo xdot' otherwise])
Dan Gohmana0da8892010-09-27 16:28:34 +00001218fi
Reid Spencer0241e382004-11-25 04:51:04 +00001219
1220dnl Find the install program
1221AC_PROG_INSTALL
Eric Christopherc7289b62010-07-22 21:13:40 +00001222dnl Prepend src dir to install path dir if it's a relative path
1223dnl This is a hack for installs that take place in something other
1224dnl than the top level.
1225case "$INSTALL" in
1226 [[\\/$]]* | ?:[[\\/]]* ) ;;
1227 *) INSTALL="\\\$(TOPSRCDIR)/$INSTALL" ;;
1228esac
John Criswell7a3334d2003-07-22 19:13:20 +00001229
Reid Spencer0194c9a2004-11-29 04:56:35 +00001230dnl Checks for documentation and testing tools that we can do without. If these
1231dnl are not found then they are set to "true" which always succeeds but does
Eric Christophere62b4412007-12-01 00:34:39 +00001232dnl nothing. This just lets the build output show that we could have done
1233dnl something if the tool was available.
Bill Wendling5ddd03d2008-03-05 09:28:02 +00001234AC_PATH_PROG(BZIP2, [bzip2])
mike-me08af302010-05-06 23:45:43 +00001235AC_PATH_PROG(CAT, [cat])
Bill Wendling5ddd03d2008-03-05 09:28:02 +00001236AC_PATH_PROG(DOXYGEN, [doxygen])
Daniel Dunbard1888822012-05-08 18:26:07 +00001237AC_PATH_PROG(GROFF, [groff])
Eric Christopher77560892010-12-10 01:31:51 +00001238AC_PATH_PROG(GZIPBIN, [gzip])
Daniel Dunbard1888822012-05-08 18:26:07 +00001239AC_PATH_PROG(PDFROFF, [pdfroff])
Bill Wendling5ddd03d2008-03-05 09:28:02 +00001240AC_PATH_PROG(ZIP, [zip])
Gordon Henriksen2289eb82008-10-22 12:40:40 +00001241AC_PATH_PROGS(OCAMLC, [ocamlc])
1242AC_PATH_PROGS(OCAMLOPT, [ocamlopt])
1243AC_PATH_PROGS(OCAMLDEP, [ocamldep])
1244AC_PATH_PROGS(OCAMLDOC, [ocamldoc])
Daniel Dunbard1888822012-05-08 18:26:07 +00001245AC_PATH_PROGS(GAS, [gas as])
Reid Spencer0241e382004-11-25 04:51:04 +00001246
Daniel Dunbarb524afb2010-08-11 23:53:59 +00001247dnl Get the version of the linker in use.
1248AC_LINK_GET_VERSION
1249
Nick Lewycky16aac992009-03-05 08:20:21 +00001250dnl Determine whether the linker supports the -R option.
Reid Spencer0241e382004-11-25 04:51:04 +00001251AC_LINK_USE_R
1252
Bob Wilson8658b912013-08-02 22:51:06 +00001253dnl Determine whether the compiler supports the -rdynamic option.
Nick Lewycky16aac992009-03-05 08:20:21 +00001254AC_LINK_EXPORT_DYNAMIC
1255
Dan Gohmanb7edb422010-06-01 14:56:56 +00001256dnl Determine whether the linker supports the --version-script option.
1257AC_LINK_VERSION_SCRIPT
Dan Gohman91f8ad72010-04-16 22:58:15 +00001258
Reid Spencera40c6872004-11-29 12:29:58 +00001259dnl Check for libtool and the library that has dlopen function (which must come
1260dnl before the AC_PROG_LIBTOOL check in order to enable dlopening libraries with
1261dnl libtool).
1262AC_LIBTOOL_DLOPEN
1263AC_LIB_LTDL
Mikhail Glushenkov2c332fe2009-04-21 19:46:10 +00001264
Reid Spencer0241e382004-11-25 04:51:04 +00001265AC_MSG_CHECKING([tool compatibility])
1266
Reid Spencerca06c8e2004-12-08 23:07:27 +00001267dnl Ensure that compilation tools are GCC or a GNU compatible compiler such as
1268dnl ICC; we use GCC specific options in the makefiles so the compiler needs
1269dnl to support those options.
1270dnl "icc" emits gcc signatures
1271dnl "icc -no-gcc" emits no gcc signature BUT is still compatible
1272ICC=no
1273IXX=no
1274case $CC in
Eric Christophere62b4412007-12-01 00:34:39 +00001275 icc*|icpc*)
Reid Spencerca06c8e2004-12-08 23:07:27 +00001276 ICC=yes
1277 IXX=yes
1278 ;;
1279 *)
1280 ;;
1281esac
1282
Duraid Madina8604de82006-02-15 07:57:42 +00001283if test "$GCC" != "yes" && test "$ICC" != "yes"
1284then
1285 AC_MSG_ERROR([gcc|icc required but not found])
1286fi
1287
Daniel Dunbar00e7a842010-12-08 01:48:03 +00001288dnl Ensure that compilation tools are compatible with GCC extensions
Duraid Madina8604de82006-02-15 07:57:42 +00001289if test "$GXX" != "yes" && test "$IXX" != "yes"
1290then
Daniel Dunbar00e7a842010-12-08 01:48:03 +00001291 AC_MSG_ERROR([g++|clang++|icc required but not found])
Duraid Madina8604de82006-02-15 07:57:42 +00001292fi
1293
Reid Spencer0241e382004-11-25 04:51:04 +00001294dnl Verify that GCC is version 3.0 or higher
Reid Spencerca06c8e2004-12-08 23:07:27 +00001295if test "$GCC" = "yes"
Reid Spencer0241e382004-11-25 04:51:04 +00001296then
NAKAMURA Takumie5bc87c2013-01-30 01:37:55 +00001297 AC_COMPILE_IFELSE(
1298[
1299 AC_LANG_SOURCE([[
1300 #if !defined(__GNUC__) || __GNUC__ < 3
1301 #error Unsupported GCC version
1302 #endif
1303 ]])
1304],
1305[], [AC_MSG_ERROR([gcc 3.x required, but you have a lower version])])
Reid Spencer0241e382004-11-25 04:51:04 +00001306fi
1307
1308dnl Check for GNU Make. We use its extensions, so don't build without it
1309if test -z "$llvm_cv_gnu_make_command"
1310then
1311 AC_MSG_ERROR([GNU Make required but not found])
1312fi
1313
1314dnl Tool compatibility is okay if we make it here.
1315AC_MSG_RESULT([ok])
1316
Eric Christopherb3762a02010-03-02 05:17:21 +00001317dnl Check optional compiler flags.
Julien Lerougee4492f62009-10-26 19:58:44 +00001318AC_MSG_CHECKING([optional compiler flags])
1319CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros])
1320CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers])
Rafael Espindola42e94d12012-02-28 23:32:06 +00001321CXX_FLAG_CHECK(COVERED_SWITCH_DEFAULT, [-Wcovered-switch-default])
Dmitri Gribenkob5e23ef2013-02-13 21:19:39 +00001322
David Greene9ff8d472013-01-09 22:11:13 +00001323dnl GCC's potential uninitialized use analysis is weak and presents lots of
1324dnl false positives, so disable it.
Dmitri Gribenkob5e23ef2013-02-13 21:19:39 +00001325NO_UNINITIALIZED=
1326NO_MAYBE_UNINITIALIZED=
David Greene9ff8d472013-01-09 22:11:13 +00001327if test "$GXX" = "yes"
1328then
1329 CXX_FLAG_CHECK(NO_MAYBE_UNINITIALIZED, [-Wno-maybe-uninitialized])
1330 dnl gcc 4.7 introduced -Wmaybe-uninitialized to distinguish cases which are
Dmitri Gribenkob5e23ef2013-02-13 21:19:39 +00001331 dnl known to be uninitialized from cases which might be uninitialized. We
David Greene9ff8d472013-01-09 22:11:13 +00001332 dnl still want to catch the first kind of errors.
Dmitri Gribenkob5e23ef2013-02-13 21:19:39 +00001333 if test -z "$NO_MAYBE_UNINITIALIZED"
David Greene9ff8d472013-01-09 22:11:13 +00001334 then
1335 CXX_FLAG_CHECK(NO_UNINITIALIZED, [-Wno-uninitialized])
David Greene9ff8d472013-01-09 22:11:13 +00001336 fi
David Greene9ff8d472013-01-09 22:11:13 +00001337fi
Eric Christopher31f43542013-03-15 00:43:00 +00001338AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED])
David Greene9ff8d472013-01-09 22:11:13 +00001339
Saleem Abdulrasool26127bd2013-01-30 04:07:37 +00001340AC_ARG_WITH([python],
1341 [AS_HELP_STRING([--with-python], [path to python])],
1342 [PYTHON="$withval"])
1343
1344if test -n "$PYTHON" && test -x "$PYTHON" ; then
1345 AC_MSG_CHECKING([for python])
1346 AC_MSG_RESULT([user defined: $with_python])
1347else
1348 if test -n "$PYTHON" ; then
1349 AC_MSG_WARN([specified python ($PYTHON) is not usable, searching path])
1350 fi
1351
1352 AC_PATH_PROG([PYTHON], [python python2 python26],
1353 [AC_MSG_RESULT([not found])
1354 AC_MSG_ERROR([could not find python 2.5 or higher])])
1355fi
1356
1357AC_MSG_CHECKING([for python >= 2.5])
1358ac_python_version=`$PYTHON -c 'import sys; print sys.version.split()[[0]]'`
1359ac_python_version_major=`echo $ac_python_version | cut -d'.' -f1`
1360ac_python_version_minor=`echo $ac_python_version | cut -d'.' -f2`
1361ac_python_version_patch=`echo $ac_python_version | cut -d'.' -f3`
1362if test "$ac_python_version_major" -eq "2" \
1363 && test "$ac_python_version_minor" -ge "5" ; then
1364 AC_MSG_RESULT([$PYTHON ($ac_python_version)])
1365else
1366 AC_MSG_RESULT([not found])
1367 AC_MSG_FAILURE([found python $ac_python_version ($PYTHON); required >= 2.5])
1368fi
Julien Lerougee4492f62009-10-26 19:58:44 +00001369
Reid Spencer0241e382004-11-25 04:51:04 +00001370dnl===-----------------------------------------------------------------------===
1371dnl===
1372dnl=== SECTION 5: Check for libraries
1373dnl===
1374dnl===-----------------------------------------------------------------------===
1375
Reid Spencerec4a7f522006-01-19 08:31:08 +00001376AC_CHECK_LIB(m,sin)
Jeff Cohenc5e5b272007-01-12 18:22:38 +00001377if test "$llvm_cv_os_type" = "MingW" ; then
Reid Spencer187b4ad2006-06-01 19:03:21 +00001378 AC_CHECK_LIB(imagehlp, main)
1379 AC_CHECK_LIB(psapi, main)
Reid Spencera16b9862006-06-01 16:55:59 +00001380fi
Reid Spencercd59fb72005-07-12 07:19:13 +00001381
Brian Gaeke25f2a372003-10-07 05:03:36 +00001382dnl dlopen() is required for plugin support.
Reid Spencer0241e382004-11-25 04:51:04 +00001383AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1],
1384 [Define if dlopen() is available on this platform.]),
1385 AC_MSG_WARN([dlopen() not found - disabling plugin support]))
John Criswell7a3334d2003-07-22 19:13:20 +00001386
Chandler Carruthd121a7b2013-01-05 00:29:06 +00001387dnl Search for the clock_gettime() function. Note that we rely on the POSIX
Chandler Carruth4a778632013-01-05 00:34:40 +00001388dnl macros to detect whether clock_gettime is available, this just finds the
1389dnl right libraries to link with.
Chandler Carruthd121a7b2013-01-05 00:29:06 +00001390AC_SEARCH_LIBS(clock_gettime,rt)
Chandler Carruthef7f9682013-01-04 23:19:55 +00001391
Chandler Carruthcad7e5e2013-08-07 08:47:36 +00001392dnl The curses library is optional; used for querying terminal info
Chandler Carruthf11f1e42013-08-12 09:49:17 +00001393if test "$llvm_cv_enable_terminfo" = "yes" ; then
Chandler Carruthcad7e5e2013-08-07 08:47:36 +00001394 dnl We need the has_color functionality in curses for it to be useful.
Chandler Carruthf11f1e42013-08-12 09:49:17 +00001395 AC_SEARCH_LIBS(setupterm,tinfo curses ncurses ncursesw,
1396 AC_DEFINE([HAVE_TERMINFO],[1],
1397 [Define if the setupterm() function is supported this platform.]))
Chandler Carruthcad7e5e2013-08-07 08:47:36 +00001398fi
1399
Nick Lewyckya89ec992009-02-04 06:26:47 +00001400dnl libffi is optional; used to call external functions from the interpreter
Nick Lewycky9ab256ac2009-06-06 06:24:44 +00001401if test "$llvm_cv_enable_libffi" = "yes" ; then
1402 AC_SEARCH_LIBS(ffi_call,ffi,AC_DEFINE([HAVE_FFI_CALL],[1],
1403 [Define if libffi is available on this platform.]),
Jeffrey Yasskin914050b2010-02-09 23:03:44 +00001404 AC_MSG_ERROR([libffi not found - configure without --enable-libffi to compile without it]))
Nick Lewycky9ab256ac2009-06-06 06:24:44 +00001405fi
Nick Lewyckya89ec992009-02-04 06:26:47 +00001406
John Criswell7a3334d2003-07-22 19:13:20 +00001407dnl mallinfo is optional; the code can compile (minus features) without it
Reid Spencer0241e382004-11-25 04:51:04 +00001408AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],
1409 [Define if mallinfo() is available on this platform.]))
John Criswell7a3334d2003-07-22 19:13:20 +00001410
Brian Gaeke7ee7b402003-12-05 19:29:01 +00001411dnl pthread locking functions are optional - but llvm will not be thread-safe
1412dnl without locks.
Dylan Noblesmithefddf202011-11-28 00:48:58 +00001413if test "$LLVM_ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then
Edward O'Callaghanedea3262009-10-14 11:12:33 +00001414 AC_CHECK_LIB(pthread, pthread_mutex_init)
Reid Spencerf85fabeb2005-08-24 10:07:20 +00001415 AC_SEARCH_LIBS(pthread_mutex_lock,pthread,
1416 AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1],
1417 [Have pthread_mutex_lock]))
Owen Andersona149e222009-06-16 18:20:20 +00001418 AC_SEARCH_LIBS(pthread_rwlock_init,pthread,
1419 AC_DEFINE([HAVE_PTHREAD_RWLOCK_INIT],[1],
1420 [Have pthread_rwlock_init]))
Owen Anderson11549832009-06-25 23:10:26 +00001421 AC_SEARCH_LIBS(pthread_getspecific,pthread,
1422 AC_DEFINE([HAVE_PTHREAD_GETSPECIFIC],[1],
1423 [Have pthread_getspecific]))
Reid Spencerf85fabeb2005-08-24 10:07:20 +00001424fi
Brian Gaeke7ee7b402003-12-05 19:29:01 +00001425
Alexey Samsonov2fb337e2013-04-23 08:28:39 +00001426dnl zlib is optional; used for compression/uncompression
1427if test "$LLVM_ENABLE_ZLIB" -eq 1 ; then
1428 AC_CHECK_LIB(z, compress2)
1429fi
1430
Anton Korobeynikov3e956972007-01-19 17:25:17 +00001431dnl Allow extra x86-disassembler library
1432AC_ARG_WITH(udis86,
1433 AS_HELP_STRING([--with-udis86=<path>],
1434 [Use udis86 external x86 disassembler library]),
1435 [
1436 AC_SUBST(USE_UDIS86, [1])
1437 case "$withval" in
Anton Korobeynikov4480ec32007-01-20 07:40:26 +00001438 /usr/lib|yes) ;;
Anton Korobeynikov3e956972007-01-19 17:25:17 +00001439 *) LDFLAGS="$LDFLAGS -L${withval}" ;;
1440 esac
1441 AC_CHECK_LIB(udis86, ud_init, [], [
1442 echo "Error! You need to have libudis86 around."
1443 exit -1
1444 ])
1445 ],
1446 AC_SUBST(USE_UDIS86, [0]))
1447AC_DEFINE_UNQUOTED([USE_UDIS86],$USE_UDIS86,
1448 [Define if use udis86 library])
1449
Jeffrey Yasskinbf3d6ba2009-07-10 21:08:20 +00001450dnl Allow OProfile support for JIT output.
1451AC_ARG_WITH(oprofile,
1452 AS_HELP_STRING([--with-oprofile=<prefix>],
1453 [Tell OProfile >= 0.9.4 how to symbolize JIT output]),
1454 [
1455 AC_SUBST(USE_OPROFILE, [1])
1456 case "$withval" in
1457 /usr|yes) llvm_cv_oppath=/usr/lib/oprofile ;;
Jeffrey Yasskin2da72312009-10-07 23:22:42 +00001458 no) llvm_cv_oppath=
1459 AC_SUBST(USE_OPROFILE, [0]) ;;
Jeffrey Yasskinbf3d6ba2009-07-10 21:08:20 +00001460 *) llvm_cv_oppath="${withval}/lib/oprofile"
Eric Christopher46342fe2012-08-03 17:45:31 +00001461 CPPFLAGS="-I${withval}/include";;
Jeffrey Yasskinbf3d6ba2009-07-10 21:08:20 +00001462 esac
Eli Bendersky5262ad22012-03-13 08:33:15 +00001463 case $llvm_cv_os_type in
1464 Linux)
1465 if test -n "$llvm_cv_oppath" ; then
1466 LIBS="$LIBS -lopagent -L${llvm_cv_oppath} -Wl,-rpath,${llvm_cv_oppath}"
1467 dnl Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537744:
1468 dnl libbfd is not included properly in libopagent in some Debian
1469 dnl versions. If libbfd isn't found at all, we assume opagent works
1470 dnl anyway.
1471 AC_SEARCH_LIBS(bfd_init, bfd, [], [])
1472 AC_SEARCH_LIBS(op_open_agent, opagent, [], [
1473 echo "Error! You need to have libopagent around."
1474 exit -1
1475 ])
1476 AC_CHECK_HEADER([opagent.h], [], [
1477 echo "Error! You need to have opagent.h around."
1478 exit -1
1479 ])
1480 fi ;;
1481 *)
1482 AC_MSG_ERROR([OProfile support is available on Linux only.]) ;;
1483 esac
Jeffrey Yasskinbf3d6ba2009-07-10 21:08:20 +00001484 ],
1485 [
Jeffrey Yasskin2da72312009-10-07 23:22:42 +00001486 AC_SUBST(USE_OPROFILE, [0])
Jeffrey Yasskinbf3d6ba2009-07-10 21:08:20 +00001487 ])
Eli Bendersky5262ad22012-03-13 08:33:15 +00001488AC_DEFINE_UNQUOTED([LLVM_USE_OPROFILE],$USE_OPROFILE,
Jeffrey Yasskinbf3d6ba2009-07-10 21:08:20 +00001489 [Define if we have the oprofile JIT-support library])
1490
Eli Bendersky5262ad22012-03-13 08:33:15 +00001491dnl Enable support for Intel JIT Events API.
1492AC_ARG_WITH(intel-jitevents,
Andrew Kaylor5808c7d2012-09-28 17:35:20 +00001493 AS_HELP_STRING([--with-intel-jitevents Notify Intel JIT profiling API of generated code]),
Eli Bendersky5262ad22012-03-13 08:33:15 +00001494 [
Andrew Kaylor5808c7d2012-09-28 17:35:20 +00001495 case "$withval" in
1496 yes) AC_SUBST(USE_INTEL_JITEVENTS,[1]);;
1497 no) AC_SUBST(USE_INTEL_JITEVENTS,[0]);;
1498 *) AC_MSG_ERROR([Invalid setting for --with-intel-jitevents. Use "yes" or "no"]);;
1499 esac
1500
Eli Bendersky5262ad22012-03-13 08:33:15 +00001501 case $llvm_cv_os_type in
1502 Linux|Win32|Cygwin|MingW) ;;
Andrew Kaylor5808c7d2012-09-28 17:35:20 +00001503 *) AC_MSG_ERROR([Intel JIT API support is available on Linux and Windows only.]);;
Eli Bendersky5262ad22012-03-13 08:33:15 +00001504 esac
1505
Eli Bendersky5262ad22012-03-13 08:33:15 +00001506 case "$llvm_cv_target_arch" in
Andrew Kaylor5808c7d2012-09-28 17:35:20 +00001507 x86|x86_64) ;;
1508 *) AC_MSG_ERROR([Target architecture $llvm_cv_target_arch does not support Intel JIT Events API.]);;
Eli Bendersky5262ad22012-03-13 08:33:15 +00001509 esac
Eli Bendersky5262ad22012-03-13 08:33:15 +00001510 ],
1511 [
1512 AC_SUBST(USE_INTEL_JITEVENTS, [0])
1513 ])
1514AC_DEFINE_UNQUOTED([LLVM_USE_INTEL_JITEVENTS],$USE_INTEL_JITEVENTS,
1515 [Define if we have the Intel JIT API runtime support library])
1516
Eric Christopherc807c532012-08-03 19:47:19 +00001517dnl Check for libxml2
1518dnl Right now we're just checking for the existence, we could also check for a
1519dnl particular version via --version on xml2-config
1520AC_CHECK_PROGS(XML2CONFIG, xml2-config)
1521
1522AC_MSG_CHECKING(for libxml2 includes)
1523if test "x$XML2CONFIG" = "x"; then
1524 AC_MSG_RESULT(xml2-config not found)
1525else
1526 LIBXML2_INC=`$XML2CONFIG --cflags`
1527 AC_MSG_RESULT($LIBXML2_INC)
1528 AC_CHECK_LIB(xml2, xmlReadFile,[AC_DEFINE([CLANG_HAVE_LIBXML],1,[Define if we have libxml2])
1529 LIBXML2_LIBS="-lxml2"])
1530fi
1531AC_SUBST(LIBXML2_LIBS)
1532AC_SUBST(LIBXML2_INC)
1533
Reid Spencer0241e382004-11-25 04:51:04 +00001534dnl===-----------------------------------------------------------------------===
1535dnl===
1536dnl=== SECTION 6: Check for header files
1537dnl===
1538dnl===-----------------------------------------------------------------------===
1539
Reid Spencer8bc110c2004-12-25 07:31:29 +00001540dnl First, use autoconf provided macros for specific headers that we need
Brian Gaeke2abe7ae2004-01-13 06:43:16 +00001541dnl We don't check for ancient stuff or things that are guaranteed to be there
1542dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers.
Reid Spencer8bc110c2004-12-25 07:31:29 +00001543dnl Generally we're looking for POSIX headers.
1544AC_HEADER_DIRENT
Reid Spencer0241e382004-11-25 04:51:04 +00001545AC_HEADER_MMAP_ANONYMOUS
Reid Spencer8bc110c2004-12-25 07:31:29 +00001546AC_HEADER_STAT
Reid Spencer8bc110c2004-12-25 07:31:29 +00001547AC_HEADER_SYS_WAIT
1548AC_HEADER_TIME
John Criswell7a3334d2003-07-22 19:13:20 +00001549
Benjamin Kramer00622f72013-05-03 15:55:06 +00001550AC_LANG_PUSH([C++])
1551AC_CHECK_HEADERS([cxxabi.h])
1552AC_LANG_POP([C++])
Reid Kleckner37f69de2013-07-26 16:54:23 +00001553AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h link.h])
Douglas Gregorb81294d2009-05-18 17:21:34 +00001554AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h termios.h unistd.h])
Reid Kleckner37f69de2013-07-26 16:54:23 +00001555AC_CHECK_HEADERS([utime.h])
Daniel Dunbar80da3fb2011-02-03 02:39:58 +00001556AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/uio.h])
Reid Kleckner37f69de2013-07-26 16:54:23 +00001557AC_CHECK_HEADERS([sys/ioctl.h malloc/malloc.h mach/mach.h])
Jeffrey Yasskin3ddd88f2010-03-15 04:57:55 +00001558AC_CHECK_HEADERS([valgrind/valgrind.h])
Dan Gohmanb48f9042010-09-17 20:06:27 +00001559AC_CHECK_HEADERS([fenv.h])
Joerg Sonnenberger8a1177f2013-03-25 13:13:33 +00001560AC_CHECK_DECLS([FE_ALL_EXCEPT, FE_INEXACT], [], [], [[#include <fenv.h>]])
Dylan Noblesmithefddf202011-11-28 00:48:58 +00001561if test "$LLVM_ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then
Reid Spencer83bcd762007-08-17 05:44:59 +00001562 AC_CHECK_HEADERS(pthread.h,
Nick Lewyckya89ec992009-02-04 06:26:47 +00001563 AC_SUBST(HAVE_PTHREAD, 1),
1564 AC_SUBST(HAVE_PTHREAD, 0))
Reid Spencerd4399922006-12-01 00:37:14 +00001565else
1566 AC_SUBST(HAVE_PTHREAD, 0)
Reid Spencerf85fabeb2005-08-24 10:07:20 +00001567fi
Alexey Samsonov2fb337e2013-04-23 08:28:39 +00001568if test "$LLVM_ENABLE_ZLIB" -eq 1 ; then
1569 AC_CHECK_HEADERS(zlib.h,
1570 AC_SUBST(HAVE_LIBZ, 1),
1571 AC_SUBST(HAVE_LIBZ, 0))
1572else
1573 AC_SUBST(HAVE_LIBZ, 0)
1574fi
Brian Gaeke090ed132004-02-23 22:07:01 +00001575
Chandler Carruthcad7e5e2013-08-07 08:47:36 +00001576dnl Try to find a suitable curses header.
Chandler Carruthf11f1e42013-08-12 09:49:17 +00001577if test "$llvm_cv_enable_terminfo" = "yes" ; then
1578 AC_CHECK_HEADERS([term.h curses.h ncurses.h ncursesw.h ncurses/curses.h ncursesw/curses.h])
Chandler Carruthcad7e5e2013-08-07 08:47:36 +00001579fi
1580
Nick Lewyckye54da992009-04-13 04:26:06 +00001581dnl Try to find ffi.h.
Nick Lewycky9ab256ac2009-06-06 06:24:44 +00001582if test "$llvm_cv_enable_libffi" = "yes" ; then
1583 AC_CHECK_HEADERS([ffi.h ffi/ffi.h])
1584fi
Nick Lewyckya89ec992009-02-04 06:26:47 +00001585
Eric Christopherca466732010-12-03 07:45:22 +00001586dnl Try to find Darwin specific crash reporting libraries.
Eric Christophere9c1bb62010-06-22 21:01:04 +00001587AC_CHECK_HEADERS([CrashReporterClient.h])
1588
Eric Christopherca466732010-12-03 07:45:22 +00001589dnl Try to find Darwin specific crash reporting global.
Eric Christopherba4f7722010-12-07 02:05:42 +00001590AC_MSG_CHECKING([__crashreporter_info__])
1591AC_LINK_IFELSE(
NAKAMURA Takumie5bc87c2013-01-30 01:37:55 +00001592[
1593 AC_LANG_SOURCE([[
1594 extern const char *__crashreporter_info__;
1595 int main() {
1596 __crashreporter_info__ = "test";
1597 return 0;
1598 }
1599 ]])
1600],
1601[
1602 AC_MSG_RESULT([yes])
NAKAMURA Takumi58da26b2013-01-30 01:38:03 +00001603 AC_DEFINE([HAVE_CRASHREPORTER_INFO], [1], [can use __crashreporter_info__])
NAKAMURA Takumie5bc87c2013-01-30 01:37:55 +00001604],
1605[
1606 AC_MSG_RESULT([no])
NAKAMURA Takumi58da26b2013-01-30 01:38:03 +00001607 AC_DEFINE([HAVE_CRASHREPORTER_INFO], [0], [can use __crashreporter_info__])
NAKAMURA Takumie5bc87c2013-01-30 01:37:55 +00001608])
Eric Christopherba4f7722010-12-07 02:05:42 +00001609
Reid Spencer0241e382004-11-25 04:51:04 +00001610dnl===-----------------------------------------------------------------------===
1611dnl===
1612dnl=== SECTION 7: Check for types and structures
1613dnl===
1614dnl===-----------------------------------------------------------------------===
1615
Reid Spencer128ae102006-11-03 18:04:08 +00001616AC_HUGE_VAL_CHECK
John Criswell7a3334d2003-07-22 19:13:20 +00001617AC_TYPE_PID_T
1618AC_TYPE_SIZE_T
Torok Edwin1e86bc52010-01-26 08:48:04 +00001619AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[Define as the return type of signal handlers (`int' or `void').])
Reid Spencer0241e382004-11-25 04:51:04 +00001620AC_STRUCT_TM
John Criswell7a3334d2003-07-22 19:13:20 +00001621AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
Reid Spencerab2228a2004-09-02 21:38:24 +00001622AC_CHECK_TYPES([uint64_t],,
Reid Spencer0241e382004-11-25 04:51:04 +00001623 AC_CHECK_TYPES([u_int64_t],,
1624 AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found])))
John Criswell7a3334d2003-07-22 19:13:20 +00001625
Reid Spencer0241e382004-11-25 04:51:04 +00001626dnl===-----------------------------------------------------------------------===
1627dnl===
1628dnl=== SECTION 8: Check for specific functions needed
1629dnl===
1630dnl===-----------------------------------------------------------------------===
1631
Chris Lattner6d5bdb02006-01-23 06:24:09 +00001632AC_CHECK_FUNCS([backtrace ceilf floorf roundf rintf nearbyintf getcwd ])
Gabor Greiff307d942007-07-13 09:48:29 +00001633AC_CHECK_FUNCS([powf fmodf strtof round ])
Owen Anderson132ae8b2013-02-07 00:21:34 +00001634AC_CHECK_FUNCS([log log2 log10 exp exp2])
Gabor Greiff307d942007-07-13 09:48:29 +00001635AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ])
Anton Korobeynikovd01defe2007-02-16 19:11:07 +00001636AC_CHECK_FUNCS([isatty mkdtemp mkstemp ])
Reid Kleckner37f69de2013-07-26 16:54:23 +00001637AC_CHECK_FUNCS([mktemp posix_spawn pread realpath sbrk setrlimit ])
Daniel Dunbar407a85e2012-05-05 16:36:16 +00001638AC_CHECK_FUNCS([strerror strerror_r setenv arc4random ])
Chris Lattner58cee552005-11-14 07:24:17 +00001639AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
Daniel Dunbar80da3fb2011-02-03 02:39:58 +00001640AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev])
Eric Christophera24dc7f2013-07-04 01:10:38 +00001641AC_CHECK_FUNCS([futimes futimens])
John Criswell42859552003-10-13 16:22:01 +00001642AC_C_PRINTF_A
Reid Spencer0241e382004-11-25 04:51:04 +00001643AC_FUNC_RAND48
John Criswell42859552003-10-13 16:22:01 +00001644
NAKAMURA Takumi189111802011-02-09 04:18:48 +00001645dnl Check the declaration "Secure API" on Windows environments.
1646AC_CHECK_DECLS([strerror_s])
1647
NAKAMURA Takumi03a541f2011-02-05 15:11:53 +00001648dnl Check symbols in libgcc.a for JIT on Mingw.
1649if test "$llvm_cv_os_type" = "MingW" ; then
1650 AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca]))
1651 AC_CHECK_LIB(gcc,__alloca,AC_DEFINE([HAVE___ALLOCA],[1],[Have host's __alloca]))
1652 AC_CHECK_LIB(gcc,__chkstk,AC_DEFINE([HAVE___CHKSTK],[1],[Have host's __chkstk]))
1653 AC_CHECK_LIB(gcc,___chkstk,AC_DEFINE([HAVE____CHKSTK],[1],[Have host's ___chkstk]))
1654
1655 AC_CHECK_LIB(gcc,__ashldi3,AC_DEFINE([HAVE___ASHLDI3],[1],[Have host's __ashldi3]))
1656 AC_CHECK_LIB(gcc,__ashrdi3,AC_DEFINE([HAVE___ASHRDI3],[1],[Have host's __ashrdi3]))
1657 AC_CHECK_LIB(gcc,__divdi3,AC_DEFINE([HAVE___DIVDI3],[1],[Have host's __divdi3]))
1658 AC_CHECK_LIB(gcc,__fixdfdi,AC_DEFINE([HAVE___FIXDFDI],[1],[Have host's __fixdfdi]))
1659 AC_CHECK_LIB(gcc,__fixsfdi,AC_DEFINE([HAVE___FIXSFDI],[1],[Have host's __fixsfdi]))
1660 AC_CHECK_LIB(gcc,__floatdidf,AC_DEFINE([HAVE___FLOATDIDF],[1],[Have host's __floatdidf]))
1661 AC_CHECK_LIB(gcc,__lshrdi3,AC_DEFINE([HAVE___LSHRDI3],[1],[Have host's __lshrdi3]))
1662 AC_CHECK_LIB(gcc,__moddi3,AC_DEFINE([HAVE___MODDI3],[1],[Have host's __moddi3]))
1663 AC_CHECK_LIB(gcc,__udivdi3,AC_DEFINE([HAVE___UDIVDI3],[1],[Have host's __udivdi3]))
1664 AC_CHECK_LIB(gcc,__umoddi3,AC_DEFINE([HAVE___UMODDI3],[1],[Have host's __umoddi3]))
1665
1666 AC_CHECK_LIB(gcc,__main,AC_DEFINE([HAVE___MAIN],[1],[Have host's __main]))
1667 AC_CHECK_LIB(gcc,__cmpdi2,AC_DEFINE([HAVE___CMPDI2],[1],[Have host's __cmpdi2]))
1668fi
1669
NAKAMURA Takumi4471f822011-05-01 13:29:49 +00001670dnl Check Win32 API EnumerateLoadedModules.
1671if test "$llvm_cv_os_type" = "MingW" ; then
1672 AC_MSG_CHECKING([whether EnumerateLoadedModules() accepts new decl])
NAKAMURA Takumie5bc87c2013-01-30 01:37:55 +00001673 AC_COMPILE_IFELSE(
1674[
1675 AC_LANG_SOURCE([[
1676 #include <windows.h>
1677 #include <imagehlp.h>
1678 extern void foo(PENUMLOADED_MODULES_CALLBACK);
1679 extern void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID));
1680 ]])
1681],
NAKAMURA Takumi4471f822011-05-01 13:29:49 +00001682[
1683 AC_MSG_RESULT([yes])
1684 llvm_cv_win32_elmcb_pcstr="PCSTR"
1685],
1686[
1687 AC_MSG_RESULT([no])
1688 llvm_cv_win32_elmcb_pcstr="PSTR"
1689])
1690 AC_DEFINE_UNQUOTED([WIN32_ELMCB_PCSTR],$llvm_cv_win32_elmcb_pcstr,[Type of 1st arg on ELM Callback])
1691fi
1692
Reid Spencer0241e382004-11-25 04:51:04 +00001693dnl Check for variations in the Standard C++ library and STL. These macros are
1694dnl provided by LLVM in the autoconf/m4 directory.
Brian Gaekebc9bff92004-06-22 23:43:04 +00001695AC_FUNC_ISNAN
Brian Gaeke499b01d2004-07-21 03:14:51 +00001696AC_FUNC_ISINF
Brian Gaekebc9bff92004-06-22 23:43:04 +00001697
Eric Christophere62b4412007-12-01 00:34:39 +00001698dnl Check for mmap support.We also need to know if /dev/zero is required to
1699dnl be opened for allocating RWX memory.
Anton Korobeynikov4480ec32007-01-20 07:40:26 +00001700dnl Make sure we aren't attempting to configure for an unknown system
1701if test "$llvm_cv_platform_type" = "Unix" ; then
Eric Christophere62b4412007-12-01 00:34:39 +00001702 AC_FUNC_MMAP
Anton Korobeynikov4480ec32007-01-20 07:40:26 +00001703 AC_FUNC_MMAP_FILE
1704 AC_NEED_DEV_ZERO_FOR_MMAP
Reid Spencer0241e382004-11-25 04:51:04 +00001705
Anton Korobeynikov4480ec32007-01-20 07:40:26 +00001706 if test "$ac_cv_func_mmap_fixed_mapped" = "no"
1707 then
1708 AC_MSG_WARN([mmap() of a fixed address required but not supported])
1709 fi
1710 if test "$ac_cv_func_mmap_file" = "no"
1711 then
1712 AC_MSG_WARN([mmap() of files required but not found])
1713 fi
John Criswell5ec24d82003-07-22 20:59:52 +00001714fi
1715
Owen Andersonb9509c52009-05-18 23:58:51 +00001716dnl atomic builtins are required for threading support.
Owen Andersonaf5db832009-05-19 22:18:56 +00001717AC_MSG_CHECKING(for GCC atomic builtins)
Eric Christopher84c95cc2010-07-28 20:26:34 +00001718dnl Since we'll be using these atomic builtins in C++ files we should test
1719dnl the C++ compiler.
1720AC_LANG_PUSH([C++])
Owen Andersonaf5db832009-05-19 22:18:56 +00001721AC_LINK_IFELSE(
NAKAMURA Takumie5bc87c2013-01-30 01:37:55 +00001722[
1723 AC_LANG_SOURCE([[
1724 int main() {
1725 volatile unsigned long val = 1;
1726 __sync_synchronize();
1727 __sync_val_compare_and_swap(&val, 1, 0);
1728 __sync_add_and_fetch(&val, 1);
1729 __sync_sub_and_fetch(&val, 1);
1730 return 0;
1731 }
1732 ]])
1733],
1734[
1735 AC_MSG_RESULT([yes])
1736 AC_DEFINE([LLVM_HAS_ATOMICS], [1], [Has gcc/MSVC atomic intrinsics])
1737],
1738[
1739 AC_MSG_RESULT([no])
1740 AC_DEFINE([LLVM_HAS_ATOMICS], [0], [Has gcc/MSVC atomic intrinsics])
1741 AC_MSG_WARN([LLVM will be built thread-unsafe because atomic builtins are missing])
1742])
1743AC_LANG_POP([C++])
Owen Andersonb9509c52009-05-18 23:58:51 +00001744
Reid Spencer0241e382004-11-25 04:51:04 +00001745dnl===-----------------------------------------------------------------------===
1746dnl===
1747dnl=== SECTION 9: Additional checks, variables, etc.
1748dnl===
1749dnl===-----------------------------------------------------------------------===
John Criswell7a3334d2003-07-22 19:13:20 +00001750
Nick Lewyckyfa4c2d32009-09-29 06:18:00 +00001751dnl Handle 32-bit linux systems running a 64-bit kernel.
1752dnl This has to come after section 4 because it invokes the compiler.
1753if test "$llvm_cv_os_type" = "Linux" -a "$llvm_cv_target_arch" = "x86_64" ; then
1754 AC_IS_LINUX_MIXED
1755 if test "$llvm_cv_linux_mixed" = "yes"; then
1756 llvm_cv_target_arch="x86"
1757 ARCH="x86"
1758 fi
1759fi
1760
Eric Christopher81858452011-09-20 22:26:35 +00001761dnl Check whether __dso_handle is present
Anton Korobeynikov7ac25212007-07-30 20:02:02 +00001762AC_CHECK_FUNCS([__dso_handle])
1763
Eric Christophere62b4412007-12-01 00:34:39 +00001764dnl Propagate the shared library extension that the libltdl checks did to
Reid Spencera40c6872004-11-29 12:29:58 +00001765dnl the Makefiles so we can use it there too
1766AC_SUBST(SHLIBEXT,$libltdl_cv_shlibext)
Brian Gaekecc3676b2004-01-21 19:38:56 +00001767
Jeffrey Yasskin6b718f72010-02-25 06:34:33 +00001768dnl Propagate the run-time library path variable that the libltdl
1769dnl checks found to the Makefiles so we can use it there too
1770AC_SUBST(SHLIBPATH_VAR,$libltdl_cv_shlibpath_var)
1771
Gabor Greife0d58d32012-01-26 10:28:58 +00001772dnl Translate the various configuration directories and other basic
1773dnl information into substitutions that will end up in Makefile.config.in
1774dnl that these configured values can be used by the makefiles
Jeff Cohenc5e5b272007-01-12 18:22:38 +00001775if test "${prefix}" = "NONE" ; then
Reid Spencer40f1b132006-05-16 08:53:32 +00001776 prefix="/usr/local"
1777fi
Reid Spencercf05c122004-08-20 09:03:12 +00001778eval LLVM_PREFIX="${prefix}";
1779eval LLVM_BINDIR="${prefix}/bin";
Reid Spencer0194c9a2004-11-29 04:56:35 +00001780eval LLVM_DATADIR="${prefix}/share/llvm";
Eric Christopherb3762a02010-03-02 05:17:21 +00001781eval LLVM_DOCSDIR="${prefix}/share/doc/llvm";
Reid Spencer0194c9a2004-11-29 04:56:35 +00001782eval LLVM_ETCDIR="${prefix}/etc/llvm";
Reid Spencercf05c122004-08-20 09:03:12 +00001783eval LLVM_INCLUDEDIR="${prefix}/include";
1784eval LLVM_INFODIR="${prefix}/info";
1785eval LLVM_MANDIR="${prefix}/man";
1786LLVM_CONFIGTIME=`date`
1787AC_SUBST(LLVM_PREFIX)
1788AC_SUBST(LLVM_BINDIR)
Reid Spencercf05c122004-08-20 09:03:12 +00001789AC_SUBST(LLVM_DATADIR)
1790AC_SUBST(LLVM_DOCSDIR)
1791AC_SUBST(LLVM_ETCDIR)
1792AC_SUBST(LLVM_INCLUDEDIR)
1793AC_SUBST(LLVM_INFODIR)
1794AC_SUBST(LLVM_MANDIR)
1795AC_SUBST(LLVM_CONFIGTIME)
Reid Spencercf05c122004-08-20 09:03:12 +00001796
Daniel Dunbar9370ecf2012-03-02 16:24:21 +00001797dnl Disable embedding timestamps in the build directory, with ENABLE_TIMESTAMPS.
1798if test "${ENABLE_TIMESTAMPS}" = "0"; then
1799 LLVM_CONFIGTIME="(timestamp not enabled)"
1800fi
1801
Gabor Greife0d58d32012-01-26 10:28:58 +00001802dnl Place the various directories into the config.h file as #defines so that we
1803dnl can know about the installation paths within LLVM.
Eric Christophere62b4412007-12-01 00:34:39 +00001804AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX",
Reid Spencer0241e382004-11-25 04:51:04 +00001805 [Installation prefix directory])
Eric Christophere62b4412007-12-01 00:34:39 +00001806AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR",
Reid Spencer0241e382004-11-25 04:51:04 +00001807 [Installation directory for binary executables])
Eric Christophere62b4412007-12-01 00:34:39 +00001808AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR",
Reid Spencer0241e382004-11-25 04:51:04 +00001809 [Installation directory for data files])
Eric Christophere62b4412007-12-01 00:34:39 +00001810AC_DEFINE_UNQUOTED(LLVM_DOCSDIR, "$LLVM_DOCSDIR",
Reid Spencer0241e382004-11-25 04:51:04 +00001811 [Installation directory for documentation])
Eric Christophere62b4412007-12-01 00:34:39 +00001812AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR",
Reid Spencer0241e382004-11-25 04:51:04 +00001813 [Installation directory for config files])
Eric Christophere62b4412007-12-01 00:34:39 +00001814AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR",
Reid Spencer0241e382004-11-25 04:51:04 +00001815 [Installation directory for include files])
Eric Christophere62b4412007-12-01 00:34:39 +00001816AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR",
Reid Spencer0241e382004-11-25 04:51:04 +00001817 [Installation directory for .info files])
Eric Christophere62b4412007-12-01 00:34:39 +00001818AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR",
Reid Spencer0241e382004-11-25 04:51:04 +00001819 [Installation directory for man pages])
Eric Christophere62b4412007-12-01 00:34:39 +00001820AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
Reid Spencer0241e382004-11-25 04:51:04 +00001821 [Time at which LLVM was configured])
Tim Northoverfee13d12013-05-04 07:36:23 +00001822AC_DEFINE_UNQUOTED(LLVM_HOST_TRIPLE, "$host",
NAKAMURA Takumi43652ae2012-07-22 03:04:52 +00001823 [Host triple LLVM will be executed on])
Sebastian Popec2fb222011-11-01 21:31:44 +00001824AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target",
1825 [Target triple LLVM will generate code for by default])
Reid Spencer0241e382004-11-25 04:51:04 +00001826
Gabor Greife0d58d32012-01-26 10:28:58 +00001827dnl Determine which bindings to build.
Gordon Henriksend48f4592007-10-02 09:50:18 +00001828if test "$BINDINGS_TO_BUILD" = auto ; then
1829 BINDINGS_TO_BUILD=""
1830 if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then
1831 BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD"
1832 fi
1833fi
1834AC_SUBST(BINDINGS_TO_BUILD,$BINDINGS_TO_BUILD)
1835
Gabor Greife0d58d32012-01-26 10:28:58 +00001836dnl This isn't really configurey, but it avoids having to repeat the list in
1837dnl other files.
Gordon Henriksend48f4592007-10-02 09:50:18 +00001838AC_SUBST(ALL_BINDINGS,ocaml)
1839
Gabor Greife0d58d32012-01-26 10:28:58 +00001840dnl Do any work necessary to ensure that bindings have what they need.
Gordon Henriksen3be1f102007-10-02 16:42:10 +00001841binding_prereqs_failed=0
1842for a_binding in $BINDINGS_TO_BUILD ; do
1843 case "$a_binding" in
1844 ocaml)
1845 if test "x$OCAMLC" = x ; then
1846 AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc])
1847 binding_prereqs_failed=1
1848 fi
1849 if test "x$OCAMLDEP" = x ; then
1850 AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep])
1851 binding_prereqs_failed=1
1852 fi
1853 if test "x$OCAMLOPT" = x ; then
1854 AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt])
Eric Christophere62b4412007-12-01 00:34:39 +00001855 dnl ocamlopt is optional!
Gordon Henriksen3be1f102007-10-02 16:42:10 +00001856 fi
1857 if test "x$with_ocaml_libdir" != xauto ; then
1858 AC_SUBST(OCAML_LIBDIR,$with_ocaml_libdir)
1859 else
1860 ocaml_stdlib="`"$OCAMLC" -where`"
1861 if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~"
1862 then
1863 # ocaml stdlib is beneath our prefix; use stdlib
1864 AC_SUBST(OCAML_LIBDIR,$ocaml_stdlib)
1865 else
1866 # ocaml stdlib is outside our prefix; use libdir/ocaml
Rafael Espindolab58973f2013-06-11 18:52:11 +00001867 AC_SUBST(OCAML_LIBDIR,${prefix}/lib/ocaml)
Gordon Henriksen3be1f102007-10-02 16:42:10 +00001868 fi
1869 fi
1870 ;;
1871 esac
1872done
1873if test "$binding_prereqs_failed" = 1 ; then
1874 AC_MSG_ERROR([Prequisites for bindings not satisfied. Fix them or use configure --disable-bindings.])
1875fi
1876
Nick Lewycky16aac992009-03-05 08:20:21 +00001877dnl Determine whether the compiler supports -fvisibility-inlines-hidden.
Daniel Dunbar61e0a822008-09-02 17:35:16 +00001878AC_CXX_USE_VISIBILITY_INLINES_HIDDEN
Gordon Henriksen3be1f102007-10-02 16:42:10 +00001879
Nick Lewycky7d01e392009-03-03 04:55:15 +00001880dnl Determine linker rpath flag
Nick Lewycky16aac992009-03-05 08:20:21 +00001881if test "$llvm_cv_link_use_r" = "yes" ; then
1882 RPATH="-Wl,-R"
1883else
1884 RPATH="-Wl,-rpath"
1885fi
Nick Lewycky7d01e392009-03-03 04:55:15 +00001886AC_SUBST(RPATH)
1887
Nick Lewycky16aac992009-03-05 08:20:21 +00001888dnl Determine linker rdynamic flag
1889if test "$llvm_cv_link_use_export_dynamic" = "yes" ; then
Bob Wilson8658b912013-08-02 22:51:06 +00001890 RDYNAMIC="-rdynamic"
Nick Lewycky16aac992009-03-05 08:20:21 +00001891else
1892 RDYNAMIC=""
1893fi
1894AC_SUBST(RDYNAMIC)
1895
Reid Spencer0241e382004-11-25 04:51:04 +00001896dnl===-----------------------------------------------------------------------===
1897dnl===
1898dnl=== SECTION 10: Specify the output files and generate it
1899dnl===
1900dnl===-----------------------------------------------------------------------===
1901
1902dnl Configure header files
Reid Spencerb48e3f82005-08-24 10:43:10 +00001903dnl WARNING: dnl If you add or remove any of the following config headers, then
Dylan Noblesmithc1209572012-01-17 02:56:49 +00001904dnl you MUST also update Makefile so that the variable FilesToConfig
Reid Spencerb48e3f82005-08-24 10:43:10 +00001905dnl contains the same list of files as AC_CONFIG_HEADERS below. This ensures the
1906dnl files can be updated automatically when their *.in sources change.
Eric Christopherf24446d2010-08-08 02:44:17 +00001907AC_CONFIG_HEADERS([include/llvm/Config/config.h include/llvm/Config/llvm-config.h])
Eric Christophere8f47dd2010-08-08 09:18:29 +00001908AH_TOP([#ifndef CONFIG_H
1909#define CONFIG_H])
1910AH_BOTTOM([#endif])
1911
Douglas Gregor1b731d52009-06-16 20:12:29 +00001912AC_CONFIG_FILES([include/llvm/Config/Targets.def])
1913AC_CONFIG_FILES([include/llvm/Config/AsmPrinters.def])
Daniel Dunbarce77aa02009-07-17 20:56:18 +00001914AC_CONFIG_FILES([include/llvm/Config/AsmParsers.def])
Daniel Dunbarf4721292009-11-25 04:30:13 +00001915AC_CONFIG_FILES([include/llvm/Config/Disassemblers.def])
Michael J. Spencer447762d2010-11-29 18:16:10 +00001916AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h])
Reid Spencer0241e382004-11-25 04:51:04 +00001917
1918dnl Configure the makefile's configuration data
1919AC_CONFIG_FILES([Makefile.config])
1920
Reid Spencer1277ba22006-08-16 00:45:38 +00001921dnl Configure the RPM spec file for LLVM
1922AC_CONFIG_FILES([llvm.spec])
1923
Peter Collingbourne5ac59df2011-05-13 03:27:56 +00001924dnl Configure doxygen's configuration file
1925AC_CONFIG_FILES([docs/doxygen.cfg])
Dylan Noblesmith57f439c2012-02-01 14:06:21 +00001926
1927dnl Configure clang, if present
Dylan Noblesmithe21a3b22012-02-04 02:41:36 +00001928if test "${clang_src_root}" = ""; then
Dylan Noblesmitha3670222012-02-02 00:54:18 +00001929 clang_src_root="$srcdir/tools/clang"
Dylan Noblesmithb5190ab2012-02-02 00:17:33 +00001930fi
Dylan Noblesmith2badba52012-02-02 00:11:14 +00001931if test -f ${clang_src_root}/README.txt; then
Dylan Noblesmitha7a29c172012-02-04 03:00:50 +00001932 dnl Use variables to stay under 80 columns.
1933 configh="include/clang/Config/config.h"
1934 doxy="docs/doxygen.cfg"
1935 AC_CONFIG_HEADERS([tools/clang/${configh}:${clang_src_root}/${configh}.in])
1936 AC_CONFIG_FILES([tools/clang/${doxy}:${clang_src_root}/${doxy}.in])
Peter Collingbourne5ac59df2011-05-13 03:27:56 +00001937fi
1938
Torok Edwin229f8d72011-10-14 20:38:02 +00001939dnl OCaml findlib META file
1940AC_CONFIG_FILES([bindings/ocaml/llvm/META.llvm])
1941
Jordan Rose3c837ab2012-10-01 18:40:32 +00001942dnl Add --program-prefix value to Makefile.rules. Already an ARG variable.
1943test "x$program_prefix" = "xNONE" && program_prefix=""
1944AC_SUBST([program_prefix])
1945
1946
Reid Spencer0241e382004-11-25 04:51:04 +00001947dnl Do special configuration of Makefiles
Reid Spencerf3102c22005-02-24 18:31:27 +00001948AC_CONFIG_COMMANDS([setup],,[llvm_src="${srcdir}"])
Reid Spencer0241e382004-11-25 04:51:04 +00001949AC_CONFIG_MAKEFILE(Makefile)
1950AC_CONFIG_MAKEFILE(Makefile.common)
1951AC_CONFIG_MAKEFILE(examples/Makefile)
1952AC_CONFIG_MAKEFILE(lib/Makefile)
Reid Spencer4b8067f2006-11-17 03:32:33 +00001953AC_CONFIG_MAKEFILE(runtime/Makefile)
Reid Spencer0241e382004-11-25 04:51:04 +00001954AC_CONFIG_MAKEFILE(test/Makefile)
1955AC_CONFIG_MAKEFILE(test/Makefile.tests)
Bill Wendling8790e322009-01-04 23:12:21 +00001956AC_CONFIG_MAKEFILE(unittests/Makefile)
Reid Spencer0241e382004-11-25 04:51:04 +00001957AC_CONFIG_MAKEFILE(tools/Makefile)
Reid Spencer0241e382004-11-25 04:51:04 +00001958AC_CONFIG_MAKEFILE(utils/Makefile)
1959AC_CONFIG_MAKEFILE(projects/Makefile)
Gordon Henriksen54fd7572007-09-22 21:36:22 +00001960AC_CONFIG_MAKEFILE(bindings/Makefile)
1961AC_CONFIG_MAKEFILE(bindings/ocaml/Makefile.ocaml)
Reid Spencer0241e382004-11-25 04:51:04 +00001962
1963dnl Finally, crank out the output
Reid Spencer2024d0e2004-09-19 23:43:52 +00001964AC_OUTPUT