John Criswell | 7a3334d | 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]) |
| 43 | dnl Turned off DISABLE_LLC_DIFFS now that LLC/x86 is |
| 44 | dnl viable for almost all our test cases. |
| 45 | dnl AC_SUBST(DISABLE_LLC_DIFFS,[[DISABLE_LLC_DIFFS:=1]]) |
| 46 | AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/]) |
| 47 | ;; |
| 48 | |
| 49 | *sparc*) AC_SUBST(OS,[SunOS]) |
| 50 | AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/]) |
| 51 | ;; |
| 52 | |
| 53 | *) AC_SUBST(OS,[Unknown]) |
| 54 | ;; |
| 55 | esac |
| 56 | |
| 57 | dnl |
| 58 | dnl If we are targetting a Sparc machine running Solaris, pretend that it is |
| 59 | dnl V9, since that is all that we support at the moment, and autoconf will only |
| 60 | dnl tell us we're a sparc. |
| 61 | dnl |
| 62 | case $target in |
| 63 | *sparc*solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]]) |
| 64 | ;; |
| 65 | esac |
| 66 | |
| 67 | dnl |
| 68 | dnl Determine what our target architecture is and configure accordingly. |
| 69 | dnl This will allow Makefiles to make a distinction between the hardware and |
| 70 | dnl the OS. |
| 71 | dnl |
| 72 | case $target in |
| 73 | *i*86*) AC_SUBST(ARCH,[x86]) |
| 74 | ;; |
| 75 | *sparc*solaris*) AC_SUBST(ARCH,[Sparc]) |
| 76 | ;; |
| 77 | esac |
| 78 | |
| 79 | dnl ************************************************************************** |
| 80 | dnl * Check for programs. |
| 81 | dnl ************************************************************************** |
| 82 | |
| 83 | dnl Check for compilation tools |
| 84 | AC_PROG_CXX |
| 85 | AC_PROG_CC(gcc) |
| 86 | AC_PROG_CPP |
| 87 | |
| 88 | dnl Ensure that compilation tools are GCC; we use GCC specific extensions |
| 89 | if test "$GCC" != "yes" |
| 90 | then |
| 91 | AC_MSG_ERROR([gcc required but not found]) |
| 92 | fi |
| 93 | |
| 94 | if test "$GXX" != "yes" |
| 95 | then |
| 96 | AC_MSG_ERROR([g++ required but not found]) |
| 97 | fi |
| 98 | |
| 99 | dnl Check for GNU Make. We use its extensions to, so don't build without it |
| 100 | CHECK_GNU_MAKE |
| 101 | if test -z "$_cv_gnu_make_command" |
| 102 | then |
| 103 | AC_MSG_ERROR([GNU Make required but not found]) |
| 104 | fi |
| 105 | |
| 106 | dnl Check for compiler-compiler tools (reminds me of Little Caesar's Pizza) |
| 107 | AC_PROG_FLEX |
| 108 | AC_PROG_BISON |
| 109 | |
| 110 | dnl Check for libtool |
| 111 | AC_PROG_LIBTOOL |
| 112 | |
| 113 | dnl Check for our special programs |
| 114 | AC_PATH_PROG(AR,[ar]) |
| 115 | AC_PATH_PROG(SED,[sed]) |
| 116 | AC_PATH_PROG(RM,[rm]) |
| 117 | AC_PATH_PROG(ECHO,[echo]) |
| 118 | AC_PATH_PROG(MKDIR,[mkdir]) |
| 119 | AC_PATH_PROG(DATE,[date]) |
| 120 | AC_PATH_PROG(MV,[mv]) |
| 121 | AC_PATH_PROG(DOT,[dot]) |
| 122 | AC_PATH_PROG(ETAGS,[etags]) |
| 123 | AC_PATH_PROG(PURIFY,[purify]) |
| 124 | |
| 125 | dnl Verify that the source directory is valid |
| 126 | AC_CONFIG_SRCDIR(["Makefile.config.in"]) |
| 127 | |
| 128 | dnl ************************************************************************** |
| 129 | dnl * Check for libraries. |
| 130 | dnl ************************************************************************** |
| 131 | |
| 132 | dnl libelf is for sparc only; we can ignore it if we don't have it |
| 133 | AC_CHECK_LIB(elf, elf_begin) |
| 134 | |
| 135 | dnl dlopen() is required. If we don't find it, quit. |
| 136 | AC_SEARCH_LIBS(dlopen,dl,,AC_MSG_ERROR([dlopen() required but not found])) |
| 137 | |
| 138 | dnl mallinfo is optional; the code can compile (minus features) without it |
| 139 | AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1])) |
| 140 | |
| 141 | dnl |
| 142 | dnl The math libraries are used by the test code, but not by the actual LLVM |
| 143 | dnl code. |
| 144 | dnl |
| 145 | dnl AC_CHECK_LIB(m, cos) |
| 146 | |
| 147 | dnl ************************************************************************** |
| 148 | dnl * Checks for header files. |
| 149 | dnl * Chances are, if the standard C or POSIX type header files are missing, |
| 150 | dnl * then LLVM just isn't going to compile. However, it is possible that |
| 151 | dnl * the necessary functions/macros will be included from other |
| 152 | dnl * (non-standard and non-obvious) header files. |
| 153 | dnl * |
| 154 | dnl * So, we'll be gracious, give it a chance, and try to go on without |
| 155 | dnl * them. |
| 156 | dnl ************************************************************************** |
| 157 | AC_HEADER_STDC |
| 158 | AC_HEADER_SYS_WAIT |
| 159 | |
| 160 | dnl Check for ANSI C/POSIX header files |
| 161 | AC_CHECK_HEADERS(assert.h fcntl.h limits.h sys/time.h unistd.h errno.h signal.h math.h) |
| 162 | |
| 163 | dnl Check for system specific header files |
| 164 | AC_CHECK_HEADERS(malloc.h strings.h sys/mman.h sys/resource.h) |
| 165 | |
| 166 | dnl Check for header files associated with dlopen and friends |
| 167 | AC_CHECK_HEADERS(dlfcn.h link.h) |
| 168 | |
| 169 | dnl ************************************************************************** |
| 170 | dnl * Checks for typedefs, structures, and compiler characteristics. |
| 171 | dnl ************************************************************************** |
| 172 | |
| 173 | dnl Check for const and inline keywords |
| 174 | AC_C_CONST |
| 175 | AC_C_INLINE |
| 176 | |
| 177 | dnl Check for machine endian-ness |
| 178 | AC_C_BIGENDIAN(AC_DEFINE([ENDIAN_BIG]),AC_DEFINE(ENDIAN_LITTLE)) |
| 179 | |
| 180 | dnl Check for types |
| 181 | AC_TYPE_PID_T |
| 182 | AC_TYPE_SIZE_T |
| 183 | AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found])) |
| 184 | AC_CHECK_TYPES([uint64_t],,AC_MSG_ERROR([Type uint64_t required but not found])) |
| 185 | AC_HEADER_TIME |
| 186 | AC_STRUCT_TM |
| 187 | |
| 188 | dnl Check for C++ extensions |
| 189 | AC_CXX_HAVE_EXT_HASH_MAP |
| 190 | AC_CXX_HAVE_EXT_HASH_SET |
| 191 | AC_CXX_HAVE_EXT_SLIST |
| 192 | AC_CXX_HAVE_STD_ITERATOR |
| 193 | AC_CXX_HAVE_BI_ITERATOR |
| 194 | AC_CXX_HAVE_FWD_ITERATOR |
| 195 | |
| 196 | dnl ************************************************************************** |
| 197 | dnl * Checks for library functions. |
| 198 | dnl ************************************************************************** |
| 199 | AC_FUNC_ALLOCA |
| 200 | AC_PROG_GCC_TRADITIONAL |
| 201 | AC_FUNC_MEMCMP |
| 202 | AC_FUNC_MMAP |
| 203 | AC_FUNC_MMAP_FILE |
| 204 | if test ${ac_cv_func_mmap_file} = "no" |
| 205 | then |
| 206 | AC_MSG_ERROR([mmap() of files required but not found]) |
| 207 | fi |
| 208 | AC_HEADER_MMAP_ANONYMOUS |
| 209 | AC_TYPE_SIGNAL |
| 210 | AC_CHECK_FUNCS(getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol) |
| 211 | |
| 212 | dnl |
| 213 | dnl Need to check mmap for MAP_PRIVATE, MAP_ANONYMOUS, MAP_ANON, MAP_FIXED |
| 214 | dnl MAP_FIXED is only needed for Sparc |
| 215 | dnl MAP_ANON is used for Sparc and BSD |
| 216 | dnl Everyone should have MAP_PRIVATE |
| 217 | dnl |
| 218 | |
| 219 | dnl Check for certain functions (even if we've already found them) so that we |
| 220 | dnl can quit with an error if they are unavailable. |
| 221 | dnl |
| 222 | dnl As the code is made more portable (i.e. less reliant on these functions, |
| 223 | dnl these checks should go away. |
| 224 | AC_CHECK_FUNC(mmap,,AC_MSG_ERROR([Function mmap() required but not found])) |
| 225 | AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found])) |
| 226 | |
| 227 | dnl ************************************************************************** |
| 228 | dnl * Enable various compile-time options |
| 229 | dnl ************************************************************************** |
| 230 | AC_ARG_ENABLE(purify,AC_HELP_STRING([--enable-purify],[Compile with purify (default is NO)]), AC_SUBST(ENABLE_PURIFY,[[ENABLE_PURIFY=1]]), AC_SUBST(ENABLE_PURIFY,[[]])) |
| 231 | AC_ARG_ENABLE(optimized,AC_HELP_STRING([--enable-optimized],[Compile with optimizations enabled (default is NO)]), AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]]), AC_SUBST(ENABLE_OPTIMIZED,[[]])) |
| 232 | AC_ARG_ENABLE(spec,AC_HELP_STRING([--enable-spec],[Compile SPEC benchmarks (default is NO)]), AC_SUBST(USE_SPEC,[[USE_SPEC=1]]), AC_SUBST(USE_SPEC,[[]])) |
| 233 | AC_ARG_ENABLE(precompiled_bytecode,AC_HELP_STRING([--enable-precompiled_bytecode],[Use pre-compiled bytecode (default is NO)]), AC_SUBST(UPB,[[USE_PRECOMPILED_BYTECODE=1]]), AC_SUBST(UPB,[[]])) |
| 234 | case $build in |
| 235 | *i*86*) AC_ARG_ENABLE(jit,AC_HELP_STRING([--enable-jit],[Enable Just In Time Compiling (default is NO)]), AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]), AC_SUBST(JIT,[[]])) |
| 236 | ;; |
| 237 | *) |
| 238 | ;; |
| 239 | esac |
| 240 | |
| 241 | dnl ************************************************************************** |
| 242 | dnl * Set the location of various third-party software packages |
| 243 | dnl ************************************************************************** |
| 244 | 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])) |
| 245 | AC_ARG_WITH(llvmgccdir,AC_HELP_STRING([--with-llvmgccdir],[Location of LLVM GCC front-end]),AC_SUBST(LLVMGCCDIR,[$withval])) |
| 246 | AC_ARG_WITH(bcrepos,AC_HELP_STRING([--with-bcrepos],[Location of Bytecode Repository]),AC_SUBST(BCR,[$withval]),AC_SUBST(BCR,[/home/vadve/lattner/LLVMPrograms])) |
| 247 | AC_ARG_WITH(papi,AC_HELP_STRING([--with-papi],[Location of PAPI]),AC_SUBST(PAPIDIR,[$withval]),AC_SUBST(PAPIDIR,[/home/vadve/shared/papi-2.3.4.1])) |
| 248 | AC_ARG_WITH(objroot,AC_HELP_STRING([--with-objroot],[Location where object files should be placed (default is .)]),AC_SUBST(OBJROOT,[$withval]),AC_SUBST(OBJROOT,[.])) |
| 249 | AC_ARG_WITH(purify,AC_HELP_STRING([--with-purify],[Location of purify program]),AC_SUBST(PURIFY,[$withval])) |
| 250 | |
| 251 | AC_OUTPUT(Makefile.config) |