John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 1 | dnl Autoconf requirements |
| 2 | dnl AC_INIT(package, version, bug-report-address) |
| 3 | dnl information on the package |
| 4 | dnl checks for programs |
| 5 | dnl checks for libraries |
| 6 | dnl checks for header files |
| 7 | dnl checks for types |
| 8 | dnl checks for structures |
| 9 | dnl checks for compiler characteristics |
| 10 | dnl checks for library functions |
| 11 | dnl checks for system services |
| 12 | dnl AC_CONFIG_FILES([file...]) |
| 13 | dnl AC_OUTPUT |
| 14 | |
| 15 | dnl ************************************************************************** |
| 16 | dnl * Initialize |
| 17 | dnl ************************************************************************** |
| 18 | AC_INIT([[[LLVM]]],[[[1.0]]],[llvmbugs@cs.uiuc.edu]) |
| 19 | |
| 20 | dnl Place all of the extra autoconf files into the config subdirectory |
| 21 | AC_CONFIG_AUX_DIR([autoconf]) |
| 22 | |
John Criswell | 93e1c72 | 2003-09-15 17:04:06 +0000 | [diff] [blame] | 23 | dnl Quit if the source directory has already been configured. |
John Criswell | 1b82432 | 2003-09-15 17:19:42 +0000 | [diff] [blame] | 24 | dnl NOTE: This relies upon undocumented autoconf behavior. |
| 25 | if test ${srcdir} != "." |
John Criswell | 93e1c72 | 2003-09-15 17:04:06 +0000 | [diff] [blame] | 26 | then |
John Criswell | 1b82432 | 2003-09-15 17:19:42 +0000 | [diff] [blame] | 27 | if test -f ${srcdir}/include/Config/config.h |
| 28 | then |
| 29 | AC_MSG_ERROR([Already configured in ${srcdir}]) |
| 30 | fi |
John Criswell | 93e1c72 | 2003-09-15 17:04:06 +0000 | [diff] [blame] | 31 | fi |
| 32 | |
John Criswell | 33a911a | 2003-11-25 20:36:46 +0000 | [diff] [blame] | 33 | dnl |
| 34 | dnl Configure all of the projects present in our source tree. |
| 35 | dnl |
| 36 | for i in `ls ${srcdir}/projects` |
| 37 | do |
| 38 | if test ${i} != "CVS" |
| 39 | then |
John Criswell | 9493c97 | 2003-12-12 20:09:33 +0000 | [diff] [blame^] | 40 | if test -f ${srcdir}/projects/${i}/configure |
John Criswell | 33a911a | 2003-11-25 20:36:46 +0000 | [diff] [blame] | 41 | then |
| 42 | AC_CONFIG_SUBDIRS(projects/${i}) |
| 43 | fi |
| 44 | fi |
| 45 | done |
John Criswell | 559a6c1 | 2003-09-30 16:31:48 +0000 | [diff] [blame] | 46 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 47 | dnl Configure a header file |
| 48 | AC_CONFIG_HEADERS(include/Config/config.h) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 49 | AC_CONFIG_MAKEFILE(Makefile) |
| 50 | AC_CONFIG_MAKEFILE(Makefile.common) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 51 | AC_CONFIG_MAKEFILE(lib/Makefile) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 52 | AC_CONFIG_MAKEFILE(runtime/Makefile) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 53 | AC_CONFIG_MAKEFILE(test/Makefile) |
| 54 | AC_CONFIG_MAKEFILE(test/Makefile.tests) |
John Criswell | f424d74 | 2003-10-07 21:13:47 +0000 | [diff] [blame] | 55 | AC_CONFIG_MAKEFILE(test/QMTest/llvm.py) |
| 56 | AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 57 | AC_CONFIG_MAKEFILE(test/Programs/Makefile) |
| 58 | AC_CONFIG_MAKEFILE(test/Programs/Makefile.programs) |
| 59 | AC_CONFIG_MAKEFILE(test/Programs/TEST.aa.Makefile) |
| 60 | AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.report) |
| 61 | AC_CONFIG_MAKEFILE(test/Programs/TEST.micro.report) |
| 62 | AC_CONFIG_MAKEFILE(test/Programs/TEST.aa.report) |
| 63 | AC_CONFIG_MAKEFILE(test/Programs/TEST.example.Makefile) |
| 64 | AC_CONFIG_MAKEFILE(test/Programs/TEST.nightly.Makefile) |
| 65 | AC_CONFIG_MAKEFILE(test/Programs/TEST.buildrepo.Makefile) |
| 66 | AC_CONFIG_MAKEFILE(test/Programs/TEST.jit.Makefile) |
| 67 | AC_CONFIG_MAKEFILE(test/Programs/TEST.nightly.report) |
| 68 | AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.Makefile) |
| 69 | AC_CONFIG_MAKEFILE(test/Programs/TEST.jit.report) |
| 70 | AC_CONFIG_MAKEFILE(test/Programs/TEST.typesafe.Makefile) |
| 71 | AC_CONFIG_MAKEFILE(test/Programs/TEST.dsgraph.gnuplot) |
| 72 | AC_CONFIG_MAKEFILE(test/Programs/TEST.micro.Makefile) |
| 73 | AC_CONFIG_MAKEFILE(test/Programs/External/Makefile) |
| 74 | AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile) |
John Criswell | 27bb35e | 2003-09-11 18:04:00 +0000 | [diff] [blame] | 75 | AC_CONFIG_MAKEFILE(test/Programs/External/SPEC/Makefile.spec) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 76 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Makefile) |
| 77 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Makefile.multisrc) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 78 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/analyzer/test.in) |
Misha Brukman | 3e910fe | 2003-11-12 19:39:10 +0000 | [diff] [blame] | 79 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/distray/Makefile) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 80 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/distray/test.in) |
Misha Brukman | 3e910fe | 2003-11-12 19:39:10 +0000 | [diff] [blame] | 81 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/Makefile) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 82 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/fourinarow/test.in) |
Misha Brukman | 3e910fe | 2003-11-12 19:39:10 +0000 | [diff] [blame] | 83 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/mason/Makefile) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 84 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/mason/test.in) |
Misha Brukman | 3e910fe | 2003-11-12 19:39:10 +0000 | [diff] [blame] | 85 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/neural/Makefile) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 86 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/neural/test.in) |
Misha Brukman | 3e910fe | 2003-11-12 19:39:10 +0000 | [diff] [blame] | 87 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2/Makefile) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 88 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pcompress2/test.in) |
Misha Brukman | 3e910fe | 2003-11-12 19:39:10 +0000 | [diff] [blame] | 89 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pifft/Makefile) |
Misha Brukman | 960624b | 2003-11-12 22:16:23 +0000 | [diff] [blame] | 90 | AC_CONFIG_MAKEFILE(test/Programs/MultiSource/Benchmarks/FreeBench/pifft/test.in) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 91 | AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile) |
| 92 | AC_CONFIG_MAKEFILE(test/Programs/SingleSource/Makefile.singlesrc) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 93 | AC_CONFIG_MAKEFILE(tools/Makefile) |
Chris Lattner | 5c866e1 | 2003-10-06 02:09:25 +0000 | [diff] [blame] | 94 | AC_CONFIG_MAKEFILE(utils/Makefile) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 95 | AC_CONFIG_MAKEFILE(projects/Makefile) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 96 | |
| 97 | dnl ************************************************************************** |
| 98 | dnl * Determine which system we are building on |
| 99 | dnl ************************************************************************** |
| 100 | |
| 101 | dnl Check the install program (needs to be done before canonical stuff) |
| 102 | AC_PROG_INSTALL |
| 103 | |
| 104 | dnl Check which host for which we're compiling. This will tell us which LLVM |
| 105 | dnl compiler will be used for compiling SSA into object code. |
| 106 | AC_CANONICAL_TARGET |
| 107 | |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 108 | 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] | 109 | dnl We will use the build machine information to set some variables. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 110 | case $build in |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 111 | *-*-linux*) |
| 112 | AC_SUBST(OS,[Linux]) |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 113 | if test -d /home/vadve/lattner/local/x86/llvm-gcc |
| 114 | then |
| 115 | AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/]) |
| 116 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 117 | ;; |
| 118 | |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 119 | *-*-solaris*) |
| 120 | AC_SUBST(OS,[SunOS]) |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 121 | if test -d /home/vadve/lattner/local/sparc/llvm-gcc |
| 122 | then |
| 123 | AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/]) |
| 124 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 125 | ;; |
| 126 | |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 127 | *-*-darwin*) |
| 128 | AC_SUBST(OS,[Darwin]) |
| 129 | ;; |
| 130 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 131 | *) AC_SUBST(OS,[Unknown]) |
| 132 | ;; |
| 133 | esac |
| 134 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 135 | dnl If we are targetting a Sparc machine running Solaris, pretend that it is |
| 136 | dnl V9, since that is all that we support at the moment, and autoconf will only |
| 137 | dnl tell us we're a sparc. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 138 | case $target in |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 139 | sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]]) |
| 140 | ;; |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 141 | esac |
| 142 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 143 | dnl Determine what our target architecture is and configure accordingly. |
| 144 | dnl This will allow Makefiles to make a distinction between the hardware and |
| 145 | dnl the OS. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 146 | case $target in |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 147 | i*86-*) AC_SUBST(ARCH,[x86]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 148 | ;; |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 149 | sparc*-*) AC_SUBST(ARCH,[Sparc]) |
| 150 | ;; |
| 151 | powerpc*-*) AC_SUBST(ARCH,[PowerPC]) |
| 152 | ;; |
| 153 | *) AC_SUBST(ARCH,[Unknown]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 154 | ;; |
| 155 | esac |
| 156 | |
| 157 | dnl ************************************************************************** |
| 158 | dnl * Check for programs. |
| 159 | dnl ************************************************************************** |
| 160 | |
| 161 | dnl Check for compilation tools |
| 162 | AC_PROG_CXX |
| 163 | AC_PROG_CC(gcc) |
| 164 | AC_PROG_CPP |
| 165 | |
| 166 | dnl Ensure that compilation tools are GCC; we use GCC specific extensions |
| 167 | if test "$GCC" != "yes" |
| 168 | then |
| 169 | AC_MSG_ERROR([gcc required but not found]) |
| 170 | fi |
| 171 | |
| 172 | if test "$GXX" != "yes" |
| 173 | then |
| 174 | AC_MSG_ERROR([g++ required but not found]) |
| 175 | fi |
| 176 | |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 177 | dnl Verify that GCC is version 3.0 or higher |
| 178 | gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1` |
| 179 | if test "$gccmajor" -lt "3" |
| 180 | then |
| 181 | AC_MSG_ERROR([gcc 3.x required]) |
| 182 | fi |
| 183 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 184 | dnl Check for GNU Make. We use its extensions to, so don't build without it |
| 185 | CHECK_GNU_MAKE |
| 186 | if test -z "$_cv_gnu_make_command" |
| 187 | then |
| 188 | AC_MSG_ERROR([GNU Make required but not found]) |
| 189 | fi |
| 190 | |
| 191 | dnl Check for compiler-compiler tools (reminds me of Little Caesar's Pizza) |
| 192 | AC_PROG_FLEX |
| 193 | AC_PROG_BISON |
| 194 | |
| 195 | dnl Check for libtool |
| 196 | AC_PROG_LIBTOOL |
| 197 | |
| 198 | dnl Check for our special programs |
John Criswell | 39827c8 | 2003-09-23 15:28:52 +0000 | [diff] [blame] | 199 | AC_PATH_PROG(RPWD,[pwd],[false]) |
| 200 | if test ${RPWD} = "false" |
| 201 | then |
| 202 | AC_MSG_ERROR([pwd required but not found]) |
| 203 | fi |
| 204 | |
| 205 | AC_PATH_PROG(AR,[ar],[false]) |
| 206 | if test ${AR} = "false" |
| 207 | then |
| 208 | AC_MSG_ERROR([ar required but not found]) |
| 209 | fi |
| 210 | |
| 211 | AC_PATH_PROG(SED,[sed],[false]) |
| 212 | if test ${SED} = "false" |
| 213 | then |
| 214 | AC_MSG_ERROR([sed required but not found]) |
| 215 | fi |
| 216 | |
| 217 | AC_PATH_PROG(RM,[rm],[false]) |
| 218 | if test ${RM} = "false" |
| 219 | then |
| 220 | AC_MSG_ERROR([rm required but not found]) |
| 221 | fi |
| 222 | |
| 223 | AC_PATH_PROG(ECHO,[echo],[false]) |
| 224 | if test ${ECHO} = "false" |
| 225 | then |
| 226 | AC_MSG_ERROR([echo required but not found]) |
| 227 | fi |
| 228 | |
| 229 | AC_PATH_PROG(MKDIR,[mkdir],[false]) |
| 230 | if test ${MKDIR} = "false" |
| 231 | then |
| 232 | AC_MSG_ERROR([mkdir required but not found]) |
| 233 | fi |
| 234 | |
| 235 | AC_PATH_PROG(DATE,[date],[false]) |
| 236 | if test ${DATE} = "false" |
| 237 | then |
| 238 | AC_MSG_ERROR([date required but not found]) |
| 239 | fi |
| 240 | |
| 241 | AC_PATH_PROG(MV,[mv],[false]) |
| 242 | if test ${MV} = "false" |
| 243 | then |
| 244 | AC_MSG_ERROR([mv required but not found]) |
| 245 | fi |
| 246 | |
| 247 | AC_PATH_PROG(DOT,[dot],[false]) |
| 248 | |
| 249 | AC_PATH_PROG(ETAGS,[etags],[false]) |
| 250 | |
John Criswell | 39827c8 | 2003-09-23 15:28:52 +0000 | [diff] [blame] | 251 | AC_PATH_PROG(PYTHON,[python],[false]) |
| 252 | if test ${PYTHON} = "false" |
| 253 | then |
John Criswell | 6109598 | 2003-09-23 20:46:32 +0000 | [diff] [blame] | 254 | AC_MSG_WARN([python required but not found]) |
John Criswell | 39827c8 | 2003-09-23 15:28:52 +0000 | [diff] [blame] | 255 | fi |
| 256 | |
| 257 | AC_PATH_PROG(QMTEST,[qmtest],[false]) |
| 258 | if test ${QMTEST} = "false" |
| 259 | then |
John Criswell | 6109598 | 2003-09-23 20:46:32 +0000 | [diff] [blame] | 260 | AC_MSG_WARN([qmtest required but not found]) |
John Criswell | 39827c8 | 2003-09-23 15:28:52 +0000 | [diff] [blame] | 261 | fi |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 262 | |
| 263 | dnl Verify that the version of python available is high enough for qmtest |
| 264 | pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2` |
| 265 | pymajor=`echo $pyversion | cut -d. -f1` |
| 266 | pyminor=`echo $pyversion | cut -d. -f2` |
| 267 | |
| 268 | if test "$pymajor" -ge "2" |
| 269 | then |
| 270 | if test "$pymajor" -eq "2" |
| 271 | then |
| 272 | if test "$pyminor" -lt "2" |
| 273 | then |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 274 | AC_MSG_WARN([Python 2.2 or greater required for qmtest]) |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 275 | fi |
| 276 | fi |
| 277 | else |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 278 | AC_MSG_WARN([Python 2.2 or greater required for qmtest]) |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 279 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 280 | |
| 281 | dnl Verify that the source directory is valid |
| 282 | AC_CONFIG_SRCDIR(["Makefile.config.in"]) |
| 283 | |
| 284 | dnl ************************************************************************** |
| 285 | dnl * Check for libraries. |
| 286 | dnl ************************************************************************** |
| 287 | |
| 288 | dnl libelf is for sparc only; we can ignore it if we don't have it |
| 289 | AC_CHECK_LIB(elf, elf_begin) |
| 290 | |
Brian Gaeke | 4c42378 | 2003-10-07 05:03:36 +0000 | [diff] [blame] | 291 | dnl dlopen() is required for plugin support. |
Brian Gaeke | a25d7ca | 2003-10-08 21:44:07 +0000 | [diff] [blame] | 292 | 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] | 293 | |
| 294 | dnl mallinfo is optional; the code can compile (minus features) without it |
Brian Gaeke | a25d7ca | 2003-10-08 21:44:07 +0000 | [diff] [blame] | 295 | 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] | 296 | |
Brian Gaeke | 5f268f7 | 2003-12-05 19:29:01 +0000 | [diff] [blame] | 297 | dnl pthread locking functions are optional - but llvm will not be thread-safe |
| 298 | dnl without locks. |
| 299 | AC_SEARCH_LIBS(pthread_mutex_lock,pthread,AC_DEFINE(HAVE_PTHREAD_MUTEX_LOCK,1,[Define if PThread mutexes (e.g., pthread_mutex_lock) are available in the system's thread library.])) |
| 300 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 301 | dnl |
| 302 | dnl The math libraries are used by the test code, but not by the actual LLVM |
| 303 | dnl code. |
| 304 | dnl |
| 305 | dnl AC_CHECK_LIB(m, cos) |
| 306 | |
| 307 | dnl ************************************************************************** |
| 308 | dnl * Checks for header files. |
| 309 | dnl * Chances are, if the standard C or POSIX type header files are missing, |
| 310 | dnl * then LLVM just isn't going to compile. However, it is possible that |
| 311 | dnl * the necessary functions/macros will be included from other |
| 312 | dnl * (non-standard and non-obvious) header files. |
| 313 | dnl * |
| 314 | dnl * So, we'll be gracious, give it a chance, and try to go on without |
| 315 | dnl * them. |
| 316 | dnl ************************************************************************** |
| 317 | AC_HEADER_STDC |
| 318 | AC_HEADER_SYS_WAIT |
| 319 | |
| 320 | dnl Check for ANSI C/POSIX header files |
| 321 | AC_CHECK_HEADERS(assert.h fcntl.h limits.h sys/time.h unistd.h errno.h signal.h math.h) |
| 322 | |
| 323 | dnl Check for system specific header files |
Brian Gaeke | a493aa3 | 2003-10-22 17:52:56 +0000 | [diff] [blame] | 324 | AC_CHECK_HEADERS(malloc.h sys/mman.h sys/resource.h) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 325 | |
| 326 | dnl Check for header files associated with dlopen and friends |
| 327 | AC_CHECK_HEADERS(dlfcn.h link.h) |
| 328 | |
| 329 | dnl ************************************************************************** |
| 330 | dnl * Checks for typedefs, structures, and compiler characteristics. |
| 331 | dnl ************************************************************************** |
| 332 | |
| 333 | dnl Check for const and inline keywords |
| 334 | AC_C_CONST |
| 335 | AC_C_INLINE |
| 336 | |
| 337 | dnl Check for machine endian-ness |
Brian Gaeke | a25d7ca | 2003-10-08 21:44:07 +0000 | [diff] [blame] | 338 | AC_C_BIGENDIAN(AC_DEFINE([ENDIAN_BIG],[],[Define if the machine is Big-Endian]),AC_DEFINE([ENDIAN_LITTLE],[],[Define if the machine is Little-Endian])) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 339 | |
| 340 | dnl Check for types |
| 341 | AC_TYPE_PID_T |
| 342 | AC_TYPE_SIZE_T |
| 343 | AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found])) |
| 344 | AC_CHECK_TYPES([uint64_t],,AC_MSG_ERROR([Type uint64_t required but not found])) |
| 345 | AC_HEADER_TIME |
| 346 | AC_STRUCT_TM |
| 347 | |
John Criswell | a0137d3 | 2003-10-13 16:22:01 +0000 | [diff] [blame] | 348 | dnl Check for various C features |
| 349 | AC_C_PRINTF_A |
| 350 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 351 | dnl Check for C++ extensions |
Brian Gaeke | 278a4ac | 2003-11-10 03:06:09 +0000 | [diff] [blame] | 352 | AC_CXX_HAVE_HASH_MAP |
| 353 | AC_CXX_HAVE_HASH_SET |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 354 | AC_CXX_HAVE_EXT_SLIST |
| 355 | AC_CXX_HAVE_STD_ITERATOR |
| 356 | AC_CXX_HAVE_BI_ITERATOR |
| 357 | AC_CXX_HAVE_FWD_ITERATOR |
| 358 | |
| 359 | dnl ************************************************************************** |
| 360 | dnl * Checks for library functions. |
| 361 | dnl ************************************************************************** |
| 362 | AC_FUNC_ALLOCA |
| 363 | AC_PROG_GCC_TRADITIONAL |
| 364 | AC_FUNC_MEMCMP |
| 365 | AC_FUNC_MMAP |
| 366 | AC_FUNC_MMAP_FILE |
| 367 | if test ${ac_cv_func_mmap_file} = "no" |
| 368 | then |
| 369 | AC_MSG_ERROR([mmap() of files required but not found]) |
| 370 | fi |
| 371 | AC_HEADER_MMAP_ANONYMOUS |
| 372 | AC_TYPE_SIGNAL |
Brian Gaeke | 16edea0 | 2003-10-10 17:04:43 +0000 | [diff] [blame] | 373 | AC_CHECK_FUNCS(getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol strtoq strtoll) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 374 | |
| 375 | dnl |
| 376 | dnl Need to check mmap for MAP_PRIVATE, MAP_ANONYMOUS, MAP_ANON, MAP_FIXED |
| 377 | dnl MAP_FIXED is only needed for Sparc |
| 378 | dnl MAP_ANON is used for Sparc and BSD |
| 379 | dnl Everyone should have MAP_PRIVATE |
| 380 | dnl |
| 381 | |
| 382 | dnl Check for certain functions (even if we've already found them) so that we |
| 383 | dnl can quit with an error if they are unavailable. |
| 384 | dnl |
| 385 | dnl As the code is made more portable (i.e. less reliant on these functions, |
| 386 | dnl these checks should go away. |
| 387 | AC_CHECK_FUNC(mmap,,AC_MSG_ERROR([Function mmap() required but not found])) |
| 388 | AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found])) |
| 389 | |
John Criswell | cb7a1eb | 2003-11-17 19:46:02 +0000 | [diff] [blame] | 390 | dnl Determine if the linker supports the -R option. |
| 391 | AC_LINK_USE_R() |
| 392 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 393 | dnl ************************************************************************** |
| 394 | dnl * Enable various compile-time options |
| 395 | dnl ************************************************************************** |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 396 | |
| 397 | dnl Purify Option |
| 398 | AC_ARG_ENABLE(purify,AC_HELP_STRING([--enable-purify],[Compile with purify (default is NO)]),,enableval="no") |
| 399 | if test ${enableval} = "no" |
| 400 | then |
| 401 | AC_SUBST(ENABLE_PURIFY,[[]]) |
| 402 | else |
| 403 | AC_SUBST(ENABLE_PURIFY,[[ENABLE_PURIFY=1]]) |
| 404 | fi |
| 405 | |
| 406 | dnl Optimized Option |
| 407 | AC_ARG_ENABLE(optimized,AC_HELP_STRING([--enable-optimized],[Compile with optimizations enabled (default is NO)]),,enableval=no) |
| 408 | if test ${enableval} = "no" |
| 409 | then |
| 410 | AC_SUBST(ENABLE_OPTIMIZED,[[]]) |
| 411 | else |
| 412 | AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]]) |
| 413 | fi |
| 414 | |
| 415 | dnl Spec Benchmarks |
John Criswell | 5512659 | 2003-10-07 21:57:39 +0000 | [diff] [blame] | 416 | AC_ARG_ENABLE(spec2000,AC_HELP_STRING([--enable-spec],[Compile SPEC 2000 benchmarks (default is NO)]),,enableval=no) |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 417 | if test ${enableval} = "no" |
| 418 | then |
John Criswell | 5512659 | 2003-10-07 21:57:39 +0000 | [diff] [blame] | 419 | if test -d /home/vadve/shared/benchmarks/speccpu2000/benchspec |
| 420 | then |
| 421 | AC_SUBST(SPEC_ROOT,[/home/vadve/shared/benchmarks/speccpu2000/benchspec]) |
| 422 | AC_SUBST(USE_SPEC,[[USE_SPEC=1]]) |
| 423 | else |
| 424 | AC_SUBST(USE_SPEC,[[]]) |
| 425 | AC_SUBST(SPEC_ROOT,[]) |
| 426 | fi |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 427 | else |
John Criswell | 5512659 | 2003-10-07 21:57:39 +0000 | [diff] [blame] | 428 | if test ${enableval} = "" |
| 429 | then |
| 430 | AC_SUBST(SPEC_ROOT,[/home/vadve/shared/benchmarks/speccpu2000/benchspec]) |
| 431 | else |
| 432 | AC_SUBST(SPEC_ROOT,[${enableval}]) |
| 433 | fi |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 434 | AC_SUBST(USE_SPEC,[[USE_SPEC=1]]) |
| 435 | fi |
| 436 | |
| 437 | dnl Precompiled Bytecode Option |
| 438 | AC_ARG_ENABLE(precompiled_bytecode,AC_HELP_STRING([--enable-precompiled_bytecode],[Use pre-compiled bytecode (default is NO)]),,enableval=no) |
| 439 | if test ${enableval} = "no" |
| 440 | then |
| 441 | AC_SUBST(UPB,[[]]) |
| 442 | else |
| 443 | AC_SUBST(UPB,[[USE_PRECOMPILED_BYTECODE=1]]) |
| 444 | fi |
| 445 | |
| 446 | |
| 447 | dnl LLC Diff Option |
| 448 | AC_ARG_ENABLE(llc_diffs,AC_HELP_STRING([--enable-llc_diffs],[Enable LLC Diffs when testing (default is YES)]),,enableval=yes) |
| 449 | if test ${enableval} = "no" |
| 450 | then |
| 451 | AC_SUBST(DISABLE_LLC_DIFFS,[DISABLE_LLC_DIFFS:=1]) |
| 452 | else |
| 453 | AC_SUBST(DISABLE_LLC_DIFFS,[[]]) |
| 454 | fi |
| 455 | |
| 456 | dnl JIT Option |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 457 | 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] | 458 | |
| 459 | if test ${enableval} = "no" |
| 460 | then |
| 461 | AC_SUBST(JIT,[[]]) |
| 462 | else |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 463 | case $target in |
| 464 | *i*86*) |
| 465 | AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) |
| 466 | ;; |
| 467 | *sparc*) |
| 468 | AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) |
| 469 | ;; |
| 470 | *) |
| 471 | AC_SUBST(JIT,[[]]) |
| 472 | ;; |
| 473 | esac |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 474 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 475 | |
| 476 | dnl ************************************************************************** |
| 477 | dnl * Set the location of various third-party software packages |
| 478 | dnl ************************************************************************** |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 479 | |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 480 | dnl Location of the LLVM C front end |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 481 | AC_ARG_WITH(llvmgccdir,AC_HELP_STRING([--with-llvmgccdir],[Location of LLVM GCC front-end]),AC_SUBST(LLVMGCCDIR,[$withval])) |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 482 | |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 483 | AC_MSG_CHECKING([for llvm-gcc]) |
| 484 | LLVM_GCC_CHECK=no |
| 485 | if test -d "$LLVMGCCDIR" |
| 486 | then |
| 487 | if test -x "$LLVMGCCDIR/bin/gcc" |
| 488 | then |
| 489 | LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc" |
| 490 | fi |
| 491 | fi |
| 492 | llvmgccwarn=no |
| 493 | AC_MSG_RESULT($LLVM_GCC_CHECK) |
| 494 | if test "$LLVM_GCC_CHECK" = "no" |
| 495 | then |
| 496 | llvmgccwarn=yes |
| 497 | fi |
| 498 | |
| 499 | AC_MSG_CHECKING([whether llvm-gcc is sane]) |
| 500 | LLVM_GCC_SANE=no |
| 501 | if test -x "$LLVM_GCC_CHECK" |
| 502 | then |
| 503 | cp /dev/null conftest.c |
| 504 | "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1 |
| 505 | if test $? -eq 0 |
| 506 | then |
| 507 | LLVM_GCC_SANE=yes |
| 508 | fi |
| 509 | rm conftest.c |
| 510 | fi |
| 511 | AC_MSG_RESULT($LLVM_GCC_SANE) |
| 512 | if test "$LLVM_GCC_SANE" = "no" |
| 513 | then |
| 514 | llvmgccwarn=yes |
| 515 | fi |
| 516 | |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 517 | dnl Location of the bytecode repository |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 518 | 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] | 519 | |
| 520 | dnl Location of PAPI |
Chris Lattner | 1b9ddd5 | 2003-08-14 18:59:53 +0000 | [diff] [blame] | 521 | 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] | 522 | |
| 523 | dnl Location of the purify program |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 524 | AC_ARG_WITH(purify,AC_HELP_STRING([--with-purify],[Location of purify program]),AC_SUBST(PURIFY,[$withval])) |
| 525 | |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 526 | dnl ************************************************************************** |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 527 | dnl * Configure other software packages (via AC_CONFIG_SUBDIRS) |
| 528 | dnl ************************************************************************** |
| 529 | |
| 530 | dnl ************************************************************************** |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 531 | dnl * Create the output files |
| 532 | dnl ************************************************************************** |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 533 | AC_OUTPUT(Makefile.config) |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 534 | |
| 535 | if test $llvmgccwarn = yes |
| 536 | then |
| 537 | AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not]) |
| 538 | AC_MSG_WARN([***** appear to be working.]) |
| 539 | AC_MSG_WARN([***** ]) |
| 540 | AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.]) |
| 541 | AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,]) |
| 542 | AC_MSG_WARN([***** but you should be able to build the llvm tools.]) |
| 543 | fi |