blob: 3f677f399816c2f2019ecc622b90a405d4169a6f [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)
John Criswell2d533082003-09-06 14:46:19 +000043AC_CONFIG_MAKEFILE(lib/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000044AC_CONFIG_MAKEFILE(runtime/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000045AC_CONFIG_MAKEFILE(test/Makefile)
46AC_CONFIG_MAKEFILE(test/Makefile.tests)
John Criswellf424d742003-10-07 21:13:47 +000047AC_CONFIG_MAKEFILE(test/QMTest/llvm.py)
48AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py)
John Criswell2d533082003-09-06 14:46:19 +000049AC_CONFIG_MAKEFILE(test/Programs/Makefile)
50AC_CONFIG_MAKEFILE(test/Programs/Makefile.programs)
John Criswell8a54a1e2004-06-22 21:35:10 +000051AC_CONFIG_MAKEFILE(test/Programs/Makefile.tests)
John Criswell2d533082003-09-06 14:46:19 +000052AC_CONFIG_MAKEFILE(test/Programs/TEST.aa.Makefile)
53AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.report)
John Criswell2d533082003-09-06 14:46:19 +000054AC_CONFIG_MAKEFILE(test/Programs/TEST.aa.report)
55AC_CONFIG_MAKEFILE(test/Programs/TEST.example.Makefile)
56AC_CONFIG_MAKEFILE(test/Programs/TEST.nightly.Makefile)
57AC_CONFIG_MAKEFILE(test/Programs/TEST.buildrepo.Makefile)
58AC_CONFIG_MAKEFILE(test/Programs/TEST.jit.Makefile)
59AC_CONFIG_MAKEFILE(test/Programs/TEST.nightly.report)
60AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.Makefile)
61AC_CONFIG_MAKEFILE(test/Programs/TEST.jit.report)
62AC_CONFIG_MAKEFILE(test/Programs/TEST.typesafe.Makefile)
63AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.gnuplot)
John Criswell878be7d2004-02-24 21:43:38 +000064AC_CONFIG_MAKEFILE(test/Programs/TEST.vtl.Makefile)
John Criswell2d533082003-09-06 14:46:19 +000065AC_CONFIG_MAKEFILE(test/Programs/External/Makefile)
66AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile)
John Criswell27bb35e2003-09-11 18:04:00 +000067AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec)
Alkis Evlogimenos271143f2004-02-26 04:14:10 +000068AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec2000)
John Criswellb607cc82004-02-10 22:29:06 +000069AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec95)
John Criswell2d533082003-09-06 14:46:19 +000070AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Makefile)
71AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Makefile.multisrc)
Misha Brukman960624b2003-11-12 22:16:23 +000072AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/test.in)
Misha Brukman3e910fe2003-11-12 19:39:10 +000073AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/distray/Makefile)
Misha Brukman960624b2003-11-12 22:16:23 +000074AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/distray/test.in)
Misha Brukman3e910fe2003-11-12 19:39:10 +000075AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/Makefile)
Misha Brukman960624b2003-11-12 22:16:23 +000076AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/test.in)
Misha Brukman3e910fe2003-11-12 19:39:10 +000077AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/mason/Makefile)
Misha Brukman960624b2003-11-12 22:16:23 +000078AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/mason/test.in)
Misha Brukman3e910fe2003-11-12 19:39:10 +000079AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/neural/Makefile)
Misha Brukman960624b2003-11-12 22:16:23 +000080AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/neural/test.in)
Misha Brukman3e910fe2003-11-12 19:39:10 +000081AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2/Makefile)
Misha Brukman960624b2003-11-12 22:16:23 +000082AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2/test.in)
Misha Brukman3e910fe2003-11-12 19:39:10 +000083AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pifft/Makefile)
Misha Brukman960624b2003-11-12 22:16:23 +000084AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pifft/test.in)
John Criswell2d533082003-09-06 14:46:19 +000085AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile)
86AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile.singlesrc)
Alkis Evlogimenos271143f2004-02-26 04:14:10 +000087AC_CONFIG_MAKEFILE(test/Programs/SingleSource/UnitTests/SetjmpLongjmp/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000088AC_CONFIG_MAKEFILE(tools/Makefile)
Chris Lattner5c866e12003-10-06 02:09:25 +000089AC_CONFIG_MAKEFILE(utils/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000090AC_CONFIG_MAKEFILE(projects/Makefile)
John Criswell4ea390d2003-07-22 19:13:20 +000091
Brian Gaeke26be9c52004-01-13 06:43:16 +000092dnl Find the install program (needs to be done before canonical stuff)
John Criswell4ea390d2003-07-22 19:13:20 +000093AC_PROG_INSTALL
94
95dnl Check which host for which we're compiling. This will tell us which LLVM
96dnl compiler will be used for compiling SSA into object code.
97AC_CANONICAL_TARGET
98
Brian Gaeke3e66e8b2003-11-17 00:30:48 +000099dnl Set the "OS" Makefile variable based on the system we are building on.
John Criswell4ea390d2003-07-22 19:13:20 +0000100dnl We will use the build machine information to set some variables.
John Criswell4ea390d2003-07-22 19:13:20 +0000101case $build in
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000102 *-*-linux*)
103 AC_SUBST(OS,[Linux])
Brian Gaeke908647f2003-11-16 18:37:46 +0000104 if test -d /home/vadve/lattner/local/x86/llvm-gcc
105 then
106 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/])
107 fi
John Criswell4ea390d2003-07-22 19:13:20 +0000108 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000109 *-*-solaris*)
110 AC_SUBST(OS,[SunOS])
Brian Gaeke908647f2003-11-16 18:37:46 +0000111 if test -d /home/vadve/lattner/local/sparc/llvm-gcc
112 then
113 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/])
114 fi
John Criswell4ea390d2003-07-22 19:13:20 +0000115 ;;
Chris Lattner44afcb72004-06-02 23:32:17 +0000116 *-*-cygwin*)
117 AC_SUBST(OS,[Cygwin])
118 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000119 *-*-darwin*)
120 AC_SUBST(OS,[Darwin])
121 ;;
Misha Brukman7b42a752004-06-22 15:32:08 +0000122 *-*-aix*)
123 AC_SUBST(OS,[AIX])
124 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000125 *) AC_SUBST(OS,[Unknown])
126 ;;
127esac
128
John Criswell4ea390d2003-07-22 19:13:20 +0000129dnl If we are targetting a Sparc machine running Solaris, pretend that it is
130dnl V9, since that is all that we support at the moment, and autoconf will only
131dnl tell us we're a sparc.
John Criswell4ea390d2003-07-22 19:13:20 +0000132case $target in
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000133 sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]])
134 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000135esac
136
John Criswell4ea390d2003-07-22 19:13:20 +0000137dnl Determine what our target architecture is and configure accordingly.
138dnl This will allow Makefiles to make a distinction between the hardware and
139dnl the OS.
John Criswell4ea390d2003-07-22 19:13:20 +0000140case $target in
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000141 i*86-*) AC_SUBST(ARCH,[x86])
John Criswell4ea390d2003-07-22 19:13:20 +0000142 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000143 sparc*-*) AC_SUBST(ARCH,[Sparc])
144 ;;
145 powerpc*-*) AC_SUBST(ARCH,[PowerPC])
146 ;;
147 *) AC_SUBST(ARCH,[Unknown])
John Criswell4ea390d2003-07-22 19:13:20 +0000148 ;;
149esac
150
John Criswell4ea390d2003-07-22 19:13:20 +0000151dnl Check for compilation tools
152AC_PROG_CXX
153AC_PROG_CC(gcc)
154AC_PROG_CPP
155
156dnl Ensure that compilation tools are GCC; we use GCC specific extensions
157if test "$GCC" != "yes"
158then
159 AC_MSG_ERROR([gcc required but not found])
160fi
John Criswell4ea390d2003-07-22 19:13:20 +0000161if test "$GXX" != "yes"
162then
163 AC_MSG_ERROR([g++ required but not found])
164fi
165
John Criswellde00db22003-08-25 16:49:54 +0000166dnl Verify that GCC is version 3.0 or higher
167gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1`
168if test "$gccmajor" -lt "3"
169then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000170 AC_MSG_ERROR([gcc 3.x required, but you have a lower version])
John Criswellde00db22003-08-25 16:49:54 +0000171fi
172
Brian Gaeke26be9c52004-01-13 06:43:16 +0000173dnl Check for GNU Make. We use its extensions too, so don't build without it
John Criswell4ea390d2003-07-22 19:13:20 +0000174CHECK_GNU_MAKE
175if test -z "$_cv_gnu_make_command"
176then
177 AC_MSG_ERROR([GNU Make required but not found])
178fi
179
Brian Gaeke26be9c52004-01-13 06:43:16 +0000180dnl Checks for other tools
John Criswell4ea390d2003-07-22 19:13:20 +0000181AC_PROG_FLEX
182AC_PROG_BISON
John Criswell4ea390d2003-07-22 19:13:20 +0000183AC_PROG_LIBTOOL
184
Brian Gaeke26be9c52004-01-13 06:43:16 +0000185dnl Checks for tools we can get away with not having:
186AC_PATH_PROG(DOT,[dot],[true dot])
187AC_PATH_PROG(ETAGS,[etags],[true etags])
Brian Gaeke027b7462004-01-22 21:55:15 +0000188dnl Check if we know how to tell etags we are using C++:
189etags_version=`$ETAGS --version 2>&1`
190case "$etags_version" in
191 *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;;
192 *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;;
193 *) ETAGSFLAGS="" ;;
194esac
195AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
Brian Gaeke26be9c52004-01-13 06:43:16 +0000196AC_PATH_PROG(PYTHON,[python],[true python])
197if test "$PYTHON" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000198then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000199 AC_MSG_WARN([Python is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000200fi
Brian Gaeke26be9c52004-01-13 06:43:16 +0000201AC_PATH_PROG(QMTEST,[qmtest],[true qmtest])
202if test "$QMTEST" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000203then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000204 AC_MSG_WARN([QMTest is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000205fi
John Criswellde00db22003-08-25 16:49:54 +0000206
207dnl Verify that the version of python available is high enough for qmtest
208pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2`
209pymajor=`echo $pyversion | cut -d. -f1`
210pyminor=`echo $pyversion | cut -d. -f2`
211
212if test "$pymajor" -ge "2"
213then
214 if test "$pymajor" -eq "2"
215 then
216 if test "$pyminor" -lt "2"
217 then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000218 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswellde00db22003-08-25 16:49:54 +0000219 fi
220 fi
221else
Brian Gaeke26be9c52004-01-13 06:43:16 +0000222 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswellde00db22003-08-25 16:49:54 +0000223fi
John Criswell4ea390d2003-07-22 19:13:20 +0000224
225dnl Verify that the source directory is valid
226AC_CONFIG_SRCDIR(["Makefile.config.in"])
227
Brian Gaeke26be9c52004-01-13 06:43:16 +0000228dnl Checks for libraries:
John Criswell4ea390d2003-07-22 19:13:20 +0000229dnl libelf is for sparc only; we can ignore it if we don't have it
230AC_CHECK_LIB(elf, elf_begin)
231
Brian Gaeke4c423782003-10-07 05:03:36 +0000232dnl dlopen() is required for plugin support.
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000233AC_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 +0000234
235dnl mallinfo is optional; the code can compile (minus features) without it
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000236AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.]))
John Criswell4ea390d2003-07-22 19:13:20 +0000237
Brian Gaeke5f268f72003-12-05 19:29:01 +0000238dnl pthread locking functions are optional - but llvm will not be thread-safe
239dnl without locks.
Brian Gaeke2e3bdba2004-02-23 21:30:36 +0000240AC_SEARCH_LIBS(pthread_mutex_lock,pthread,HAVE_PTHREAD_MUTEX_LOCK=1,HAVE_PTHREAD_MUTEX_LOCK=0)
241AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK)
Brian Gaeke5f268f72003-12-05 19:29:01 +0000242
Brian Gaeke26be9c52004-01-13 06:43:16 +0000243dnl Checks for header files.
244dnl We don't check for ancient stuff or things that are guaranteed to be there
245dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers.
John Criswell4ea390d2003-07-22 19:13:20 +0000246AC_HEADER_STDC
247AC_HEADER_SYS_WAIT
248
Brian Gaeke26be9c52004-01-13 06:43:16 +0000249dnl Checks for POSIX and other various system-specific header files
John Criswellb2815e02004-05-27 20:40:39 +0000250AC_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 +0000251
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000252dnl Check for things that need to be included in public headers, and so
253dnl for which we may not have access to a HAVE_* preprocessor #define.
254dnl (primarily used in DataTypes.h)
255AC_CHECK_HEADER([sys/types.h],
256 [INCLUDE_SYS_TYPES_H='#include <sys/types.h>'],
257 [INCLUDE_SYS_TYPES_H=''])
258AC_SUBST(INCLUDE_SYS_TYPES_H)
259AC_CHECK_HEADER([inttypes.h],
260 [INCLUDE_INTTYPES_H='#include <inttypes.h>'],
261 [INCLUDE_INTTYPES_H=''])
262AC_SUBST(INCLUDE_INTTYPES_H)
John Criswell7ed43ad2004-07-19 16:12:29 +0000263AC_CHECK_HEADER([stdint.h],
264 [INCLUDE_STDINT_H='#include <stdint.h>'],
265 [INCLUDE_STDINT_H=''])
266AC_SUBST(INCLUDE_STDINT_H)
267
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000268
John Criswell4ea390d2003-07-22 19:13:20 +0000269dnl Check for types
270AC_TYPE_PID_T
271AC_TYPE_SIZE_T
272AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
273AC_CHECK_TYPES([uint64_t],,AC_MSG_ERROR([Type uint64_t required but not found]))
274AC_HEADER_TIME
275AC_STRUCT_TM
276
John Criswella0137d32003-10-13 16:22:01 +0000277dnl Check for various C features
278AC_C_PRINTF_A
279
John Criswell0021c312004-02-13 21:57:29 +0000280dnl Check for the endianness of the target
281AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
282
John Criswell4ea390d2003-07-22 19:13:20 +0000283dnl Check for C++ extensions
Brian Gaeke278a4ac2003-11-10 03:06:09 +0000284AC_CXX_HAVE_HASH_MAP
285AC_CXX_HAVE_HASH_SET
John Criswell4ea390d2003-07-22 19:13:20 +0000286AC_CXX_HAVE_STD_ITERATOR
287AC_CXX_HAVE_BI_ITERATOR
288AC_CXX_HAVE_FWD_ITERATOR
289
Brian Gaeke8828eb52004-06-22 23:43:04 +0000290AC_FUNC_ISNAN
Brian Gaeke3869b272004-07-21 03:14:51 +0000291AC_FUNC_ISINF
Brian Gaeke8828eb52004-06-22 23:43:04 +0000292
Brian Gaeke26be9c52004-01-13 06:43:16 +0000293dnl Checks for library functions.
John Criswell4ea390d2003-07-22 19:13:20 +0000294AC_FUNC_ALLOCA
John Criswell4ea390d2003-07-22 19:13:20 +0000295AC_FUNC_MMAP
Brian Gaeke26be9c52004-01-13 06:43:16 +0000296if test "$ac_cv_func_mmap_fixed_mapped" = "no"
297then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000298 AC_MSG_WARN([mmap() required but not found])
Brian Gaeke26be9c52004-01-13 06:43:16 +0000299fi
John Criswell4ea390d2003-07-22 19:13:20 +0000300AC_FUNC_MMAP_FILE
Brian Gaeke26be9c52004-01-13 06:43:16 +0000301if test "$ac_cv_func_mmap_file" = "no"
John Criswell4ea390d2003-07-22 19:13:20 +0000302then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000303 AC_MSG_WARN([mmap() of files required but not found])
John Criswell4ea390d2003-07-22 19:13:20 +0000304fi
305AC_HEADER_MMAP_ANONYMOUS
306AC_TYPE_SIGNAL
Brian Gaeke8828eb52004-06-22 23:43:04 +0000307AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace isatty mkstemp getrusage)
John Criswell4ea390d2003-07-22 19:13:20 +0000308AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found]))
309
John Criswellcb7a1eb2003-11-17 19:46:02 +0000310dnl Determine if the linker supports the -R option.
Brian Gaeke26be9c52004-01-13 06:43:16 +0000311AC_LINK_USE_R
John Criswellcb7a1eb2003-11-17 19:46:02 +0000312
Brian Gaeke26be9c52004-01-13 06:43:16 +0000313dnl --enable/--with command-line options:
314dnl Check whether they want to do an optimized build:
John Criswell79a8f092003-07-22 20:59:52 +0000315AC_ARG_ENABLE(optimized,AC_HELP_STRING([--enable-optimized],[Compile with optimizations enabled (default is NO)]),,enableval=no)
316if test ${enableval} = "no"
317then
318 AC_SUBST(ENABLE_OPTIMIZED,[[]])
319else
320 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
321fi
322
Brian Gaekedbaf9812004-04-16 17:13:33 +0000323AC_DEFUN(EXTERNAL_BENCHMARK,
324[m4_define([allcapsname],translit($1,a-z,A-Z))
325 AC_ARG_ENABLE($1,
326 AC_HELP_STRING([--enable-$1=ARG],
327 [Use $1 as a benchmark (srcs in DIR)]),
328 checkresult=$enableval,
329 checkresult=auto)
330AC_MSG_CHECKING([for $1 benchmark sources])
331case "$checkresult" in
Chris Lattnerac847282004-04-14 16:32:34 +0000332auto|yes)
Brian Gaekedbaf9812004-04-16 17:13:33 +0000333 defaultdir=$2
334 if test -d "$defaultdir"
John Criswell0538d422004-02-20 22:30:22 +0000335 then
Brian Gaekedbaf9812004-04-16 17:13:33 +0000336 AC_SUBST(allcapsname()[_ROOT],[$defaultdir])
337 AC_SUBST([USE_]allcapsname(),[USE_]allcapsname()=1)
338 checkresult="yes, found in $defaultdir"
Brian Gaekebc7b85f2004-04-13 19:02:51 +0000339 else
Brian Gaekedbaf9812004-04-16 17:13:33 +0000340 checkresult=no
Brian Gaekebc7b85f2004-04-13 19:02:51 +0000341 fi
342 ;;
Chris Lattnerac847282004-04-14 16:32:34 +0000343no)
Brian Gaekedbaf9812004-04-16 17:13:33 +0000344 AC_SUBST(allcapsname()[_ROOT],[])
345 AC_SUBST([USE_]allcapsname(),[])
346 checkresult=no
Brian Gaekebc7b85f2004-04-13 19:02:51 +0000347 ;;
Brian Gaekedbaf9812004-04-16 17:13:33 +0000348*) if test -d "$checkresult"
Brian Gaekebc7b85f2004-04-13 19:02:51 +0000349 then
Brian Gaekedbaf9812004-04-16 17:13:33 +0000350 AC_SUBST(allcapsname()[_ROOT],"$checkresult")
351 AC_SUBST([USE_]allcapsname(),[USE_]allcapsname()=1)
352 checkresult="yes, in $checkresult"
Brian Gaekebc7b85f2004-04-13 19:02:51 +0000353 else
Brian Gaekedbaf9812004-04-16 17:13:33 +0000354 AC_SUBST(allcapsname()[_ROOT],[])
355 AC_SUBST([USE_]allcapsname(),[])
356 checkresult="no, not found in $checkresult"
Brian Gaekebc7b85f2004-04-13 19:02:51 +0000357 fi
358 ;;
359esac
Brian Gaekedbaf9812004-04-16 17:13:33 +0000360AC_MSG_RESULT($checkresult)
361m4_undefine([allcapsname])
362])
363
364EXTERNAL_BENCHMARK(spec95,/home/vadve/shared/benchmarks/spec95/benchspec)
365EXTERNAL_BENCHMARK(spec2000,/home/vadve/shared/benchmarks/speccpu2000/benchspec)
366EXTERNAL_BENCHMARK(povray,/home/vadve/shared/benchmarks/povray31)
John Criswell0538d422004-02-20 22:30:22 +0000367
John Criswell79a8f092003-07-22 20:59:52 +0000368dnl Precompiled Bytecode Option
369AC_ARG_ENABLE(precompiled_bytecode,AC_HELP_STRING([--enable-precompiled_bytecode],[Use pre-compiled bytecode (default is NO)]),,enableval=no)
370if test ${enableval} = "no"
371then
372 AC_SUBST(UPB,[[]])
373else
374 AC_SUBST(UPB,[[USE_PRECOMPILED_BYTECODE=1]])
375fi
376
John Criswell79a8f092003-07-22 20:59:52 +0000377dnl LLC Diff Option
378AC_ARG_ENABLE(llc_diffs,AC_HELP_STRING([--enable-llc_diffs],[Enable LLC Diffs when testing (default is YES)]),,enableval=yes)
379if test ${enableval} = "no"
380then
381 AC_SUBST(DISABLE_LLC_DIFFS,[DISABLE_LLC_DIFFS:=1])
382else
383 AC_SUBST(DISABLE_LLC_DIFFS,[[]])
384fi
385
386dnl JIT Option
John Criswellc78022e2003-07-29 19:11:58 +0000387AC_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 +0000388if test ${enableval} = "no"
389then
390 AC_SUBST(JIT,[[]])
391else
John Criswellc78022e2003-07-29 19:11:58 +0000392 case $target in
393 *i*86*)
394 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
395 ;;
396 *sparc*)
397 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
398 ;;
399 *)
400 AC_SUBST(JIT,[[]])
401 ;;
402 esac
John Criswell79a8f092003-07-22 20:59:52 +0000403fi
John Criswell4ea390d2003-07-22 19:13:20 +0000404
Brian Gaeke26be9c52004-01-13 06:43:16 +0000405dnl Find the LLVM GCC-based C/C++ front end
John Criswell4ea390d2003-07-22 19:13:20 +0000406AC_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 +0000407AC_MSG_CHECKING([for llvm-gcc])
408LLVM_GCC_CHECK=no
409if test -d "$LLVMGCCDIR"
410then
411 if test -x "$LLVMGCCDIR/bin/gcc"
412 then
413 LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc"
414 fi
415fi
416llvmgccwarn=no
417AC_MSG_RESULT($LLVM_GCC_CHECK)
418if test "$LLVM_GCC_CHECK" = "no"
419then
420 llvmgccwarn=yes
421fi
Brian Gaeke908647f2003-11-16 18:37:46 +0000422AC_MSG_CHECKING([whether llvm-gcc is sane])
423LLVM_GCC_SANE=no
424if test -x "$LLVM_GCC_CHECK"
425then
426 cp /dev/null conftest.c
427 "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1
428 if test $? -eq 0
429 then
430 LLVM_GCC_SANE=yes
431 fi
432 rm conftest.c
Brian Gaeked05e39d2004-01-16 21:31:22 +0000433 llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1`
434 AC_SUBST(LLVMCC1,$llvmcc1path)
435 llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus`
436 AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
Brian Gaeke908647f2003-11-16 18:37:46 +0000437fi
438AC_MSG_RESULT($LLVM_GCC_SANE)
439if test "$LLVM_GCC_SANE" = "no"
440then
441 llvmgccwarn=yes
442fi
443
John Criswellc78022e2003-07-29 19:11:58 +0000444dnl Location of the bytecode repository
John Criswell4ea390d2003-07-22 19:13:20 +0000445AC_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 +0000446
447dnl Location of PAPI
Chris Lattner1b9ddd52003-08-14 18:59:53 +0000448AC_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 +0000449
Brian Gaekecea9a602004-01-21 19:38:56 +0000450dnl Get libtool's idea of what the shared library suffix is.
451dnl (This is a hack; it relies on undocumented behavior.)
452AC_MSG_CHECKING([for shared library suffix])
453eval "SHLIBEXT=$shrext"
454AC_MSG_RESULT($SHLIBEXT)
455dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint).
456AC_SUBST(SHLIBEXT,$SHLIBEXT)
457AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT",
458 [Extension that shared libraries have, e.g., ".so".])
459
Reid Spencera91929d2004-08-20 09:03:12 +0000460# Translate the various configuration directories and other basic
461# information into substitutions that will end up in config.h.in so
462# that these configured values can be hard-wired into a program.
463eval LLVM_PREFIX="${prefix}";
464eval LLVM_BINDIR="${prefix}/bin";
465eval LLVM_LIBDIR="${prefix}/lib";
466eval LLVM_DATADIR="${prefix}/data";
467eval LLVM_DOCSDIR="${prefix}/docs";
468eval LLVM_ETCDIR="${prefix}/etc";
469eval LLVM_INCLUDEDIR="${prefix}/include";
470eval LLVM_INFODIR="${prefix}/info";
471eval LLVM_MANDIR="${prefix}/man";
472LLVM_CONFIGTIME=`date`
473AC_SUBST(LLVM_PREFIX)
474AC_SUBST(LLVM_BINDIR)
475AC_SUBST(LLVM_LIBDIR)
476AC_SUBST(LLVM_DATADIR)
477AC_SUBST(LLVM_DOCSDIR)
478AC_SUBST(LLVM_ETCDIR)
479AC_SUBST(LLVM_INCLUDEDIR)
480AC_SUBST(LLVM_INFODIR)
481AC_SUBST(LLVM_MANDIR)
482AC_SUBST(LLVM_CONFIGTIME)
483AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", [Installation prefix directory])
484AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", [Installation directory for binary executables])
485AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR", [Installation directory for libraries])
486AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", [Installation directory for data files])
487AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR", [Installation directory for documentation])
488AC_DEFINE_UNQUOTED(LLVM_CONFIGDIR, "$LLVM_ETCDIR", [Installation directory for config files])
489AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", [Installation directory for include files])
490AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", [Installation directory for .info files])
491AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", [Installation directory for man pages])
492AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", [Time at which LLVM was configured])
493
Brian Gaeke26be9c52004-01-13 06:43:16 +0000494dnl Create the output files
John Criswelldc76e322004-07-23 15:40:57 +0000495AC_OUTPUT()
Brian Gaeke908647f2003-11-16 18:37:46 +0000496
Brian Gaeke26be9c52004-01-13 06:43:16 +0000497dnl Warn loudly if llvm-gcc was not obviously working
Brian Gaeke908647f2003-11-16 18:37:46 +0000498if test $llvmgccwarn = yes
499then
500 AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not])
501 AC_MSG_WARN([***** appear to be working.])
502 AC_MSG_WARN([***** ])
503 AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.])
504 AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,])
505 AC_MSG_WARN([***** but you should be able to build the llvm tools.])
506fi
Brian Gaekecea9a602004-01-21 19:38:56 +0000507