Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 1 | dnl Initialize autoconf |
Reid Spencer | abec8f9 | 2004-10-27 23:03:44 +0000 | [diff] [blame] | 2 | AC_INIT([[llvm]],[[1.4]],[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 |
Reid Spencer | c1b0d49 | 2004-09-19 23:43:52 +0000 | [diff] [blame] | 5 | dnl Tell various tools where the m4 autoconf macros are |
| 6 | dnl Have configure verify that the source directory is valid. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 7 | AC_CONFIG_AUX_DIR([autoconf]) |
Reid Spencer | c1b0d49 | 2004-09-19 23:43:52 +0000 | [diff] [blame] | 8 | dnl AC_CONFIG_MACRO_DIR(autoconf/m4) |
| 9 | dnl Verify that the source directory is valid |
| 10 | AC_CONFIG_SRCDIR(["Makefile.config.in"]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 11 | |
John Criswell | 93e1c72 | 2003-09-15 17:04:06 +0000 | [diff] [blame] | 12 | dnl Quit if the source directory has already been configured. |
John Criswell | 1b82432 | 2003-09-15 17:19:42 +0000 | [diff] [blame] | 13 | dnl NOTE: This relies upon undocumented autoconf behavior. |
Reid Spencer | c1b0d49 | 2004-09-19 23:43:52 +0000 | [diff] [blame] | 14 | if test ${srcdir} != "." ; then |
| 15 | if test -f ${srcdir}/include/llvm/Config/config.h ; then |
John Criswell | 1b82432 | 2003-09-15 17:19:42 +0000 | [diff] [blame] | 16 | AC_MSG_ERROR([Already configured in ${srcdir}]) |
| 17 | fi |
John Criswell | 93e1c72 | 2003-09-15 17:04:06 +0000 | [diff] [blame] | 18 | fi |
| 19 | |
John Criswell | 33a911a | 2003-11-25 20:36:46 +0000 | [diff] [blame] | 20 | dnl Configure all of the projects present in our source tree. |
John Criswell | 33a911a | 2003-11-25 20:36:46 +0000 | [diff] [blame] | 21 | for i in `ls ${srcdir}/projects` |
| 22 | do |
Reid Spencer | f7b2de5 | 2004-09-07 16:26:18 +0000 | [diff] [blame] | 23 | if test -d ${srcdir}/projects/${i} ; then |
| 24 | case ${i} in |
| 25 | "CVS") ;; |
| 26 | "sample") AC_CONFIG_SUBDIRS([projects/sample]) ;; |
| 27 | "Stacker") AC_CONFIG_SUBDIRS([projects/Stacker]) ;; |
| 28 | "llvm-test") AC_CONFIG_SUBDIRS([projects/llvm-test]) ;; |
| 29 | "llvm-reopt") AC_CONFIG_SUBDIRS([projects/llvm-reopt]);; |
| 30 | "llvm-gcc") AC_CONFIG_SUBDIRS([projects/llvm-gcc]) ;; |
Alkis Evlogimenos | 7e2315e | 2004-09-20 15:45:36 +0000 | [diff] [blame] | 31 | "Java") AC_CONFIG_SUBDIRS([projects/Java]) ;; |
Reid Spencer | f7b2de5 | 2004-09-07 16:26:18 +0000 | [diff] [blame] | 32 | "llvm-tv") AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;; |
| 33 | "llvm-fefw") AC_CONFIG_SUBDIRS([projects/llvm-fefw]) ;; |
John Criswell | e96aa1c | 2004-10-28 13:35:00 +0000 | [diff] [blame] | 34 | "poolalloc") AC_CONFIG_SUBDIRS([projects/poolalloc]) ;; |
Reid Spencer | c2186e2 | 2004-09-21 17:12:35 +0000 | [diff] [blame] | 35 | *) |
Alkis Evlogimenos | a281b6fa | 2004-09-27 07:35:19 +0000 | [diff] [blame] | 36 | AC_MSG_WARN([Unknown project (${i}) won't be configured automatically]) |
Reid Spencer | c2186e2 | 2004-09-21 17:12:35 +0000 | [diff] [blame] | 37 | ;; |
Reid Spencer | f7b2de5 | 2004-09-07 16:26:18 +0000 | [diff] [blame] | 38 | esac |
John Criswell | 33a911a | 2003-11-25 20:36:46 +0000 | [diff] [blame] | 39 | fi |
| 40 | done |
John Criswell | 559a6c1 | 2003-09-30 16:31:48 +0000 | [diff] [blame] | 41 | |
John Criswell | dc76e32 | 2004-07-23 15:40:57 +0000 | [diff] [blame] | 42 | dnl Configure header files |
Reid Spencer | 551ccae | 2004-09-01 22:55:40 +0000 | [diff] [blame] | 43 | AC_CONFIG_HEADERS(include/llvm/Config/config.h) |
John Criswell | dc76e32 | 2004-07-23 15:40:57 +0000 | [diff] [blame] | 44 | |
| 45 | dnl Configure other output file |
John Criswell | 4046846 | 2004-09-24 21:19:06 +0000 | [diff] [blame] | 46 | AC_CONFIG_FILES(Makefile.config) |
John Criswell | 5fbb1f8 | 2004-09-24 13:28:51 +0000 | [diff] [blame] | 47 | AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h]) |
John Criswell | 9f01186 | 2004-09-24 18:28:00 +0000 | [diff] [blame] | 48 | AC_CONFIG_HEADERS([include/llvm/ADT/hash_map]) |
| 49 | AC_CONFIG_HEADERS([include/llvm/ADT/hash_set]) |
John Criswell | 4046846 | 2004-09-24 21:19:06 +0000 | [diff] [blame] | 50 | AC_CONFIG_HEADERS([include/llvm/Support/ThreadSupport.h]) |
| 51 | AC_CONFIG_HEADERS([include/llvm/ADT/iterator]) |
John Criswell | dc76e32 | 2004-07-23 15:40:57 +0000 | [diff] [blame] | 52 | |
| 53 | dnl Do special configuration of Makefiles |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 54 | AC_CONFIG_MAKEFILE(Makefile) |
| 55 | AC_CONFIG_MAKEFILE(Makefile.common) |
Reid Spencer | 367754a | 2004-08-24 16:31:01 +0000 | [diff] [blame] | 56 | AC_CONFIG_MAKEFILE(examples/Makefile) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 57 | AC_CONFIG_MAKEFILE(lib/Makefile) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 58 | AC_CONFIG_MAKEFILE(runtime/Makefile) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 59 | AC_CONFIG_MAKEFILE(test/Makefile) |
| 60 | AC_CONFIG_MAKEFILE(test/Makefile.tests) |
John Criswell | f424d74 | 2003-10-07 21:13:47 +0000 | [diff] [blame] | 61 | AC_CONFIG_MAKEFILE(test/QMTest/llvm.py) |
| 62 | AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 63 | AC_CONFIG_MAKEFILE(tools/Makefile) |
Misha Brukman | 824e83d | 2004-10-14 18:59:09 +0000 | [diff] [blame] | 64 | AC_CONFIG_MAKEFILE(tools/Makefile.JIT) |
Chris Lattner | 5c866e1 | 2003-10-06 02:09:25 +0000 | [diff] [blame] | 65 | AC_CONFIG_MAKEFILE(utils/Makefile) |
John Criswell | 2d53308 | 2003-09-06 14:46:19 +0000 | [diff] [blame] | 66 | AC_CONFIG_MAKEFILE(projects/Makefile) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 67 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 68 | dnl Find the install program (needs to be done before canonical stuff) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 69 | AC_PROG_INSTALL |
| 70 | |
| 71 | dnl Check which host for which we're compiling. This will tell us which LLVM |
| 72 | dnl compiler will be used for compiling SSA into object code. |
| 73 | AC_CANONICAL_TARGET |
| 74 | |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 75 | 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] | 76 | dnl We will use the build machine information to set some variables. |
Reid Spencer | 73fb548 | 2004-08-31 14:20:36 +0000 | [diff] [blame] | 77 | |
| 78 | AC_MSG_CHECKING([support for generic build operating system]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 79 | case $build in |
Reid Spencer | 73fb548 | 2004-08-31 14:20:36 +0000 | [diff] [blame] | 80 | *-*-aix*) |
| 81 | AC_SUBST(OS,[AIX]) |
| 82 | platform_type="AIX" |
| 83 | ;; |
| 84 | *-*-cygwin*) |
| 85 | AC_SUBST(OS,[Cygwin]) |
| 86 | platform_type="Cygwin" |
| 87 | ;; |
| 88 | *-*-darwin*) |
| 89 | AC_SUBST(OS,[Darwin]) |
| 90 | platform_type="Darwin" |
| 91 | ;; |
| 92 | *-*-freebsd*) |
| 93 | AC_SUBST(OS,[Linux]) |
Reid Spencer | a11e4db | 2004-08-31 18:03:23 +0000 | [diff] [blame] | 94 | platform_type="FreeBSD" |
Reid Spencer | 73fb548 | 2004-08-31 14:20:36 +0000 | [diff] [blame] | 95 | ;; |
| 96 | *-*-interix*) |
| 97 | AC_SUBST(OS,[SunOS]) |
Reid Spencer | a11e4db | 2004-08-31 18:03:23 +0000 | [diff] [blame] | 98 | platform_type="Interix" |
Reid Spencer | 73fb548 | 2004-08-31 14:20:36 +0000 | [diff] [blame] | 99 | ;; |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 100 | *-*-linux*) |
| 101 | AC_SUBST(OS,[Linux]) |
Reid Spencer | 59ee436 | 2004-08-29 19:18:05 +0000 | [diff] [blame] | 102 | platform_type="Linux" |
| 103 | if test -d /home/vadve/lattner/local/x86/llvm-gcc |
| 104 | then |
| 105 | AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/]) |
| 106 | fi |
| 107 | ;; |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 108 | *-*-solaris*) |
| 109 | AC_SUBST(OS,[SunOS]) |
Reid Spencer | 59ee436 | 2004-08-29 19:18:05 +0000 | [diff] [blame] | 110 | platform_type="SunOS" |
| 111 | if test -d /home/vadve/lattner/local/sparc/llvm-gcc |
| 112 | then |
| 113 | AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/]) |
| 114 | fi |
| 115 | ;; |
Reid Spencer | 59ee436 | 2004-08-29 19:18:05 +0000 | [diff] [blame] | 116 | *-*-win32*) |
| 117 | AC_SUBST(OS,[Win32]) |
| 118 | platform_type="Win32" |
| 119 | ;; |
Brian Gaeke | 2f686db | 2004-09-08 20:32:11 +0000 | [diff] [blame] | 120 | *-*-mingw*) |
| 121 | AC_SUBST(OS,[Win32]) |
| 122 | platform_type="Win32" |
| 123 | ;; |
Reid Spencer | 59ee436 | 2004-08-29 19:18:05 +0000 | [diff] [blame] | 124 | *) |
| 125 | AC_SUBST(OS,[Unknown]) |
| 126 | platform_type="Unknown" |
| 127 | ;; |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 128 | esac |
| 129 | |
Reid Spencer | 886e951 | 2004-08-31 01:34:10 +0000 | [diff] [blame] | 130 | dnl Make sure we aren't attempting to configure for an unknown system |
Reid Spencer | 73fb548 | 2004-08-31 14:20:36 +0000 | [diff] [blame] | 131 | if test "$platform_type" = "Unknown" ; then |
Reid Spencer | 886e951 | 2004-08-31 01:34:10 +0000 | [diff] [blame] | 132 | AC_MSG_ERROR([Platform is unknown, configure can't continue]) |
| 133 | fi |
| 134 | |
Reid Spencer | 59ee436 | 2004-08-29 19:18:05 +0000 | [diff] [blame] | 135 | dnl Make a link from lib/System/platform to lib/System/$platform_type |
| 136 | dnl This helps the #inclusion of the system specific include files |
| 137 | dnl for the operating system abstraction library |
| 138 | AC_CONFIG_LINKS(lib/System/platform:lib/System/$platform_type) |
| 139 | |
Reid Spencer | 73fb548 | 2004-08-31 14:20:36 +0000 | [diff] [blame] | 140 | |
| 141 | AC_MSG_CHECKING(target architecture) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 142 | dnl If we are targetting a Sparc machine running Solaris, pretend that it is |
| 143 | dnl V9, since that is all that we support at the moment, and autoconf will only |
| 144 | dnl tell us we're a sparc. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 145 | case $target in |
Brian Gaeke | 3e66e8b | 2003-11-17 00:30:48 +0000 | [diff] [blame] | 146 | sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]]) |
| 147 | ;; |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 148 | esac |
| 149 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 150 | dnl Determine what our target architecture is and configure accordingly. |
| 151 | dnl This will allow Makefiles to make a distinction between the hardware and |
| 152 | dnl the OS. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 153 | case $target in |
Reid Spencer | 73fb548 | 2004-08-31 14:20:36 +0000 | [diff] [blame] | 154 | i*86-*) |
| 155 | ARCH="x86" |
| 156 | AC_SUBST(ARCH,[x86]) |
| 157 | ;; |
| 158 | sparc*-*) |
| 159 | ARCH="Sparc" |
| 160 | AC_SUBST(ARCH,[Sparc]) |
| 161 | ;; |
| 162 | powerpc*-*) |
| 163 | ARCH="PowerPC" |
| 164 | AC_SUBST(ARCH,[PowerPC]) |
| 165 | ;; |
| 166 | *) |
| 167 | ARCH="Unknown" |
| 168 | AC_SUBST(ARCH,[Unknown]) |
| 169 | ;; |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 170 | esac |
| 171 | |
Reid Spencer | 73fb548 | 2004-08-31 14:20:36 +0000 | [diff] [blame] | 172 | AC_MSG_RESULT($ARCH) |
| 173 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 174 | dnl Check for compilation tools |
| 175 | AC_PROG_CXX |
| 176 | AC_PROG_CC(gcc) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 177 | dnl Ensure that compilation tools are GCC; we use GCC specific extensions |
| 178 | if test "$GCC" != "yes" |
| 179 | then |
| 180 | AC_MSG_ERROR([gcc required but not found]) |
| 181 | fi |
Reid Spencer | c1b0d49 | 2004-09-19 23:43:52 +0000 | [diff] [blame] | 182 | AC_PROG_CPP |
| 183 | dnl Ensure that compilation tools are GCC; we use GCC specific extensions |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 184 | if test "$GXX" != "yes" |
| 185 | then |
| 186 | AC_MSG_ERROR([g++ required but not found]) |
| 187 | fi |
| 188 | |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 189 | dnl Verify that GCC is version 3.0 or higher |
| 190 | gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1` |
| 191 | if test "$gccmajor" -lt "3" |
| 192 | then |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 193 | 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] | 194 | fi |
| 195 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 196 | dnl Check for GNU Make. We use its extensions too, so don't build without it |
Reid Spencer | f7b2de5 | 2004-09-07 16:26:18 +0000 | [diff] [blame] | 197 | AC_CHECK_GNU_MAKE |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 198 | if test -z "$_cv_gnu_make_command" |
| 199 | then |
| 200 | AC_MSG_ERROR([GNU Make required but not found]) |
| 201 | fi |
| 202 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 203 | dnl Checks for other tools |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 204 | AC_PROG_FLEX |
| 205 | AC_PROG_BISON |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 206 | AC_PROG_LIBTOOL |
Reid Spencer | ad354c9 | 2004-10-25 08:18:47 +0000 | [diff] [blame] | 207 | AC_PATH_PROG(TAR,[tar],[gtar]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 208 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 209 | dnl Checks for tools we can get away with not having: |
| 210 | AC_PATH_PROG(DOT,[dot],[true dot]) |
| 211 | AC_PATH_PROG(ETAGS,[etags],[true etags]) |
Brian Gaeke | 027b746 | 2004-01-22 21:55:15 +0000 | [diff] [blame] | 212 | dnl Check if we know how to tell etags we are using C++: |
| 213 | etags_version=`$ETAGS --version 2>&1` |
| 214 | case "$etags_version" in |
| 215 | *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;; |
| 216 | *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;; |
| 217 | *) ETAGSFLAGS="" ;; |
| 218 | esac |
| 219 | AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS) |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 220 | AC_PATH_PROG(PYTHON,[python],[true python]) |
| 221 | if test "$PYTHON" = "false" |
John Criswell | 39827c8 | 2003-09-23 15:28:52 +0000 | [diff] [blame] | 222 | then |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 223 | 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] | 224 | fi |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 225 | AC_PATH_PROG(QMTEST,[qmtest],[true qmtest]) |
| 226 | if test "$QMTEST" = "false" |
John Criswell | 39827c8 | 2003-09-23 15:28:52 +0000 | [diff] [blame] | 227 | then |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 228 | 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] | 229 | fi |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 230 | |
| 231 | dnl Verify that the version of python available is high enough for qmtest |
| 232 | pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2` |
| 233 | pymajor=`echo $pyversion | cut -d. -f1` |
| 234 | pyminor=`echo $pyversion | cut -d. -f2` |
| 235 | |
| 236 | if test "$pymajor" -ge "2" |
| 237 | then |
| 238 | if test "$pymajor" -eq "2" |
| 239 | then |
| 240 | if test "$pyminor" -lt "2" |
| 241 | then |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 242 | AC_MSG_WARN([QMTest requires Python 2.2 or later]) |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 243 | fi |
| 244 | fi |
| 245 | else |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 246 | AC_MSG_WARN([QMTest requires Python 2.2 or later]) |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame] | 247 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 248 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 249 | dnl Checks for libraries: |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 250 | dnl libelf is for sparc only; we can ignore it if we don't have it |
| 251 | AC_CHECK_LIB(elf, elf_begin) |
| 252 | |
Reid Spencer | c28d7ad | 2004-10-02 08:50:58 +0000 | [diff] [blame] | 253 | dnl Check for bzip2 and zlib compression libraries needed for archive reading/writing |
| 254 | AC_CHECK_LIB(bz2,BZ2_bzCompressInit,[bzip2_found=1],[bzip2_found=0]) |
Reid Spencer | 0d98aed | 2004-10-04 22:05:53 +0000 | [diff] [blame] | 255 | AC_CHECK_HEADERS([bzlib.h],[bzlib_h_found=1],[bzlib_h_found=0],[]) |
Reid Spencer | c28d7ad | 2004-10-02 08:50:58 +0000 | [diff] [blame] | 256 | AC_CHECK_LIB(z,gzopen,[zlib_found=1],[zlib_found=0]) |
Reid Spencer | 0d98aed | 2004-10-04 22:05:53 +0000 | [diff] [blame] | 257 | AC_CHECK_HEADERS([zlib.h],[zlib_h_found=1],[zlib_h_found=0],[]) |
| 258 | if test $zlib_found -eq 1 -a $zlib_h_found -eq 1; then |
Reid Spencer | c28d7ad | 2004-10-02 08:50:58 +0000 | [diff] [blame] | 259 | AC_DEFINE([HAVE_ZLIB],[1],[Define if zlib library is available on this platform.]) |
Reid Spencer | 0d98aed | 2004-10-04 22:05:53 +0000 | [diff] [blame] | 260 | AC_SUBST([HAVE_ZLIB],[1]) |
| 261 | else |
| 262 | AC_SUBST([HAVE_ZLIB],[0]) |
Reid Spencer | c28d7ad | 2004-10-02 08:50:58 +0000 | [diff] [blame] | 263 | fi |
Reid Spencer | 0d98aed | 2004-10-04 22:05:53 +0000 | [diff] [blame] | 264 | if test $bzip2_found -eq 1 -a $bzlib_h_found -eq 1 ; then |
Reid Spencer | c28d7ad | 2004-10-02 08:50:58 +0000 | [diff] [blame] | 265 | AC_DEFINE([HAVE_BZIP2],[1],[Define if bzip2 library is available on this platform.]) |
Reid Spencer | 0d98aed | 2004-10-04 22:05:53 +0000 | [diff] [blame] | 266 | AC_SUBST([HAVE_BZIP2],[1]) |
| 267 | else |
| 268 | AC_SUBST([HAVE_BZIP2],[0]) |
Reid Spencer | c28d7ad | 2004-10-02 08:50:58 +0000 | [diff] [blame] | 269 | fi |
Brian Gaeke | 4c42378 | 2003-10-07 05:03:36 +0000 | [diff] [blame] | 270 | dnl dlopen() is required for plugin support. |
Brian Gaeke | a25d7ca | 2003-10-08 21:44:07 +0000 | [diff] [blame] | 271 | 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] | 272 | |
| 273 | dnl mallinfo is optional; the code can compile (minus features) without it |
Brian Gaeke | a25d7ca | 2003-10-08 21:44:07 +0000 | [diff] [blame] | 274 | 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] | 275 | |
Brian Gaeke | 5f268f7 | 2003-12-05 19:29:01 +0000 | [diff] [blame] | 276 | dnl pthread locking functions are optional - but llvm will not be thread-safe |
| 277 | dnl without locks. |
John Criswell | 4046846 | 2004-09-24 21:19:06 +0000 | [diff] [blame] | 278 | AC_SEARCH_LIBS(pthread_mutex_lock,pthread,AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1],[Have pthread_mutex_lock])) |
| 279 | dnl AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK) |
Brian Gaeke | 5f268f7 | 2003-12-05 19:29:01 +0000 | [diff] [blame] | 280 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 281 | dnl Checks for header files. |
| 282 | dnl We don't check for ancient stuff or things that are guaranteed to be there |
| 283 | 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] | 284 | AC_HEADER_STDC |
| 285 | AC_HEADER_SYS_WAIT |
| 286 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 287 | dnl Checks for POSIX and other various system-specific header files |
John Criswell | b2815e0 | 2004-05-27 20:40:39 +0000 | [diff] [blame] | 288 | 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 | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 289 | |
Brian Gaeke | 1133eaf | 2004-02-23 22:07:01 +0000 | [diff] [blame] | 290 | dnl Check for things that need to be included in public headers, and so |
| 291 | dnl for which we may not have access to a HAVE_* preprocessor #define. |
| 292 | dnl (primarily used in DataTypes.h) |
John Criswell | 5fbb1f8 | 2004-09-24 13:28:51 +0000 | [diff] [blame] | 293 | AC_CHECK_HEADER([sys/types.h]) |
| 294 | AC_CHECK_HEADER([inttypes.h]) |
| 295 | AC_CHECK_HEADER([stdint.h]) |
Brian Gaeke | 1133eaf | 2004-02-23 22:07:01 +0000 | [diff] [blame] | 296 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 297 | dnl Check for types |
| 298 | AC_TYPE_PID_T |
| 299 | AC_TYPE_SIZE_T |
| 300 | AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found])) |
Reid Spencer | e2c6f51 | 2004-09-02 21:38:24 +0000 | [diff] [blame] | 301 | AC_CHECK_TYPES([uint64_t],, |
| 302 | AC_CHECK_TYPES([u_int64_t],, |
| 303 | AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found]))) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 304 | AC_HEADER_TIME |
| 305 | AC_STRUCT_TM |
| 306 | |
John Criswell | a0137d3 | 2003-10-13 16:22:01 +0000 | [diff] [blame] | 307 | dnl Check for various C features |
| 308 | AC_C_PRINTF_A |
| 309 | |
John Criswell | 0021c31 | 2004-02-13 21:57:29 +0000 | [diff] [blame] | 310 | dnl Check for the endianness of the target |
| 311 | AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little])) |
| 312 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 313 | dnl Check for C++ extensions |
Brian Gaeke | 278a4ac | 2003-11-10 03:06:09 +0000 | [diff] [blame] | 314 | AC_CXX_HAVE_HASH_MAP |
| 315 | AC_CXX_HAVE_HASH_SET |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 316 | AC_CXX_HAVE_STD_ITERATOR |
| 317 | AC_CXX_HAVE_BI_ITERATOR |
| 318 | AC_CXX_HAVE_FWD_ITERATOR |
| 319 | |
Brian Gaeke | 8828eb5 | 2004-06-22 23:43:04 +0000 | [diff] [blame] | 320 | AC_FUNC_ISNAN |
Brian Gaeke | 3869b27 | 2004-07-21 03:14:51 +0000 | [diff] [blame] | 321 | AC_FUNC_ISINF |
Reid Spencer | abec8f9 | 2004-10-27 23:03:44 +0000 | [diff] [blame] | 322 | AC_FUNC_RAND48 |
Brian Gaeke | 8828eb5 | 2004-06-22 23:43:04 +0000 | [diff] [blame] | 323 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 324 | dnl Checks for library functions. |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 325 | AC_FUNC_ALLOCA |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 326 | AC_FUNC_MMAP |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 327 | if test "$ac_cv_func_mmap_fixed_mapped" = "no" |
| 328 | then |
John Criswell | f3ecf3a | 2004-05-27 00:57:50 +0000 | [diff] [blame] | 329 | AC_MSG_WARN([mmap() required but not found]) |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 330 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 331 | AC_FUNC_MMAP_FILE |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 332 | if test "$ac_cv_func_mmap_file" = "no" |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 333 | then |
John Criswell | f3ecf3a | 2004-05-27 00:57:50 +0000 | [diff] [blame] | 334 | AC_MSG_WARN([mmap() of files required but not found]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 335 | fi |
| 336 | AC_HEADER_MMAP_ANONYMOUS |
| 337 | AC_TYPE_SIGNAL |
Brian Gaeke | 8828eb5 | 2004-06-22 23:43:04 +0000 | [diff] [blame] | 338 | AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace isatty mkstemp getrusage) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 339 | AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found])) |
| 340 | |
John Criswell | cb7a1eb | 2003-11-17 19:46:02 +0000 | [diff] [blame] | 341 | dnl Determine if the linker supports the -R option. |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 342 | AC_LINK_USE_R |
John Criswell | cb7a1eb | 2003-11-17 19:46:02 +0000 | [diff] [blame] | 343 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 344 | dnl --enable/--with command-line options: |
| 345 | dnl Check whether they want to do an optimized build: |
Reid Spencer | c1b0d49 | 2004-09-19 23:43:52 +0000 | [diff] [blame] | 346 | AC_ARG_ENABLE(optimized,AS_HELP_STRING(--enable-optimized,Compile with optimizations enabled (default is NO)),,enableval=no) |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 347 | if test ${enableval} = "no" |
| 348 | then |
| 349 | AC_SUBST(ENABLE_OPTIMIZED,[[]]) |
| 350 | else |
| 351 | AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]]) |
| 352 | fi |
| 353 | |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 354 | dnl JIT Option |
Reid Spencer | c1b0d49 | 2004-09-19 23:43:52 +0000 | [diff] [blame] | 355 | AC_ARG_ENABLE(jit,AS_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] | 356 | if test ${enableval} = "no" |
| 357 | then |
| 358 | AC_SUBST(JIT,[[]]) |
| 359 | else |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 360 | case $target in |
| 361 | *i*86*) |
| 362 | AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) |
| 363 | ;; |
| 364 | *sparc*) |
| 365 | AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) |
| 366 | ;; |
| 367 | *) |
| 368 | AC_SUBST(JIT,[[]]) |
| 369 | ;; |
| 370 | esac |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 371 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 372 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 373 | dnl Find the LLVM GCC-based C/C++ front end |
Reid Spencer | c1b0d49 | 2004-09-19 23:43:52 +0000 | [diff] [blame] | 374 | AC_ARG_WITH(llvmgccdir,AS_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] | 375 | AC_MSG_CHECKING([for llvm-gcc]) |
| 376 | LLVM_GCC_CHECK=no |
| 377 | if test -d "$LLVMGCCDIR" |
| 378 | then |
| 379 | if test -x "$LLVMGCCDIR/bin/gcc" |
| 380 | then |
| 381 | LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc" |
| 382 | fi |
| 383 | fi |
| 384 | llvmgccwarn=no |
| 385 | AC_MSG_RESULT($LLVM_GCC_CHECK) |
| 386 | if test "$LLVM_GCC_CHECK" = "no" |
| 387 | then |
| 388 | llvmgccwarn=yes |
| 389 | fi |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 390 | AC_MSG_CHECKING([whether llvm-gcc is sane]) |
| 391 | LLVM_GCC_SANE=no |
| 392 | if test -x "$LLVM_GCC_CHECK" |
| 393 | then |
| 394 | cp /dev/null conftest.c |
| 395 | "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1 |
| 396 | if test $? -eq 0 |
| 397 | then |
| 398 | LLVM_GCC_SANE=yes |
| 399 | fi |
| 400 | rm conftest.c |
Brian Gaeke | d05e39d | 2004-01-16 21:31:22 +0000 | [diff] [blame] | 401 | llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1` |
| 402 | AC_SUBST(LLVMCC1,$llvmcc1path) |
| 403 | llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus` |
| 404 | AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath) |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 405 | fi |
| 406 | AC_MSG_RESULT($LLVM_GCC_SANE) |
| 407 | if test "$LLVM_GCC_SANE" = "no" |
| 408 | then |
| 409 | llvmgccwarn=yes |
| 410 | fi |
| 411 | |
Brian Gaeke | cea9a60 | 2004-01-21 19:38:56 +0000 | [diff] [blame] | 412 | dnl Get libtool's idea of what the shared library suffix is. |
| 413 | dnl (This is a hack; it relies on undocumented behavior.) |
| 414 | AC_MSG_CHECKING([for shared library suffix]) |
Reid Spencer | 2650835 | 2004-09-20 03:05:46 +0000 | [diff] [blame] | 415 | eval "SHLIBEXT=$shrext_cmds" |
Brian Gaeke | cea9a60 | 2004-01-21 19:38:56 +0000 | [diff] [blame] | 416 | AC_MSG_RESULT($SHLIBEXT) |
| 417 | dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint). |
| 418 | AC_SUBST(SHLIBEXT,$SHLIBEXT) |
| 419 | AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT", |
| 420 | [Extension that shared libraries have, e.g., ".so".]) |
| 421 | |
Reid Spencer | a91929d | 2004-08-20 09:03:12 +0000 | [diff] [blame] | 422 | # Translate the various configuration directories and other basic |
| 423 | # information into substitutions that will end up in config.h.in so |
| 424 | # that these configured values can be hard-wired into a program. |
| 425 | eval LLVM_PREFIX="${prefix}"; |
| 426 | eval LLVM_BINDIR="${prefix}/bin"; |
| 427 | eval LLVM_LIBDIR="${prefix}/lib"; |
| 428 | eval LLVM_DATADIR="${prefix}/data"; |
| 429 | eval LLVM_DOCSDIR="${prefix}/docs"; |
| 430 | eval LLVM_ETCDIR="${prefix}/etc"; |
| 431 | eval LLVM_INCLUDEDIR="${prefix}/include"; |
| 432 | eval LLVM_INFODIR="${prefix}/info"; |
| 433 | eval LLVM_MANDIR="${prefix}/man"; |
| 434 | LLVM_CONFIGTIME=`date` |
| 435 | AC_SUBST(LLVM_PREFIX) |
| 436 | AC_SUBST(LLVM_BINDIR) |
| 437 | AC_SUBST(LLVM_LIBDIR) |
| 438 | AC_SUBST(LLVM_DATADIR) |
| 439 | AC_SUBST(LLVM_DOCSDIR) |
| 440 | AC_SUBST(LLVM_ETCDIR) |
| 441 | AC_SUBST(LLVM_INCLUDEDIR) |
| 442 | AC_SUBST(LLVM_INFODIR) |
| 443 | AC_SUBST(LLVM_MANDIR) |
| 444 | AC_SUBST(LLVM_CONFIGTIME) |
| 445 | AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", [Installation prefix directory]) |
| 446 | AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", [Installation directory for binary executables]) |
| 447 | AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR", [Installation directory for libraries]) |
| 448 | AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", [Installation directory for data files]) |
| 449 | AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR", [Installation directory for documentation]) |
Reid Spencer | 19d96ee | 2004-08-20 09:08:57 +0000 | [diff] [blame] | 450 | AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", [Installation directory for config files]) |
Reid Spencer | a91929d | 2004-08-20 09:03:12 +0000 | [diff] [blame] | 451 | AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", [Installation directory for include files]) |
| 452 | AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", [Installation directory for .info files]) |
| 453 | AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", [Installation directory for man pages]) |
| 454 | AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", [Time at which LLVM was configured]) |
| 455 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 456 | dnl Create the output files |
Reid Spencer | c1b0d49 | 2004-09-19 23:43:52 +0000 | [diff] [blame] | 457 | AC_OUTPUT |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 458 | |
Reid Spencer | 5cb99fb | 2004-10-04 18:02:55 +0000 | [diff] [blame] | 459 | dnl Warn if we don't have a compression library |
| 460 | if test $bzip2_found -ne 1 ; then |
| 461 | if test $zlib_found -ne 1 ; then |
| 462 | AC_MSG_WARN([*** Neither zlib nor bzip2 compression libraries were found.]) |
| 463 | AC_MSG_WARN([*** Bytecode archives will not support compression!]) |
| 464 | AC_MSG_WARN([*** To correct, install the libraries and and re-run configure.]) |
| 465 | fi |
| 466 | fi |
| 467 | |
Brian Gaeke | 26be9c5 | 2004-01-13 06:43:16 +0000 | [diff] [blame] | 468 | dnl Warn loudly if llvm-gcc was not obviously working |
Brian Gaeke | 908647f | 2003-11-16 18:37:46 +0000 | [diff] [blame] | 469 | if test $llvmgccwarn = yes |
| 470 | then |
| 471 | AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not]) |
| 472 | AC_MSG_WARN([***** appear to be working.]) |
| 473 | AC_MSG_WARN([***** ]) |
| 474 | AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.]) |
| 475 | AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,]) |
| 476 | AC_MSG_WARN([***** but you should be able to build the llvm tools.]) |
| 477 | fi |
Brian Gaeke | cea9a60 | 2004-01-21 19:38:56 +0000 | [diff] [blame] | 478 | |