blob: 94b306f847c6046833600c69508fb1a02efead41 [file] [log] [blame]
Brian Gaeke26be9c52004-01-13 06:43:16 +00001dnl Initialize autoconf
Reid Spencera91929d2004-08-20 09:03:12 +00002AC_INIT([[LLVM]],[[1.4]],[llvmbugs@cs.uiuc.edu])
John Criswell4ea390d2003-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 Criswell93e1c722003-09-15 17:04:06 +00007dnl Quit if the source directory has already been configured.
John Criswell1b824322003-09-15 17:19:42 +00008dnl NOTE: This relies upon undocumented autoconf behavior.
9if test ${srcdir} != "."
John Criswell93e1c722003-09-15 17:04:06 +000010then
John Criswell1b824322003-09-15 17:19:42 +000011 if test -f ${srcdir}/include/Config/config.h
12 then
13 AC_MSG_ERROR([Already configured in ${srcdir}])
14 fi
John Criswell93e1c722003-09-15 17:04:06 +000015fi
16
John Criswell33a911a2003-11-25 20:36:46 +000017dnl Configure all of the projects present in our source tree.
John Criswell33a911a2003-11-25 20:36:46 +000018for i in `ls ${srcdir}/projects`
19do
20 if test ${i} != "CVS"
21 then
John Criswell9493c972003-12-12 20:09:33 +000022 if test -f ${srcdir}/projects/${i}/configure
John Criswell33a911a2003-11-25 20:36:46 +000023 then
24 AC_CONFIG_SUBDIRS(projects/${i})
25 fi
26 fi
27done
John Criswell559a6c12003-09-30 16:31:48 +000028
John Criswelldc76e322004-07-23 15:40:57 +000029dnl Configure header files
John Criswell4ea390d2003-07-22 19:13:20 +000030AC_CONFIG_HEADERS(include/Config/config.h)
John Criswelldc76e322004-07-23 15:40:57 +000031
32dnl Configure other output file
33AC_CONFIG_FILES(Makefile.config
34 include/Support/DataTypes.h
35 include/Support/ThreadSupport.h
36 include/Support/hash_map
37 include/Support/hash_set
38 include/Support/iterator)
39
40dnl Do special configuration of Makefiles
John Criswell2d533082003-09-06 14:46:19 +000041AC_CONFIG_MAKEFILE(Makefile)
42AC_CONFIG_MAKEFILE(Makefile.common)
Reid Spencer367754a2004-08-24 16:31:01 +000043AC_CONFIG_MAKEFILE(examples/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000044AC_CONFIG_MAKEFILE(lib/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000045AC_CONFIG_MAKEFILE(runtime/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000046AC_CONFIG_MAKEFILE(test/Makefile)
47AC_CONFIG_MAKEFILE(test/Makefile.tests)
John Criswellf424d742003-10-07 21:13:47 +000048AC_CONFIG_MAKEFILE(test/QMTest/llvm.py)
49AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py)
John Criswell2d533082003-09-06 14:46:19 +000050AC_CONFIG_MAKEFILE(test/Programs/Makefile)
51AC_CONFIG_MAKEFILE(test/Programs/Makefile.programs)
John Criswell8a54a1e2004-06-22 21:35:10 +000052AC_CONFIG_MAKEFILE(test/Programs/Makefile.tests)
John Criswell2d533082003-09-06 14:46:19 +000053AC_CONFIG_MAKEFILE(test/Programs/TEST.aa.Makefile)
54AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.report)
John Criswell2d533082003-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 Criswell878be7d2004-02-24 21:43:38 +000065AC_CONFIG_MAKEFILE(test/Programs/TEST.vtl.Makefile)
John Criswell2d533082003-09-06 14:46:19 +000066AC_CONFIG_MAKEFILE(test/Programs/External/Makefile)
67AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile)
John Criswell27bb35e2003-09-11 18:04:00 +000068AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec)
Alkis Evlogimenos271143f2004-02-26 04:14:10 +000069AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec2000)
John Criswellb607cc82004-02-10 22:29:06 +000070AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec95)
John Criswell2d533082003-09-06 14:46:19 +000071AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Makefile)
72AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Makefile.multisrc)
Misha Brukman960624b2003-11-12 22:16:23 +000073AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/test.in)
Misha Brukman3e910fe2003-11-12 19:39:10 +000074AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/distray/Makefile)
Misha Brukman960624b2003-11-12 22:16:23 +000075AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/distray/test.in)
Misha Brukman3e910fe2003-11-12 19:39:10 +000076AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/Makefile)
Misha Brukman960624b2003-11-12 22:16:23 +000077AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/test.in)
Misha Brukman3e910fe2003-11-12 19:39:10 +000078AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/mason/Makefile)
Misha Brukman960624b2003-11-12 22:16:23 +000079AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/mason/test.in)
Misha Brukman3e910fe2003-11-12 19:39:10 +000080AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/neural/Makefile)
Misha Brukman960624b2003-11-12 22:16:23 +000081AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/neural/test.in)
Misha Brukman3e910fe2003-11-12 19:39:10 +000082AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2/Makefile)
Misha Brukman960624b2003-11-12 22:16:23 +000083AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2/test.in)
Misha Brukman3e910fe2003-11-12 19:39:10 +000084AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pifft/Makefile)
Misha Brukman960624b2003-11-12 22:16:23 +000085AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pifft/test.in)
John Criswell2d533082003-09-06 14:46:19 +000086AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile)
87AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile.singlesrc)
Alkis Evlogimenos271143f2004-02-26 04:14:10 +000088AC_CONFIG_MAKEFILE(test/Programs/SingleSource/UnitTests/SetjmpLongjmp/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000089AC_CONFIG_MAKEFILE(tools/Makefile)
Chris Lattner5c866e12003-10-06 02:09:25 +000090AC_CONFIG_MAKEFILE(utils/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000091AC_CONFIG_MAKEFILE(projects/Makefile)
John Criswell4ea390d2003-07-22 19:13:20 +000092
Brian Gaeke26be9c52004-01-13 06:43:16 +000093dnl Find the install program (needs to be done before canonical stuff)
John Criswell4ea390d2003-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 Gaeke3e66e8b2003-11-17 00:30:48 +0000100dnl Set the "OS" Makefile variable based on the system we are building on.
John Criswell4ea390d2003-07-22 19:13:20 +0000101dnl We will use the build machine information to set some variables.
John Criswell4ea390d2003-07-22 19:13:20 +0000102case $build in
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000103 *-*-linux*)
104 AC_SUBST(OS,[Linux])
Reid Spencer59ee4362004-08-29 19:18:05 +0000105 platform_type="Linux"
106 if test -d /home/vadve/lattner/local/x86/llvm-gcc
107 then
108 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/])
109 fi
110 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000111 *-*-solaris*)
112 AC_SUBST(OS,[SunOS])
Reid Spencer59ee4362004-08-29 19:18:05 +0000113 platform_type="SunOS"
114 if test -d /home/vadve/lattner/local/sparc/llvm-gcc
115 then
116 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/])
117 fi
118 ;;
Chris Lattner44afcb72004-06-02 23:32:17 +0000119 *-*-cygwin*)
120 AC_SUBST(OS,[Cygwin])
Reid Spencer59ee4362004-08-29 19:18:05 +0000121 platform_type="Cygwin"
122 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000123 *-*-darwin*)
124 AC_SUBST(OS,[Darwin])
Reid Spencer59ee4362004-08-29 19:18:05 +0000125 platform_type="Darwin"
126 ;;
Misha Brukman7b42a752004-06-22 15:32:08 +0000127 *-*-aix*)
128 AC_SUBST(OS,[AIX])
Reid Spencer59ee4362004-08-29 19:18:05 +0000129 platform_type="AIX"
130 ;;
Reid Spencer886e9512004-08-31 01:34:10 +0000131 *-*-interix*)
132 AC_SUBST(OS,[SunOS])
133 platform_type="SunOS"
134 ;;
Reid Spencer59ee4362004-08-29 19:18:05 +0000135 *-*-win32*)
136 AC_SUBST(OS,[Win32])
137 platform_type="Win32"
138 ;;
139 *)
140 AC_SUBST(OS,[Unknown])
141 platform_type="Unknown"
142 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000143esac
144
Reid Spencer886e9512004-08-31 01:34:10 +0000145dnl Make sure we aren't attempting to configure for an unknown system
146if test $platform_type -eq "Unknown" ; then
147 AC_MSG_ERROR([Platform is unknown, configure can't continue])
148fi
149
Reid Spencer59ee4362004-08-29 19:18:05 +0000150dnl Make a link from lib/System/platform to lib/System/$platform_type
151dnl This helps the #inclusion of the system specific include files
152dnl for the operating system abstraction library
153AC_CONFIG_LINKS(lib/System/platform:lib/System/$platform_type)
154
John Criswell4ea390d2003-07-22 19:13:20 +0000155dnl If we are targetting a Sparc machine running Solaris, pretend that it is
156dnl V9, since that is all that we support at the moment, and autoconf will only
157dnl tell us we're a sparc.
John Criswell4ea390d2003-07-22 19:13:20 +0000158case $target in
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000159 sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]])
160 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000161esac
162
John Criswell4ea390d2003-07-22 19:13:20 +0000163dnl Determine what our target architecture is and configure accordingly.
164dnl This will allow Makefiles to make a distinction between the hardware and
165dnl the OS.
John Criswell4ea390d2003-07-22 19:13:20 +0000166case $target in
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000167 i*86-*) AC_SUBST(ARCH,[x86])
John Criswell4ea390d2003-07-22 19:13:20 +0000168 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000169 sparc*-*) AC_SUBST(ARCH,[Sparc])
170 ;;
171 powerpc*-*) AC_SUBST(ARCH,[PowerPC])
172 ;;
173 *) AC_SUBST(ARCH,[Unknown])
John Criswell4ea390d2003-07-22 19:13:20 +0000174 ;;
175esac
176
John Criswell4ea390d2003-07-22 19:13:20 +0000177dnl Check for compilation tools
178AC_PROG_CXX
179AC_PROG_CC(gcc)
180AC_PROG_CPP
181
182dnl Ensure that compilation tools are GCC; we use GCC specific extensions
183if test "$GCC" != "yes"
184then
185 AC_MSG_ERROR([gcc required but not found])
186fi
John Criswell4ea390d2003-07-22 19:13:20 +0000187if test "$GXX" != "yes"
188then
189 AC_MSG_ERROR([g++ required but not found])
190fi
191
John Criswellde00db22003-08-25 16:49:54 +0000192dnl Verify that GCC is version 3.0 or higher
193gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1`
194if test "$gccmajor" -lt "3"
195then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000196 AC_MSG_ERROR([gcc 3.x required, but you have a lower version])
John Criswellde00db22003-08-25 16:49:54 +0000197fi
198
Brian Gaeke26be9c52004-01-13 06:43:16 +0000199dnl Check for GNU Make. We use its extensions too, so don't build without it
John Criswell4ea390d2003-07-22 19:13:20 +0000200CHECK_GNU_MAKE
201if test -z "$_cv_gnu_make_command"
202then
203 AC_MSG_ERROR([GNU Make required but not found])
204fi
205
Brian Gaeke26be9c52004-01-13 06:43:16 +0000206dnl Checks for other tools
John Criswell4ea390d2003-07-22 19:13:20 +0000207AC_PROG_FLEX
208AC_PROG_BISON
John Criswell4ea390d2003-07-22 19:13:20 +0000209AC_PROG_LIBTOOL
210
Brian Gaeke26be9c52004-01-13 06:43:16 +0000211dnl Checks for tools we can get away with not having:
212AC_PATH_PROG(DOT,[dot],[true dot])
213AC_PATH_PROG(ETAGS,[etags],[true etags])
Brian Gaeke027b7462004-01-22 21:55:15 +0000214dnl Check if we know how to tell etags we are using C++:
215etags_version=`$ETAGS --version 2>&1`
216case "$etags_version" in
217 *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;;
218 *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;;
219 *) ETAGSFLAGS="" ;;
220esac
221AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
Brian Gaeke26be9c52004-01-13 06:43:16 +0000222AC_PATH_PROG(PYTHON,[python],[true python])
223if test "$PYTHON" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000224then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000225 AC_MSG_WARN([Python is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000226fi
Brian Gaeke26be9c52004-01-13 06:43:16 +0000227AC_PATH_PROG(QMTEST,[qmtest],[true qmtest])
228if test "$QMTEST" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000229then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000230 AC_MSG_WARN([QMTest is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000231fi
John Criswellde00db22003-08-25 16:49:54 +0000232
233dnl Verify that the version of python available is high enough for qmtest
234pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2`
235pymajor=`echo $pyversion | cut -d. -f1`
236pyminor=`echo $pyversion | cut -d. -f2`
237
238if test "$pymajor" -ge "2"
239then
240 if test "$pymajor" -eq "2"
241 then
242 if test "$pyminor" -lt "2"
243 then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000244 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswellde00db22003-08-25 16:49:54 +0000245 fi
246 fi
247else
Brian Gaeke26be9c52004-01-13 06:43:16 +0000248 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswellde00db22003-08-25 16:49:54 +0000249fi
John Criswell4ea390d2003-07-22 19:13:20 +0000250
251dnl Verify that the source directory is valid
252AC_CONFIG_SRCDIR(["Makefile.config.in"])
253
Brian Gaeke26be9c52004-01-13 06:43:16 +0000254dnl Checks for libraries:
John Criswell4ea390d2003-07-22 19:13:20 +0000255dnl libelf is for sparc only; we can ignore it if we don't have it
256AC_CHECK_LIB(elf, elf_begin)
257
Brian Gaeke4c423782003-10-07 05:03:36 +0000258dnl dlopen() is required for plugin support.
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000259AC_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 Criswell4ea390d2003-07-22 19:13:20 +0000260
261dnl mallinfo is optional; the code can compile (minus features) without it
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000262AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.]))
John Criswell4ea390d2003-07-22 19:13:20 +0000263
Brian Gaeke5f268f72003-12-05 19:29:01 +0000264dnl pthread locking functions are optional - but llvm will not be thread-safe
265dnl without locks.
Brian Gaeke2e3bdba2004-02-23 21:30:36 +0000266AC_SEARCH_LIBS(pthread_mutex_lock,pthread,HAVE_PTHREAD_MUTEX_LOCK=1,HAVE_PTHREAD_MUTEX_LOCK=0)
267AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK)
Brian Gaeke5f268f72003-12-05 19:29:01 +0000268
Brian Gaeke26be9c52004-01-13 06:43:16 +0000269dnl Checks for header files.
270dnl We don't check for ancient stuff or things that are guaranteed to be there
271dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers.
John Criswell4ea390d2003-07-22 19:13:20 +0000272AC_HEADER_STDC
273AC_HEADER_SYS_WAIT
274
Brian Gaeke26be9c52004-01-13 06:43:16 +0000275dnl Checks for POSIX and other various system-specific header files
John Criswellb2815e02004-05-27 20:40:39 +0000276AC_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 Criswell4ea390d2003-07-22 19:13:20 +0000277
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000278dnl Check for things that need to be included in public headers, and so
279dnl for which we may not have access to a HAVE_* preprocessor #define.
280dnl (primarily used in DataTypes.h)
281AC_CHECK_HEADER([sys/types.h],
282 [INCLUDE_SYS_TYPES_H='#include <sys/types.h>'],
283 [INCLUDE_SYS_TYPES_H=''])
284AC_SUBST(INCLUDE_SYS_TYPES_H)
285AC_CHECK_HEADER([inttypes.h],
286 [INCLUDE_INTTYPES_H='#include <inttypes.h>'],
287 [INCLUDE_INTTYPES_H=''])
288AC_SUBST(INCLUDE_INTTYPES_H)
John Criswell7ed43ad2004-07-19 16:12:29 +0000289AC_CHECK_HEADER([stdint.h],
290 [INCLUDE_STDINT_H='#include <stdint.h>'],
291 [INCLUDE_STDINT_H=''])
292AC_SUBST(INCLUDE_STDINT_H)
293
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000294
John Criswell4ea390d2003-07-22 19:13:20 +0000295dnl Check for types
296AC_TYPE_PID_T
297AC_TYPE_SIZE_T
298AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
299AC_CHECK_TYPES([uint64_t],,AC_MSG_ERROR([Type uint64_t required but not found]))
300AC_HEADER_TIME
301AC_STRUCT_TM
302
John Criswella0137d32003-10-13 16:22:01 +0000303dnl Check for various C features
304AC_C_PRINTF_A
305
John Criswell0021c312004-02-13 21:57:29 +0000306dnl Check for the endianness of the target
307AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
308
John Criswell4ea390d2003-07-22 19:13:20 +0000309dnl Check for C++ extensions
Brian Gaeke278a4ac2003-11-10 03:06:09 +0000310AC_CXX_HAVE_HASH_MAP
311AC_CXX_HAVE_HASH_SET
John Criswell4ea390d2003-07-22 19:13:20 +0000312AC_CXX_HAVE_STD_ITERATOR
313AC_CXX_HAVE_BI_ITERATOR
314AC_CXX_HAVE_FWD_ITERATOR
315
Brian Gaeke8828eb52004-06-22 23:43:04 +0000316AC_FUNC_ISNAN
Brian Gaeke3869b272004-07-21 03:14:51 +0000317AC_FUNC_ISINF
Brian Gaeke8828eb52004-06-22 23:43:04 +0000318
Brian Gaeke26be9c52004-01-13 06:43:16 +0000319dnl Checks for library functions.
John Criswell4ea390d2003-07-22 19:13:20 +0000320AC_FUNC_ALLOCA
John Criswell4ea390d2003-07-22 19:13:20 +0000321AC_FUNC_MMAP
Brian Gaeke26be9c52004-01-13 06:43:16 +0000322if test "$ac_cv_func_mmap_fixed_mapped" = "no"
323then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000324 AC_MSG_WARN([mmap() required but not found])
Brian Gaeke26be9c52004-01-13 06:43:16 +0000325fi
John Criswell4ea390d2003-07-22 19:13:20 +0000326AC_FUNC_MMAP_FILE
Brian Gaeke26be9c52004-01-13 06:43:16 +0000327if test "$ac_cv_func_mmap_file" = "no"
John Criswell4ea390d2003-07-22 19:13:20 +0000328then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000329 AC_MSG_WARN([mmap() of files required but not found])
John Criswell4ea390d2003-07-22 19:13:20 +0000330fi
331AC_HEADER_MMAP_ANONYMOUS
332AC_TYPE_SIGNAL
Brian Gaeke8828eb52004-06-22 23:43:04 +0000333AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace isatty mkstemp getrusage)
John Criswell4ea390d2003-07-22 19:13:20 +0000334AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found]))
335
John Criswellcb7a1eb2003-11-17 19:46:02 +0000336dnl Determine if the linker supports the -R option.
Brian Gaeke26be9c52004-01-13 06:43:16 +0000337AC_LINK_USE_R
John Criswellcb7a1eb2003-11-17 19:46:02 +0000338
Brian Gaeke26be9c52004-01-13 06:43:16 +0000339dnl --enable/--with command-line options:
340dnl Check whether they want to do an optimized build:
John Criswell79a8f092003-07-22 20:59:52 +0000341AC_ARG_ENABLE(optimized,AC_HELP_STRING([--enable-optimized],[Compile with optimizations enabled (default is NO)]),,enableval=no)
342if test ${enableval} = "no"
343then
344 AC_SUBST(ENABLE_OPTIMIZED,[[]])
345else
346 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
347fi
348
Brian Gaekedbaf9812004-04-16 17:13:33 +0000349AC_DEFUN(EXTERNAL_BENCHMARK,
350[m4_define([allcapsname],translit($1,a-z,A-Z))
351 AC_ARG_ENABLE($1,
352 AC_HELP_STRING([--enable-$1=ARG],
353 [Use $1 as a benchmark (srcs in DIR)]),
354 checkresult=$enableval,
355 checkresult=auto)
356AC_MSG_CHECKING([for $1 benchmark sources])
357case "$checkresult" in
Chris Lattnerac847282004-04-14 16:32:34 +0000358auto|yes)
Brian Gaekedbaf9812004-04-16 17:13:33 +0000359 defaultdir=$2
360 if test -d "$defaultdir"
John Criswell0538d422004-02-20 22:30:22 +0000361 then
Brian Gaekedbaf9812004-04-16 17:13:33 +0000362 AC_SUBST(allcapsname()[_ROOT],[$defaultdir])
363 AC_SUBST([USE_]allcapsname(),[USE_]allcapsname()=1)
364 checkresult="yes, found in $defaultdir"
Brian Gaekebc7b85f2004-04-13 19:02:51 +0000365 else
Brian Gaekedbaf9812004-04-16 17:13:33 +0000366 checkresult=no
Brian Gaekebc7b85f2004-04-13 19:02:51 +0000367 fi
368 ;;
Chris Lattnerac847282004-04-14 16:32:34 +0000369no)
Brian Gaekedbaf9812004-04-16 17:13:33 +0000370 AC_SUBST(allcapsname()[_ROOT],[])
371 AC_SUBST([USE_]allcapsname(),[])
372 checkresult=no
Brian Gaekebc7b85f2004-04-13 19:02:51 +0000373 ;;
Brian Gaekedbaf9812004-04-16 17:13:33 +0000374*) if test -d "$checkresult"
Brian Gaekebc7b85f2004-04-13 19:02:51 +0000375 then
Brian Gaekedbaf9812004-04-16 17:13:33 +0000376 AC_SUBST(allcapsname()[_ROOT],"$checkresult")
377 AC_SUBST([USE_]allcapsname(),[USE_]allcapsname()=1)
378 checkresult="yes, in $checkresult"
Brian Gaekebc7b85f2004-04-13 19:02:51 +0000379 else
Brian Gaekedbaf9812004-04-16 17:13:33 +0000380 AC_SUBST(allcapsname()[_ROOT],[])
381 AC_SUBST([USE_]allcapsname(),[])
382 checkresult="no, not found in $checkresult"
Brian Gaekebc7b85f2004-04-13 19:02:51 +0000383 fi
384 ;;
385esac
Brian Gaekedbaf9812004-04-16 17:13:33 +0000386AC_MSG_RESULT($checkresult)
387m4_undefine([allcapsname])
388])
389
390EXTERNAL_BENCHMARK(spec95,/home/vadve/shared/benchmarks/spec95/benchspec)
391EXTERNAL_BENCHMARK(spec2000,/home/vadve/shared/benchmarks/speccpu2000/benchspec)
392EXTERNAL_BENCHMARK(povray,/home/vadve/shared/benchmarks/povray31)
John Criswell0538d422004-02-20 22:30:22 +0000393
John Criswell79a8f092003-07-22 20:59:52 +0000394dnl Precompiled Bytecode Option
395AC_ARG_ENABLE(precompiled_bytecode,AC_HELP_STRING([--enable-precompiled_bytecode],[Use pre-compiled bytecode (default is NO)]),,enableval=no)
396if test ${enableval} = "no"
397then
398 AC_SUBST(UPB,[[]])
399else
400 AC_SUBST(UPB,[[USE_PRECOMPILED_BYTECODE=1]])
401fi
402
John Criswell79a8f092003-07-22 20:59:52 +0000403dnl LLC Diff Option
404AC_ARG_ENABLE(llc_diffs,AC_HELP_STRING([--enable-llc_diffs],[Enable LLC Diffs when testing (default is YES)]),,enableval=yes)
405if test ${enableval} = "no"
406then
407 AC_SUBST(DISABLE_LLC_DIFFS,[DISABLE_LLC_DIFFS:=1])
408else
409 AC_SUBST(DISABLE_LLC_DIFFS,[[]])
410fi
411
412dnl JIT Option
John Criswellc78022e2003-07-29 19:11:58 +0000413AC_ARG_ENABLE(jit,AC_HELP_STRING([--enable-jit],[Enable Just In Time Compiling (default is YES)]),,enableval=default)
John Criswell79a8f092003-07-22 20:59:52 +0000414if test ${enableval} = "no"
415then
416 AC_SUBST(JIT,[[]])
417else
John Criswellc78022e2003-07-29 19:11:58 +0000418 case $target in
419 *i*86*)
420 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
421 ;;
422 *sparc*)
423 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
424 ;;
425 *)
426 AC_SUBST(JIT,[[]])
427 ;;
428 esac
John Criswell79a8f092003-07-22 20:59:52 +0000429fi
John Criswell4ea390d2003-07-22 19:13:20 +0000430
Brian Gaeke26be9c52004-01-13 06:43:16 +0000431dnl Find the LLVM GCC-based C/C++ front end
John Criswell4ea390d2003-07-22 19:13:20 +0000432AC_ARG_WITH(llvmgccdir,AC_HELP_STRING([--with-llvmgccdir],[Location of LLVM GCC front-end]),AC_SUBST(LLVMGCCDIR,[$withval]))
Brian Gaeke908647f2003-11-16 18:37:46 +0000433AC_MSG_CHECKING([for llvm-gcc])
434LLVM_GCC_CHECK=no
435if test -d "$LLVMGCCDIR"
436then
437 if test -x "$LLVMGCCDIR/bin/gcc"
438 then
439 LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc"
440 fi
441fi
442llvmgccwarn=no
443AC_MSG_RESULT($LLVM_GCC_CHECK)
444if test "$LLVM_GCC_CHECK" = "no"
445then
446 llvmgccwarn=yes
447fi
Brian Gaeke908647f2003-11-16 18:37:46 +0000448AC_MSG_CHECKING([whether llvm-gcc is sane])
449LLVM_GCC_SANE=no
450if test -x "$LLVM_GCC_CHECK"
451then
452 cp /dev/null conftest.c
453 "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1
454 if test $? -eq 0
455 then
456 LLVM_GCC_SANE=yes
457 fi
458 rm conftest.c
Brian Gaeked05e39d2004-01-16 21:31:22 +0000459 llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1`
460 AC_SUBST(LLVMCC1,$llvmcc1path)
461 llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus`
462 AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
Brian Gaeke908647f2003-11-16 18:37:46 +0000463fi
464AC_MSG_RESULT($LLVM_GCC_SANE)
465if test "$LLVM_GCC_SANE" = "no"
466then
467 llvmgccwarn=yes
468fi
469
John Criswellc78022e2003-07-29 19:11:58 +0000470dnl Location of the bytecode repository
John Criswell4ea390d2003-07-22 19:13:20 +0000471AC_ARG_WITH(bcrepos,AC_HELP_STRING([--with-bcrepos],[Location of Bytecode Repository]),AC_SUBST(BCR,[$withval]),AC_SUBST(BCR,[/home/vadve/lattner/LLVMPrograms]))
John Criswellc78022e2003-07-29 19:11:58 +0000472
473dnl Location of PAPI
Chris Lattner1b9ddd52003-08-14 18:59:53 +0000474AC_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 Criswellc78022e2003-07-29 19:11:58 +0000475
Brian Gaekecea9a602004-01-21 19:38:56 +0000476dnl Get libtool's idea of what the shared library suffix is.
477dnl (This is a hack; it relies on undocumented behavior.)
478AC_MSG_CHECKING([for shared library suffix])
479eval "SHLIBEXT=$shrext"
480AC_MSG_RESULT($SHLIBEXT)
481dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint).
482AC_SUBST(SHLIBEXT,$SHLIBEXT)
483AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT",
484 [Extension that shared libraries have, e.g., ".so".])
485
Reid Spencera91929d2004-08-20 09:03:12 +0000486# Translate the various configuration directories and other basic
487# information into substitutions that will end up in config.h.in so
488# that these configured values can be hard-wired into a program.
489eval LLVM_PREFIX="${prefix}";
490eval LLVM_BINDIR="${prefix}/bin";
491eval LLVM_LIBDIR="${prefix}/lib";
492eval LLVM_DATADIR="${prefix}/data";
493eval LLVM_DOCSDIR="${prefix}/docs";
494eval LLVM_ETCDIR="${prefix}/etc";
495eval LLVM_INCLUDEDIR="${prefix}/include";
496eval LLVM_INFODIR="${prefix}/info";
497eval LLVM_MANDIR="${prefix}/man";
498LLVM_CONFIGTIME=`date`
499AC_SUBST(LLVM_PREFIX)
500AC_SUBST(LLVM_BINDIR)
501AC_SUBST(LLVM_LIBDIR)
502AC_SUBST(LLVM_DATADIR)
503AC_SUBST(LLVM_DOCSDIR)
504AC_SUBST(LLVM_ETCDIR)
505AC_SUBST(LLVM_INCLUDEDIR)
506AC_SUBST(LLVM_INFODIR)
507AC_SUBST(LLVM_MANDIR)
508AC_SUBST(LLVM_CONFIGTIME)
509AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", [Installation prefix directory])
510AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", [Installation directory for binary executables])
511AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR", [Installation directory for libraries])
512AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", [Installation directory for data files])
513AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR", [Installation directory for documentation])
Reid Spencer19d96ee2004-08-20 09:08:57 +0000514AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", [Installation directory for config files])
Reid Spencera91929d2004-08-20 09:03:12 +0000515AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", [Installation directory for include files])
516AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", [Installation directory for .info files])
517AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", [Installation directory for man pages])
518AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", [Time at which LLVM was configured])
519
Brian Gaeke26be9c52004-01-13 06:43:16 +0000520dnl Create the output files
John Criswelldc76e322004-07-23 15:40:57 +0000521AC_OUTPUT()
Brian Gaeke908647f2003-11-16 18:37:46 +0000522
Brian Gaeke26be9c52004-01-13 06:43:16 +0000523dnl Warn loudly if llvm-gcc was not obviously working
Brian Gaeke908647f2003-11-16 18:37:46 +0000524if test $llvmgccwarn = yes
525then
526 AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not])
527 AC_MSG_WARN([***** appear to be working.])
528 AC_MSG_WARN([***** ])
529 AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.])
530 AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,])
531 AC_MSG_WARN([***** but you should be able to build the llvm tools.])
532fi
Brian Gaekecea9a602004-01-21 19:38:56 +0000533