1 dnl Initialize autoconf
2 AC_INIT([[[LLVM]]],[[[1.1]]],[llvmbugs@cs.uiuc.edu])
4 dnl Place all of the extra autoconf files into the config subdirectory
5 AC_CONFIG_AUX_DIR([autoconf])
7 dnl Quit if the source directory has already been configured.
8 dnl NOTE: This relies upon undocumented autoconf behavior.
9 if test ${srcdir} != "."
11 if test -f ${srcdir}/include/Config/config.h
13 AC_MSG_ERROR([Already configured in ${srcdir}])
17 dnl Configure all of the projects present in our source tree.
18 for i in `ls ${srcdir}/projects`
22 if test -f ${srcdir}/projects/${i}/configure
24 AC_CONFIG_SUBDIRS(projects/${i})
29 dnl Configure a header file
30 AC_CONFIG_HEADERS(include/Config/config.h)
31 AC_CONFIG_MAKEFILE(Makefile)
32 AC_CONFIG_MAKEFILE(Makefile.common)
33 AC_CONFIG_MAKEFILE(lib/Makefile)
34 AC_CONFIG_MAKEFILE(runtime/Makefile)
35 AC_CONFIG_MAKEFILE(test/Makefile)
36 AC_CONFIG_MAKEFILE(test/Makefile.tests)
37 AC_CONFIG_MAKEFILE(test/QMTest/llvm.py)
38 AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py)
39 AC_CONFIG_MAKEFILE(test/Programs/Makefile)
40 AC_CONFIG_MAKEFILE(test/Programs/Makefile.programs)
41 AC_CONFIG_MAKEFILE(test/Programs/TEST.aa.Makefile)
42 AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.report)
43 AC_CONFIG_MAKEFILE(test/Programs/TEST.aa.report)
44 AC_CONFIG_MAKEFILE(test/Programs/TEST.example.Makefile)
45 AC_CONFIG_MAKEFILE(test/Programs/TEST.nightly.Makefile)
46 AC_CONFIG_MAKEFILE(test/Programs/TEST.buildrepo.Makefile)
47 AC_CONFIG_MAKEFILE(test/Programs/TEST.jit.Makefile)
48 AC_CONFIG_MAKEFILE(test/Programs/TEST.nightly.report)
49 AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.Makefile)
50 AC_CONFIG_MAKEFILE(test/Programs/TEST.jit.report)
51 AC_CONFIG_MAKEFILE(test/Programs/TEST.typesafe.Makefile)
52 AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.gnuplot)
53 AC_CONFIG_MAKEFILE(test/Programs/TEST.vtl.Makefile)
54 AC_CONFIG_MAKEFILE(test/Programs/External/Makefile)
55 AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile)
56 AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec)
57 AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec2000)
58 AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec95)
59 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Makefile)
60 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Makefile.multisrc)
61 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/test.in)
62 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/distray/Makefile)
63 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/distray/test.in)
64 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/Makefile)
65 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/test.in)
66 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/mason/Makefile)
67 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/mason/test.in)
68 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/neural/Makefile)
69 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/neural/test.in)
70 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2/Makefile)
71 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2/test.in)
72 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pifft/Makefile)
73 AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pifft/test.in)
74 AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile)
75 AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile.singlesrc)
76 AC_CONFIG_MAKEFILE(test/Programs/SingleSource/UnitTests/SetjmpLongjmp/Makefile)
77 AC_CONFIG_MAKEFILE(tools/Makefile)
78 AC_CONFIG_MAKEFILE(utils/Makefile)
79 AC_CONFIG_MAKEFILE(projects/Makefile)
81 dnl Find the install program (needs to be done before canonical stuff)
84 dnl Check which host for which we're compiling. This will tell us which LLVM
85 dnl compiler will be used for compiling SSA into object code.
88 dnl Set the "OS" Makefile variable based on the system we are building on.
89 dnl We will use the build machine information to set some variables.
93 if test -d /home/vadve/lattner/local/x86/llvm-gcc
95 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/])
101 if test -d /home/vadve/lattner/local/sparc/llvm-gcc
103 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/])
108 AC_SUBST(OS,[Darwin])
111 *) AC_SUBST(OS,[Unknown])
115 dnl If we are targetting a Sparc machine running Solaris, pretend that it is
116 dnl V9, since that is all that we support at the moment, and autoconf will only
117 dnl tell us we're a sparc.
119 sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]])
123 dnl Determine what our target architecture is and configure accordingly.
124 dnl This will allow Makefiles to make a distinction between the hardware and
127 i*86-*) AC_SUBST(ARCH,[x86])
129 sparc*-*) AC_SUBST(ARCH,[Sparc])
131 powerpc*-*) AC_SUBST(ARCH,[PowerPC])
133 *) AC_SUBST(ARCH,[Unknown])
137 dnl Check for compilation tools
142 dnl Ensure that compilation tools are GCC; we use GCC specific extensions
143 if test "$GCC" != "yes"
145 AC_MSG_ERROR([gcc required but not found])
147 if test "$GXX" != "yes"
149 AC_MSG_ERROR([g++ required but not found])
152 dnl Verify that GCC is version 3.0 or higher
153 gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1`
154 if test "$gccmajor" -lt "3"
156 AC_MSG_ERROR([gcc 3.x required, but you have a lower version])
159 dnl Check for GNU Make. We use its extensions too, so don't build without it
161 if test -z "$_cv_gnu_make_command"
163 AC_MSG_ERROR([GNU Make required but not found])
166 dnl Checks for other tools
171 dnl Checks for tools we can get away with not having:
172 AC_PATH_PROG(DOT,[dot],[true dot])
173 AC_PATH_PROG(ETAGS,[etags],[true etags])
174 dnl Check if we know how to tell etags we are using C++:
175 etags_version=`$ETAGS --version 2>&1`
176 case "$etags_version" in
177 *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;;
178 *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;;
181 AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
182 AC_PATH_PROG(PYTHON,[python],[true python])
183 if test "$PYTHON" = "false"
185 AC_MSG_WARN([Python is required for the test suite, but it was not found])
187 AC_PATH_PROG(QMTEST,[qmtest],[true qmtest])
188 if test "$QMTEST" = "false"
190 AC_MSG_WARN([QMTest is required for the test suite, but it was not found])
193 dnl Verify that the version of python available is high enough for qmtest
194 pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2`
195 pymajor=`echo $pyversion | cut -d. -f1`
196 pyminor=`echo $pyversion | cut -d. -f2`
198 if test "$pymajor" -ge "2"
200 if test "$pymajor" -eq "2"
202 if test "$pyminor" -lt "2"
204 AC_MSG_WARN([QMTest requires Python 2.2 or later])
208 AC_MSG_WARN([QMTest requires Python 2.2 or later])
211 dnl Verify that the source directory is valid
212 AC_CONFIG_SRCDIR(["Makefile.config.in"])
214 dnl Checks for libraries:
215 dnl libelf is for sparc only; we can ignore it if we don't have it
216 AC_CHECK_LIB(elf, elf_begin)
218 dnl dlopen() is required for plugin support.
219 AC_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]))
221 dnl mallinfo is optional; the code can compile (minus features) without it
222 AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.]))
224 dnl pthread locking functions are optional - but llvm will not be thread-safe
226 AC_SEARCH_LIBS(pthread_mutex_lock,pthread,HAVE_PTHREAD_MUTEX_LOCK=1,HAVE_PTHREAD_MUTEX_LOCK=0)
227 AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK)
229 dnl Checks for header files.
230 dnl We don't check for ancient stuff or things that are guaranteed to be there
231 dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers.
235 dnl Checks for POSIX and other various system-specific header files
236 AC_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)
238 dnl Check for things that need to be included in public headers, and so
239 dnl for which we may not have access to a HAVE_* preprocessor #define.
240 dnl (primarily used in DataTypes.h)
241 AC_CHECK_HEADER([sys/types.h],
242 [INCLUDE_SYS_TYPES_H='#include <sys/types.h>'],
243 [INCLUDE_SYS_TYPES_H=''])
244 AC_SUBST(INCLUDE_SYS_TYPES_H)
245 AC_CHECK_HEADER([inttypes.h],
246 [INCLUDE_INTTYPES_H='#include <inttypes.h>'],
247 [INCLUDE_INTTYPES_H=''])
248 AC_SUBST(INCLUDE_INTTYPES_H)
253 AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
254 AC_CHECK_TYPES([uint64_t],,AC_MSG_ERROR([Type uint64_t required but not found]))
258 dnl Check for various C features
261 dnl Check for the endianness of the target
262 AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
264 dnl Check for C++ extensions
267 AC_CXX_HAVE_STD_ITERATOR
268 AC_CXX_HAVE_BI_ITERATOR
269 AC_CXX_HAVE_FWD_ITERATOR
271 dnl Checks for library functions.
274 if test "$ac_cv_func_mmap_fixed_mapped" = "no"
276 AC_MSG_ERROR([mmap() required but not found])
279 if test "$ac_cv_func_mmap_file" = "no"
281 AC_MSG_ERROR([mmap() of files required but not found])
283 AC_HEADER_MMAP_ANONYMOUS
285 AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace isatty)
286 AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found]))
288 dnl Determine if the linker supports the -R option.
291 dnl --enable/--with command-line options:
292 dnl Check whether they want to do an optimized build:
293 AC_ARG_ENABLE(optimized,AC_HELP_STRING([--enable-optimized],[Compile with optimizations enabled (default is NO)]),,enableval=no)
294 if test ${enableval} = "no"
296 AC_SUBST(ENABLE_OPTIMIZED,[[]])
298 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
301 dnl Spec 2000 Benchmarks
302 AC_ARG_ENABLE(spec2000,AC_HELP_STRING([--enable-spec2000],[Compile SPEC 2000 benchmarks (default is NO)]),,enableval=no)
303 if test ${enableval} = "no"
305 if test -d /home/vadve/shared/benchmarks/speccpu2000/benchspec
307 AC_SUBST(SPEC2000_ROOT,[/home/vadve/shared/benchmarks/speccpu2000/benchspec])
308 AC_SUBST(USE_SPEC2000,[[USE_SPEC2000=1]])
310 AC_SUBST(USE_SPEC2000,[[]])
311 AC_SUBST(SPEC2000_ROOT,[])
314 if test ${enableval} = ""
316 AC_SUBST(SPEC2000_ROOT,[/home/vadve/shared/benchmarks/speccpu2000/benchspec])
318 AC_SUBST(SPEC2000_ROOT,[${enableval}])
320 AC_SUBST(USE_SPEC2000,[[USE_SPEC2000=1]])
323 dnl Spec 95 Benchmarks
324 AC_ARG_ENABLE(spec95,AC_HELP_STRING([--enable-spec95],[Compile SPEC 95 benchmarks (default is NO)]),,enableval=no)
325 if test ${enableval} = "no"
327 if test -d /home/vadve/shared/benchmarks/spec95/benchspec
329 AC_SUBST(SPEC95_ROOT,[/home/vadve/shared/benchmarks/spec95/benchspec])
330 AC_SUBST(USE_SPEC95,[[USE_SPEC95=1]])
332 AC_SUBST(USE_SPEC95,[[]])
333 AC_SUBST(SPEC95_ROOT,[])
336 if test ${enableval} = ""
338 AC_SUBST(SPEC95_ROOT,[/home/vadve/shared/benchmarks/spec95/benchspec])
340 AC_SUBST(SPEC95_ROOT,[${enableval}])
342 AC_SUBST(USE_SPEC95,[[USE_SPEC95=1]])
345 dnl We can use POV-Ray as an external benchmark, if they have the sources.
346 AC_ARG_ENABLE(povray,
347 AC_HELP_STRING([--enable-povray=ARG],
348 [Use POV-Ray as a benchmark (srcs in DIR)]),
351 AC_MSG_CHECKING([for POV-Ray benchmark sources])
354 defaultdir=/home/vadve/shared/benchmarks/povray31
355 if test -d $defaultdir
357 AC_SUBST(POVRAY_ROOT,[$defaultdir])
358 AC_SUBST(USE_POVRAY,[[USE_POVRAY=1]])
359 povray="yes, found in $defaultdir"
365 AC_SUBST(POVRAY_ROOT,[])
366 AC_SUBST(USE_POVRAY,[[]])
369 *) if test -d "$povray"
371 AC_SUBST(POVRAY_ROOT,"$povray")
372 AC_SUBST(USE_POVRAY,[[USE_POVRAY=1]])
373 povray="yes, in $povray"
375 AC_SUBST(POVRAY_ROOT,[])
376 AC_SUBST(USE_POVRAY,[[]])
377 povray="no, not found in $povray"
381 AC_MSG_RESULT($povray)
383 dnl Precompiled Bytecode Option
384 AC_ARG_ENABLE(precompiled_bytecode,AC_HELP_STRING([--enable-precompiled_bytecode],[Use pre-compiled bytecode (default is NO)]),,enableval=no)
385 if test ${enableval} = "no"
389 AC_SUBST(UPB,[[USE_PRECOMPILED_BYTECODE=1]])
393 AC_ARG_ENABLE(llc_diffs,AC_HELP_STRING([--enable-llc_diffs],[Enable LLC Diffs when testing (default is YES)]),,enableval=yes)
394 if test ${enableval} = "no"
396 AC_SUBST(DISABLE_LLC_DIFFS,[DISABLE_LLC_DIFFS:=1])
398 AC_SUBST(DISABLE_LLC_DIFFS,[[]])
402 AC_ARG_ENABLE(jit,AC_HELP_STRING([--enable-jit],[Enable Just In Time Compiling (default is YES)]),,enableval=default)
403 if test ${enableval} = "no"
409 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
412 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
420 dnl Find the LLVM GCC-based C/C++ front end
421 AC_ARG_WITH(llvmgccdir,AC_HELP_STRING([--with-llvmgccdir],[Location of LLVM GCC front-end]),AC_SUBST(LLVMGCCDIR,[$withval]))
422 AC_MSG_CHECKING([for llvm-gcc])
424 if test -d "$LLVMGCCDIR"
426 if test -x "$LLVMGCCDIR/bin/gcc"
428 LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc"
432 AC_MSG_RESULT($LLVM_GCC_CHECK)
433 if test "$LLVM_GCC_CHECK" = "no"
437 AC_MSG_CHECKING([whether llvm-gcc is sane])
439 if test -x "$LLVM_GCC_CHECK"
441 cp /dev/null conftest.c
442 "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1
448 llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1`
449 AC_SUBST(LLVMCC1,$llvmcc1path)
450 llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus`
451 AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
453 AC_MSG_RESULT($LLVM_GCC_SANE)
454 if test "$LLVM_GCC_SANE" = "no"
459 dnl Location of the bytecode repository
460 AC_ARG_WITH(bcrepos,AC_HELP_STRING([--with-bcrepos],[Location of Bytecode Repository]),AC_SUBST(BCR,[$withval]),AC_SUBST(BCR,[/home/vadve/lattner/LLVMPrograms]))
463 AC_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]))
465 dnl Get libtool's idea of what the shared library suffix is.
466 dnl (This is a hack; it relies on undocumented behavior.)
467 AC_MSG_CHECKING([for shared library suffix])
468 eval "SHLIBEXT=$shrext"
469 AC_MSG_RESULT($SHLIBEXT)
470 dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint).
471 AC_SUBST(SHLIBEXT,$SHLIBEXT)
472 AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT",
473 [Extension that shared libraries have, e.g., ".so".])
475 dnl Create the output files
476 AC_OUTPUT(Makefile.config
477 include/Support/DataTypes.h
478 include/Support/ThreadSupport.h
479 include/Support/hash_map
480 include/Support/hash_set
481 include/Support/iterator)
483 dnl Warn loudly if llvm-gcc was not obviously working
484 if test $llvmgccwarn = yes
486 AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not])
487 AC_MSG_WARN([***** appear to be working.])
488 AC_MSG_WARN([***** ])
489 AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.])
490 AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,])
491 AC_MSG_WARN([***** but you should be able to build the llvm tools.])