Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 1 | dnl Initialize autoconf |
John Criswell | d000e1d | 2003-12-18 16:43:17 +0000 | [diff] [blame] | 2 | AC_INIT([[[LLVM]]],[[[1.1]]],[llvmbugs@cs.uiuc.edu]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 3 | |
| 4 | dnl Place all of the extra autoconf files into the config subdirectory |
| 5 | AC_CONFIG_AUX_DIR([autoconf]) |
| 6 | |
John Criswell | 93e1c72 | 2003-09-15 17:04:06 +0000 | [diff] [blame] | 7 | dnl Quit if the source directory has already been configured. |
John Criswell | 1b82432 | 2003-09-15 17:19:42 +0000 | [diff] [blame] | 8 | dnl NOTE: This relies upon undocumented autoconf behavior. |
| 9 | if test ${srcdir} != "." |
John Criswell | 93e1c72 | 2003-09-15 17:04:06 +0000 | [diff] [blame] | 10 | then |
John Criswell | 1b82432 | 2003-09-15 17:19:42 +0000 | [diff] [blame] | 11 | if test -f ${srcdir}/include/Config/config.h |
| 12 | then |
| 13 | AC_MSG_ERROR([Already configured in ${srcdir}]) |
| 14 | fi |
John Criswell | 93e1c72 | 2003-09-15 17:04:06 +0000 | [diff] [blame] | 15 | fi |
| 16 | |
John Criswell | 33a911a | 2003-11-25 20:36:46 +0000 | [diff] [blame] | 17 | dnl Configure all of the projects present in our source tree. |
John Criswell | 33a911a | 2003-11-25 20:36:46 +0000 | [diff] [blame] | 18 | for i in `ls ${srcdir}/projects` |
| 19 | do |
| 20 | if test ${i} != "CVS" |
| 21 | then |
John Criswell | 9493c97 | 2003-12-12 20:09:33 +0000 | [diff] [blame] | 22 | if test -f ${srcdir}/projects/${i}/configure |
John Criswell | 33a911a | 2003-11-25 20:36:46 +0000 | [diff] [blame] | 23 | then |
| 24 | AC_CONFIG_SUBDIRS(projects/${i}) |
| 25 | fi |
| 26 | fi |
| 27 | done |
John Criswell | 559a6c1 | 2003-09-30 16:31:48 +0000 | [diff] [blame] | 28 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 29 | dnl Configure a header file |
| 30 | AC_CONFIG_HEADERS(include/Config/config.h) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 31 | AC_CONFIG_MAKEFILE(Makefile) |
| 32 | AC_CONFIG_MAKEFILE(Makefile.common) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 33 | AC_CONFIG_MAKEFILE(lib/Makefile) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 34 | AC_CONFIG_MAKEFILE(runtime/Makefile) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 35 | AC_CONFIG_MAKEFILE(test/Makefile) |
| 36 | AC_CONFIG_MAKEFILE(test/Makefile.tests) |
John Criswell | f424d74 | 2003-10-07 21:13:47 +0000 | [diff] [blame] | 37 | AC_CONFIG_MAKEFILE(test/QMTest/llvm.py) |
| 38 | AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 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.micro.report) |
| 44 | AC_CONFIG_MAKEFILE(test/Programs/TEST.aa.report) |
| 45 | AC_CONFIG_MAKEFILE(test/Programs/TEST.example.Makefile) |
| 46 | AC_CONFIG_MAKEFILE(test/Programs/TEST.nightly.Makefile) |
| 47 | AC_CONFIG_MAKEFILE(test/Programs/TEST.buildrepo.Makefile) |
| 48 | AC_CONFIG_MAKEFILE(test/Programs/TEST.jit.Makefile) |
| 49 | AC_CONFIG_MAKEFILE(test/Programs/TEST.nightly.report) |
| 50 | AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.Makefile) |
| 51 | AC_CONFIG_MAKEFILE(test/Programs/TEST.jit.report) |
| 52 | AC_CONFIG_MAKEFILE(test/Programs/TEST.typesafe.Makefile) |
| 53 | AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.gnuplot) |
| 54 | AC_CONFIG_MAKEFILE(test/Programs/TEST.micro.Makefile) |
| 55 | AC_CONFIG_MAKEFILE(test/Programs/External/Makefile) |
| 56 | AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile) |
John Criswell | 27bb35e | 2003-09-11 18:04:00 +0000 | [diff] [blame] | 57 | AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec) |
John Criswell | b607cc8 | 2004-02-10 22:29:06 +0000 | [diff] [blame] | 58 | AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec95) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 59 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Makefile) |
| 60 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Makefile.multisrc) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 61 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/test.in) |
Misha Brukman | 3e910fe | 2003-11-12 19:39:10 +0000 | [diff] [blame] | 62 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/distray/Makefile) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 63 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/distray/test.in) |
Misha Brukman | 3e910fe | 2003-11-12 19:39:10 +0000 | [diff] [blame] | 64 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/Makefile) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 65 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/test.in) |
Misha Brukman | 3e910fe | 2003-11-12 19:39:10 +0000 | [diff] [blame] | 66 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/mason/Makefile) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 67 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/mason/test.in) |
Misha Brukman | 3e910fe | 2003-11-12 19:39:10 +0000 | [diff] [blame] | 68 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/neural/Makefile) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 69 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/neural/test.in) |
Misha Brukman | 3e910fe | 2003-11-12 19:39:10 +0000 | [diff] [blame] | 70 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2/Makefile) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 71 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2/test.in) |
Misha Brukman | 3e910fe | 2003-11-12 19:39:10 +0000 | [diff] [blame] | 72 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pifft/Makefile) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 73 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pifft/test.in) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 74 | AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile) |
| 75 | AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile.singlesrc) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 76 | AC_CONFIG_MAKEFILE(tools/Makefile) |
Chris Lattner | 5c866e1 | 2003-10-06 02:09:25 +0000 | [diff] [blame] | 77 | AC_CONFIG_MAKEFILE(utils/Makefile) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 78 | AC_CONFIG_MAKEFILE(projects/Makefile) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 79 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 80 | dnl Find the install program (needs to be done before canonical stuff) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 81 | AC_PROG_INSTALL |
| 82 | |
| 83 | dnl Check which host for which we're compiling. This will tell us which LLVM |
| 84 | dnl compiler will be used for compiling SSA into object code. |
| 85 | AC_CANONICAL_TARGET |
| 86 | |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 87 | dnl Set the "OS" Makefile variable based on the system we are building on. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 88 | dnl We will use the build machine information to set some variables. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 89 | case $build in |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 90 | *-*-linux*) |
| 91 | AC_SUBST(OS,[Linux]) |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 92 | if test -d /home/vadve/lattner/local/x86/llvm-gcc |
| 93 | then |
| 94 | AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/]) |
| 95 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 96 | ;; |
| 97 | |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 98 | *-*-solaris*) |
| 99 | AC_SUBST(OS,[SunOS]) |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 100 | if test -d /home/vadve/lattner/local/sparc/llvm-gcc |
| 101 | then |
| 102 | AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/]) |
| 103 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 104 | ;; |
| 105 | |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 106 | *-*-darwin*) |
| 107 | AC_SUBST(OS,[Darwin]) |
| 108 | ;; |
| 109 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 110 | *) AC_SUBST(OS,[Unknown]) |
| 111 | ;; |
| 112 | esac |
| 113 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 114 | dnl If we are targetting a Sparc machine running Solaris, pretend that it is |
| 115 | dnl V9, since that is all that we support at the moment, and autoconf will only |
| 116 | dnl tell us we're a sparc. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 117 | case $target in |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 118 | sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]]) |
| 119 | ;; |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 120 | esac |
| 121 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 122 | dnl Determine what our target architecture is and configure accordingly. |
| 123 | dnl This will allow Makefiles to make a distinction between the hardware and |
| 124 | dnl the OS. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 125 | case $target in |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 126 | i*86-*) AC_SUBST(ARCH,[x86]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 127 | ;; |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 128 | sparc*-*) AC_SUBST(ARCH,[Sparc]) |
| 129 | ;; |
| 130 | powerpc*-*) AC_SUBST(ARCH,[PowerPC]) |
| 131 | ;; |
| 132 | *) AC_SUBST(ARCH,[Unknown]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 133 | ;; |
| 134 | esac |
| 135 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 136 | dnl Check for compilation tools |
| 137 | AC_PROG_CXX |
| 138 | AC_PROG_CC(gcc) |
| 139 | AC_PROG_CPP |
| 140 | |
| 141 | dnl Ensure that compilation tools are GCC; we use GCC specific extensions |
| 142 | if test "$GCC" != "yes" |
| 143 | then |
| 144 | AC_MSG_ERROR([gcc required but not found]) |
| 145 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 146 | if test "$GXX" != "yes" |
| 147 | then |
| 148 | AC_MSG_ERROR([g++ required but not found]) |
| 149 | fi |
| 150 | |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 151 | dnl Verify that GCC is version 3.0 or higher |
| 152 | gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1` |
| 153 | if test "$gccmajor" -lt "3" |
| 154 | then |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 155 | AC_MSG_ERROR([gcc 3.x required, but you have a lower version]) |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 156 | fi |
| 157 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 158 | dnl Check for GNU Make. We use its extensions too, so don't build without it |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 159 | CHECK_GNU_MAKE |
| 160 | if test -z "$_cv_gnu_make_command" |
| 161 | then |
| 162 | AC_MSG_ERROR([GNU Make required but not found]) |
| 163 | fi |
| 164 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 165 | dnl Checks for other tools |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 166 | AC_PROG_FLEX |
| 167 | AC_PROG_BISON |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 168 | AC_PROG_LIBTOOL |
| 169 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 170 | dnl Checks for tools we can get away with not having: |
| 171 | AC_PATH_PROG(DOT,[dot],[true dot]) |
| 172 | AC_PATH_PROG(ETAGS,[etags],[true etags]) |
Brian Gaeke | 027b746 | 2004-01-22 21:55:15 +0000 | [diff] [blame] | 173 | dnl Check if we know how to tell etags we are using C++: |
| 174 | etags_version=`$ETAGS --version 2>&1` |
| 175 | case "$etags_version" in |
| 176 | *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;; |
| 177 | *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;; |
| 178 | *) ETAGSFLAGS="" ;; |
| 179 | esac |
| 180 | AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS) |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 181 | AC_PATH_PROG(PYTHON,[python],[true python]) |
| 182 | if test "$PYTHON" = "false" |
John Criswell | 39827c8 | 2003-09-23 15:28:52 +0000 | [diff] [blame] | 183 | then |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 184 | AC_MSG_WARN([Python is required for the test suite, but it was not found]) |
John Criswell | 39827c8 | 2003-09-23 15:28:52 +0000 | [diff] [blame] | 185 | fi |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 186 | AC_PATH_PROG(QMTEST,[qmtest],[true qmtest]) |
| 187 | if test "$QMTEST" = "false" |
John Criswell | 39827c8 | 2003-09-23 15:28:52 +0000 | [diff] [blame] | 188 | then |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 189 | AC_MSG_WARN([QMTest is required for the test suite, but it was not found]) |
John Criswell | 39827c8 | 2003-09-23 15:28:52 +0000 | [diff] [blame] | 190 | fi |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 191 | |
| 192 | dnl Verify that the version of python available is high enough for qmtest |
| 193 | pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2` |
| 194 | pymajor=`echo $pyversion | cut -d. -f1` |
| 195 | pyminor=`echo $pyversion | cut -d. -f2` |
| 196 | |
| 197 | if test "$pymajor" -ge "2" |
| 198 | then |
| 199 | if test "$pymajor" -eq "2" |
| 200 | then |
| 201 | if test "$pyminor" -lt "2" |
| 202 | then |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 203 | AC_MSG_WARN([QMTest requires Python 2.2 or later]) |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 204 | fi |
| 205 | fi |
| 206 | else |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 207 | AC_MSG_WARN([QMTest requires Python 2.2 or later]) |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 208 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 209 | |
| 210 | dnl Verify that the source directory is valid |
| 211 | AC_CONFIG_SRCDIR(["Makefile.config.in"]) |
| 212 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 213 | dnl Checks for libraries: |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 214 | dnl libelf is for sparc only; we can ignore it if we don't have it |
| 215 | AC_CHECK_LIB(elf, elf_begin) |
| 216 | |
Brian Gaeke | 4c42378 | 2003-10-07 05:03:36 +0000 | [diff] [blame] | 217 | dnl dlopen() is required for plugin support. |
Brian Gaeke | a25d7ca | 2003-10-08 21:44:07 +0000 | [diff] [blame] | 218 | 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])) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 219 | |
| 220 | dnl mallinfo is optional; the code can compile (minus features) without it |
Brian Gaeke | a25d7ca | 2003-10-08 21:44:07 +0000 | [diff] [blame] | 221 | AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.])) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 222 | |
Brian Gaeke | 5f268f7 | 2003-12-05 19:29:01 +0000 | [diff] [blame] | 223 | dnl pthread locking functions are optional - but llvm will not be thread-safe |
| 224 | dnl without locks. |
Brian Gaeke | 2e3bdba | 2004-02-23 21:30:36 +0000 | [diff] [blame] | 225 | AC_SEARCH_LIBS(pthread_mutex_lock,pthread,HAVE_PTHREAD_MUTEX_LOCK=1,HAVE_PTHREAD_MUTEX_LOCK=0) |
| 226 | AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK) |
Brian Gaeke | 5f268f7 | 2003-12-05 19:29:01 +0000 | [diff] [blame] | 227 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 228 | dnl Checks for header files. |
| 229 | dnl We don't check for ancient stuff or things that are guaranteed to be there |
| 230 | dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 231 | AC_HEADER_STDC |
| 232 | AC_HEADER_SYS_WAIT |
| 233 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 234 | dnl Checks for POSIX and other various system-specific header files |
Brian Gaeke | 22f7646 | 2004-02-20 06:41:59 +0000 | [diff] [blame] | 235 | 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) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 236 | |
Brian Gaeke | 1133eaf | 2004-02-23 22:07:01 +0000 | [diff] [blame^] | 237 | dnl Check for things that need to be included in public headers, and so |
| 238 | dnl for which we may not have access to a HAVE_* preprocessor #define. |
| 239 | dnl (primarily used in DataTypes.h) |
| 240 | AC_CHECK_HEADER([sys/types.h], |
| 241 | [INCLUDE_SYS_TYPES_H='#include <sys/types.h>'], |
| 242 | [INCLUDE_SYS_TYPES_H='']) |
| 243 | AC_SUBST(INCLUDE_SYS_TYPES_H) |
| 244 | AC_CHECK_HEADER([inttypes.h], |
| 245 | [INCLUDE_INTTYPES_H='#include <inttypes.h>'], |
| 246 | [INCLUDE_INTTYPES_H='']) |
| 247 | AC_SUBST(INCLUDE_INTTYPES_H) |
| 248 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 249 | dnl Check for types |
| 250 | AC_TYPE_PID_T |
| 251 | AC_TYPE_SIZE_T |
| 252 | AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found])) |
| 253 | AC_CHECK_TYPES([uint64_t],,AC_MSG_ERROR([Type uint64_t required but not found])) |
| 254 | AC_HEADER_TIME |
| 255 | AC_STRUCT_TM |
| 256 | |
John Criswell | a0137d3 | 2003-10-13 16:22:01 +0000 | [diff] [blame] | 257 | dnl Check for various C features |
| 258 | AC_C_PRINTF_A |
| 259 | |
John Criswell | 0021c31 | 2004-02-13 21:57:29 +0000 | [diff] [blame] | 260 | dnl Check for the endianness of the target |
| 261 | AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little])) |
| 262 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 263 | dnl Check for C++ extensions |
Brian Gaeke | 278a4ac | 2003-11-10 03:06:09 +0000 | [diff] [blame] | 264 | AC_CXX_HAVE_HASH_MAP |
| 265 | AC_CXX_HAVE_HASH_SET |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 266 | AC_CXX_HAVE_STD_ITERATOR |
| 267 | AC_CXX_HAVE_BI_ITERATOR |
| 268 | AC_CXX_HAVE_FWD_ITERATOR |
| 269 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 270 | dnl Checks for library functions. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 271 | AC_FUNC_ALLOCA |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 272 | AC_FUNC_MMAP |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 273 | if test "$ac_cv_func_mmap_fixed_mapped" = "no" |
| 274 | then |
| 275 | AC_MSG_ERROR([mmap() required but not found]) |
| 276 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 277 | AC_FUNC_MMAP_FILE |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 278 | if test "$ac_cv_func_mmap_file" = "no" |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 279 | then |
| 280 | AC_MSG_ERROR([mmap() of files required but not found]) |
| 281 | fi |
| 282 | AC_HEADER_MMAP_ANONYMOUS |
| 283 | AC_TYPE_SIGNAL |
Brian Gaeke | 22f7646 | 2004-02-20 06:41:59 +0000 | [diff] [blame] | 284 | AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 285 | AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found])) |
| 286 | |
John Criswell | cb7a1eb | 2003-11-17 19:46:02 +0000 | [diff] [blame] | 287 | dnl Determine if the linker supports the -R option. |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 288 | AC_LINK_USE_R |
John Criswell | cb7a1eb | 2003-11-17 19:46:02 +0000 | [diff] [blame] | 289 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 290 | dnl --enable/--with command-line options: |
| 291 | dnl Check whether they want to do an optimized build: |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 292 | AC_ARG_ENABLE(optimized,AC_HELP_STRING([--enable-optimized],[Compile with optimizations enabled (default is NO)]),,enableval=no) |
| 293 | if test ${enableval} = "no" |
| 294 | then |
| 295 | AC_SUBST(ENABLE_OPTIMIZED,[[]]) |
| 296 | else |
| 297 | AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]]) |
| 298 | fi |
| 299 | |
John Criswell | b607cc8 | 2004-02-10 22:29:06 +0000 | [diff] [blame] | 300 | dnl Spec 2000 Benchmarks |
Alkis Evlogimenos | 3e58e48 | 2003-12-20 21:35:15 +0000 | [diff] [blame] | 301 | AC_ARG_ENABLE(spec2000,AC_HELP_STRING([--enable-spec2000],[Compile SPEC 2000 benchmarks (default is NO)]),,enableval=no) |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 302 | if test ${enableval} = "no" |
| 303 | then |
John Criswell | 5512659 | 2003-10-07 21:57:39 +0000 | [diff] [blame] | 304 | if test -d /home/vadve/shared/benchmarks/speccpu2000/benchspec |
| 305 | then |
| 306 | AC_SUBST(SPEC_ROOT,[/home/vadve/shared/benchmarks/speccpu2000/benchspec]) |
| 307 | AC_SUBST(USE_SPEC,[[USE_SPEC=1]]) |
| 308 | else |
| 309 | AC_SUBST(USE_SPEC,[[]]) |
| 310 | AC_SUBST(SPEC_ROOT,[]) |
| 311 | fi |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 312 | else |
John Criswell | 5512659 | 2003-10-07 21:57:39 +0000 | [diff] [blame] | 313 | if test ${enableval} = "" |
| 314 | then |
| 315 | AC_SUBST(SPEC_ROOT,[/home/vadve/shared/benchmarks/speccpu2000/benchspec]) |
| 316 | else |
| 317 | AC_SUBST(SPEC_ROOT,[${enableval}]) |
| 318 | fi |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 319 | AC_SUBST(USE_SPEC,[[USE_SPEC=1]]) |
| 320 | fi |
| 321 | |
John Criswell | b607cc8 | 2004-02-10 22:29:06 +0000 | [diff] [blame] | 322 | dnl Spec 95 Benchmarks |
| 323 | AC_ARG_ENABLE(spec95,AC_HELP_STRING([--enable-spec95],[Compile SPEC 95 benchmarks (default is NO)]),,enableval=no) |
| 324 | if test ${enableval} = "no" |
| 325 | then |
John Criswell | 542af5f | 2004-02-16 14:55:18 +0000 | [diff] [blame] | 326 | if test -d /home/vadve/shared/benchmarks/spec95/benchspec |
John Criswell | b607cc8 | 2004-02-10 22:29:06 +0000 | [diff] [blame] | 327 | then |
John Criswell | 542af5f | 2004-02-16 14:55:18 +0000 | [diff] [blame] | 328 | AC_SUBST(SPEC95_ROOT,[/home/vadve/shared/benchmarks/spec95/benchspec]) |
John Criswell | b607cc8 | 2004-02-10 22:29:06 +0000 | [diff] [blame] | 329 | AC_SUBST(USE_SPEC95,[[USE_SPEC95=1]]) |
| 330 | else |
| 331 | AC_SUBST(USE_SPEC95,[[]]) |
| 332 | AC_SUBST(SPEC95_ROOT,[]) |
| 333 | fi |
| 334 | else |
| 335 | if test ${enableval} = "" |
| 336 | then |
John Criswell | 542af5f | 2004-02-16 14:55:18 +0000 | [diff] [blame] | 337 | AC_SUBST(SPEC95_ROOT,[/home/vadve/shared/benchmarks/spec95/benchspec]) |
John Criswell | b607cc8 | 2004-02-10 22:29:06 +0000 | [diff] [blame] | 338 | else |
| 339 | AC_SUBST(SPEC95_ROOT,[${enableval}]) |
| 340 | fi |
| 341 | AC_SUBST(USE_SPEC95,[[USE_SPEC95=1]]) |
| 342 | fi |
| 343 | |
John Criswell | 0538d42 | 2004-02-20 22:30:22 +0000 | [diff] [blame] | 344 | dnl Povray External Benchmark |
| 345 | AC_ARG_ENABLE(povray,AC_HELP_STRING([--enable-povray],[Compile Povray benchmark (default is NO)]),,enableval=no) |
| 346 | if test ${enableval} = "no" |
| 347 | then |
| 348 | if test -d /home/vadve/criswell/Downloads/povray-3.50c |
| 349 | then |
| 350 | AC_SUBST(POVRAY_ROOT,[/home/vadve/criswell/Downloads/povray-3.50c]) |
| 351 | AC_SUBST(USE_POVRAY,[[USE_POVRAY=1]]) |
| 352 | else |
| 353 | AC_SUBST(USE_POVRAY,[[]]) |
| 354 | AC_SUBST(POVRAY_ROOT,[]) |
| 355 | fi |
| 356 | else |
| 357 | if test ${enableval} = "" |
| 358 | then |
| 359 | AC_SUBST(POVRAY_ROOT,[/home/vadve/criswell/Downloads/povray-3.50c]) |
| 360 | else |
| 361 | AC_SUBST(POVRAY_ROOT,[${enableval}]) |
| 362 | fi |
| 363 | AC_SUBST(USE_POVRAY,[[USE_POVRAY=1]]) |
| 364 | fi |
| 365 | |
| 366 | |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 367 | dnl Precompiled Bytecode Option |
| 368 | AC_ARG_ENABLE(precompiled_bytecode,AC_HELP_STRING([--enable-precompiled_bytecode],[Use pre-compiled bytecode (default is NO)]),,enableval=no) |
| 369 | if test ${enableval} = "no" |
| 370 | then |
| 371 | AC_SUBST(UPB,[[]]) |
| 372 | else |
| 373 | AC_SUBST(UPB,[[USE_PRECOMPILED_BYTECODE=1]]) |
| 374 | fi |
| 375 | |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 376 | dnl LLC Diff Option |
| 377 | AC_ARG_ENABLE(llc_diffs,AC_HELP_STRING([--enable-llc_diffs],[Enable LLC Diffs when testing (default is YES)]),,enableval=yes) |
| 378 | if test ${enableval} = "no" |
| 379 | then |
| 380 | AC_SUBST(DISABLE_LLC_DIFFS,[DISABLE_LLC_DIFFS:=1]) |
| 381 | else |
| 382 | AC_SUBST(DISABLE_LLC_DIFFS,[[]]) |
| 383 | fi |
| 384 | |
| 385 | dnl JIT Option |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 386 | AC_ARG_ENABLE(jit,AC_HELP_STRING([--enable-jit],[Enable Just In Time Compiling (default is YES)]),,enableval=default) |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 387 | if test ${enableval} = "no" |
| 388 | then |
| 389 | AC_SUBST(JIT,[[]]) |
| 390 | else |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 391 | case $target in |
| 392 | *i*86*) |
| 393 | AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) |
| 394 | ;; |
| 395 | *sparc*) |
| 396 | AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) |
| 397 | ;; |
| 398 | *) |
| 399 | AC_SUBST(JIT,[[]]) |
| 400 | ;; |
| 401 | esac |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 402 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 403 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 404 | dnl Find the LLVM GCC-based C/C++ front end |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 405 | AC_ARG_WITH(llvmgccdir,AC_HELP_STRING([--with-llvmgccdir],[Location of LLVM GCC front-end]),AC_SUBST(LLVMGCCDIR,[$withval])) |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 406 | AC_MSG_CHECKING([for llvm-gcc]) |
| 407 | LLVM_GCC_CHECK=no |
| 408 | if test -d "$LLVMGCCDIR" |
| 409 | then |
| 410 | if test -x "$LLVMGCCDIR/bin/gcc" |
| 411 | then |
| 412 | LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc" |
| 413 | fi |
| 414 | fi |
| 415 | llvmgccwarn=no |
| 416 | AC_MSG_RESULT($LLVM_GCC_CHECK) |
| 417 | if test "$LLVM_GCC_CHECK" = "no" |
| 418 | then |
| 419 | llvmgccwarn=yes |
| 420 | fi |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 421 | AC_MSG_CHECKING([whether llvm-gcc is sane]) |
| 422 | LLVM_GCC_SANE=no |
| 423 | if test -x "$LLVM_GCC_CHECK" |
| 424 | then |
| 425 | cp /dev/null conftest.c |
| 426 | "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1 |
| 427 | if test $? -eq 0 |
| 428 | then |
| 429 | LLVM_GCC_SANE=yes |
| 430 | fi |
| 431 | rm conftest.c |
Brian Gaeke | d05e39d | 2004-01-16 21:31:22 +0000 | [diff] [blame] | 432 | llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1` |
| 433 | AC_SUBST(LLVMCC1,$llvmcc1path) |
| 434 | llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus` |
| 435 | AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath) |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 436 | fi |
| 437 | AC_MSG_RESULT($LLVM_GCC_SANE) |
| 438 | if test "$LLVM_GCC_SANE" = "no" |
| 439 | then |
| 440 | llvmgccwarn=yes |
| 441 | fi |
| 442 | |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 443 | dnl Location of the bytecode repository |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 444 | AC_ARG_WITH(bcrepos,AC_HELP_STRING([--with-bcrepos],[Location of Bytecode Repository]),AC_SUBST(BCR,[$withval]),AC_SUBST(BCR,[/home/vadve/lattner/LLVMPrograms])) |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 445 | |
| 446 | dnl Location of PAPI |
Chris Lattner | 1b9ddd5 | 2003-08-14 18:59:53 +0000 | [diff] [blame] | 447 | 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])) |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 448 | |
Brian Gaeke | cea9a60 | 2004-01-21 19:38:56 +0000 | [diff] [blame] | 449 | dnl Get libtool's idea of what the shared library suffix is. |
| 450 | dnl (This is a hack; it relies on undocumented behavior.) |
| 451 | AC_MSG_CHECKING([for shared library suffix]) |
| 452 | eval "SHLIBEXT=$shrext" |
| 453 | AC_MSG_RESULT($SHLIBEXT) |
| 454 | dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint). |
| 455 | AC_SUBST(SHLIBEXT,$SHLIBEXT) |
| 456 | AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT", |
| 457 | [Extension that shared libraries have, e.g., ".so".]) |
| 458 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 459 | dnl Create the output files |
Brian Gaeke | c1cf424 | 2004-02-23 18:56:05 +0000 | [diff] [blame] | 460 | AC_OUTPUT(Makefile.config |
Brian Gaeke | 1133eaf | 2004-02-23 22:07:01 +0000 | [diff] [blame^] | 461 | include/Support/DataTypes.h |
| 462 | include/Support/ThreadSupport.h |
Brian Gaeke | c1cf424 | 2004-02-23 18:56:05 +0000 | [diff] [blame] | 463 | include/Support/hash_map |
Brian Gaeke | 2e3bdba | 2004-02-23 21:30:36 +0000 | [diff] [blame] | 464 | include/Support/hash_set |
Brian Gaeke | 1133eaf | 2004-02-23 22:07:01 +0000 | [diff] [blame^] | 465 | include/Support/iterator) |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 466 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 467 | dnl Warn loudly if llvm-gcc was not obviously working |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 468 | if test $llvmgccwarn = yes |
| 469 | then |
| 470 | AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not]) |
| 471 | AC_MSG_WARN([***** appear to be working.]) |
| 472 | AC_MSG_WARN([***** ]) |
| 473 | AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.]) |
| 474 | AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,]) |
| 475 | AC_MSG_WARN([***** but you should be able to build the llvm tools.]) |
| 476 | fi |
Brian Gaeke | cea9a60 | 2004-01-21 19:38:56 +0000 | [diff] [blame] | 477 | |