blob: b21d3d9318d7b24a6a96e1182bf16dcd60e80874 [file] [log] [blame]
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001dnl === configure.ac --------------------------------------------------------===
2dnl The LLVM Compiler Infrastructure
3dnl
Chris Lattner234d5292007-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 Christopher790e11c2007-12-01 00:34:39 +00006dnl
Reid Spencer5e1d9a52004-11-25 04:51:04 +00007dnl===-----------------------------------------------------------------------===
8dnl This is the LLVM configuration script. It is processed by the autoconf
Eric Christopher790e11c2007-12-01 00:34:39 +00009dnl program to produce a script named configure. This script contains the
Reid Spencer5e1d9a52004-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 Noblesmith7fe0e032011-12-18 18:50:16 +000033dnl address for reporting bugs.
34AC_INIT([LLVM],[3.1svn],[http://llvm.org/bugs/])
Dylan Noblesmithfde82372012-02-13 18:48:10 +000035AC_DEFINE([LLVM_VERSION_MAJOR], [3], [Major version of the LLVM API])
36AC_DEFINE([LLVM_VERSION_MINOR], [1], [Minor version of the LLVM API])
John Criswell4ea390d2003-07-22 19:13:20 +000037
Reid Spencer5e1d9a52004-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 Takumi45ba1652012-01-01 08:16:56 +000040AC_SUBST(LLVM_COPYRIGHT,["Copyright (c) 2003-2012 University of Illinois at Urbana-Champaign."])
41AC_COPYRIGHT([Copyright (c) 2003-2012 University of Illinois at Urbana-Champaign.])
Reid Spencer5e1d9a52004-11-25 04:51:04 +000042
Eric Christopherd8282cd2011-09-23 00:53:10 +000043dnl Indicate that we require autoconf 2.60 or later.
44AC_PREREQ(2.60)
Reid Spencer5e1d9a52004-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)
48AC_CONFIG_SRCDIR([lib/VMCore/Module.cpp])
49
Eric Christopher790e11c2007-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 Criswell4ea390d2003-07-22 19:13:20 +000052AC_CONFIG_AUX_DIR([autoconf])
53
John Criswell93e1c722003-09-15 17:04:06 +000054dnl Quit if the source directory has already been configured.
John Criswell1b824322003-09-15 17:19:42 +000055dnl NOTE: This relies upon undocumented autoconf behavior.
Reid Spencerc1b0d492004-09-19 23:43:52 +000056if test ${srcdir} != "." ; then
Reid Spencer5e1d9a52004-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 Criswell93e1c722003-09-15 17:04:06 +000060fi
61
Eric Christopherffee5722011-09-16 20:36:25 +000062dnl We need to check for the compiler up here to avoid anything else
63dnl starting with a different one.
64AC_PROG_CC(clang llvm-gcc gcc)
65AC_PROG_CXX(clang++ llvm-g++ g++)
66AC_PROG_CPP
67
Reid Spencer5e1d9a52004-11-25 04:51:04 +000068dnl Configure all of the projects present in our source tree. While we could
69dnl just AC_CONFIG_SUBDIRS on the set of directories in projects that have a
70dnl configure script, that usage of the AC_CONFIG_SUBDIRS macro is deprecated.
71dnl Instead we match on the known projects.
John Criswell0157f502010-03-19 21:31:39 +000072
73dnl
74dnl One tricky part of doing this is that some projects depend upon other
75dnl projects. For example, several projects rely upon the LLVM test suite.
76dnl We want to configure those projects first so that their object trees are
77dnl created before running the configure scripts of projects that depend upon
78dnl them.
79dnl
80
81dnl Several projects use llvm-gcc, so configure that first
82if test -d ${srcdir}/projects/llvm-gcc ; then
83 AC_CONFIG_SUBDIRS([projects/llvm-gcc])
84fi
85
86dnl Several projects use the LLVM test suite, so configure it next.
87if test -d ${srcdir}/projects/test-suite ; then
88 AC_CONFIG_SUBDIRS([projects/test-suite])
89fi
90
91dnl llvm-test is the old name of the test-suite, kept here for backwards
92dnl compatibility
93if test -d ${srcdir}/projects/llvm-test ; then
94 AC_CONFIG_SUBDIRS([projects/llvm-test])
95fi
96
97dnl Some projects use poolalloc; configure that next
98if test -d ${srcdir}/projects/poolalloc ; then
99 AC_CONFIG_SUBDIRS([projects/poolalloc])
100fi
101
102if test -d ${srcdir}/projects/llvm-poolalloc ; then
103 AC_CONFIG_SUBDIRS([projects/llvm-poolalloc])
104fi
105
106dnl Check for all other projects
John Criswell33a911a2003-11-25 20:36:46 +0000107for i in `ls ${srcdir}/projects`
108do
Reid Spencerf7b2de52004-09-07 16:26:18 +0000109 if test -d ${srcdir}/projects/${i} ; then
110 case ${i} in
Reid Spencer67bb0792007-01-17 02:14:46 +0000111 sample) AC_CONFIG_SUBDIRS([projects/sample]) ;;
112 privbracket) AC_CONFIG_SUBDIRS([projects/privbracket]) ;;
113 llvm-stacker) AC_CONFIG_SUBDIRS([projects/llvm-stacker]) ;;
Reid Spencer67bb0792007-01-17 02:14:46 +0000114 llvm-reopt) AC_CONFIG_SUBDIRS([projects/llvm-reopt]);;
Reid Spencer67bb0792007-01-17 02:14:46 +0000115 llvm-java) AC_CONFIG_SUBDIRS([projects/llvm-java]) ;;
116 llvm-tv) AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;;
John Criswell7def2932010-02-25 22:57:19 +0000117 safecode) AC_CONFIG_SUBDIRS([projects/safecode]) ;;
Reid Spencer67bb0792007-01-17 02:14:46 +0000118 llvm-kernel) AC_CONFIG_SUBDIRS([projects/llvm-kernel]) ;;
Daniel Dunbard45162b2011-12-07 22:07:03 +0000119 compiler-rt) ;;
John Criswell52c02862010-03-25 13:59:09 +0000120 llvm-gcc) ;;
121 test-suite) ;;
122 llvm-test) ;;
123 poolalloc) ;;
124 llvm-poolalloc) ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000125 *)
Alkis Evlogimenosa281b6fa2004-09-27 07:35:19 +0000126 AC_MSG_WARN([Unknown project (${i}) won't be configured automatically])
Reid Spencerc2186e22004-09-21 17:12:35 +0000127 ;;
Reid Spencerf7b2de52004-09-07 16:26:18 +0000128 esac
John Criswell33a911a2003-11-25 20:36:46 +0000129 fi
130done
John Criswell559a6c12003-09-30 16:31:48 +0000131
Tobias Grosserbaaadb22010-10-30 00:54:26 +0000132dnl Disable the build of polly, even if it is checked out into tools/polly.
133AC_ARG_ENABLE(polly,
134 AS_HELP_STRING([--enable-polly],
135 [Use polly if available (default is YES)]),,
136 enableval=default)
137case "$enableval" in
138 yes) AC_SUBST(ENABLE_POLLY,[1]) ;;
139 no) AC_SUBST(ENABLE_POLLY,[0]) ;;
140 default) AC_SUBST(ENABLE_POLLY,[1]) ;;
141 *) AC_MSG_ERROR([Invalid setting for --enable-polly. Use "yes" or "no"]) ;;
142esac
143
144
145dnl Check if polly is checked out into tools/polly and configure it if
146dnl available.
147if (test -d ${srcdir}/tools/polly) && (test $ENABLE_POLLY -eq 1) ; then
148 AC_SUBST(LLVM_HAS_POLLY,1)
149 AC_CONFIG_SUBDIRS([tools/polly])
150fi
151
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000152dnl===-----------------------------------------------------------------------===
153dnl===
154dnl=== SECTION 2: Architecture, target, and host checks
155dnl===
156dnl===-----------------------------------------------------------------------===
John Criswelldc76e322004-07-23 15:40:57 +0000157
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000158dnl Check the target for which we're compiling and the host that will do the
Eric Christopher790e11c2007-12-01 00:34:39 +0000159dnl compilations. This will tell us which LLVM compiler will be used for
160dnl compiling SSA into object code. This needs to be done early because
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000161dnl following tests depend on it.
John Criswell4ea390d2003-07-22 19:13:20 +0000162AC_CANONICAL_TARGET
163
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000164dnl Determine the platform type and cache its value. This helps us configure
165dnl the System library to the correct build platform.
Reid Spencere2cfe5d2006-07-26 21:14:56 +0000166AC_CACHE_CHECK([type of operating system we're going to host on],
Reid Spencer7b3e8512004-12-24 06:29:05 +0000167 [llvm_cv_os_type],
Reid Spencere2cfe5d2006-07-26 21:14:56 +0000168[case $host in
Eric Christopher790e11c2007-12-01 00:34:39 +0000169 *-*-aix*)
Reid Spencera773bd52006-08-04 18:18:08 +0000170 llvm_cv_link_all_option="-Wl,--whole-archive"
171 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christopher790e11c2007-12-01 00:34:39 +0000172 llvm_cv_os_type="AIX"
Reid Spencer7b3e8512004-12-24 06:29:05 +0000173 llvm_cv_platform_type="Unix" ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000174 *-*-irix*)
Reid Spencer6ccd01a2006-08-22 22:21:38 +0000175 llvm_cv_link_all_option="-Wl,--whole-archive"
176 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christopher790e11c2007-12-01 00:34:39 +0000177 llvm_cv_os_type="IRIX"
Reid Spencer6ccd01a2006-08-22 22:21:38 +0000178 llvm_cv_platform_type="Unix" ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000179 *-*-cygwin*)
Reid Spencera773bd52006-08-04 18:18:08 +0000180 llvm_cv_link_all_option="-Wl,--whole-archive"
181 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christopher790e11c2007-12-01 00:34:39 +0000182 llvm_cv_os_type="Cygwin"
Reid Spencer7b3e8512004-12-24 06:29:05 +0000183 llvm_cv_platform_type="Unix" ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000184 *-*-darwin*)
Reid Spencera773bd52006-08-04 18:18:08 +0000185 llvm_cv_link_all_option="-Wl,-all_load"
Chris Lattnerf5c94672008-02-05 19:43:40 +0000186 llvm_cv_no_link_all_option="-Wl,-noall_load"
Reid Spencer7b3e8512004-12-24 06:29:05 +0000187 llvm_cv_os_type="Darwin"
188 llvm_cv_platform_type="Unix" ;;
Chris Lattner21aa3472010-04-09 20:45:04 +0000189 *-*-minix*)
190 llvm_cv_link_all_option="-Wl,-all_load"
191 llvm_cv_no_link_all_option="-Wl,-noall_load"
192 llvm_cv_os_type="Minix"
193 llvm_cv_platform_type="Unix" ;;
Rafael Espindolaf6139192011-12-22 14:01:18 +0000194 *-*-freebsd* | *-*-kfreebsd-gnu)
Reid Spencera773bd52006-08-04 18:18:08 +0000195 llvm_cv_link_all_option="-Wl,--whole-archive"
196 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christopher790e11c2007-12-01 00:34:39 +0000197 llvm_cv_os_type="FreeBSD"
Reid Spencer7b3e8512004-12-24 06:29:05 +0000198 llvm_cv_platform_type="Unix" ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000199 *-*-openbsd*)
Reid Spencera773bd52006-08-04 18:18:08 +0000200 llvm_cv_link_all_option="-Wl,--whole-archive"
201 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christopher790e11c2007-12-01 00:34:39 +0000202 llvm_cv_os_type="OpenBSD"
Reid Spencer1014ab42006-04-19 23:47:16 +0000203 llvm_cv_platform_type="Unix" ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000204 *-*-netbsd*)
Reid Spencer377170a2007-01-20 20:43:35 +0000205 llvm_cv_link_all_option="-Wl,--whole-archive"
206 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christopher790e11c2007-12-01 00:34:39 +0000207 llvm_cv_os_type="NetBSD"
Reid Spencer377170a2007-01-20 20:43:35 +0000208 llvm_cv_platform_type="Unix" ;;
Matthijs Kooijmanf5122812008-06-26 10:36:58 +0000209 *-*-dragonfly*)
210 llvm_cv_link_all_option="-Wl,--whole-archive"
211 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
212 llvm_cv_os_type="DragonFly"
213 llvm_cv_platform_type="Unix" ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000214 *-*-hpux*)
Reid Spencera773bd52006-08-04 18:18:08 +0000215 llvm_cv_link_all_option="-Wl,--whole-archive"
216 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christopher790e11c2007-12-01 00:34:39 +0000217 llvm_cv_os_type="HP-UX"
Duraid Madina4c61d922005-05-16 05:39:00 +0000218 llvm_cv_platform_type="Unix" ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000219 *-*-interix*)
Reid Spencera773bd52006-08-04 18:18:08 +0000220 llvm_cv_link_all_option="-Wl,--whole-archive"
221 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Reid Spencer7b3e8512004-12-24 06:29:05 +0000222 llvm_cv_os_type="Interix"
223 llvm_cv_platform_type="Unix" ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000224 *-*-linux*)
Reid Spencera773bd52006-08-04 18:18:08 +0000225 llvm_cv_link_all_option="-Wl,--whole-archive"
226 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Reid Spencer7b3e8512004-12-24 06:29:05 +0000227 llvm_cv_os_type="Linux"
228 llvm_cv_platform_type="Unix" ;;
Rafael Espindolaf6139192011-12-22 14:01:18 +0000229 *-*-gnu*)
230 llvm_cv_link_all_option="-Wl,--whole-archive"
231 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
232 llvm_cv_os_type="GNU"
233 llvm_cv_platform_type="Unix" ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000234 *-*-solaris*)
Reid Spencera773bd52006-08-04 18:18:08 +0000235 llvm_cv_link_all_option="-Wl,-z,allextract"
236 llvm_cv_no_link_all_option="-Wl,-z,defaultextract"
Reid Spencer7b3e8512004-12-24 06:29:05 +0000237 llvm_cv_os_type="SunOS"
238 llvm_cv_platform_type="Unix" ;;
Edward O'Callaghan2b19d692009-10-14 00:44:50 +0000239 *-*-auroraux*)
240 llvm_cv_link_all_option="-Wl,-z,allextract"
241 llvm_cv_link_all_option="-Wl,-z,defaultextract"
242 llvm_cv_os_type="AuroraUX"
243 llvm_cv_platform_type="Unix" ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000244 *-*-win32*)
Reid Spencera773bd52006-08-04 18:18:08 +0000245 llvm_cv_link_all_option="-Wl,--whole-archive"
246 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Reid Spencer7b3e8512004-12-24 06:29:05 +0000247 llvm_cv_os_type="Win32"
248 llvm_cv_platform_type="Win32" ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000249 *-*-mingw*)
Reid Spencera773bd52006-08-04 18:18:08 +0000250 llvm_cv_link_all_option="-Wl,--whole-archive"
251 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
Eric Christopher790e11c2007-12-01 00:34:39 +0000252 llvm_cv_os_type="MingW"
Reid Spencer7b3e8512004-12-24 06:29:05 +0000253 llvm_cv_platform_type="Win32" ;;
Edward O'Callaghandf406642009-10-12 04:57:20 +0000254 *-*-haiku*)
255 llvm_cv_link_all_option="-Wl,--whole-archive"
256 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
257 llvm_cv_os_type="Haiku"
Eric Christopherec274962010-03-02 05:17:21 +0000258 llvm_cv_platform_type="Unix" ;;
Anton Korobeynikove55db742009-08-18 00:40:33 +0000259 *-unknown-eabi*)
260 llvm_cv_link_all_option="-Wl,--whole-archive"
261 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
262 llvm_cv_os_type="Freestanding"
263 llvm_cv_platform_type="Unix" ;;
264 *-unknown-elf*)
265 llvm_cv_link_all_option="-Wl,--whole-archive"
266 llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
267 llvm_cv_os_type="Freestanding"
268 llvm_cv_platform_type="Unix" ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000269 *)
270 llvm_cv_link_all_option=""
Reid Spencera773bd52006-08-04 18:18:08 +0000271 llvm_cv_no_link_all_option=""
Eric Christopher790e11c2007-12-01 00:34:39 +0000272 llvm_cv_os_type="Unknown"
Reid Spencer7b3e8512004-12-24 06:29:05 +0000273 llvm_cv_platform_type="Unknown" ;;
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000274esac])
John Criswell4ea390d2003-07-22 19:13:20 +0000275
Anton Korobeynikove55db742009-08-18 00:40:33 +0000276AC_CACHE_CHECK([type of operating system we're going to target],
277 [llvm_cv_target_os_type],
278[case $target in
279 *-*-aix*)
280 llvm_cv_target_os_type="AIX" ;;
281 *-*-irix*)
282 llvm_cv_target_os_type="IRIX" ;;
283 *-*-cygwin*)
284 llvm_cv_target_os_type="Cygwin" ;;
285 *-*-darwin*)
286 llvm_cv_target_os_type="Darwin" ;;
Chris Lattner21aa3472010-04-09 20:45:04 +0000287 *-*-minix*)
288 llvm_cv_target_os_type="Minix" ;;
Anton Korobeynikove55db742009-08-18 00:40:33 +0000289 *-*-freebsd*)
290 llvm_cv_target_os_type="FreeBSD" ;;
291 *-*-openbsd*)
292 llvm_cv_target_os_type="OpenBSD" ;;
293 *-*-netbsd*)
294 llvm_cv_target_os_type="NetBSD" ;;
295 *-*-dragonfly*)
296 llvm_cv_target_os_type="DragonFly" ;;
297 *-*-hpux*)
298 llvm_cv_target_os_type="HP-UX" ;;
299 *-*-interix*)
300 llvm_cv_target_os_type="Interix" ;;
301 *-*-linux*)
302 llvm_cv_target_os_type="Linux" ;;
303 *-*-solaris*)
304 llvm_cv_target_os_type="SunOS" ;;
Edward O'Callaghan2b19d692009-10-14 00:44:50 +0000305 *-*-auroraux*)
306 llvm_cv_target_os_type="AuroraUX" ;;
Anton Korobeynikove55db742009-08-18 00:40:33 +0000307 *-*-win32*)
308 llvm_cv_target_os_type="Win32" ;;
309 *-*-mingw*)
310 llvm_cv_target_os_type="MingW" ;;
Edward O'Callaghandf406642009-10-12 04:57:20 +0000311 *-*-haiku*)
Eric Christopherec274962010-03-02 05:17:21 +0000312 llvm_cv_target_os_type="Haiku" ;;
Douglas Gregor6ced1d12011-07-01 22:41:06 +0000313 *-*-rtems*)
314 llvm_cv_target_os_type="RTEMS" ;;
Ivan Krasinfb234622011-08-18 22:54:21 +0000315 *-*-nacl*)
316 llvm_cv_target_os_type="NativeClient" ;;
Anton Korobeynikove55db742009-08-18 00:40:33 +0000317 *-unknown-eabi*)
318 llvm_cv_target_os_type="Freestanding" ;;
319 *)
320 llvm_cv_target_os_type="Unknown" ;;
321esac])
322
Reid Spencer886e9512004-08-31 01:34:10 +0000323dnl Make sure we aren't attempting to configure for an unknown system
Reid Spencer7b3e8512004-12-24 06:29:05 +0000324if test "$llvm_cv_os_type" = "Unknown" ; then
325 AC_MSG_ERROR([Operating system is unknown, configure can't continue])
Reid Spencer886e9512004-08-31 01:34:10 +0000326fi
327
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000328dnl Set the "OS" Makefile variable based on the platform type so the
329dnl makefile can configure itself to specific build hosts
Reid Spencer7b3e8512004-12-24 06:29:05 +0000330AC_SUBST(OS,$llvm_cv_os_type)
Anton Korobeynikove55db742009-08-18 00:40:33 +0000331AC_SUBST(HOST_OS,$llvm_cv_os_type)
332AC_SUBST(TARGET_OS,$llvm_cv_target_os_type)
Reid Spencer7b3e8512004-12-24 06:29:05 +0000333
Reid Spencera773bd52006-08-04 18:18:08 +0000334dnl Set the LINKALL and NOLINKALL Makefile variables based on the platform
335AC_SUBST(LINKALL,$llvm_cv_link_all_option)
336AC_SUBST(NOLINKALL,$llvm_cv_no_link_all_option)
337
Dan Gohman4b393842010-08-04 16:48:36 +0000338dnl Set the "LLVM_ON_*" variables based on llvm_cv_platform_type
Michael J. Spencer1f6efa32010-11-29 18:16:10 +0000339dnl This is used by lib/Support to determine the basic kind of implementation
Reid Spencer7b3e8512004-12-24 06:29:05 +0000340dnl to use.
341case $llvm_cv_platform_type in
Eric Christopher790e11c2007-12-01 00:34:39 +0000342 Unix)
343 AC_DEFINE([LLVM_ON_UNIX],[1],[Define if this is Unixish platform])
Reid Spencerbbf7a8a2004-12-31 22:54:28 +0000344 AC_SUBST(LLVM_ON_UNIX,[1])
345 AC_SUBST(LLVM_ON_WIN32,[0])
Reid Spencer7b3e8512004-12-24 06:29:05 +0000346 ;;
Eric Christopher790e11c2007-12-01 00:34:39 +0000347 Win32)
348 AC_DEFINE([LLVM_ON_WIN32],[1],[Define if this is Win32ish platform])
Reid Spencerbbf7a8a2004-12-31 22:54:28 +0000349 AC_SUBST(LLVM_ON_UNIX,[0])
350 AC_SUBST(LLVM_ON_WIN32,[1])
Reid Spencer7b3e8512004-12-24 06:29:05 +0000351 ;;
352esac
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000353
John Criswell4ea390d2003-07-22 19:13:20 +0000354dnl Determine what our target architecture is and configure accordingly.
355dnl This will allow Makefiles to make a distinction between the hardware and
356dnl the OS.
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000357AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
358[case $target in
Reid Spenceree93c872004-12-23 21:08:52 +0000359 i?86-*) llvm_cv_target_arch="x86" ;;
Reid Spencer2dc65862004-12-28 07:56:14 +0000360 amd64-* | x86_64-*) llvm_cv_target_arch="x86_64" ;;
Reid Spenceree93c872004-12-23 21:08:52 +0000361 sparc*-*) llvm_cv_target_arch="Sparc" ;;
362 powerpc*-*) llvm_cv_target_arch="PowerPC" ;;
Nick Lewyckyfa8ffc12009-04-18 18:11:26 +0000363 arm*-*) llvm_cv_target_arch="ARM" ;;
Chris Lattner6307c292007-08-19 20:45:10 +0000364 mips-*) llvm_cv_target_arch="Mips" ;;
Rafael Espindola97fb69b2011-12-28 17:08:00 +0000365 mipsel-*) llvm_cv_target_arch="Mips" ;;
Richard Osborneb25baef2008-11-07 10:59:00 +0000366 xcore-*) llvm_cv_target_arch="XCore" ;;
Anton Korobeynikovf2c3e172009-05-03 12:57:15 +0000367 msp430-*) llvm_cv_target_arch="MSP430" ;;
Tony Linthicumb4b54152011-12-12 21:14:40 +0000368 hexagon-*) llvm_cv_target_arch="Hexagon" ;;
Wesley Pecka70f28c2010-02-23 19:15:24 +0000369 mblaze-*) llvm_cv_target_arch="MBlaze" ;;
Nick Lewyckyf7a3c502010-09-07 18:14:24 +0000370 ptx-*) llvm_cv_target_arch="PTX" ;;
Reid Spenceree93c872004-12-23 21:08:52 +0000371 *) llvm_cv_target_arch="Unknown" ;;
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000372esac])
John Criswell4ea390d2003-07-22 19:13:20 +0000373
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000374if test "$llvm_cv_target_arch" = "Unknown" ; then
375 AC_MSG_WARN([Configuring LLVM for an unknown target archicture])
376fi
377
Gabor Greiff18b6fe2012-01-26 10:28:58 +0000378dnl Determine the LLVM native architecture for the target
Douglas Gregor76166fc2009-06-17 00:42:33 +0000379case "$llvm_cv_target_arch" in
380 x86) LLVM_NATIVE_ARCH="X86" ;;
381 x86_64) LLVM_NATIVE_ARCH="X86" ;;
382 *) LLVM_NATIVE_ARCH="$llvm_cv_target_arch" ;;
383esac
Mikhail Glushenkov895f32c2009-07-03 03:52:07 +0000384
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000385dnl Define a substitution, ARCH, for the target architecture
386AC_SUBST(ARCH,$llvm_cv_target_arch)
387
388dnl Check for the endianness of the target
Duncan Sands67f1c492007-12-12 23:03:45 +0000389AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000390
Gabor Greiff18b6fe2012-01-26 10:28:58 +0000391dnl Check for build platform executable suffix if we're cross-compiling
Reid Spencere2cfe5d2006-07-26 21:14:56 +0000392if test "$cross_compiling" = yes; then
Eric Christopher790e11c2007-12-01 00:34:39 +0000393 AC_SUBST(LLVM_CROSS_COMPILING, [1])
Reid Spencere2cfe5d2006-07-26 21:14:56 +0000394 AC_BUILD_EXEEXT
Jim Grosbach673612e2008-10-02 22:56:44 +0000395 ac_build_prefix=${build_alias}-
396 AC_CHECK_PROG(BUILD_CXX, ${ac_build_prefix}g++, ${ac_build_prefix}g++)
397 if test -z "$BUILD_CXX"; then
398 AC_CHECK_PROG(BUILD_CXX, g++, g++)
399 if test -z "$BUILD_CXX"; then
400 AC_CHECK_PROG(BUILD_CXX, c++, c++, , , /usr/ucb/c++)
401 fi
402 fi
Reid Spencere2cfe5d2006-07-26 21:14:56 +0000403else
404 AC_SUBST(LLVM_CROSS_COMPILING, [0])
405fi
406
Dan Gohman56fb5f92010-08-04 16:25:01 +0000407dnl Check to see if there's a .svn or .git directory indicating that this
408dnl build is being done from a checkout. This sets up several defaults for
409dnl the command line switches. When we build with a checkout directory,
Nick Lewyckyd04bc732009-04-01 04:39:25 +0000410dnl we get a debug with assertions turned on. Without, we assume a source
411dnl release and we get an optimized build without assertions.
412dnl See --enable-optimized and --enable-assertions below
Dan Gohman56fb5f92010-08-04 16:25:01 +0000413if test -d ".svn" -o -d "${srcdir}/.svn" -o -d ".git" -o -d "${srcdir}/.git"; then
Reid Spencer54d14482006-04-07 16:01:51 +0000414 cvsbuild="yes"
415 optimize="no"
Reid Spencer54d14482006-04-07 16:01:51 +0000416 AC_SUBST(CVSBUILD,[[CVSBUILD=1]])
417else
418 cvsbuild="no"
419 optimize="yes"
Reid Spencer54d14482006-04-07 16:01:51 +0000420fi
421
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000422dnl===-----------------------------------------------------------------------===
423dnl===
424dnl=== SECTION 3: Command line arguments for the configure script.
425dnl===
426dnl===-----------------------------------------------------------------------===
427
Eric Christopherbee515f2011-11-11 22:51:42 +0000428dnl --enable-libcpp : check whether or not to use libc++ on the command line
429AC_ARG_ENABLE(libcpp,
430 AS_HELP_STRING([--enable-libcpp],
431 [Use libc++ if available (default is NO)]),,
432 enableval=default)
433case "$enableval" in
434 yes) AC_SUBST(ENABLE_LIBCPP,[1]) ;;
435 no) AC_SUBST(ENABLE_LIBCPP,[0]) ;;
436 default) AC_SUBST(ENABLE_LIBCPP,[0]);;
437 *) AC_MSG_ERROR([Invalid setting for --enable-libcpp. Use "yes" or "no"]) ;;
438esac
439
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000440dnl --enable-optimized : check whether they want to do an optimized build:
Reid Spencer54d14482006-04-07 16:01:51 +0000441AC_ARG_ENABLE(optimized, AS_HELP_STRING(
Nick Lewycky84bd0752009-06-06 06:24:44 +0000442 --enable-optimized,[Compile with optimizations enabled (default is NO)]),,enableval=$optimize)
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000443if test ${enableval} = "no" ; then
444 AC_SUBST(ENABLE_OPTIMIZED,[[]])
445else
446 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
447fi
448
David Greenedbefd0c2009-04-17 14:49:22 +0000449dnl --enable-profiling : check whether they want to do a profile build:
450AC_ARG_ENABLE(profiling, AS_HELP_STRING(
Nick Lewycky84bd0752009-06-06 06:24:44 +0000451 --enable-profiling,[Compile with profiling enabled (default is NO)]),,enableval="no")
David Greenedbefd0c2009-04-17 14:49:22 +0000452if test ${enableval} = "no" ; then
453 AC_SUBST(ENABLE_PROFILING,[[]])
454else
455 AC_SUBST(ENABLE_PROFILING,[[ENABLE_PROFILING=1]])
456fi
457
Reid Spencer54d14482006-04-07 16:01:51 +0000458dnl --enable-assertions : check whether they want to turn on assertions or not:
459AC_ARG_ENABLE(assertions,AS_HELP_STRING(
Nick Lewycky84bd0752009-06-06 06:24:44 +0000460 --enable-assertions,[Compile with assertion checks enabled (default is YES)]),, enableval="yes")
Reid Spencerc28ccd82006-04-09 20:42:14 +0000461if test ${enableval} = "yes" ; then
462 AC_SUBST(DISABLE_ASSERTIONS,[[]])
Reid Spencer54d14482006-04-07 16:01:51 +0000463else
Reid Spencerc28ccd82006-04-09 20:42:14 +0000464 AC_SUBST(DISABLE_ASSERTIONS,[[DISABLE_ASSERTIONS=1]])
Reid Spencer54d14482006-04-07 16:01:51 +0000465fi
466
David Greenea696d242007-06-28 19:36:08 +0000467dnl --enable-expensive-checks : check whether they want to turn on expensive debug checks:
468AC_ARG_ENABLE(expensive-checks,AS_HELP_STRING(
Nick Lewycky84bd0752009-06-06 06:24:44 +0000469 --enable-expensive-checks,[Compile with expensive debug checks enabled (default is NO)]),, enableval="no")
David Greenea696d242007-06-28 19:36:08 +0000470if test ${enableval} = "yes" ; then
471 AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[ENABLE_EXPENSIVE_CHECKS=1]])
472 AC_SUBST(EXPENSIVE_CHECKS,[[yes]])
473else
474 AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[]])
475 AC_SUBST(EXPENSIVE_CHECKS,[[no]])
476fi
477
Reid Spencer8b2e1412006-11-17 03:32:33 +0000478dnl --enable-debug-runtime : should runtime libraries have debug symbols?
479AC_ARG_ENABLE(debug-runtime,
Nick Lewycky84bd0752009-06-06 06:24:44 +0000480 AS_HELP_STRING(--enable-debug-runtime,[Build runtime libs with debug symbols (default is NO)]),,enableval=no)
Reid Spencer8b2e1412006-11-17 03:32:33 +0000481if test ${enableval} = "no" ; then
482 AC_SUBST(DEBUG_RUNTIME,[[]])
483else
484 AC_SUBST(DEBUG_RUNTIME,[[DEBUG_RUNTIME=1]])
485fi
486
Jeffrey Yasskin7fd82e52009-09-27 17:47:29 +0000487dnl --enable-debug-symbols : should even optimized compiler libraries
488dnl have debug symbols?
489AC_ARG_ENABLE(debug-symbols,
490 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)
491if test ${enableval} = "no" ; then
492 AC_SUBST(DEBUG_SYMBOLS,[[]])
493else
494 AC_SUBST(DEBUG_SYMBOLS,[[DEBUG_SYMBOLS=1]])
495fi
496
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000497dnl --enable-jit: check whether they want to enable the jit
498AC_ARG_ENABLE(jit,
499 AS_HELP_STRING(--enable-jit,
500 [Enable Just In Time Compiling (default is YES)]),,
501 enableval=default)
502if test ${enableval} = "no"
503then
504 AC_SUBST(JIT,[[]])
505else
Reid Spencerefbe40a2004-11-25 07:28:19 +0000506 case "$llvm_cv_target_arch" in
Jakob Stoklund Olesen73b7bb72009-08-02 17:32:37 +0000507 x86) AC_SUBST(TARGET_HAS_JIT,1) ;;
508 Sparc) AC_SUBST(TARGET_HAS_JIT,0) ;;
509 PowerPC) AC_SUBST(TARGET_HAS_JIT,1) ;;
510 x86_64) AC_SUBST(TARGET_HAS_JIT,1) ;;
Eric Christopher030e5a02009-09-14 16:38:49 +0000511 ARM) AC_SUBST(TARGET_HAS_JIT,1) ;;
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +0000512 Mips) AC_SUBST(TARGET_HAS_JIT,1) ;;
Jakob Stoklund Olesen73b7bb72009-08-02 17:32:37 +0000513 XCore) AC_SUBST(TARGET_HAS_JIT,0) ;;
514 MSP430) AC_SUBST(TARGET_HAS_JIT,0) ;;
Tony Linthicumb4b54152011-12-12 21:14:40 +0000515 Hexagon) AC_SUBST(TARGET_HAS_JIT,0) ;;
Wesley Pecka70f28c2010-02-23 19:15:24 +0000516 MBlaze) AC_SUBST(TARGET_HAS_JIT,0) ;;
Nick Lewyckyf7a3c502010-09-07 18:14:24 +0000517 PTX) AC_SUBST(TARGET_HAS_JIT,0) ;;
Jakob Stoklund Olesen73b7bb72009-08-02 17:32:37 +0000518 *) AC_SUBST(TARGET_HAS_JIT,0) ;;
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000519 esac
520fi
521
Rafael Espindola9d9ae9f2010-11-12 19:24:06 +0000522dnl Allow enablement of building and installing docs
523AC_ARG_ENABLE(docs,
524 AS_HELP_STRING([--enable-docs],
525 [Build documents (default is YES)]),,
526 enableval=default)
527case "$enableval" in
528 yes) AC_SUBST(ENABLE_DOCS,[1]) ;;
529 no) AC_SUBST(ENABLE_DOCS,[0]) ;;
530 default) AC_SUBST(ENABLE_DOCS,[1]) ;;
531 *) AC_MSG_ERROR([Invalid setting for --enable-docs. Use "yes" or "no"]) ;;
532esac
533
Reid Spencer1f319422004-11-29 04:56:35 +0000534dnl Allow enablement of doxygen generated documentation
535AC_ARG_ENABLE(doxygen,
536 AS_HELP_STRING([--enable-doxygen],
537 [Build doxygen documentation (default is NO)]),,
538 enableval=default)
539case "$enableval" in
540 yes) AC_SUBST(ENABLE_DOXYGEN,[1]) ;;
541 no) AC_SUBST(ENABLE_DOXYGEN,[0]) ;;
542 default) AC_SUBST(ENABLE_DOXYGEN,[0]) ;;
543 *) AC_MSG_ERROR([Invalid setting for --enable-doxygen. Use "yes" or "no"]) ;;
544esac
545
Reid Spencer0a262ba2005-08-24 10:07:20 +0000546dnl Allow disablement of threads
547AC_ARG_ENABLE(threads,
548 AS_HELP_STRING([--enable-threads],
549 [Use threads if available (default is YES)]),,
Reid Spencer65c5d752006-11-05 17:08:18 +0000550 enableval=default)
Reid Spencer0a262ba2005-08-24 10:07:20 +0000551case "$enableval" in
Dylan Noblesmith08b73a32011-11-28 00:48:58 +0000552 yes) AC_SUBST(LLVM_ENABLE_THREADS,[1]) ;;
553 no) AC_SUBST(LLVM_ENABLE_THREADS,[0]) ;;
554 default) AC_SUBST(LLVM_ENABLE_THREADS,[1]) ;;
Reid Spencer0a262ba2005-08-24 10:07:20 +0000555 *) AC_MSG_ERROR([Invalid setting for --enable-threads. Use "yes" or "no"]) ;;
556esac
Dylan Noblesmith08b73a32011-11-28 00:48:58 +0000557AC_DEFINE_UNQUOTED([LLVM_ENABLE_THREADS],$LLVM_ENABLE_THREADS,
558 [Define if threads enabled])
Reid Spencer0a262ba2005-08-24 10:07:20 +0000559
NAKAMURA Takumi0dc84392010-12-29 03:59:03 +0000560dnl Allow disablement of pthread.h
561AC_ARG_ENABLE(pthreads,
562 AS_HELP_STRING([--enable-pthreads],
563 [Use pthreads if available (default is YES)]),,
564 enableval=default)
565case "$enableval" in
566 yes) AC_SUBST(ENABLE_PTHREADS,[1]) ;;
567 no) AC_SUBST(ENABLE_PTHREADS,[0]) ;;
568 default) AC_SUBST(ENABLE_PTHREADS,[1]) ;;
569 *) AC_MSG_ERROR([Invalid setting for --enable-pthreads. Use "yes" or "no"]) ;;
570esac
571
Nick Lewycky7e664622009-02-19 06:18:24 +0000572dnl Allow building without position independent code
Reid Spencer89b0d992006-12-16 22:07:52 +0000573AC_ARG_ENABLE(pic,
574 AS_HELP_STRING([--enable-pic],
Nick Lewycky7e664622009-02-19 06:18:24 +0000575 [Build LLVM with Position Independent Code (default is YES)]),,
Reid Spencer89b0d992006-12-16 22:07:52 +0000576 enableval=default)
577case "$enableval" in
578 yes) AC_SUBST(ENABLE_PIC,[1]) ;;
579 no) AC_SUBST(ENABLE_PIC,[0]) ;;
Nick Lewycky7e664622009-02-19 06:18:24 +0000580 default) AC_SUBST(ENABLE_PIC,[1]) ;;
Reid Spencer89b0d992006-12-16 22:07:52 +0000581 *) AC_MSG_ERROR([Invalid setting for --enable-pic. Use "yes" or "no"]) ;;
582esac
583AC_DEFINE_UNQUOTED([ENABLE_PIC],$ENABLE_PIC,
584 [Define if position independent code is enabled])
585
Jeffrey Yasskinc9017192010-02-25 06:34:33 +0000586dnl Allow building a shared library and linking tools against it.
587AC_ARG_ENABLE(shared,
588 AS_HELP_STRING([--enable-shared],
589 [Build a shared library and link tools against it (default is NO)]),,
590 enableval=default)
591case "$enableval" in
592 yes) AC_SUBST(ENABLE_SHARED,[1]) ;;
593 no) AC_SUBST(ENABLE_SHARED,[0]) ;;
594 default) AC_SUBST(ENABLE_SHARED,[0]) ;;
595 *) AC_MSG_ERROR([Invalid setting for --enable-shared. Use "yes" or "no"]) ;;
596esac
597
NAKAMURA Takumi8eac8862010-12-29 03:59:14 +0000598dnl Allow libstdc++ is embedded in LLVM.dll.
599AC_ARG_ENABLE(embed-stdcxx,
600 AS_HELP_STRING([--enable-embed-stdcxx],
NAKAMURA Takumie9d3c1c2011-10-13 18:04:52 +0000601 [Build a shared library with embedded libstdc++ for Win32 DLL (default is NO)]),,
NAKAMURA Takumi8eac8862010-12-29 03:59:14 +0000602 enableval=default)
603case "$enableval" in
604 yes) AC_SUBST(ENABLE_EMBED_STDCXX,[1]) ;;
605 no) AC_SUBST(ENABLE_EMBED_STDCXX,[0]) ;;
NAKAMURA Takumie9d3c1c2011-10-13 18:04:52 +0000606 default) AC_SUBST(ENABLE_EMBED_STDCXX,[0]) ;;
NAKAMURA Takumi8eac8862010-12-29 03:59:14 +0000607 *) AC_MSG_ERROR([Invalid setting for --enable-embed-stdcxx. Use "yes" or "no"]) ;;
608esac
609
Daniel Dunbardd464df2010-05-10 20:11:56 +0000610dnl Enable embedding timestamp information into build.
611AC_ARG_ENABLE(timestamps,
612 AS_HELP_STRING([--enable-timestamps],
613 [Enable embedding timestamp information in build (default is YES)]),,
614 enableval=default)
615case "$enableval" in
616 yes) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;;
617 no) AC_SUBST(ENABLE_TIMESTAMPS,[0]) ;;
618 default) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;;
619 *) AC_MSG_ERROR([Invalid setting for --enable-timestamps. Use "yes" or "no"]) ;;
620esac
621AC_DEFINE_UNQUOTED([ENABLE_TIMESTAMPS],$ENABLE_TIMESTAMPS,
622 [Define if timestamp information (e.g., __DATE___) is allowed])
623
Reid Spencer945de9b2005-04-22 07:27:28 +0000624dnl Allow specific targets to be specified for building (or not)
625TARGETS_TO_BUILD=""
Evan Cheng939ea652006-07-06 07:46:33 +0000626AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
Jeffrey Yasskine04701a2009-09-23 17:05:42 +0000627 [Build specific host targets: all or target1,target2,... Valid targets are:
Tony Linthicumb4b54152011-12-12 21:14:40 +0000628 host, x86, x86_64, sparc, powerpc, arm, mips, spu, hexagon,
Dan Gohman3e6157d2011-10-25 00:05:42 +0000629 xcore, msp430, ptx, cbe, and cpp (default=all)]),,
Reid Spencer99d1fcc2005-04-22 17:02:18 +0000630 enableval=all)
Jeffrey Yasskine04701a2009-09-23 17:05:42 +0000631if test "$enableval" = host-only ; then
632 enableval=host
633fi
Reid Spencer99d1fcc2005-04-22 17:02:18 +0000634case "$enableval" in
Eric Christophera443e5b2012-03-23 05:50:46 +0000635 all) TARGETS_TO_BUILD="X86 Sparc PowerPC ARM Mips CellSPU XCore MSP430 CppBackend MBlaze PTX Hexagon" ;;
Reid Spencer99d1fcc2005-04-22 17:02:18 +0000636 *)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
637 case "$a_target" in
Jakob Stoklund Olesen73b7bb72009-08-02 17:32:37 +0000638 x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
639 x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
640 sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;;
641 powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;;
Jakob Stoklund Olesen73b7bb72009-08-02 17:32:37 +0000642 arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
643 mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
Rafael Espindola97fb69b2011-12-28 17:08:00 +0000644 mipsel) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
Jakob Stoklund Olesen73b7bb72009-08-02 17:32:37 +0000645 spu) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;;
Jakob Stoklund Olesen73b7bb72009-08-02 17:32:37 +0000646 xcore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
647 msp430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;;
Jakob Stoklund Olesen73b7bb72009-08-02 17:32:37 +0000648 cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;;
Tony Linthicumb4b54152011-12-12 21:14:40 +0000649 hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;;
Wesley Pecka70f28c2010-02-23 19:15:24 +0000650 mblaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
Nick Lewyckyf7a3c502010-09-07 18:14:24 +0000651 ptx) TARGETS_TO_BUILD="PTX $TARGETS_TO_BUILD" ;;
Jeffrey Yasskine04701a2009-09-23 17:05:42 +0000652 host) case "$llvm_cv_target_arch" in
653 x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
654 x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
655 Sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;;
656 PowerPC) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;;
Jeffrey Yasskine04701a2009-09-23 17:05:42 +0000657 ARM) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
658 Mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
Wesley Pecka70f28c2010-02-23 19:15:24 +0000659 MBlaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
Jeffrey Yasskine04701a2009-09-23 17:05:42 +0000660 CellSPU|SPU) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;;
Jeffrey Yasskine04701a2009-09-23 17:05:42 +0000661 XCore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
662 MSP430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;;
Tony Linthicumb4b54152011-12-12 21:14:40 +0000663 Hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;;
Nick Lewyckyf7a3c502010-09-07 18:14:24 +0000664 PTX) TARGETS_TO_BUILD="PTX $TARGETS_TO_BUILD" ;;
Jeffrey Yasskine04701a2009-09-23 17:05:42 +0000665 *) AC_MSG_ERROR([Can not set target to build]) ;;
666 esac ;;
Reid Spencer99d1fcc2005-04-22 17:02:18 +0000667 *) AC_MSG_ERROR([Unrecognized target $a_target]) ;;
668 esac
Eric Christopher790e11c2007-12-01 00:34:39 +0000669 done
Reid Spencer99d1fcc2005-04-22 17:02:18 +0000670 ;;
671esac
Reid Spencer945de9b2005-04-22 07:27:28 +0000672AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BUILD)
673
Gabor Greiff18b6fe2012-01-26 10:28:58 +0000674dnl Determine whether we are building LLVM support for the native architecture.
675dnl If so, define LLVM_NATIVE_ARCH to that LLVM target.
Douglas Gregor76166fc2009-06-17 00:42:33 +0000676for a_target in $TARGETS_TO_BUILD; do
677 if test "$a_target" = "$LLVM_NATIVE_ARCH"; then
Eric Christopher753f3262010-08-30 18:34:48 +0000678 AC_DEFINE_UNQUOTED(LLVM_NATIVE_ARCH, $LLVM_NATIVE_ARCH,
Douglas Gregor76166fc2009-06-17 00:42:33 +0000679 [LLVM architecture name for the native architecture, if available])
Eric Christopher753f3262010-08-30 18:34:48 +0000680 LLVM_NATIVE_TARGET="LLVMInitialize${LLVM_NATIVE_ARCH}Target"
681 LLVM_NATIVE_TARGETINFO="LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo"
Evan Chenge78085a2011-07-22 21:58:54 +0000682 LLVM_NATIVE_TARGETMC="LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC"
Eric Christopher753f3262010-08-30 18:34:48 +0000683 LLVM_NATIVE_ASMPRINTER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter"
Jan Sjödin6e70cc12011-03-14 22:12:35 +0000684 if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
685 LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser"
686 fi
Eric Christopher753f3262010-08-30 18:34:48 +0000687 AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGET, $LLVM_NATIVE_TARGET,
688 [LLVM name for the native Target init function, if available])
689 AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETINFO, $LLVM_NATIVE_TARGETINFO,
690 [LLVM name for the native TargetInfo init function, if available])
Evan Chenge78085a2011-07-22 21:58:54 +0000691 AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETMC, $LLVM_NATIVE_TARGETMC,
692 [LLVM name for the native target MC init function, if available])
Eric Christopher753f3262010-08-30 18:34:48 +0000693 AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPRINTER, $LLVM_NATIVE_ASMPRINTER,
694 [LLVM name for the native AsmPrinter init function, if available])
Jan Sjödin6e70cc12011-03-14 22:12:35 +0000695 if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then
696 AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPARSER, $LLVM_NATIVE_ASMPARSER,
697 [LLVM name for the native AsmParser init function, if available])
698 fi
Douglas Gregor76166fc2009-06-17 00:42:33 +0000699 fi
700done
701
Gabor Greiff18b6fe2012-01-26 10:28:58 +0000702dnl Build the LLVM_TARGET and LLVM_... macros for Targets.def and the individual
703dnl target feature def files.
Douglas Gregor1555a232009-06-16 20:12:29 +0000704LLVM_ENUM_TARGETS=""
705LLVM_ENUM_ASM_PRINTERS=""
Daniel Dunbar092a9dd2009-07-17 20:42:00 +0000706LLVM_ENUM_ASM_PARSERS=""
Daniel Dunbarfa3f0b92009-11-25 04:30:13 +0000707LLVM_ENUM_DISASSEMBLERS=""
Douglas Gregor1555a232009-06-16 20:12:29 +0000708for target_to_build in $TARGETS_TO_BUILD; do
709 LLVM_ENUM_TARGETS="LLVM_TARGET($target_to_build) $LLVM_ENUM_TARGETS"
Chris Lattnere15f2e12010-11-14 19:10:47 +0000710 if test -f ${srcdir}/lib/Target/${target_to_build}/*AsmPrinter.cpp ; then
Eric Christopher14074e82010-10-12 02:42:05 +0000711 LLVM_ENUM_ASM_PRINTERS="LLVM_ASM_PRINTER($target_to_build) $LLVM_ENUM_ASM_PRINTERS";
712 fi
Daniel Dunbar092a9dd2009-07-17 20:42:00 +0000713 if test -f ${srcdir}/lib/Target/${target_to_build}/AsmParser/Makefile ; then
714 LLVM_ENUM_ASM_PARSERS="LLVM_ASM_PARSER($target_to_build) $LLVM_ENUM_ASM_PARSERS";
715 fi
Daniel Dunbarfa3f0b92009-11-25 04:30:13 +0000716 if test -f ${srcdir}/lib/Target/${target_to_build}/Disassembler/Makefile ; then
717 LLVM_ENUM_DISASSEMBLERS="LLVM_DISASSEMBLER($target_to_build) $LLVM_ENUM_DISASSEMBLERS";
718 fi
Douglas Gregor1555a232009-06-16 20:12:29 +0000719done
720AC_SUBST(LLVM_ENUM_TARGETS)
721AC_SUBST(LLVM_ENUM_ASM_PRINTERS)
Daniel Dunbar092a9dd2009-07-17 20:42:00 +0000722AC_SUBST(LLVM_ENUM_ASM_PARSERS)
Daniel Dunbarfa3f0b92009-11-25 04:30:13 +0000723AC_SUBST(LLVM_ENUM_DISASSEMBLERS)
Douglas Gregor1555a232009-06-16 20:12:29 +0000724
Daniel Dunbar1fce9482009-11-04 04:32:50 +0000725dnl Override the option to use for optimized builds.
726AC_ARG_WITH(optimize-option,
727 AS_HELP_STRING([--with-optimize-option],
728 [Select the compiler options to use for optimized builds]),,
729 withval=default)
730AC_MSG_CHECKING([optimization flags])
731case "$withval" in
732 default)
733 case "$llvm_cv_os_type" in
Daniel Dunbar753b43c2010-04-30 17:12:23 +0000734 FreeBSD) optimize_option=-O2 ;;
Daniel Dunbar195d2de2010-04-10 18:56:24 +0000735 MingW) optimize_option=-O2 ;;
736 *) optimize_option=-O3 ;;
Daniel Dunbar1fce9482009-11-04 04:32:50 +0000737 esac ;;
738 *) optimize_option="$withval" ;;
739esac
740AC_SUBST(OPTIMIZE_OPTION,$optimize_option)
741AC_MSG_RESULT([$optimize_option])
742
Evan Chengcf9be262006-06-20 22:16:32 +0000743dnl Specify extra build options
744AC_ARG_WITH(extra-options,
745 AS_HELP_STRING([--with-extra-options],
Duncan Sandse4eb2d22009-05-13 13:13:18 +0000746 [Specify additional options to compile LLVM with]),,
Reid Spencerceaf1c32006-07-28 22:50:07 +0000747 withval=default)
748case "$withval" in
Evan Chengcf9be262006-06-20 22:16:32 +0000749 default) EXTRA_OPTIONS= ;;
Reid Spencerceaf1c32006-07-28 22:50:07 +0000750 *) EXTRA_OPTIONS=$withval ;;
Evan Chengcf9be262006-06-20 22:16:32 +0000751esac
752AC_SUBST(EXTRA_OPTIONS,$EXTRA_OPTIONS)
Reid Spencer945de9b2005-04-22 07:27:28 +0000753
Daniel Dunbare2a91a72011-06-16 22:30:38 +0000754dnl Specify extra linker build options
755AC_ARG_WITH(extra-ld-options,
756 AS_HELP_STRING([--with-extra-ld-options],
757 [Specify additional options to link LLVM with]),,
758 withval=default)
759case "$withval" in
760 default) EXTRA_LD_OPTIONS= ;;
761 *) EXTRA_LD_OPTIONS=$withval ;;
762esac
763AC_SUBST(EXTRA_LD_OPTIONS,$EXTRA_LD_OPTIONS)
764
Gordon Henriksen6530e9d2007-10-02 09:50:18 +0000765dnl Allow specific bindings to be specified for building (or not)
766AC_ARG_ENABLE([bindings],AS_HELP_STRING([--enable-bindings],
767 [Build specific language bindings: all,auto,none,{binding-name} (default=auto)]),,
768 enableval=default)
769BINDINGS_TO_BUILD=""
770case "$enableval" in
Gordon Henriksen48c72532007-10-02 10:14:32 +0000771 yes | default | auto) BINDINGS_TO_BUILD="auto" ;;
Gordon Henriksen6530e9d2007-10-02 09:50:18 +0000772 all ) BINDINGS_TO_BUILD="ocaml" ;;
773 none | no) BINDINGS_TO_BUILD="" ;;
774 *)for a_binding in `echo $enableval|sed -e 's/,/ /g' ` ; do
775 case "$a_binding" in
776 ocaml) BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" ;;
777 *) AC_MSG_ERROR([Unrecognized binding $a_binding]) ;;
778 esac
Eric Christopher790e11c2007-12-01 00:34:39 +0000779 done
Gordon Henriksen6530e9d2007-10-02 09:50:18 +0000780 ;;
781esac
782
Gordon Henriksen1d4e0782007-10-02 16:42:10 +0000783dnl Allow the ocaml libdir to be overridden. This could go in a configure
784dnl script for bindings/ocaml/configure, except that its auto value depends on
785dnl OCAMLC, which is found here to support tests.
786AC_ARG_WITH([ocaml-libdir],
787 [AS_HELP_STRING([--with-ocaml-libdir],
788 [Specify install location for ocaml bindings (default is stdlib)])],
789 [],
790 [withval=auto])
791case "$withval" in
792 auto) with_ocaml_libdir="$withval" ;;
793 /* | [[A-Za-z]]:[[\\/]]*) with_ocaml_libdir="$withval" ;;
794 *) AC_MSG_ERROR([Invalid path for --with-ocaml-libdir. Provide full path]) ;;
795esac
796
NAKAMURA Takumie5ab51d2011-10-16 02:54:26 +0000797AC_ARG_WITH(clang-srcdir,
798 AS_HELP_STRING([--with-clang-srcdir],
799 [Directory to the out-of-tree Clang source]),,
800 withval="-")
801case "$withval" in
Dylan Noblesmithdb6caea2012-02-02 00:17:33 +0000802 -) clang_src_root="" ;;
NAKAMURA Takumie5ab51d2011-10-16 02:54:26 +0000803 /* | [[A-Za-z]]:[[\\/]]*) clang_src_root="$withval" ;;
804 *) clang_src_root="$ac_pwd/$withval" ;;
805esac
806AC_SUBST(CLANG_SRC_ROOT,[$clang_src_root])
807
Chandler Carruth6b241162010-10-19 08:21:25 +0000808AC_ARG_WITH(clang-resource-dir,
809 AS_HELP_STRING([--with-clang-resource-dir],
810 [Relative directory from the Clang binary for resource files]),,
811 withval="")
812AC_DEFINE_UNQUOTED(CLANG_RESOURCE_DIR,"$withval",
813 [Relative directory for resource files])
814
Rafael Espindolad6c8ec62009-12-07 00:27:35 +0000815AC_ARG_WITH(c-include-dirs,
Rafael Espindola7f9ec912009-11-12 05:46:09 +0000816 AS_HELP_STRING([--with-c-include-dirs],
817 [Colon separated list of directories clang will search for headers]),,
818 withval="")
819AC_DEFINE_UNQUOTED(C_INCLUDE_DIRS,"$withval",
820 [Directories clang will search for headers])
821
Rafael Espindola1aee22e2012-02-03 00:59:30 +0000822# Clang normally uses the system c++ headers and libraries. With this option,
823# clang will use the ones provided by a gcc installation instead. This option should
824# be passed the same value that was used with --prefix when configuring gcc.
825AC_ARG_WITH(gcc-toolchain,
826 AS_HELP_STRING([--with-gcc-toolchain],
827 [Directory where gcc is installed.]),,
Rafael Espindola420d23c2009-11-16 19:46:55 +0000828 withval="")
Rafael Espindola1aee22e2012-02-03 00:59:30 +0000829AC_DEFINE_UNQUOTED(GCC_INSTALL_PREFIX,"$withval",
830 [Directory where gcc is installed.])
Rafael Espindola420d23c2009-11-16 19:46:55 +0000831
Nick Lewyckye2be5d52009-02-03 07:10:08 +0000832dnl Allow linking of LLVM with GPLv3 binutils code.
833AC_ARG_WITH(binutils-include,
834 AS_HELP_STRING([--with-binutils-include],
835 [Specify path to binutils/include/ containing plugin-api.h file for gold plugin.]),,
836 withval=default)
837case "$withval" in
838 default) WITH_BINUTILS_INCDIR=default ;;
839 /* | [[A-Za-z]]:[[\\/]]*) WITH_BINUTILS_INCDIR=$withval ;;
840 *) AC_MSG_ERROR([Invalid path for --with-binutils-include. Provide full path]) ;;
841esac
842if test "x$WITH_BINUTILS_INCDIR" != xdefault ; then
843 AC_SUBST(BINUTILS_INCDIR,$WITH_BINUTILS_INCDIR)
844 if test ! -f "$WITH_BINUTILS_INCDIR/plugin-api.h"; then
845 echo "$WITH_BINUTILS_INCDIR/plugin-api.h"
846 AC_MSG_ERROR([Invalid path to directory containing plugin-api.h.]);
847 fi
848fi
849
Chad Rosier96212ad2011-07-15 00:37:26 +0000850dnl Specify the URL where bug reports should be submitted.
851AC_ARG_WITH(bug-report-url,
852 AS_HELP_STRING([--with-bug-report-url],
Chad Rosier11066fb2011-08-02 20:53:43 +0000853 [Specify the URL where bug reports should be submitted (default=http://llvm.org/bugs/)]),,
854 withval="http://llvm.org/bugs/")
Chad Rosier96212ad2011-07-15 00:37:26 +0000855AC_DEFINE_UNQUOTED(BUG_REPORT_URL,"$withval",
856 [Bug report URL.])
857
Nick Lewycky84bd0752009-06-06 06:24:44 +0000858dnl --enable-libffi : check whether the user wants to turn off libffi:
859AC_ARG_ENABLE(libffi,AS_HELP_STRING(
Jeffrey Yasskinbc83d062010-02-09 23:03:44 +0000860 --enable-libffi,[Check for the presence of libffi (default is NO)]),
861 [case "$enableval" in
862 yes) llvm_cv_enable_libffi="yes" ;;
863 no) llvm_cv_enable_libffi="no" ;;
864 *) AC_MSG_ERROR([Invalid setting for --enable-libffi. Use "yes" or "no"]) ;;
865 esac],
866 llvm_cv_enable_libffi=no)
Nick Lewycky84bd0752009-06-06 06:24:44 +0000867
Bob Wilsonae7e2a42011-11-28 07:59:52 +0000868AC_ARG_WITH(internal-prefix,
869 AS_HELP_STRING([--with-internal-prefix],
870 [Installation directory for internal files]),,
871 withval="")
872AC_SUBST(INTERNAL_PREFIX,[$withval])
873
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000874dnl===-----------------------------------------------------------------------===
875dnl===
876dnl=== SECTION 4: Check for programs we need and that they are the right version
877dnl===
878dnl===-----------------------------------------------------------------------===
Reid Spencer73fb5482004-08-31 14:20:36 +0000879
Reid Spencer1bc68642006-07-27 23:00:30 +0000880AC_PROG_NM
881AC_SUBST(NM)
882
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000883dnl Check for the tools that the makefiles require
884AC_CHECK_GNU_MAKE
885AC_PROG_LN_S
Reid Spencer8a2d4712004-12-16 17:48:14 +0000886AC_PATH_PROG(CMP, [cmp], [cmp])
887AC_PATH_PROG(CP, [cp], [cp])
Reid Spencer1f319422004-11-29 04:56:35 +0000888AC_PATH_PROG(DATE, [date], [date])
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000889AC_PATH_PROG(FIND, [find], [find])
890AC_PATH_PROG(GREP, [grep], [grep])
891AC_PATH_PROG(MKDIR,[mkdir],[mkdir])
Reid Spencer1f319422004-11-29 04:56:35 +0000892AC_PATH_PROG(MV, [mv], [mv])
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000893AC_PROG_RANLIB
Torok Edwinf6ce9ef2010-01-26 08:48:04 +0000894AC_CHECK_TOOL(AR, ar, false)
Reid Spencer1f319422004-11-29 04:56:35 +0000895AC_PATH_PROG(RM, [rm], [rm])
896AC_PATH_PROG(SED, [sed], [sed])
897AC_PATH_PROG(TAR, [tar], [gtar])
Reid Spenceraea7fe42006-07-28 05:05:00 +0000898AC_PATH_PROG(BINPWD,[pwd], [pwd])
Reid Spencerecbd2422006-06-02 23:13:18 +0000899
900dnl Looking for misc. graph plotting software
Reid Spencerc232a652005-07-14 02:25:12 +0000901AC_PATH_PROG(GRAPHVIZ, [Graphviz], [echo Graphviz])
902if test "$GRAPHVIZ" != "echo Graphviz" ; then
Reid Spencer8a2246f2005-07-13 03:20:14 +0000903 AC_DEFINE([HAVE_GRAPHVIZ],[1],[Define if the Graphviz program is available])
Reid Spencercaf0ece2006-06-05 15:54:38 +0000904 dnl If we're targeting for mingw we should emit windows paths, not msys
Jeff Cohen28783c32007-01-12 18:22:38 +0000905 if test "$llvm_cv_os_type" = "MingW" ; then
Reid Spencercaf0ece2006-06-05 15:54:38 +0000906 GRAPHVIZ=`echo $GRAPHVIZ | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
907 fi
908 AC_DEFINE_UNQUOTED([LLVM_PATH_GRAPHVIZ],"$GRAPHVIZ${EXEEXT}",
Reid Spencerc232a652005-07-14 02:25:12 +0000909 [Define to path to Graphviz program if found or 'echo Graphviz' otherwise])
Reid Spencer8a2246f2005-07-13 03:20:14 +0000910fi
Reid Spencercaf0ece2006-06-05 15:54:38 +0000911AC_PATH_PROG(DOT, [dot], [echo dot])
912if test "$DOT" != "echo dot" ; then
913 AC_DEFINE([HAVE_DOT],[1],[Define if the dot program is available])
914 dnl If we're targeting for mingw we should emit windows paths, not msys
Jeff Cohen28783c32007-01-12 18:22:38 +0000915 if test "$llvm_cv_os_type" = "MingW" ; then
Reid Spencercaf0ece2006-06-05 15:54:38 +0000916 DOT=`echo $DOT | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
917 fi
918 AC_DEFINE_UNQUOTED([LLVM_PATH_DOT],"$DOT${EXEEXT}",
919 [Define to path to dot program if found or 'echo dot' otherwise])
920fi
David Greene00ad26f2009-07-09 17:06:18 +0000921AC_PATH_PROG(FDP, [fdp], [echo fdp])
922if test "$FDP" != "echo fdp" ; then
923 AC_DEFINE([HAVE_FDP],[1],[Define if the neat program is available])
924 dnl If we're targeting for mingw we should emit windows paths, not msys
925 if test "$llvm_cv_os_type" = "MingW" ; then
926 FDP=`echo $FDP | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
927 fi
928 AC_DEFINE_UNQUOTED([LLVM_PATH_FDP],"$FDP${EXEEXT}",
929 [Define to path to fdp program if found or 'echo fdp' otherwise])
930fi
931AC_PATH_PROG(NEATO, [neato], [echo neato])
932if test "$NEATO" != "echo neato" ; then
933 AC_DEFINE([HAVE_NEATO],[1],[Define if the neat program is available])
934 dnl If we're targeting for mingw we should emit windows paths, not msys
935 if test "$llvm_cv_os_type" = "MingW" ; then
936 NEATO=`echo $NEATO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
937 fi
938 AC_DEFINE_UNQUOTED([LLVM_PATH_NEATO],"$NEATO${EXEEXT}",
939 [Define to path to neato program if found or 'echo neato' otherwise])
940fi
941AC_PATH_PROG(TWOPI, [twopi], [echo twopi])
942if test "$TWOPI" != "echo twopi" ; then
943 AC_DEFINE([HAVE_TWOPI],[1],[Define if the neat program is available])
944 dnl If we're targeting for mingw we should emit windows paths, not msys
945 if test "$llvm_cv_os_type" = "MingW" ; then
946 TWOPI=`echo $TWOPI | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
947 fi
948 AC_DEFINE_UNQUOTED([LLVM_PATH_TWOPI],"$TWOPI${EXEEXT}",
949 [Define to path to twopi program if found or 'echo twopi' otherwise])
950fi
951AC_PATH_PROG(CIRCO, [circo], [echo circo])
952if test "$CIRCO" != "echo circo" ; then
953 AC_DEFINE([HAVE_CIRCO],[1],[Define if the neat program is available])
954 dnl If we're targeting for mingw we should emit windows paths, not msys
955 if test "$llvm_cv_os_type" = "MingW" ; then
956 CIRCO=`echo $CIRCO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
957 fi
958 AC_DEFINE_UNQUOTED([LLVM_PATH_CIRCO],"$CIRCO${EXEEXT}",
959 [Define to path to circo program if found or 'echo circo' otherwise])
960fi
Reid Spencercaf0ece2006-06-05 15:54:38 +0000961AC_PATH_PROGS(GV, [gv gsview32], [echo gv])
Misha Brukmanea04dfd2005-11-01 20:58:08 +0000962if test "$GV" != "echo gv" ; then
Reid Spencerbe130282005-07-14 05:19:12 +0000963 AC_DEFINE([HAVE_GV],[1],[Define if the gv program is available])
Reid Spencercaf0ece2006-06-05 15:54:38 +0000964 dnl If we're targeting for mingw we should emit windows paths, not msys
Jeff Cohen28783c32007-01-12 18:22:38 +0000965 if test "$llvm_cv_os_type" = "MingW" ; then
Reid Spencercaf0ece2006-06-05 15:54:38 +0000966 GV=`echo $GV | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
967 fi
968 AC_DEFINE_UNQUOTED([LLVM_PATH_GV],"$GV${EXEEXT}",
Reid Spencerbe130282005-07-14 05:19:12 +0000969 [Define to path to gv program if found or 'echo gv' otherwise])
970fi
Reid Spencerecbd2422006-06-02 23:13:18 +0000971AC_PATH_PROG(DOTTY, [dotty], [echo dotty])
972if test "$DOTTY" != "echo dotty" ; then
973 AC_DEFINE([HAVE_DOTTY],[1],[Define if the dotty program is available])
Reid Spencercaf0ece2006-06-05 15:54:38 +0000974 dnl If we're targeting for mingw we should emit windows paths, not msys
Jeff Cohen28783c32007-01-12 18:22:38 +0000975 if test "$llvm_cv_os_type" = "MingW" ; then
Reid Spencercaf0ece2006-06-05 15:54:38 +0000976 DOTTY=`echo $DOTTY | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
977 fi
978 AC_DEFINE_UNQUOTED([LLVM_PATH_DOTTY],"$DOTTY${EXEEXT}",
Reid Spencerecbd2422006-06-02 23:13:18 +0000979 [Define to path to dotty program if found or 'echo dotty' otherwise])
980fi
Dan Gohman48fd5a72010-09-27 16:28:34 +0000981AC_PATH_PROG(XDOT_PY, [xdot.py], [echo xdot.py])
982if test "$XDOT_PY" != "echo xdot.py" ; then
983 AC_DEFINE([HAVE_XDOT_PY],[1],[Define if the xdot.py program is available])
984 dnl If we're targeting for mingw we should emit windows paths, not msys
985 if test "$llvm_cv_os_type" = "MingW" ; then
986 XDOT_PY=`echo $XDOT_PY | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
987 fi
988 AC_DEFINE_UNQUOTED([LLVM_PATH_XDOT_PY],"$XDOT_PY${EXEEXT}",
989 [Define to path to xdot.py program if found or 'echo xdot.py' otherwise])
990fi
Reid Spencer5e1d9a52004-11-25 04:51:04 +0000991
992dnl Find the install program
993AC_PROG_INSTALL
Eric Christopher86fa2f22010-07-22 21:13:40 +0000994dnl Prepend src dir to install path dir if it's a relative path
995dnl This is a hack for installs that take place in something other
996dnl than the top level.
997case "$INSTALL" in
998 [[\\/$]]* | ?:[[\\/]]* ) ;;
999 *) INSTALL="\\\$(TOPSRCDIR)/$INSTALL" ;;
1000esac
John Criswell4ea390d2003-07-22 19:13:20 +00001001
Reid Spencer1f319422004-11-29 04:56:35 +00001002dnl Checks for documentation and testing tools that we can do without. If these
1003dnl are not found then they are set to "true" which always succeeds but does
Eric Christopher790e11c2007-12-01 00:34:39 +00001004dnl nothing. This just lets the build output show that we could have done
1005dnl something if the tool was available.
Bill Wendling41ef25b2008-03-05 09:28:02 +00001006AC_PATH_PROG(BZIP2, [bzip2])
mike-m68cb3192010-05-06 23:45:43 +00001007AC_PATH_PROG(CAT, [cat])
Bill Wendling41ef25b2008-03-05 09:28:02 +00001008AC_PATH_PROG(DOXYGEN, [doxygen])
1009AC_PATH_PROG(GROFF, [groff])
Eric Christopher031d3072010-12-10 01:31:51 +00001010AC_PATH_PROG(GZIPBIN, [gzip])
Bill Wendling41ef25b2008-03-05 09:28:02 +00001011AC_PATH_PROG(POD2HTML, [pod2html])
1012AC_PATH_PROG(POD2MAN, [pod2man])
mike-m68cb3192010-05-06 23:45:43 +00001013AC_PATH_PROG(PDFROFF, [pdfroff])
Bill Wendling41ef25b2008-03-05 09:28:02 +00001014AC_PATH_PROG(RUNTEST, [runtest])
Reid Spencer0fcb9412004-11-30 08:11:54 +00001015DJ_AC_PATH_TCLSH
Bill Wendling41ef25b2008-03-05 09:28:02 +00001016AC_PATH_PROG(ZIP, [zip])
Gordon Henriksen0f392e12008-10-22 12:40:40 +00001017AC_PATH_PROGS(OCAMLC, [ocamlc])
1018AC_PATH_PROGS(OCAMLOPT, [ocamlopt])
1019AC_PATH_PROGS(OCAMLDEP, [ocamldep])
1020AC_PATH_PROGS(OCAMLDOC, [ocamldoc])
Torok Edwin237033e2008-10-21 17:21:32 +00001021AC_PATH_PROGS(GAS, [gas as])
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001022
Daniel Dunbaree0f32d2010-08-11 23:53:59 +00001023dnl Get the version of the linker in use.
1024AC_LINK_GET_VERSION
1025
Nick Lewycky18f99072009-03-05 08:20:21 +00001026dnl Determine whether the linker supports the -R option.
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001027AC_LINK_USE_R
1028
Nick Lewycky18f99072009-03-05 08:20:21 +00001029dnl Determine whether the linker supports the -export-dynamic option.
1030AC_LINK_EXPORT_DYNAMIC
1031
Dan Gohmanda612d62010-06-01 14:56:56 +00001032dnl Determine whether the linker supports the --version-script option.
1033AC_LINK_VERSION_SCRIPT
Dan Gohmane05f6092010-04-16 22:58:15 +00001034
Reid Spencer2bc7bd52004-11-29 12:29:58 +00001035dnl Check for libtool and the library that has dlopen function (which must come
1036dnl before the AC_PROG_LIBTOOL check in order to enable dlopening libraries with
1037dnl libtool).
1038AC_LIBTOOL_DLOPEN
1039AC_LIB_LTDL
Mikhail Glushenkov4558f482009-04-21 19:46:10 +00001040
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001041AC_MSG_CHECKING([tool compatibility])
1042
Reid Spencer86901802004-12-08 23:07:27 +00001043dnl Ensure that compilation tools are GCC or a GNU compatible compiler such as
1044dnl ICC; we use GCC specific options in the makefiles so the compiler needs
1045dnl to support those options.
1046dnl "icc" emits gcc signatures
1047dnl "icc -no-gcc" emits no gcc signature BUT is still compatible
1048ICC=no
1049IXX=no
1050case $CC in
Eric Christopher790e11c2007-12-01 00:34:39 +00001051 icc*|icpc*)
Reid Spencer86901802004-12-08 23:07:27 +00001052 ICC=yes
1053 IXX=yes
1054 ;;
1055 *)
1056 ;;
1057esac
1058
Duraid Madina937c60a2006-02-15 07:57:42 +00001059if test "$GCC" != "yes" && test "$ICC" != "yes"
1060then
1061 AC_MSG_ERROR([gcc|icc required but not found])
1062fi
1063
Daniel Dunbarbf488162010-12-08 01:48:03 +00001064dnl Ensure that compilation tools are compatible with GCC extensions
Duraid Madina937c60a2006-02-15 07:57:42 +00001065if test "$GXX" != "yes" && test "$IXX" != "yes"
1066then
Daniel Dunbarbf488162010-12-08 01:48:03 +00001067 AC_MSG_ERROR([g++|clang++|icc required but not found])
Duraid Madina937c60a2006-02-15 07:57:42 +00001068fi
1069
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001070dnl Verify that GCC is version 3.0 or higher
Reid Spencer86901802004-12-08 23:07:27 +00001071if test "$GCC" = "yes"
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001072then
Chris Lattnerf5c94672008-02-05 19:43:40 +00001073 AC_COMPILE_IFELSE([[#if !defined(__GNUC__) || __GNUC__ < 3
1074#error Unsupported GCC version
1075#endif
1076]], [], [AC_MSG_ERROR([gcc 3.x required, but you have a lower version])])
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001077fi
1078
1079dnl Check for GNU Make. We use its extensions, so don't build without it
1080if test -z "$llvm_cv_gnu_make_command"
1081then
1082 AC_MSG_ERROR([GNU Make required but not found])
1083fi
1084
1085dnl Tool compatibility is okay if we make it here.
1086AC_MSG_RESULT([ok])
1087
Eric Christopherec274962010-03-02 05:17:21 +00001088dnl Check optional compiler flags.
Julien Lerouge8039e032009-10-26 19:58:44 +00001089AC_MSG_CHECKING([optional compiler flags])
1090CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros])
1091CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers])
Rafael Espindola9993a3a2012-02-28 23:32:06 +00001092CXX_FLAG_CHECK(COVERED_SWITCH_DEFAULT, [-Wcovered-switch-default])
1093AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT])
Julien Lerouge8039e032009-10-26 19:58:44 +00001094
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001095dnl===-----------------------------------------------------------------------===
1096dnl===
1097dnl=== SECTION 5: Check for libraries
1098dnl===
1099dnl===-----------------------------------------------------------------------===
1100
Reid Spencer3484a992006-01-19 08:31:08 +00001101AC_CHECK_LIB(m,sin)
Jeff Cohen28783c32007-01-12 18:22:38 +00001102if test "$llvm_cv_os_type" = "MingW" ; then
Reid Spencer48fdf912006-06-01 19:03:21 +00001103 AC_CHECK_LIB(imagehlp, main)
1104 AC_CHECK_LIB(psapi, main)
Reid Spencer484fc8e2006-06-01 16:55:59 +00001105fi
Reid Spencer9e4f7012005-07-12 07:19:13 +00001106
Brian Gaeke4c423782003-10-07 05:03:36 +00001107dnl dlopen() is required for plugin support.
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001108AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1],
1109 [Define if dlopen() is available on this platform.]),
1110 AC_MSG_WARN([dlopen() not found - disabling plugin support]))
John Criswell4ea390d2003-07-22 19:13:20 +00001111
Nick Lewyckyf9c5c5c2009-02-04 06:26:47 +00001112dnl libffi is optional; used to call external functions from the interpreter
Nick Lewycky84bd0752009-06-06 06:24:44 +00001113if test "$llvm_cv_enable_libffi" = "yes" ; then
1114 AC_SEARCH_LIBS(ffi_call,ffi,AC_DEFINE([HAVE_FFI_CALL],[1],
1115 [Define if libffi is available on this platform.]),
Jeffrey Yasskinbc83d062010-02-09 23:03:44 +00001116 AC_MSG_ERROR([libffi not found - configure without --enable-libffi to compile without it]))
Nick Lewycky84bd0752009-06-06 06:24:44 +00001117fi
Nick Lewyckyf9c5c5c2009-02-04 06:26:47 +00001118
John Criswell4ea390d2003-07-22 19:13:20 +00001119dnl mallinfo is optional; the code can compile (minus features) without it
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001120AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],
1121 [Define if mallinfo() is available on this platform.]))
John Criswell4ea390d2003-07-22 19:13:20 +00001122
Brian Gaeke5f268f72003-12-05 19:29:01 +00001123dnl pthread locking functions are optional - but llvm will not be thread-safe
1124dnl without locks.
Dylan Noblesmith08b73a32011-11-28 00:48:58 +00001125if test "$LLVM_ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then
Edward O'Callaghan5da60462009-10-14 11:12:33 +00001126 AC_CHECK_LIB(pthread, pthread_mutex_init)
Reid Spencer0a262ba2005-08-24 10:07:20 +00001127 AC_SEARCH_LIBS(pthread_mutex_lock,pthread,
1128 AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1],
1129 [Have pthread_mutex_lock]))
Owen Andersonde8aed22009-06-16 18:20:20 +00001130 AC_SEARCH_LIBS(pthread_rwlock_init,pthread,
1131 AC_DEFINE([HAVE_PTHREAD_RWLOCK_INIT],[1],
1132 [Have pthread_rwlock_init]))
Owen Anderson27fcfe12009-06-25 23:10:26 +00001133 AC_SEARCH_LIBS(pthread_getspecific,pthread,
1134 AC_DEFINE([HAVE_PTHREAD_GETSPECIFIC],[1],
1135 [Have pthread_getspecific]))
Reid Spencer0a262ba2005-08-24 10:07:20 +00001136fi
Brian Gaeke5f268f72003-12-05 19:29:01 +00001137
Anton Korobeynikov8cd4c3e2007-01-19 17:25:17 +00001138dnl Allow extra x86-disassembler library
1139AC_ARG_WITH(udis86,
1140 AS_HELP_STRING([--with-udis86=<path>],
1141 [Use udis86 external x86 disassembler library]),
1142 [
1143 AC_SUBST(USE_UDIS86, [1])
1144 case "$withval" in
Anton Korobeynikova5137f32007-01-20 07:40:26 +00001145 /usr/lib|yes) ;;
Anton Korobeynikov8cd4c3e2007-01-19 17:25:17 +00001146 *) LDFLAGS="$LDFLAGS -L${withval}" ;;
1147 esac
1148 AC_CHECK_LIB(udis86, ud_init, [], [
1149 echo "Error! You need to have libudis86 around."
1150 exit -1
1151 ])
1152 ],
1153 AC_SUBST(USE_UDIS86, [0]))
1154AC_DEFINE_UNQUOTED([USE_UDIS86],$USE_UDIS86,
1155 [Define if use udis86 library])
1156
Jeffrey Yasskin8f6d9a72009-07-10 21:08:20 +00001157dnl Allow OProfile support for JIT output.
1158AC_ARG_WITH(oprofile,
1159 AS_HELP_STRING([--with-oprofile=<prefix>],
1160 [Tell OProfile >= 0.9.4 how to symbolize JIT output]),
1161 [
1162 AC_SUBST(USE_OPROFILE, [1])
1163 case "$withval" in
1164 /usr|yes) llvm_cv_oppath=/usr/lib/oprofile ;;
Jeffrey Yasskinfe897b22009-10-07 23:22:42 +00001165 no) llvm_cv_oppath=
1166 AC_SUBST(USE_OPROFILE, [0]) ;;
Jeffrey Yasskin8f6d9a72009-07-10 21:08:20 +00001167 *) llvm_cv_oppath="${withval}/lib/oprofile"
1168 CPPFLAGS="-I${withval}/include";;
1169 esac
Eli Bendersky61b18512012-03-13 08:33:15 +00001170 case $llvm_cv_os_type in
1171 Linux)
1172 if test -n "$llvm_cv_oppath" ; then
1173 LIBS="$LIBS -lopagent -L${llvm_cv_oppath} -Wl,-rpath,${llvm_cv_oppath}"
1174 dnl Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537744:
1175 dnl libbfd is not included properly in libopagent in some Debian
1176 dnl versions. If libbfd isn't found at all, we assume opagent works
1177 dnl anyway.
1178 AC_SEARCH_LIBS(bfd_init, bfd, [], [])
1179 AC_SEARCH_LIBS(op_open_agent, opagent, [], [
1180 echo "Error! You need to have libopagent around."
1181 exit -1
1182 ])
1183 AC_CHECK_HEADER([opagent.h], [], [
1184 echo "Error! You need to have opagent.h around."
1185 exit -1
1186 ])
1187 fi ;;
1188 *)
1189 AC_MSG_ERROR([OProfile support is available on Linux only.]) ;;
1190 esac
Jeffrey Yasskin8f6d9a72009-07-10 21:08:20 +00001191 ],
1192 [
Jeffrey Yasskinfe897b22009-10-07 23:22:42 +00001193 AC_SUBST(USE_OPROFILE, [0])
Jeffrey Yasskin8f6d9a72009-07-10 21:08:20 +00001194 ])
Eli Bendersky61b18512012-03-13 08:33:15 +00001195AC_DEFINE_UNQUOTED([LLVM_USE_OPROFILE],$USE_OPROFILE,
Jeffrey Yasskin8f6d9a72009-07-10 21:08:20 +00001196 [Define if we have the oprofile JIT-support library])
1197
Eli Bendersky61b18512012-03-13 08:33:15 +00001198dnl Enable support for Intel JIT Events API.
1199AC_ARG_WITH(intel-jitevents,
1200 AS_HELP_STRING([--with-intel-jitevents=<vtune-amplifier-dir>],
1201 [Specify location of run-time support library for Intel JIT API (default=/opt/intel/vtune_amplifier_xe_2011)]),
1202 [
1203 case $llvm_cv_os_type in
1204 Linux|Win32|Cygwin|MingW) ;;
1205 *)
1206 AC_MSG_ERROR([
1207 Intel JIT API support is available on Linux and Windows only."]) ;;
1208 esac
1209
1210 AC_SUBST(USE_INTEL_JITEVENTS, [1])
1211 case "$llvm_cv_target_arch" in
1212 x86) llvm_intel_jitevents_archdir="lib32";;
1213 x86_64) llvm_intel_jitevents_archdir="lib64";;
1214 *) echo "Target architecture $llvm_cv_target_arch does not support Intel JIT Events API"
1215 exit -1;;
1216 esac
1217 INTEL_JITEVENTS_INCDIR="/opt/intel/vtune_amplifier_xe_2011/include"
1218 INTEL_JITEVENTS_LIBDIR="/opt/intel/vtune_amplifier_xe_2011/$llvm_intel_jitevents_archdir"
1219 case "$withval" in
1220 /* | [[A-Za-z]]:[[\\/]]*) INTEL_JITEVENTS_INCDIR=$withval/include
1221 INTEL_JITEVENTS_LIBDIR=$withval/$llvm_intel_jitevents_archdir ;;
1222 *) ;;
1223 esac
1224
1225 AC_SUBST(INTEL_JITEVENTS_INCDIR)
1226 AC_SUBST(INTEL_JITEVENTS_LIBDIR)
1227
1228 LIBS="$LIBS -L${INTEL_JITEVENTS_LIBDIR}"
1229 CPPFLAGS="$CPPFLAGS -I$INTEL_JITEVENTS_INCDIR"
1230
1231 AC_SEARCH_LIBS(iJIT_IsProfilingActive, jitprofiling, [], [
1232 echo "Error! Cannot find libjitprofiling.a. Please check path specified in flag --with-intel-jitevents"
1233 exit -1
1234 ])
1235 AC_CHECK_HEADER([jitprofiling.h], [], [
1236 echo "Error! Cannot find jitprofiling.h. Please check path specified in flag --with-intel-jitevents"
1237 exit -1
1238 ])
1239
1240 ],
1241 [
1242 AC_SUBST(USE_INTEL_JITEVENTS, [0])
1243 ])
1244AC_DEFINE_UNQUOTED([LLVM_USE_INTEL_JITEVENTS],$USE_INTEL_JITEVENTS,
1245 [Define if we have the Intel JIT API runtime support library])
1246
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001247dnl===-----------------------------------------------------------------------===
1248dnl===
1249dnl=== SECTION 6: Check for header files
1250dnl===
1251dnl===-----------------------------------------------------------------------===
1252
Reid Spencer59473af2004-12-25 07:31:29 +00001253dnl First, use autoconf provided macros for specific headers that we need
Brian Gaeke26be9c52004-01-13 06:43:16 +00001254dnl We don't check for ancient stuff or things that are guaranteed to be there
1255dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers.
Reid Spencer59473af2004-12-25 07:31:29 +00001256dnl Generally we're looking for POSIX headers.
1257AC_HEADER_DIRENT
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001258AC_HEADER_MMAP_ANONYMOUS
Reid Spencer59473af2004-12-25 07:31:29 +00001259AC_HEADER_STAT
Reid Spencer59473af2004-12-25 07:31:29 +00001260AC_HEADER_SYS_WAIT
1261AC_HEADER_TIME
John Criswell4ea390d2003-07-22 19:13:20 +00001262
Reid Spencer59473af2004-12-25 07:31:29 +00001263AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h])
Douglas Gregor071d73d2009-05-18 17:21:34 +00001264AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h termios.h unistd.h])
1265AC_CHECK_HEADERS([utime.h windows.h])
Daniel Dunbar5cd067f2011-02-03 02:39:58 +00001266AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/uio.h])
Douglas Gregor01746742009-05-11 18:05:52 +00001267AC_CHECK_HEADERS([sys/types.h sys/ioctl.h malloc/malloc.h mach/mach.h])
Jeffrey Yasskinf28411f2010-03-15 04:57:55 +00001268AC_CHECK_HEADERS([valgrind/valgrind.h])
Dan Gohman3f2f21e2010-09-17 20:06:27 +00001269AC_CHECK_HEADERS([fenv.h])
Dylan Noblesmith08b73a32011-11-28 00:48:58 +00001270if test "$LLVM_ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then
Reid Spencerf8e9f7c2007-08-17 05:44:59 +00001271 AC_CHECK_HEADERS(pthread.h,
Nick Lewyckyf9c5c5c2009-02-04 06:26:47 +00001272 AC_SUBST(HAVE_PTHREAD, 1),
1273 AC_SUBST(HAVE_PTHREAD, 0))
Reid Spencer1000b732006-12-01 00:37:14 +00001274else
1275 AC_SUBST(HAVE_PTHREAD, 0)
Reid Spencer0a262ba2005-08-24 10:07:20 +00001276fi
Brian Gaeke1133eaf2004-02-23 22:07:01 +00001277
Nick Lewycky93f70fc2009-04-13 04:26:06 +00001278dnl Try to find ffi.h.
Nick Lewycky84bd0752009-06-06 06:24:44 +00001279if test "$llvm_cv_enable_libffi" = "yes" ; then
1280 AC_CHECK_HEADERS([ffi.h ffi/ffi.h])
1281fi
Nick Lewyckyf9c5c5c2009-02-04 06:26:47 +00001282
Eric Christopher481d4022010-12-03 07:45:22 +00001283dnl Try to find Darwin specific crash reporting libraries.
Eric Christopher654dee42010-06-22 21:01:04 +00001284AC_CHECK_HEADERS([CrashReporterClient.h])
1285
Eric Christopher481d4022010-12-03 07:45:22 +00001286dnl Try to find Darwin specific crash reporting global.
Eric Christopher51e57132010-12-07 02:05:42 +00001287AC_MSG_CHECKING([__crashreporter_info__])
1288AC_LINK_IFELSE(
1289 AC_LANG_SOURCE(
1290 [[extern const char *__crashreporter_info__;
1291 int main() {
1292 __crashreporter_info__ = "test";
1293 return 0;
1294 }
1295 ]]),
1296 AC_MSG_RESULT(yes)
1297 AC_DEFINE(HAVE_CRASHREPORTER_INFO, 1, Can use __crashreporter_info__),
1298 AC_MSG_RESULT(no)
1299 AC_DEFINE(HAVE_CRASHREPORTER_INFO, 0,
1300 Define if __crashreporter_info__ exists.))
1301
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001302dnl===-----------------------------------------------------------------------===
1303dnl===
1304dnl=== SECTION 7: Check for types and structures
1305dnl===
1306dnl===-----------------------------------------------------------------------===
1307
Reid Spencerb2ed05262006-11-03 18:04:08 +00001308AC_HUGE_VAL_CHECK
John Criswell4ea390d2003-07-22 19:13:20 +00001309AC_TYPE_PID_T
1310AC_TYPE_SIZE_T
Torok Edwinf6ce9ef2010-01-26 08:48:04 +00001311AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[Define as the return type of signal handlers (`int' or `void').])
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001312AC_STRUCT_TM
John Criswell4ea390d2003-07-22 19:13:20 +00001313AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
Reid Spencere2c6f512004-09-02 21:38:24 +00001314AC_CHECK_TYPES([uint64_t],,
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001315 AC_CHECK_TYPES([u_int64_t],,
1316 AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found])))
John Criswell4ea390d2003-07-22 19:13:20 +00001317
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001318dnl===-----------------------------------------------------------------------===
1319dnl===
1320dnl=== SECTION 8: Check for specific functions needed
1321dnl===
1322dnl===-----------------------------------------------------------------------===
1323
Chris Lattnerec7a9b32006-01-23 06:24:09 +00001324AC_CHECK_FUNCS([backtrace ceilf floorf roundf rintf nearbyintf getcwd ])
Gabor Greiff70414f2007-07-13 09:48:29 +00001325AC_CHECK_FUNCS([powf fmodf strtof round ])
1326AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ])
Anton Korobeynikov9ba8a762007-02-16 19:11:07 +00001327AC_CHECK_FUNCS([isatty mkdtemp mkstemp ])
Benjamin Kramer5745fbc2011-11-22 12:31:53 +00001328AC_CHECK_FUNCS([mktemp posix_spawn pread realpath sbrk setrlimit strdup ])
NAKAMURA Takumie29b0ac2011-02-09 04:18:48 +00001329AC_CHECK_FUNCS([strerror strerror_r setenv ])
Chris Lattner368c36f2005-11-14 07:24:17 +00001330AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
Daniel Dunbar5cd067f2011-02-03 02:39:58 +00001331AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev])
John Criswella0137d32003-10-13 16:22:01 +00001332AC_C_PRINTF_A
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001333AC_FUNC_RAND48
John Criswella0137d32003-10-13 16:22:01 +00001334
NAKAMURA Takumie29b0ac2011-02-09 04:18:48 +00001335dnl Check the declaration "Secure API" on Windows environments.
1336AC_CHECK_DECLS([strerror_s])
1337
NAKAMURA Takumi1f6832a2011-02-05 15:11:53 +00001338dnl Check symbols in libgcc.a for JIT on Mingw.
1339if test "$llvm_cv_os_type" = "MingW" ; then
1340 AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca]))
1341 AC_CHECK_LIB(gcc,__alloca,AC_DEFINE([HAVE___ALLOCA],[1],[Have host's __alloca]))
1342 AC_CHECK_LIB(gcc,__chkstk,AC_DEFINE([HAVE___CHKSTK],[1],[Have host's __chkstk]))
1343 AC_CHECK_LIB(gcc,___chkstk,AC_DEFINE([HAVE____CHKSTK],[1],[Have host's ___chkstk]))
1344
1345 AC_CHECK_LIB(gcc,__ashldi3,AC_DEFINE([HAVE___ASHLDI3],[1],[Have host's __ashldi3]))
1346 AC_CHECK_LIB(gcc,__ashrdi3,AC_DEFINE([HAVE___ASHRDI3],[1],[Have host's __ashrdi3]))
1347 AC_CHECK_LIB(gcc,__divdi3,AC_DEFINE([HAVE___DIVDI3],[1],[Have host's __divdi3]))
1348 AC_CHECK_LIB(gcc,__fixdfdi,AC_DEFINE([HAVE___FIXDFDI],[1],[Have host's __fixdfdi]))
1349 AC_CHECK_LIB(gcc,__fixsfdi,AC_DEFINE([HAVE___FIXSFDI],[1],[Have host's __fixsfdi]))
1350 AC_CHECK_LIB(gcc,__floatdidf,AC_DEFINE([HAVE___FLOATDIDF],[1],[Have host's __floatdidf]))
1351 AC_CHECK_LIB(gcc,__lshrdi3,AC_DEFINE([HAVE___LSHRDI3],[1],[Have host's __lshrdi3]))
1352 AC_CHECK_LIB(gcc,__moddi3,AC_DEFINE([HAVE___MODDI3],[1],[Have host's __moddi3]))
1353 AC_CHECK_LIB(gcc,__udivdi3,AC_DEFINE([HAVE___UDIVDI3],[1],[Have host's __udivdi3]))
1354 AC_CHECK_LIB(gcc,__umoddi3,AC_DEFINE([HAVE___UMODDI3],[1],[Have host's __umoddi3]))
1355
1356 AC_CHECK_LIB(gcc,__main,AC_DEFINE([HAVE___MAIN],[1],[Have host's __main]))
1357 AC_CHECK_LIB(gcc,__cmpdi2,AC_DEFINE([HAVE___CMPDI2],[1],[Have host's __cmpdi2]))
1358fi
1359
NAKAMURA Takumi6073a052011-05-01 13:29:49 +00001360dnl Check Win32 API EnumerateLoadedModules.
1361if test "$llvm_cv_os_type" = "MingW" ; then
1362 AC_MSG_CHECKING([whether EnumerateLoadedModules() accepts new decl])
1363 AC_COMPILE_IFELSE([[#include <windows.h>
1364#include <imagehlp.h>
1365extern void foo(PENUMLOADED_MODULES_CALLBACK);
1366extern void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID));]],
1367[
1368 AC_MSG_RESULT([yes])
1369 llvm_cv_win32_elmcb_pcstr="PCSTR"
1370],
1371[
1372 AC_MSG_RESULT([no])
1373 llvm_cv_win32_elmcb_pcstr="PSTR"
1374])
1375 AC_DEFINE_UNQUOTED([WIN32_ELMCB_PCSTR],$llvm_cv_win32_elmcb_pcstr,[Type of 1st arg on ELM Callback])
1376fi
1377
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001378dnl Check for variations in the Standard C++ library and STL. These macros are
1379dnl provided by LLVM in the autoconf/m4 directory.
Brian Gaeke8828eb52004-06-22 23:43:04 +00001380AC_FUNC_ISNAN
Brian Gaeke3869b272004-07-21 03:14:51 +00001381AC_FUNC_ISINF
Brian Gaeke8828eb52004-06-22 23:43:04 +00001382
Eric Christopher790e11c2007-12-01 00:34:39 +00001383dnl Check for mmap support.We also need to know if /dev/zero is required to
1384dnl be opened for allocating RWX memory.
Anton Korobeynikova5137f32007-01-20 07:40:26 +00001385dnl Make sure we aren't attempting to configure for an unknown system
1386if test "$llvm_cv_platform_type" = "Unix" ; then
Eric Christopher790e11c2007-12-01 00:34:39 +00001387 AC_FUNC_MMAP
Anton Korobeynikova5137f32007-01-20 07:40:26 +00001388 AC_FUNC_MMAP_FILE
1389 AC_NEED_DEV_ZERO_FOR_MMAP
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001390
Anton Korobeynikova5137f32007-01-20 07:40:26 +00001391 if test "$ac_cv_func_mmap_fixed_mapped" = "no"
1392 then
1393 AC_MSG_WARN([mmap() of a fixed address required but not supported])
1394 fi
1395 if test "$ac_cv_func_mmap_file" = "no"
1396 then
1397 AC_MSG_WARN([mmap() of files required but not found])
1398 fi
John Criswell79a8f092003-07-22 20:59:52 +00001399fi
1400
Owen Andersond4b272b2009-05-18 23:58:51 +00001401dnl atomic builtins are required for threading support.
Owen Andersona8603702009-05-19 22:18:56 +00001402AC_MSG_CHECKING(for GCC atomic builtins)
Eric Christopher475b3d32010-07-28 20:26:34 +00001403dnl Since we'll be using these atomic builtins in C++ files we should test
1404dnl the C++ compiler.
1405AC_LANG_PUSH([C++])
Owen Andersona8603702009-05-19 22:18:56 +00001406AC_LINK_IFELSE(
1407 AC_LANG_SOURCE(
Mikhail Glushenkov895f32c2009-07-03 03:52:07 +00001408 [[int main() {
Owen Andersona8603702009-05-19 22:18:56 +00001409 volatile unsigned long val = 1;
1410 __sync_synchronize();
1411 __sync_val_compare_and_swap(&val, 1, 0);
Owen Anderson9a3df672009-06-17 00:13:00 +00001412 __sync_add_and_fetch(&val, 1);
1413 __sync_sub_and_fetch(&val, 1);
Owen Andersona8603702009-05-19 22:18:56 +00001414 return 0;
1415 }
1416 ]]),
Eric Christopher475b3d32010-07-28 20:26:34 +00001417 AC_LANG_POP([C++])
Owen Andersona8603702009-05-19 22:18:56 +00001418 AC_MSG_RESULT(yes)
Eric Christopher627445f2011-09-19 20:43:23 +00001419 AC_DEFINE(LLVM_HAS_ATOMICS, 1, Has gcc/MSVC atomic intrinsics),
Owen Andersona8603702009-05-19 22:18:56 +00001420 AC_MSG_RESULT(no)
Eric Christopher627445f2011-09-19 20:43:23 +00001421 AC_DEFINE(LLVM_HAS_ATOMICS, 0, Has gcc/MSVC atomic intrinsics)
Owen Andersona8603702009-05-19 22:18:56 +00001422 AC_MSG_WARN([LLVM will be built thread-unsafe because atomic builtins are missing]))
Owen Andersond4b272b2009-05-18 23:58:51 +00001423
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001424dnl===-----------------------------------------------------------------------===
1425dnl===
1426dnl=== SECTION 9: Additional checks, variables, etc.
1427dnl===
1428dnl===-----------------------------------------------------------------------===
John Criswell4ea390d2003-07-22 19:13:20 +00001429
Nick Lewycky166b2b12009-09-29 06:18:00 +00001430dnl Handle 32-bit linux systems running a 64-bit kernel.
1431dnl This has to come after section 4 because it invokes the compiler.
1432if test "$llvm_cv_os_type" = "Linux" -a "$llvm_cv_target_arch" = "x86_64" ; then
1433 AC_IS_LINUX_MIXED
1434 if test "$llvm_cv_linux_mixed" = "yes"; then
1435 llvm_cv_target_arch="x86"
1436 ARCH="x86"
1437 fi
1438fi
1439
Eric Christophere4b3ef42011-09-20 22:26:35 +00001440dnl Check whether __dso_handle is present
Anton Korobeynikov3b30a6e2007-07-30 20:02:02 +00001441AC_CHECK_FUNCS([__dso_handle])
1442
Eric Christopher790e11c2007-12-01 00:34:39 +00001443dnl Propagate the shared library extension that the libltdl checks did to
Reid Spencer2bc7bd52004-11-29 12:29:58 +00001444dnl the Makefiles so we can use it there too
1445AC_SUBST(SHLIBEXT,$libltdl_cv_shlibext)
Brian Gaekecea9a602004-01-21 19:38:56 +00001446
Jeffrey Yasskinc9017192010-02-25 06:34:33 +00001447dnl Propagate the run-time library path variable that the libltdl
1448dnl checks found to the Makefiles so we can use it there too
1449AC_SUBST(SHLIBPATH_VAR,$libltdl_cv_shlibpath_var)
1450
Gabor Greiff18b6fe2012-01-26 10:28:58 +00001451dnl Translate the various configuration directories and other basic
1452dnl information into substitutions that will end up in Makefile.config.in
1453dnl that these configured values can be used by the makefiles
Jeff Cohen28783c32007-01-12 18:22:38 +00001454if test "${prefix}" = "NONE" ; then
Reid Spencer05828872006-05-16 08:53:32 +00001455 prefix="/usr/local"
1456fi
Reid Spencera91929d2004-08-20 09:03:12 +00001457eval LLVM_PREFIX="${prefix}";
1458eval LLVM_BINDIR="${prefix}/bin";
1459eval LLVM_LIBDIR="${prefix}/lib";
Reid Spencer1f319422004-11-29 04:56:35 +00001460eval LLVM_DATADIR="${prefix}/share/llvm";
Eric Christopherec274962010-03-02 05:17:21 +00001461eval LLVM_DOCSDIR="${prefix}/share/doc/llvm";
Reid Spencer1f319422004-11-29 04:56:35 +00001462eval LLVM_ETCDIR="${prefix}/etc/llvm";
Reid Spencera91929d2004-08-20 09:03:12 +00001463eval LLVM_INCLUDEDIR="${prefix}/include";
1464eval LLVM_INFODIR="${prefix}/info";
1465eval LLVM_MANDIR="${prefix}/man";
1466LLVM_CONFIGTIME=`date`
1467AC_SUBST(LLVM_PREFIX)
1468AC_SUBST(LLVM_BINDIR)
1469AC_SUBST(LLVM_LIBDIR)
1470AC_SUBST(LLVM_DATADIR)
1471AC_SUBST(LLVM_DOCSDIR)
1472AC_SUBST(LLVM_ETCDIR)
1473AC_SUBST(LLVM_INCLUDEDIR)
1474AC_SUBST(LLVM_INFODIR)
1475AC_SUBST(LLVM_MANDIR)
1476AC_SUBST(LLVM_CONFIGTIME)
Reid Spencera91929d2004-08-20 09:03:12 +00001477
Daniel Dunbarc70b79e2012-03-02 16:24:21 +00001478dnl Disable embedding timestamps in the build directory, with ENABLE_TIMESTAMPS.
1479if test "${ENABLE_TIMESTAMPS}" = "0"; then
1480 LLVM_CONFIGTIME="(timestamp not enabled)"
1481fi
1482
Gabor Greiff18b6fe2012-01-26 10:28:58 +00001483dnl Place the various directories into the config.h file as #defines so that we
1484dnl can know about the installation paths within LLVM.
Eric Christopher790e11c2007-12-01 00:34:39 +00001485AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX",
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001486 [Installation prefix directory])
Eric Christopher790e11c2007-12-01 00:34:39 +00001487AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR",
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001488 [Installation directory for binary executables])
Eric Christopher790e11c2007-12-01 00:34:39 +00001489AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR",
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001490 [Installation directory for libraries])
Eric Christopher790e11c2007-12-01 00:34:39 +00001491AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR",
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001492 [Installation directory for data files])
Eric Christopher790e11c2007-12-01 00:34:39 +00001493AC_DEFINE_UNQUOTED(LLVM_DOCSDIR, "$LLVM_DOCSDIR",
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001494 [Installation directory for documentation])
Eric Christopher790e11c2007-12-01 00:34:39 +00001495AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR",
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001496 [Installation directory for config files])
Eric Christopher790e11c2007-12-01 00:34:39 +00001497AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR",
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001498 [Installation directory for include files])
Eric Christopher790e11c2007-12-01 00:34:39 +00001499AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR",
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001500 [Installation directory for .info files])
Eric Christopher790e11c2007-12-01 00:34:39 +00001501AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR",
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001502 [Installation directory for man pages])
Eric Christopher790e11c2007-12-01 00:34:39 +00001503AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001504 [Time at which LLVM was configured])
Sebastian Popde2e0b52011-11-01 21:31:44 +00001505AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target",
1506 [Target triple LLVM will generate code for by default])
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001507
Gabor Greiff18b6fe2012-01-26 10:28:58 +00001508dnl Determine which bindings to build.
Gordon Henriksen6530e9d2007-10-02 09:50:18 +00001509if test "$BINDINGS_TO_BUILD" = auto ; then
1510 BINDINGS_TO_BUILD=""
1511 if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then
1512 BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD"
1513 fi
1514fi
1515AC_SUBST(BINDINGS_TO_BUILD,$BINDINGS_TO_BUILD)
1516
Gabor Greiff18b6fe2012-01-26 10:28:58 +00001517dnl This isn't really configurey, but it avoids having to repeat the list in
1518dnl other files.
Gordon Henriksen6530e9d2007-10-02 09:50:18 +00001519AC_SUBST(ALL_BINDINGS,ocaml)
1520
Gabor Greiff18b6fe2012-01-26 10:28:58 +00001521dnl Do any work necessary to ensure that bindings have what they need.
Gordon Henriksen1d4e0782007-10-02 16:42:10 +00001522binding_prereqs_failed=0
1523for a_binding in $BINDINGS_TO_BUILD ; do
1524 case "$a_binding" in
1525 ocaml)
1526 if test "x$OCAMLC" = x ; then
1527 AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc])
1528 binding_prereqs_failed=1
1529 fi
1530 if test "x$OCAMLDEP" = x ; then
1531 AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep])
1532 binding_prereqs_failed=1
1533 fi
1534 if test "x$OCAMLOPT" = x ; then
1535 AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt])
Eric Christopher790e11c2007-12-01 00:34:39 +00001536 dnl ocamlopt is optional!
Gordon Henriksen1d4e0782007-10-02 16:42:10 +00001537 fi
1538 if test "x$with_ocaml_libdir" != xauto ; then
1539 AC_SUBST(OCAML_LIBDIR,$with_ocaml_libdir)
1540 else
1541 ocaml_stdlib="`"$OCAMLC" -where`"
1542 if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~"
1543 then
1544 # ocaml stdlib is beneath our prefix; use stdlib
1545 AC_SUBST(OCAML_LIBDIR,$ocaml_stdlib)
1546 else
1547 # ocaml stdlib is outside our prefix; use libdir/ocaml
1548 AC_SUBST(OCAML_LIBDIR,$LLVM_LIBDIR/ocaml)
1549 fi
1550 fi
1551 ;;
1552 esac
1553done
1554if test "$binding_prereqs_failed" = 1 ; then
1555 AC_MSG_ERROR([Prequisites for bindings not satisfied. Fix them or use configure --disable-bindings.])
1556fi
1557
Nick Lewycky18f99072009-03-05 08:20:21 +00001558dnl Determine whether the compiler supports -fvisibility-inlines-hidden.
Daniel Dunbarecfe67c2008-09-02 17:35:16 +00001559AC_CXX_USE_VISIBILITY_INLINES_HIDDEN
Gordon Henriksen1d4e0782007-10-02 16:42:10 +00001560
Nick Lewycky1dace482009-03-03 04:55:15 +00001561dnl Determine linker rpath flag
Nick Lewycky18f99072009-03-05 08:20:21 +00001562if test "$llvm_cv_link_use_r" = "yes" ; then
1563 RPATH="-Wl,-R"
1564else
1565 RPATH="-Wl,-rpath"
1566fi
Nick Lewycky1dace482009-03-03 04:55:15 +00001567AC_SUBST(RPATH)
1568
Nick Lewycky18f99072009-03-05 08:20:21 +00001569dnl Determine linker rdynamic flag
1570if test "$llvm_cv_link_use_export_dynamic" = "yes" ; then
1571 RDYNAMIC="-Wl,-export-dynamic"
1572else
1573 RDYNAMIC=""
1574fi
1575AC_SUBST(RDYNAMIC)
1576
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001577dnl===-----------------------------------------------------------------------===
1578dnl===
1579dnl=== SECTION 10: Specify the output files and generate it
1580dnl===
1581dnl===-----------------------------------------------------------------------===
1582
1583dnl Configure header files
Reid Spencer755bcf02005-08-24 10:43:10 +00001584dnl WARNING: dnl If you add or remove any of the following config headers, then
Dylan Noblesmithf214b802012-01-17 02:56:49 +00001585dnl you MUST also update Makefile so that the variable FilesToConfig
Reid Spencer755bcf02005-08-24 10:43:10 +00001586dnl contains the same list of files as AC_CONFIG_HEADERS below. This ensures the
1587dnl files can be updated automatically when their *.in sources change.
Eric Christophereec50082010-08-08 02:44:17 +00001588AC_CONFIG_HEADERS([include/llvm/Config/config.h include/llvm/Config/llvm-config.h])
Eric Christopherd442d282010-08-08 09:18:29 +00001589AH_TOP([#ifndef CONFIG_H
1590#define CONFIG_H])
1591AH_BOTTOM([#endif])
1592
Douglas Gregor1555a232009-06-16 20:12:29 +00001593AC_CONFIG_FILES([include/llvm/Config/Targets.def])
1594AC_CONFIG_FILES([include/llvm/Config/AsmPrinters.def])
Daniel Dunbar8413b222009-07-17 20:56:18 +00001595AC_CONFIG_FILES([include/llvm/Config/AsmParsers.def])
Daniel Dunbarfa3f0b92009-11-25 04:30:13 +00001596AC_CONFIG_FILES([include/llvm/Config/Disassemblers.def])
Michael J. Spencer1f6efa32010-11-29 18:16:10 +00001597AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h])
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001598
1599dnl Configure the makefile's configuration data
1600AC_CONFIG_FILES([Makefile.config])
1601
Reid Spencerea949cf2006-08-16 00:45:38 +00001602dnl Configure the RPM spec file for LLVM
1603AC_CONFIG_FILES([llvm.spec])
1604
Peter Collingbourne7be3a602011-05-13 03:27:56 +00001605dnl Configure doxygen's configuration file
1606AC_CONFIG_FILES([docs/doxygen.cfg])
Dylan Noblesmith06db4582012-02-01 14:06:21 +00001607
1608dnl Configure clang, if present
Dylan Noblesmith3e82b4a2012-02-04 02:41:36 +00001609if test "${clang_src_root}" = ""; then
Dylan Noblesmith32cf80b2012-02-02 00:54:18 +00001610 clang_src_root="$srcdir/tools/clang"
Dylan Noblesmithdb6caea2012-02-02 00:17:33 +00001611fi
Dylan Noblesmith8d6dd0f2012-02-02 00:11:14 +00001612if test -f ${clang_src_root}/README.txt; then
Dylan Noblesmith965a1662012-02-04 03:00:50 +00001613 dnl Use variables to stay under 80 columns.
1614 configh="include/clang/Config/config.h"
1615 doxy="docs/doxygen.cfg"
1616 AC_CONFIG_HEADERS([tools/clang/${configh}:${clang_src_root}/${configh}.in])
1617 AC_CONFIG_FILES([tools/clang/${doxy}:${clang_src_root}/${doxy}.in])
Peter Collingbourne7be3a602011-05-13 03:27:56 +00001618fi
1619
Torok Edwin4c4b71c2011-10-14 20:38:02 +00001620dnl OCaml findlib META file
1621AC_CONFIG_FILES([bindings/ocaml/llvm/META.llvm])
1622
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001623dnl Do special configuration of Makefiles
Reid Spencer1807c1a2005-02-24 18:31:27 +00001624AC_CONFIG_COMMANDS([setup],,[llvm_src="${srcdir}"])
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001625AC_CONFIG_MAKEFILE(Makefile)
1626AC_CONFIG_MAKEFILE(Makefile.common)
1627AC_CONFIG_MAKEFILE(examples/Makefile)
1628AC_CONFIG_MAKEFILE(lib/Makefile)
Reid Spencer8b2e1412006-11-17 03:32:33 +00001629AC_CONFIG_MAKEFILE(runtime/Makefile)
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001630AC_CONFIG_MAKEFILE(test/Makefile)
1631AC_CONFIG_MAKEFILE(test/Makefile.tests)
Bill Wendling4113bd12009-01-04 23:12:21 +00001632AC_CONFIG_MAKEFILE(unittests/Makefile)
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001633AC_CONFIG_MAKEFILE(tools/Makefile)
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001634AC_CONFIG_MAKEFILE(utils/Makefile)
1635AC_CONFIG_MAKEFILE(projects/Makefile)
Gordon Henriksen28622d62007-09-22 21:36:22 +00001636AC_CONFIG_MAKEFILE(bindings/Makefile)
1637AC_CONFIG_MAKEFILE(bindings/ocaml/Makefile.ocaml)
Reid Spencer5e1d9a52004-11-25 04:51:04 +00001638
1639dnl Finally, crank out the output
Reid Spencerc1b0d492004-09-19 23:43:52 +00001640AC_OUTPUT