John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 1 | dnl Autoconf requirements |
| 2 | dnl AC_INIT(package, version, bug-report-address) |
| 3 | dnl information on the package |
| 4 | dnl checks for programs |
| 5 | dnl checks for libraries |
| 6 | dnl checks for header files |
| 7 | dnl checks for types |
| 8 | dnl checks for structures |
| 9 | dnl checks for compiler characteristics |
| 10 | dnl checks for library functions |
| 11 | dnl checks for system services |
| 12 | dnl AC_CONFIG_FILES([file...]) |
| 13 | dnl AC_OUTPUT |
| 14 | |
| 15 | dnl ************************************************************************** |
| 16 | dnl * Initialize |
| 17 | dnl ************************************************************************** |
| 18 | AC_INIT([[[LLVM]]],[[[1.0]]],[llvmbugs@cs.uiuc.edu]) |
| 19 | |
| 20 | dnl Place all of the extra autoconf files into the config subdirectory |
| 21 | AC_CONFIG_AUX_DIR([autoconf]) |
| 22 | |
| 23 | dnl Configure a header file |
| 24 | AC_CONFIG_HEADERS(include/Config/config.h) |
| 25 | |
| 26 | dnl ************************************************************************** |
| 27 | dnl * Determine which system we are building on |
| 28 | dnl ************************************************************************** |
| 29 | |
| 30 | dnl Check the install program (needs to be done before canonical stuff) |
| 31 | AC_PROG_INSTALL |
| 32 | |
| 33 | dnl Check which host for which we're compiling. This will tell us which LLVM |
| 34 | dnl compiler will be used for compiling SSA into object code. |
| 35 | AC_CANONICAL_TARGET |
| 36 | |
| 37 | dnl |
| 38 | dnl Now, for some of our own magic: |
| 39 | dnl We will use the build machine information to set some variables. |
| 40 | dnl |
| 41 | case $build in |
| 42 | *i*86*) AC_SUBST(OS,[Linux]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 43 | AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/]) |
| 44 | ;; |
| 45 | |
| 46 | *sparc*) AC_SUBST(OS,[SunOS]) |
| 47 | AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/]) |
| 48 | ;; |
| 49 | |
| 50 | *) AC_SUBST(OS,[Unknown]) |
| 51 | ;; |
| 52 | esac |
| 53 | |
| 54 | dnl |
| 55 | dnl If we are targetting a Sparc machine running Solaris, pretend that it is |
| 56 | dnl V9, since that is all that we support at the moment, and autoconf will only |
| 57 | dnl tell us we're a sparc. |
| 58 | dnl |
| 59 | case $target in |
| 60 | *sparc*solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]]) |
| 61 | ;; |
| 62 | esac |
| 63 | |
| 64 | dnl |
| 65 | dnl Determine what our target architecture is and configure accordingly. |
| 66 | dnl This will allow Makefiles to make a distinction between the hardware and |
| 67 | dnl the OS. |
| 68 | dnl |
| 69 | case $target in |
| 70 | *i*86*) AC_SUBST(ARCH,[x86]) |
| 71 | ;; |
| 72 | *sparc*solaris*) AC_SUBST(ARCH,[Sparc]) |
| 73 | ;; |
| 74 | esac |
| 75 | |
| 76 | dnl ************************************************************************** |
| 77 | dnl * Check for programs. |
| 78 | dnl ************************************************************************** |
| 79 | |
| 80 | dnl Check for compilation tools |
| 81 | AC_PROG_CXX |
| 82 | AC_PROG_CC(gcc) |
| 83 | AC_PROG_CPP |
| 84 | |
| 85 | dnl Ensure that compilation tools are GCC; we use GCC specific extensions |
| 86 | if test "$GCC" != "yes" |
| 87 | then |
| 88 | AC_MSG_ERROR([gcc required but not found]) |
| 89 | fi |
| 90 | |
| 91 | if test "$GXX" != "yes" |
| 92 | then |
| 93 | AC_MSG_ERROR([g++ required but not found]) |
| 94 | fi |
| 95 | |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame^] | 96 | dnl Verify that GCC is version 3.0 or higher |
| 97 | gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1` |
| 98 | if test "$gccmajor" -lt "3" |
| 99 | then |
| 100 | AC_MSG_ERROR([gcc 3.x required]) |
| 101 | fi |
| 102 | |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 103 | dnl Check for GNU Make. We use its extensions to, so don't build without it |
| 104 | CHECK_GNU_MAKE |
| 105 | if test -z "$_cv_gnu_make_command" |
| 106 | then |
| 107 | AC_MSG_ERROR([GNU Make required but not found]) |
| 108 | fi |
| 109 | |
| 110 | dnl Check for compiler-compiler tools (reminds me of Little Caesar's Pizza) |
| 111 | AC_PROG_FLEX |
| 112 | AC_PROG_BISON |
| 113 | |
| 114 | dnl Check for libtool |
| 115 | AC_PROG_LIBTOOL |
| 116 | |
| 117 | dnl Check for our special programs |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame^] | 118 | AC_PATH_PROG(RPWD,[pwd]) |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 119 | AC_PATH_PROG(AR,[ar]) |
| 120 | AC_PATH_PROG(SED,[sed]) |
| 121 | AC_PATH_PROG(RM,[rm]) |
| 122 | AC_PATH_PROG(ECHO,[echo]) |
| 123 | AC_PATH_PROG(MKDIR,[mkdir]) |
| 124 | AC_PATH_PROG(DATE,[date]) |
| 125 | AC_PATH_PROG(MV,[mv]) |
| 126 | AC_PATH_PROG(DOT,[dot]) |
| 127 | AC_PATH_PROG(ETAGS,[etags]) |
| 128 | AC_PATH_PROG(PURIFY,[purify]) |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame^] | 129 | AC_PATH_PROG(PYTHON,[python]) |
| 130 | AC_PATH_PROG(QMTEST,[qmtest]) |
| 131 | |
| 132 | dnl Verify that the version of python available is high enough for qmtest |
| 133 | pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2` |
| 134 | pymajor=`echo $pyversion | cut -d. -f1` |
| 135 | pyminor=`echo $pyversion | cut -d. -f2` |
| 136 | |
| 137 | if test "$pymajor" -ge "2" |
| 138 | then |
| 139 | if test "$pymajor" -eq "2" |
| 140 | then |
| 141 | if test "$pyminor" -lt "2" |
| 142 | then |
| 143 | AC_MSG_ERROR([Python 2.2 or greater required]) |
| 144 | fi |
| 145 | fi |
| 146 | else |
| 147 | AC_MSG_ERROR([Python 2.2 or greater required]) |
| 148 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 149 | |
| 150 | dnl Verify that the source directory is valid |
| 151 | AC_CONFIG_SRCDIR(["Makefile.config.in"]) |
| 152 | |
| 153 | dnl ************************************************************************** |
| 154 | dnl * Check for libraries. |
| 155 | dnl ************************************************************************** |
| 156 | |
| 157 | dnl libelf is for sparc only; we can ignore it if we don't have it |
| 158 | AC_CHECK_LIB(elf, elf_begin) |
| 159 | |
| 160 | dnl dlopen() is required. If we don't find it, quit. |
| 161 | AC_SEARCH_LIBS(dlopen,dl,,AC_MSG_ERROR([dlopen() required but not found])) |
| 162 | |
| 163 | dnl mallinfo is optional; the code can compile (minus features) without it |
| 164 | AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1])) |
| 165 | |
| 166 | dnl |
| 167 | dnl The math libraries are used by the test code, but not by the actual LLVM |
| 168 | dnl code. |
| 169 | dnl |
| 170 | dnl AC_CHECK_LIB(m, cos) |
| 171 | |
| 172 | dnl ************************************************************************** |
| 173 | dnl * Checks for header files. |
| 174 | dnl * Chances are, if the standard C or POSIX type header files are missing, |
| 175 | dnl * then LLVM just isn't going to compile. However, it is possible that |
| 176 | dnl * the necessary functions/macros will be included from other |
| 177 | dnl * (non-standard and non-obvious) header files. |
| 178 | dnl * |
| 179 | dnl * So, we'll be gracious, give it a chance, and try to go on without |
| 180 | dnl * them. |
| 181 | dnl ************************************************************************** |
| 182 | AC_HEADER_STDC |
| 183 | AC_HEADER_SYS_WAIT |
| 184 | |
| 185 | dnl Check for ANSI C/POSIX header files |
| 186 | AC_CHECK_HEADERS(assert.h fcntl.h limits.h sys/time.h unistd.h errno.h signal.h math.h) |
| 187 | |
| 188 | dnl Check for system specific header files |
| 189 | AC_CHECK_HEADERS(malloc.h strings.h sys/mman.h sys/resource.h) |
| 190 | |
| 191 | dnl Check for header files associated with dlopen and friends |
| 192 | AC_CHECK_HEADERS(dlfcn.h link.h) |
| 193 | |
| 194 | dnl ************************************************************************** |
| 195 | dnl * Checks for typedefs, structures, and compiler characteristics. |
| 196 | dnl ************************************************************************** |
| 197 | |
| 198 | dnl Check for const and inline keywords |
| 199 | AC_C_CONST |
| 200 | AC_C_INLINE |
| 201 | |
| 202 | dnl Check for machine endian-ness |
| 203 | AC_C_BIGENDIAN(AC_DEFINE([ENDIAN_BIG]),AC_DEFINE(ENDIAN_LITTLE)) |
| 204 | |
| 205 | dnl Check for types |
| 206 | AC_TYPE_PID_T |
| 207 | AC_TYPE_SIZE_T |
| 208 | AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found])) |
| 209 | AC_CHECK_TYPES([uint64_t],,AC_MSG_ERROR([Type uint64_t required but not found])) |
| 210 | AC_HEADER_TIME |
| 211 | AC_STRUCT_TM |
| 212 | |
| 213 | dnl Check for C++ extensions |
| 214 | AC_CXX_HAVE_EXT_HASH_MAP |
| 215 | AC_CXX_HAVE_EXT_HASH_SET |
| 216 | AC_CXX_HAVE_EXT_SLIST |
| 217 | AC_CXX_HAVE_STD_ITERATOR |
| 218 | AC_CXX_HAVE_BI_ITERATOR |
| 219 | AC_CXX_HAVE_FWD_ITERATOR |
| 220 | |
| 221 | dnl ************************************************************************** |
| 222 | dnl * Checks for library functions. |
| 223 | dnl ************************************************************************** |
| 224 | AC_FUNC_ALLOCA |
| 225 | AC_PROG_GCC_TRADITIONAL |
| 226 | AC_FUNC_MEMCMP |
| 227 | AC_FUNC_MMAP |
| 228 | AC_FUNC_MMAP_FILE |
| 229 | if test ${ac_cv_func_mmap_file} = "no" |
| 230 | then |
| 231 | AC_MSG_ERROR([mmap() of files required but not found]) |
| 232 | fi |
| 233 | AC_HEADER_MMAP_ANONYMOUS |
| 234 | AC_TYPE_SIGNAL |
| 235 | AC_CHECK_FUNCS(getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol) |
| 236 | |
| 237 | dnl |
| 238 | dnl Need to check mmap for MAP_PRIVATE, MAP_ANONYMOUS, MAP_ANON, MAP_FIXED |
| 239 | dnl MAP_FIXED is only needed for Sparc |
| 240 | dnl MAP_ANON is used for Sparc and BSD |
| 241 | dnl Everyone should have MAP_PRIVATE |
| 242 | dnl |
| 243 | |
| 244 | dnl Check for certain functions (even if we've already found them) so that we |
| 245 | dnl can quit with an error if they are unavailable. |
| 246 | dnl |
| 247 | dnl As the code is made more portable (i.e. less reliant on these functions, |
| 248 | dnl these checks should go away. |
| 249 | AC_CHECK_FUNC(mmap,,AC_MSG_ERROR([Function mmap() required but not found])) |
| 250 | AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found])) |
| 251 | |
| 252 | dnl ************************************************************************** |
| 253 | dnl * Enable various compile-time options |
| 254 | dnl ************************************************************************** |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 255 | |
| 256 | dnl Purify Option |
| 257 | AC_ARG_ENABLE(purify,AC_HELP_STRING([--enable-purify],[Compile with purify (default is NO)]),,enableval="no") |
| 258 | if test ${enableval} = "no" |
| 259 | then |
| 260 | AC_SUBST(ENABLE_PURIFY,[[]]) |
| 261 | else |
| 262 | AC_SUBST(ENABLE_PURIFY,[[ENABLE_PURIFY=1]]) |
| 263 | fi |
| 264 | |
| 265 | dnl Optimized Option |
| 266 | AC_ARG_ENABLE(optimized,AC_HELP_STRING([--enable-optimized],[Compile with optimizations enabled (default is NO)]),,enableval=no) |
| 267 | if test ${enableval} = "no" |
| 268 | then |
| 269 | AC_SUBST(ENABLE_OPTIMIZED,[[]]) |
| 270 | else |
| 271 | AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]]) |
| 272 | fi |
| 273 | |
| 274 | dnl Spec Benchmarks |
| 275 | AC_ARG_ENABLE(spec,AC_HELP_STRING([--enable-spec],[Compile SPEC benchmarks (default is NO)]),,enableval=no) |
| 276 | if test ${enableval} = "no" |
| 277 | then |
| 278 | AC_SUBST(USE_SPEC,[[]]) |
| 279 | else |
| 280 | AC_SUBST(USE_SPEC,[[USE_SPEC=1]]) |
| 281 | fi |
| 282 | |
| 283 | dnl Precompiled Bytecode Option |
| 284 | AC_ARG_ENABLE(precompiled_bytecode,AC_HELP_STRING([--enable-precompiled_bytecode],[Use pre-compiled bytecode (default is NO)]),,enableval=no) |
| 285 | if test ${enableval} = "no" |
| 286 | then |
| 287 | AC_SUBST(UPB,[[]]) |
| 288 | else |
| 289 | AC_SUBST(UPB,[[USE_PRECOMPILED_BYTECODE=1]]) |
| 290 | fi |
| 291 | |
| 292 | |
| 293 | dnl LLC Diff Option |
| 294 | AC_ARG_ENABLE(llc_diffs,AC_HELP_STRING([--enable-llc_diffs],[Enable LLC Diffs when testing (default is YES)]),,enableval=yes) |
| 295 | if test ${enableval} = "no" |
| 296 | then |
| 297 | AC_SUBST(DISABLE_LLC_DIFFS,[DISABLE_LLC_DIFFS:=1]) |
| 298 | else |
| 299 | AC_SUBST(DISABLE_LLC_DIFFS,[[]]) |
| 300 | fi |
| 301 | |
| 302 | dnl JIT Option |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 303 | 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] | 304 | |
| 305 | if test ${enableval} = "no" |
| 306 | then |
| 307 | AC_SUBST(JIT,[[]]) |
| 308 | else |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 309 | case $target in |
| 310 | *i*86*) |
| 311 | AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) |
| 312 | ;; |
| 313 | *sparc*) |
| 314 | AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) |
| 315 | ;; |
| 316 | *) |
| 317 | AC_SUBST(JIT,[[]]) |
| 318 | ;; |
| 319 | esac |
John Criswell | 79a8f09 | 2003-07-22 20:59:52 +0000 | [diff] [blame] | 320 | fi |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 321 | |
| 322 | dnl ************************************************************************** |
| 323 | dnl * Set the location of various third-party software packages |
| 324 | dnl ************************************************************************** |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 325 | |
| 326 | dnl Location of SPEC benchmarks |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 327 | AC_ARG_WITH(spec,AC_HELP_STRING([--with-spec],[Location of SPEC benchmarks]),AC_SUBST(SPEC_ROOT,[$withval]),AC_SUBST(SPEC_ROOT,[/home/vadve/shared/benchmarks/speccpu2000/benchspec])) |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 328 | |
| 329 | dnl Location of the LLVM C front end |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 330 | AC_ARG_WITH(llvmgccdir,AC_HELP_STRING([--with-llvmgccdir],[Location of LLVM GCC front-end]),AC_SUBST(LLVMGCCDIR,[$withval])) |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 331 | |
| 332 | dnl Location of the bytecode repository |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 333 | AC_ARG_WITH(bcrepos,AC_HELP_STRING([--with-bcrepos],[Location of Bytecode Repository]),AC_SUBST(BCR,[$withval]),AC_SUBST(BCR,[/home/vadve/lattner/LLVMPrograms])) |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 334 | |
| 335 | dnl Location of PAPI |
Chris Lattner | 1b9ddd5 | 2003-08-14 18:59:53 +0000 | [diff] [blame] | 336 | AC_ARG_WITH(papi,AC_HELP_STRING([--with-papi],[Location of PAPI]),AC_SUBST(PAPIDIR,[$withval]),AC_SUBST(PAPIDIR,[/home/vadve/shared/Sparc/papi-2.3.4.1])) |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 337 | |
| 338 | dnl Location of the purify program |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 339 | AC_ARG_WITH(purify,AC_HELP_STRING([--with-purify],[Location of purify program]),AC_SUBST(PURIFY,[$withval])) |
| 340 | |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 341 | dnl Location for placing object files and built programs, libraries, etc |
John Criswell | 54ac8b1 | 2003-07-31 16:45:37 +0000 | [diff] [blame] | 342 | if test ${USER} |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 343 | then |
John Criswell | 54ac8b1 | 2003-07-31 16:45:37 +0000 | [diff] [blame] | 344 | if test -d /localhome/${USER} |
| 345 | then |
| 346 | AC_SUBST(OBJROOT,[/localhome/${USER}]) |
| 347 | else |
| 348 | AC_SUBST(OBJROOT,[.]) |
| 349 | fi |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 350 | else |
| 351 | AC_SUBST(OBJROOT,[.]) |
| 352 | fi |
| 353 | |
| 354 | AC_ARG_WITH(objroot,AC_HELP_STRING([--with-objroot],[Location where object files should be placed (default is .)]),AC_SUBST(OBJROOT,[$withval])) |
| 355 | |
| 356 | dnl ************************************************************************** |
John Criswell | de00db2 | 2003-08-25 16:49:54 +0000 | [diff] [blame^] | 357 | dnl * Configure other software packages (via AC_CONFIG_SUBDIRS) |
| 358 | dnl ************************************************************************** |
| 359 | |
| 360 | dnl ************************************************************************** |
John Criswell | c78022e | 2003-07-29 19:11:58 +0000 | [diff] [blame] | 361 | dnl * Create the output files |
| 362 | dnl ************************************************************************** |
John Criswell | 4ea390d | 2003-07-22 19:13:20 +0000 | [diff] [blame] | 363 | AC_OUTPUT(Makefile.config) |