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