blob: 6d968e72dd42007011c2f3e53deb434fa46b7021 [file] [log] [blame]
Brian Gaeke2abe7ae2004-01-13 06:43:16 +00001dnl Initialize autoconf
Reid Spencercf05c122004-08-20 09:03:12 +00002AC_INIT([[LLVM]],[[1.4]],[llvmbugs@cs.uiuc.edu])
John Criswell7a3334d2003-07-22 19:13:20 +00003
4dnl Place all of the extra autoconf files into the config subdirectory
5AC_CONFIG_AUX_DIR([autoconf])
6
John Criswell22107a72003-09-15 17:04:06 +00007dnl Quit if the source directory has already been configured.
John Criswellf6778b62003-09-15 17:19:42 +00008dnl NOTE: This relies upon undocumented autoconf behavior.
9if test ${srcdir} != "."
John Criswell22107a72003-09-15 17:04:06 +000010then
Reid Spencer7c16caa2004-09-01 22:55:40 +000011 if test -f ${srcdir}/include/llvm/Config/config.h
John Criswellf6778b62003-09-15 17:19:42 +000012 then
13 AC_MSG_ERROR([Already configured in ${srcdir}])
14 fi
John Criswell22107a72003-09-15 17:04:06 +000015fi
16
John Criswell297baed2003-11-25 20:36:46 +000017dnl Configure all of the projects present in our source tree.
John Criswell297baed2003-11-25 20:36:46 +000018for i in `ls ${srcdir}/projects`
19do
20 if test ${i} != "CVS"
21 then
John Criswell6f73d282003-12-12 20:09:33 +000022 if test -f ${srcdir}/projects/${i}/configure
John Criswell297baed2003-11-25 20:36:46 +000023 then
24 AC_CONFIG_SUBDIRS(projects/${i})
25 fi
26 fi
27done
John Criswellee7ebdc2003-09-30 16:31:48 +000028
John Criswell9537b042004-07-23 15:40:57 +000029dnl Configure header files
Reid Spencer7c16caa2004-09-01 22:55:40 +000030AC_CONFIG_HEADERS(include/llvm/Config/config.h)
John Criswell9537b042004-07-23 15:40:57 +000031
32dnl Configure other output file
33AC_CONFIG_FILES(Makefile.config
Reid Spencer7c16caa2004-09-01 22:55:40 +000034 include/llvm/Support/DataTypes.h
35 include/llvm/Support/ThreadSupport.h
36 include/llvm/ADT/hash_map
37 include/llvm/ADT/hash_set
38 include/llvm/ADT/iterator)
John Criswell9537b042004-07-23 15:40:57 +000039
40dnl Do special configuration of Makefiles
John Criswell2970d522003-09-06 14:46:19 +000041AC_CONFIG_MAKEFILE(Makefile)
42AC_CONFIG_MAKEFILE(Makefile.common)
Reid Spencera4070072004-08-24 16:31:01 +000043AC_CONFIG_MAKEFILE(examples/Makefile)
John Criswell2970d522003-09-06 14:46:19 +000044AC_CONFIG_MAKEFILE(lib/Makefile)
John Criswell2970d522003-09-06 14:46:19 +000045AC_CONFIG_MAKEFILE(runtime/Makefile)
John Criswell2970d522003-09-06 14:46:19 +000046AC_CONFIG_MAKEFILE(test/Makefile)
47AC_CONFIG_MAKEFILE(test/Makefile.tests)
John Criswelle078b432003-10-07 21:13:47 +000048AC_CONFIG_MAKEFILE(test/QMTest/llvm.py)
49AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py)
John Criswell2970d522003-09-06 14:46:19 +000050AC_CONFIG_MAKEFILE(test/Programs/Makefile)
51AC_CONFIG_MAKEFILE(test/Programs/Makefile.programs)
John Criswell3c99d0c2004-06-22 21:35:10 +000052AC_CONFIG_MAKEFILE(test/Programs/Makefile.tests)
John Criswell2970d522003-09-06 14:46:19 +000053AC_CONFIG_MAKEFILE(test/Programs/TEST.aa.Makefile)
54AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.report)
John Criswell2970d522003-09-06 14:46:19 +000055AC_CONFIG_MAKEFILE(test/Programs/TEST.aa.report)
56AC_CONFIG_MAKEFILE(test/Programs/TEST.example.Makefile)
57AC_CONFIG_MAKEFILE(test/Programs/TEST.nightly.Makefile)
58AC_CONFIG_MAKEFILE(test/Programs/TEST.buildrepo.Makefile)
59AC_CONFIG_MAKEFILE(test/Programs/TEST.jit.Makefile)
60AC_CONFIG_MAKEFILE(test/Programs/TEST.nightly.report)
61AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.Makefile)
62AC_CONFIG_MAKEFILE(test/Programs/TEST.jit.report)
63AC_CONFIG_MAKEFILE(test/Programs/TEST.typesafe.Makefile)
64AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.gnuplot)
John Criswell47c54592004-02-24 21:43:38 +000065AC_CONFIG_MAKEFILE(test/Programs/TEST.vtl.Makefile)
John Criswell2970d522003-09-06 14:46:19 +000066AC_CONFIG_MAKEFILE(test/Programs/External/Makefile)
67AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile)
John Criswell7e0a65d2003-09-11 18:04:00 +000068AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec)
Alkis Evlogimenose008a4b2004-02-26 04:14:10 +000069AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec2000)
John Criswell43fc5c12004-02-10 22:29:06 +000070AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec95)
John Criswell2970d522003-09-06 14:46:19 +000071AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Makefile)
72AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Makefile.multisrc)
Misha Brukman77a8be82003-11-12 22:16:23 +000073AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/test.in)
Misha Brukmandc6863a2003-11-12 19:39:10 +000074AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/distray/Makefile)
Misha Brukman77a8be82003-11-12 22:16:23 +000075AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/distray/test.in)
Misha Brukmandc6863a2003-11-12 19:39:10 +000076AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/Makefile)
Misha Brukman77a8be82003-11-12 22:16:23 +000077AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/test.in)
Misha Brukmandc6863a2003-11-12 19:39:10 +000078AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/mason/Makefile)
Misha Brukman77a8be82003-11-12 22:16:23 +000079AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/mason/test.in)
Misha Brukmandc6863a2003-11-12 19:39:10 +000080AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/neural/Makefile)
Misha Brukman77a8be82003-11-12 22:16:23 +000081AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/neural/test.in)
Misha Brukmandc6863a2003-11-12 19:39:10 +000082AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2/Makefile)
Misha Brukman77a8be82003-11-12 22:16:23 +000083AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2/test.in)
Misha Brukmandc6863a2003-11-12 19:39:10 +000084AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pifft/Makefile)
Misha Brukman77a8be82003-11-12 22:16:23 +000085AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pifft/test.in)
John Criswell2970d522003-09-06 14:46:19 +000086AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile)
87AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile.singlesrc)
Alkis Evlogimenose008a4b2004-02-26 04:14:10 +000088AC_CONFIG_MAKEFILE(test/Programs/SingleSource/UnitTests/SetjmpLongjmp/Makefile)
John Criswell2970d522003-09-06 14:46:19 +000089AC_CONFIG_MAKEFILE(tools/Makefile)
Chris Lattner672edbc2003-10-06 02:09:25 +000090AC_CONFIG_MAKEFILE(utils/Makefile)
John Criswell2970d522003-09-06 14:46:19 +000091AC_CONFIG_MAKEFILE(projects/Makefile)
John Criswell7a3334d2003-07-22 19:13:20 +000092
Brian Gaeke2abe7ae2004-01-13 06:43:16 +000093dnl Find the install program (needs to be done before canonical stuff)
John Criswell7a3334d2003-07-22 19:13:20 +000094AC_PROG_INSTALL
95
96dnl Check which host for which we're compiling. This will tell us which LLVM
97dnl compiler will be used for compiling SSA into object code.
98AC_CANONICAL_TARGET
99
Brian Gaeke7027ed82003-11-17 00:30:48 +0000100dnl Set the "OS" Makefile variable based on the system we are building on.
John Criswell7a3334d2003-07-22 19:13:20 +0000101dnl We will use the build machine information to set some variables.
Reid Spencer67be17a2004-08-31 14:20:36 +0000102
103AC_MSG_CHECKING([support for generic build operating system])
John Criswell7a3334d2003-07-22 19:13:20 +0000104case $build in
Reid Spencer67be17a2004-08-31 14:20:36 +0000105 *-*-aix*)
106 AC_SUBST(OS,[AIX])
107 platform_type="AIX"
108 ;;
109 *-*-cygwin*)
110 AC_SUBST(OS,[Cygwin])
111 platform_type="Cygwin"
112 ;;
113 *-*-darwin*)
114 AC_SUBST(OS,[Darwin])
115 platform_type="Darwin"
116 ;;
117 *-*-freebsd*)
118 AC_SUBST(OS,[Linux])
Reid Spencerf2531a12004-08-31 18:03:23 +0000119 platform_type="FreeBSD"
Reid Spencer67be17a2004-08-31 14:20:36 +0000120 ;;
121 *-*-interix*)
122 AC_SUBST(OS,[SunOS])
Reid Spencerf2531a12004-08-31 18:03:23 +0000123 platform_type="Interix"
Reid Spencer67be17a2004-08-31 14:20:36 +0000124 ;;
Brian Gaeke7027ed82003-11-17 00:30:48 +0000125 *-*-linux*)
126 AC_SUBST(OS,[Linux])
Reid Spencera872cbe2004-08-29 19:18:05 +0000127 platform_type="Linux"
128 if test -d /home/vadve/lattner/local/x86/llvm-gcc
129 then
130 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/])
131 fi
132 ;;
Brian Gaeke7027ed82003-11-17 00:30:48 +0000133 *-*-solaris*)
134 AC_SUBST(OS,[SunOS])
Reid Spencera872cbe2004-08-29 19:18:05 +0000135 platform_type="SunOS"
136 if test -d /home/vadve/lattner/local/sparc/llvm-gcc
137 then
138 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/])
139 fi
140 ;;
Reid Spencera872cbe2004-08-29 19:18:05 +0000141 *-*-win32*)
142 AC_SUBST(OS,[Win32])
143 platform_type="Win32"
144 ;;
145 *)
146 AC_SUBST(OS,[Unknown])
147 platform_type="Unknown"
148 ;;
John Criswell7a3334d2003-07-22 19:13:20 +0000149esac
150
Reid Spencer1daffa52004-08-31 01:34:10 +0000151dnl Make sure we aren't attempting to configure for an unknown system
Reid Spencer67be17a2004-08-31 14:20:36 +0000152if test "$platform_type" = "Unknown" ; then
Reid Spencer1daffa52004-08-31 01:34:10 +0000153 AC_MSG_ERROR([Platform is unknown, configure can't continue])
154fi
155
Reid Spencera872cbe2004-08-29 19:18:05 +0000156dnl Make a link from lib/System/platform to lib/System/$platform_type
157dnl This helps the #inclusion of the system specific include files
158dnl for the operating system abstraction library
159AC_CONFIG_LINKS(lib/System/platform:lib/System/$platform_type)
160
Reid Spencer67be17a2004-08-31 14:20:36 +0000161AC_MSG_RESULT($platform_type)
162
163AC_MSG_CHECKING(target architecture)
John Criswell7a3334d2003-07-22 19:13:20 +0000164dnl If we are targetting a Sparc machine running Solaris, pretend that it is
165dnl V9, since that is all that we support at the moment, and autoconf will only
166dnl tell us we're a sparc.
John Criswell7a3334d2003-07-22 19:13:20 +0000167case $target in
Brian Gaeke7027ed82003-11-17 00:30:48 +0000168 sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]])
169 ;;
John Criswell7a3334d2003-07-22 19:13:20 +0000170esac
171
John Criswell7a3334d2003-07-22 19:13:20 +0000172dnl Determine what our target architecture is and configure accordingly.
173dnl This will allow Makefiles to make a distinction between the hardware and
174dnl the OS.
John Criswell7a3334d2003-07-22 19:13:20 +0000175case $target in
Reid Spencer67be17a2004-08-31 14:20:36 +0000176 i*86-*)
177 ARCH="x86"
178 AC_SUBST(ARCH,[x86])
179 ;;
180 sparc*-*)
181 ARCH="Sparc"
182 AC_SUBST(ARCH,[Sparc])
183 ;;
184 powerpc*-*)
185 ARCH="PowerPC"
186 AC_SUBST(ARCH,[PowerPC])
187 ;;
188 *)
189 ARCH="Unknown"
190 AC_SUBST(ARCH,[Unknown])
191 ;;
John Criswell7a3334d2003-07-22 19:13:20 +0000192esac
193
Reid Spencer67be17a2004-08-31 14:20:36 +0000194AC_MSG_RESULT($ARCH)
195
John Criswell7a3334d2003-07-22 19:13:20 +0000196dnl Check for compilation tools
197AC_PROG_CXX
198AC_PROG_CC(gcc)
199AC_PROG_CPP
200
201dnl Ensure that compilation tools are GCC; we use GCC specific extensions
202if test "$GCC" != "yes"
203then
204 AC_MSG_ERROR([gcc required but not found])
205fi
John Criswell7a3334d2003-07-22 19:13:20 +0000206if test "$GXX" != "yes"
207then
208 AC_MSG_ERROR([g++ required but not found])
209fi
210
John Criswell6a47a972003-08-25 16:49:54 +0000211dnl Verify that GCC is version 3.0 or higher
212gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1`
213if test "$gccmajor" -lt "3"
214then
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000215 AC_MSG_ERROR([gcc 3.x required, but you have a lower version])
John Criswell6a47a972003-08-25 16:49:54 +0000216fi
217
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000218dnl Check for GNU Make. We use its extensions too, so don't build without it
John Criswell7a3334d2003-07-22 19:13:20 +0000219CHECK_GNU_MAKE
220if test -z "$_cv_gnu_make_command"
221then
222 AC_MSG_ERROR([GNU Make required but not found])
223fi
224
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000225dnl Checks for other tools
John Criswell7a3334d2003-07-22 19:13:20 +0000226AC_PROG_FLEX
227AC_PROG_BISON
John Criswell7a3334d2003-07-22 19:13:20 +0000228AC_PROG_LIBTOOL
229
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000230dnl Checks for tools we can get away with not having:
231AC_PATH_PROG(DOT,[dot],[true dot])
232AC_PATH_PROG(ETAGS,[etags],[true etags])
Brian Gaeke3f58a872004-01-22 21:55:15 +0000233dnl Check if we know how to tell etags we are using C++:
234etags_version=`$ETAGS --version 2>&1`
235case "$etags_version" in
236 *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;;
237 *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;;
238 *) ETAGSFLAGS="" ;;
239esac
240AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000241AC_PATH_PROG(PYTHON,[python],[true python])
242if test "$PYTHON" = "false"
John Criswell31494482003-09-23 15:28:52 +0000243then
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000244 AC_MSG_WARN([Python is required for the test suite, but it was not found])
John Criswell31494482003-09-23 15:28:52 +0000245fi
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000246AC_PATH_PROG(QMTEST,[qmtest],[true qmtest])
247if test "$QMTEST" = "false"
John Criswell31494482003-09-23 15:28:52 +0000248then
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000249 AC_MSG_WARN([QMTest is required for the test suite, but it was not found])
John Criswell31494482003-09-23 15:28:52 +0000250fi
John Criswell6a47a972003-08-25 16:49:54 +0000251
252dnl Verify that the version of python available is high enough for qmtest
253pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2`
254pymajor=`echo $pyversion | cut -d. -f1`
255pyminor=`echo $pyversion | cut -d. -f2`
256
257if test "$pymajor" -ge "2"
258then
259 if test "$pymajor" -eq "2"
260 then
261 if test "$pyminor" -lt "2"
262 then
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000263 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswell6a47a972003-08-25 16:49:54 +0000264 fi
265 fi
266else
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000267 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswell6a47a972003-08-25 16:49:54 +0000268fi
John Criswell7a3334d2003-07-22 19:13:20 +0000269
270dnl Verify that the source directory is valid
271AC_CONFIG_SRCDIR(["Makefile.config.in"])
272
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000273dnl Checks for libraries:
John Criswell7a3334d2003-07-22 19:13:20 +0000274dnl libelf is for sparc only; we can ignore it if we don't have it
275AC_CHECK_LIB(elf, elf_begin)
276
Brian Gaeke25f2a372003-10-07 05:03:36 +0000277dnl dlopen() is required for plugin support.
Brian Gaeked7a702d2003-10-08 21:44:07 +0000278AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1],[Define if dlopen() is available on this platform.]),AC_MSG_WARN([dlopen() not found - disabling plugin support]))
John Criswell7a3334d2003-07-22 19:13:20 +0000279
280dnl mallinfo is optional; the code can compile (minus features) without it
Brian Gaeked7a702d2003-10-08 21:44:07 +0000281AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.]))
John Criswell7a3334d2003-07-22 19:13:20 +0000282
Brian Gaeke7ee7b402003-12-05 19:29:01 +0000283dnl pthread locking functions are optional - but llvm will not be thread-safe
284dnl without locks.
Brian Gaeke01cc3d82004-02-23 21:30:36 +0000285AC_SEARCH_LIBS(pthread_mutex_lock,pthread,HAVE_PTHREAD_MUTEX_LOCK=1,HAVE_PTHREAD_MUTEX_LOCK=0)
286AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK)
Brian Gaeke7ee7b402003-12-05 19:29:01 +0000287
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000288dnl Checks for header files.
289dnl We don't check for ancient stuff or things that are guaranteed to be there
290dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers.
John Criswell7a3334d2003-07-22 19:13:20 +0000291AC_HEADER_STDC
292AC_HEADER_SYS_WAIT
293
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000294dnl Checks for POSIX and other various system-specific header files
John Criswell1cd5f922004-05-27 20:40:39 +0000295AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h malloc.h sys/mman.h sys/resource.h dlfcn.h link.h execinfo.h windows.h)
John Criswell7a3334d2003-07-22 19:13:20 +0000296
Brian Gaeke090ed132004-02-23 22:07:01 +0000297dnl Check for things that need to be included in public headers, and so
298dnl for which we may not have access to a HAVE_* preprocessor #define.
299dnl (primarily used in DataTypes.h)
300AC_CHECK_HEADER([sys/types.h],
301 [INCLUDE_SYS_TYPES_H='#include <sys/types.h>'],
302 [INCLUDE_SYS_TYPES_H=''])
303AC_SUBST(INCLUDE_SYS_TYPES_H)
304AC_CHECK_HEADER([inttypes.h],
305 [INCLUDE_INTTYPES_H='#include <inttypes.h>'],
306 [INCLUDE_INTTYPES_H=''])
307AC_SUBST(INCLUDE_INTTYPES_H)
John Criswellb92c7c22004-07-19 16:12:29 +0000308AC_CHECK_HEADER([stdint.h],
309 [INCLUDE_STDINT_H='#include <stdint.h>'],
310 [INCLUDE_STDINT_H=''])
311AC_SUBST(INCLUDE_STDINT_H)
312
Brian Gaeke090ed132004-02-23 22:07:01 +0000313
John Criswell7a3334d2003-07-22 19:13:20 +0000314dnl Check for types
315AC_TYPE_PID_T
316AC_TYPE_SIZE_T
317AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
Reid Spencerab2228a2004-09-02 21:38:24 +0000318AC_CHECK_TYPES([uint64_t],,
319 AC_CHECK_TYPES([u_int64_t],,
320 AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found])))
John Criswell7a3334d2003-07-22 19:13:20 +0000321AC_HEADER_TIME
322AC_STRUCT_TM
323
John Criswell42859552003-10-13 16:22:01 +0000324dnl Check for various C features
325AC_C_PRINTF_A
326
John Criswell3b4195f32004-02-13 21:57:29 +0000327dnl Check for the endianness of the target
328AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
329
John Criswell7a3334d2003-07-22 19:13:20 +0000330dnl Check for C++ extensions
Brian Gaekeb6218572003-11-10 03:06:09 +0000331AC_CXX_HAVE_HASH_MAP
332AC_CXX_HAVE_HASH_SET
John Criswell7a3334d2003-07-22 19:13:20 +0000333AC_CXX_HAVE_STD_ITERATOR
334AC_CXX_HAVE_BI_ITERATOR
335AC_CXX_HAVE_FWD_ITERATOR
336
Brian Gaekebc9bff92004-06-22 23:43:04 +0000337AC_FUNC_ISNAN
Brian Gaeke499b01d2004-07-21 03:14:51 +0000338AC_FUNC_ISINF
Brian Gaekebc9bff92004-06-22 23:43:04 +0000339
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000340dnl Checks for library functions.
John Criswell7a3334d2003-07-22 19:13:20 +0000341AC_FUNC_ALLOCA
John Criswell7a3334d2003-07-22 19:13:20 +0000342AC_FUNC_MMAP
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000343if test "$ac_cv_func_mmap_fixed_mapped" = "no"
344then
John Criswellb82cbbf2004-05-27 00:57:50 +0000345 AC_MSG_WARN([mmap() required but not found])
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000346fi
John Criswell7a3334d2003-07-22 19:13:20 +0000347AC_FUNC_MMAP_FILE
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000348if test "$ac_cv_func_mmap_file" = "no"
John Criswell7a3334d2003-07-22 19:13:20 +0000349then
John Criswellb82cbbf2004-05-27 00:57:50 +0000350 AC_MSG_WARN([mmap() of files required but not found])
John Criswell7a3334d2003-07-22 19:13:20 +0000351fi
352AC_HEADER_MMAP_ANONYMOUS
353AC_TYPE_SIGNAL
Brian Gaekebc9bff92004-06-22 23:43:04 +0000354AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace isatty mkstemp getrusage)
John Criswell7a3334d2003-07-22 19:13:20 +0000355AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found]))
356
John Criswell6ee0ed52003-11-17 19:46:02 +0000357dnl Determine if the linker supports the -R option.
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000358AC_LINK_USE_R
John Criswell6ee0ed52003-11-17 19:46:02 +0000359
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000360dnl --enable/--with command-line options:
361dnl Check whether they want to do an optimized build:
John Criswell5ec24d82003-07-22 20:59:52 +0000362AC_ARG_ENABLE(optimized,AC_HELP_STRING([--enable-optimized],[Compile with optimizations enabled (default is NO)]),,enableval=no)
363if test ${enableval} = "no"
364then
365 AC_SUBST(ENABLE_OPTIMIZED,[[]])
366else
367 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
368fi
369
Brian Gaekefe766052004-04-16 17:13:33 +0000370AC_DEFUN(EXTERNAL_BENCHMARK,
371[m4_define([allcapsname],translit($1,a-z,A-Z))
372 AC_ARG_ENABLE($1,
373 AC_HELP_STRING([--enable-$1=ARG],
374 [Use $1 as a benchmark (srcs in DIR)]),
375 checkresult=$enableval,
376 checkresult=auto)
377AC_MSG_CHECKING([for $1 benchmark sources])
378case "$checkresult" in
Chris Lattnercea7f662004-04-14 16:32:34 +0000379auto|yes)
Brian Gaekefe766052004-04-16 17:13:33 +0000380 defaultdir=$2
381 if test -d "$defaultdir"
John Criswellacbd6572004-02-20 22:30:22 +0000382 then
Brian Gaekefe766052004-04-16 17:13:33 +0000383 AC_SUBST(allcapsname()[_ROOT],[$defaultdir])
384 AC_SUBST([USE_]allcapsname(),[USE_]allcapsname()=1)
385 checkresult="yes, found in $defaultdir"
Brian Gaekefca47202004-04-13 19:02:51 +0000386 else
Brian Gaekefe766052004-04-16 17:13:33 +0000387 checkresult=no
Brian Gaekefca47202004-04-13 19:02:51 +0000388 fi
389 ;;
Chris Lattnercea7f662004-04-14 16:32:34 +0000390no)
Brian Gaekefe766052004-04-16 17:13:33 +0000391 AC_SUBST(allcapsname()[_ROOT],[])
392 AC_SUBST([USE_]allcapsname(),[])
393 checkresult=no
Brian Gaekefca47202004-04-13 19:02:51 +0000394 ;;
Brian Gaekefe766052004-04-16 17:13:33 +0000395*) if test -d "$checkresult"
Brian Gaekefca47202004-04-13 19:02:51 +0000396 then
Brian Gaekefe766052004-04-16 17:13:33 +0000397 AC_SUBST(allcapsname()[_ROOT],"$checkresult")
398 AC_SUBST([USE_]allcapsname(),[USE_]allcapsname()=1)
399 checkresult="yes, in $checkresult"
Brian Gaekefca47202004-04-13 19:02:51 +0000400 else
Brian Gaekefe766052004-04-16 17:13:33 +0000401 AC_SUBST(allcapsname()[_ROOT],[])
402 AC_SUBST([USE_]allcapsname(),[])
403 checkresult="no, not found in $checkresult"
Brian Gaekefca47202004-04-13 19:02:51 +0000404 fi
405 ;;
406esac
Brian Gaekefe766052004-04-16 17:13:33 +0000407AC_MSG_RESULT($checkresult)
408m4_undefine([allcapsname])
409])
410
411EXTERNAL_BENCHMARK(spec95,/home/vadve/shared/benchmarks/spec95/benchspec)
412EXTERNAL_BENCHMARK(spec2000,/home/vadve/shared/benchmarks/speccpu2000/benchspec)
413EXTERNAL_BENCHMARK(povray,/home/vadve/shared/benchmarks/povray31)
John Criswellacbd6572004-02-20 22:30:22 +0000414
John Criswell5ec24d82003-07-22 20:59:52 +0000415dnl Precompiled Bytecode Option
416AC_ARG_ENABLE(precompiled_bytecode,AC_HELP_STRING([--enable-precompiled_bytecode],[Use pre-compiled bytecode (default is NO)]),,enableval=no)
417if test ${enableval} = "no"
418then
419 AC_SUBST(UPB,[[]])
420else
421 AC_SUBST(UPB,[[USE_PRECOMPILED_BYTECODE=1]])
422fi
423
John Criswell5ec24d82003-07-22 20:59:52 +0000424dnl LLC Diff Option
425AC_ARG_ENABLE(llc_diffs,AC_HELP_STRING([--enable-llc_diffs],[Enable LLC Diffs when testing (default is YES)]),,enableval=yes)
426if test ${enableval} = "no"
427then
428 AC_SUBST(DISABLE_LLC_DIFFS,[DISABLE_LLC_DIFFS:=1])
429else
430 AC_SUBST(DISABLE_LLC_DIFFS,[[]])
431fi
432
433dnl JIT Option
John Criswell4f376922003-07-29 19:11:58 +0000434AC_ARG_ENABLE(jit,AC_HELP_STRING([--enable-jit],[Enable Just In Time Compiling (default is YES)]),,enableval=default)
John Criswell5ec24d82003-07-22 20:59:52 +0000435if test ${enableval} = "no"
436then
437 AC_SUBST(JIT,[[]])
438else
John Criswell4f376922003-07-29 19:11:58 +0000439 case $target in
440 *i*86*)
441 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
442 ;;
443 *sparc*)
444 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
445 ;;
446 *)
447 AC_SUBST(JIT,[[]])
448 ;;
449 esac
John Criswell5ec24d82003-07-22 20:59:52 +0000450fi
John Criswell7a3334d2003-07-22 19:13:20 +0000451
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000452dnl Find the LLVM GCC-based C/C++ front end
John Criswell7a3334d2003-07-22 19:13:20 +0000453AC_ARG_WITH(llvmgccdir,AC_HELP_STRING([--with-llvmgccdir],[Location of LLVM GCC front-end]),AC_SUBST(LLVMGCCDIR,[$withval]))
Brian Gaekedfbd3d42003-11-16 18:37:46 +0000454AC_MSG_CHECKING([for llvm-gcc])
455LLVM_GCC_CHECK=no
456if test -d "$LLVMGCCDIR"
457then
458 if test -x "$LLVMGCCDIR/bin/gcc"
459 then
460 LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc"
461 fi
462fi
463llvmgccwarn=no
464AC_MSG_RESULT($LLVM_GCC_CHECK)
465if test "$LLVM_GCC_CHECK" = "no"
466then
467 llvmgccwarn=yes
468fi
Brian Gaekedfbd3d42003-11-16 18:37:46 +0000469AC_MSG_CHECKING([whether llvm-gcc is sane])
470LLVM_GCC_SANE=no
471if test -x "$LLVM_GCC_CHECK"
472then
473 cp /dev/null conftest.c
474 "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1
475 if test $? -eq 0
476 then
477 LLVM_GCC_SANE=yes
478 fi
479 rm conftest.c
Brian Gaeke423ceca2004-01-16 21:31:22 +0000480 llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1`
481 AC_SUBST(LLVMCC1,$llvmcc1path)
482 llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus`
483 AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
Brian Gaekedfbd3d42003-11-16 18:37:46 +0000484fi
485AC_MSG_RESULT($LLVM_GCC_SANE)
486if test "$LLVM_GCC_SANE" = "no"
487then
488 llvmgccwarn=yes
489fi
490
John Criswell4f376922003-07-29 19:11:58 +0000491dnl Location of the bytecode repository
John Criswell7a3334d2003-07-22 19:13:20 +0000492AC_ARG_WITH(bcrepos,AC_HELP_STRING([--with-bcrepos],[Location of Bytecode Repository]),AC_SUBST(BCR,[$withval]),AC_SUBST(BCR,[/home/vadve/lattner/LLVMPrograms]))
John Criswell4f376922003-07-29 19:11:58 +0000493
494dnl Location of PAPI
Chris Lattner00645502003-08-14 18:59:53 +0000495AC_ARG_WITH(papi,AC_HELP_STRING([--with-papi],[Location of PAPI]),AC_SUBST(PAPIDIR,[$withval]),AC_SUBST(PAPIDIR,[/home/vadve/shared/Sparc/papi-2.3.4.1]))
John Criswell4f376922003-07-29 19:11:58 +0000496
Brian Gaekecc3676b2004-01-21 19:38:56 +0000497dnl Get libtool's idea of what the shared library suffix is.
498dnl (This is a hack; it relies on undocumented behavior.)
499AC_MSG_CHECKING([for shared library suffix])
500eval "SHLIBEXT=$shrext"
501AC_MSG_RESULT($SHLIBEXT)
502dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint).
503AC_SUBST(SHLIBEXT,$SHLIBEXT)
504AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT",
505 [Extension that shared libraries have, e.g., ".so".])
506
Reid Spencercf05c122004-08-20 09:03:12 +0000507# Translate the various configuration directories and other basic
508# information into substitutions that will end up in config.h.in so
509# that these configured values can be hard-wired into a program.
510eval LLVM_PREFIX="${prefix}";
511eval LLVM_BINDIR="${prefix}/bin";
512eval LLVM_LIBDIR="${prefix}/lib";
513eval LLVM_DATADIR="${prefix}/data";
514eval LLVM_DOCSDIR="${prefix}/docs";
515eval LLVM_ETCDIR="${prefix}/etc";
516eval LLVM_INCLUDEDIR="${prefix}/include";
517eval LLVM_INFODIR="${prefix}/info";
518eval LLVM_MANDIR="${prefix}/man";
519LLVM_CONFIGTIME=`date`
520AC_SUBST(LLVM_PREFIX)
521AC_SUBST(LLVM_BINDIR)
522AC_SUBST(LLVM_LIBDIR)
523AC_SUBST(LLVM_DATADIR)
524AC_SUBST(LLVM_DOCSDIR)
525AC_SUBST(LLVM_ETCDIR)
526AC_SUBST(LLVM_INCLUDEDIR)
527AC_SUBST(LLVM_INFODIR)
528AC_SUBST(LLVM_MANDIR)
529AC_SUBST(LLVM_CONFIGTIME)
530AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", [Installation prefix directory])
531AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", [Installation directory for binary executables])
532AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR", [Installation directory for libraries])
533AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", [Installation directory for data files])
534AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR", [Installation directory for documentation])
Reid Spencer3b65b0a2004-08-20 09:08:57 +0000535AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", [Installation directory for config files])
Reid Spencercf05c122004-08-20 09:03:12 +0000536AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", [Installation directory for include files])
537AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", [Installation directory for .info files])
538AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", [Installation directory for man pages])
539AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", [Time at which LLVM was configured])
540
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000541dnl Create the output files
John Criswell9537b042004-07-23 15:40:57 +0000542AC_OUTPUT()
Brian Gaekedfbd3d42003-11-16 18:37:46 +0000543
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000544dnl Warn loudly if llvm-gcc was not obviously working
Brian Gaekedfbd3d42003-11-16 18:37:46 +0000545if test $llvmgccwarn = yes
546then
547 AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not])
548 AC_MSG_WARN([***** appear to be working.])
549 AC_MSG_WARN([***** ])
550 AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.])
551 AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,])
552 AC_MSG_WARN([***** but you should be able to build the llvm tools.])
553fi
Brian Gaekecc3676b2004-01-21 19:38:56 +0000554