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