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