blob: 81806f6b9a24fc74dbf9fdf91591054f3c43694d [file] [log] [blame]
Brian Gaeke2abe7ae2004-01-13 06:43:16 +00001dnl Initialize autoconf
Reid Spencerf9676532004-10-27 23:03:44 +00002AC_INIT([[llvm]],[[1.4]],[llvmbugs@cs.uiuc.edu])
John Criswell7a3334d2003-07-22 19:13:20 +00003
4dnl Place all of the extra autoconf files into the config subdirectory
Reid Spencer2024d0e2004-09-19 23:43:52 +00005dnl Tell various tools where the m4 autoconf macros are
6dnl Have configure verify that the source directory is valid.
John Criswell7a3334d2003-07-22 19:13:20 +00007AC_CONFIG_AUX_DIR([autoconf])
Reid Spencer2024d0e2004-09-19 23:43:52 +00008dnl AC_CONFIG_MACRO_DIR(autoconf/m4)
9dnl Verify that the source directory is valid
10AC_CONFIG_SRCDIR(["Makefile.config.in"])
John Criswell7a3334d2003-07-22 19:13:20 +000011
John Criswell22107a72003-09-15 17:04:06 +000012dnl Quit if the source directory has already been configured.
John Criswellf6778b62003-09-15 17:19:42 +000013dnl NOTE: This relies upon undocumented autoconf behavior.
Reid Spencer2024d0e2004-09-19 23:43:52 +000014if test ${srcdir} != "." ; then
15 if test -f ${srcdir}/include/llvm/Config/config.h ; then
John Criswellf6778b62003-09-15 17:19:42 +000016 AC_MSG_ERROR([Already configured in ${srcdir}])
17 fi
John Criswell22107a72003-09-15 17:04:06 +000018fi
19
John Criswell297baed2003-11-25 20:36:46 +000020dnl Configure all of the projects present in our source tree.
John Criswell297baed2003-11-25 20:36:46 +000021for i in `ls ${srcdir}/projects`
22do
Reid Spencer90de7fb2004-09-07 16:26:18 +000023 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 Evlogimenosdc62cad2004-09-20 15:45:36 +000031 "Java") AC_CONFIG_SUBDIRS([projects/Java]) ;;
Reid Spencer90de7fb2004-09-07 16:26:18 +000032 "llvm-tv") AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;;
33 "llvm-fefw") AC_CONFIG_SUBDIRS([projects/llvm-fefw]) ;;
John Criswell033d2152004-10-28 13:35:00 +000034 "poolalloc") AC_CONFIG_SUBDIRS([projects/poolalloc]) ;;
Reid Spencerc6f9e0f2004-09-21 17:12:35 +000035 *)
Alkis Evlogimenos26227282004-09-27 07:35:19 +000036 AC_MSG_WARN([Unknown project (${i}) won't be configured automatically])
Reid Spencerc6f9e0f2004-09-21 17:12:35 +000037 ;;
Reid Spencer90de7fb2004-09-07 16:26:18 +000038 esac
John Criswell297baed2003-11-25 20:36:46 +000039 fi
40done
John Criswellee7ebdc2003-09-30 16:31:48 +000041
John Criswell9537b042004-07-23 15:40:57 +000042dnl Configure header files
Reid Spencer7c16caa2004-09-01 22:55:40 +000043AC_CONFIG_HEADERS(include/llvm/Config/config.h)
John Criswell9537b042004-07-23 15:40:57 +000044
45dnl Configure other output file
John Criswell71c8d5e2004-09-24 21:19:06 +000046AC_CONFIG_FILES(Makefile.config)
John Criswell3ed86d72004-09-24 13:28:51 +000047AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h])
John Criswell08e72262004-09-24 18:28:00 +000048AC_CONFIG_HEADERS([include/llvm/ADT/hash_map])
49AC_CONFIG_HEADERS([include/llvm/ADT/hash_set])
John Criswell71c8d5e2004-09-24 21:19:06 +000050AC_CONFIG_HEADERS([include/llvm/Support/ThreadSupport.h])
51AC_CONFIG_HEADERS([include/llvm/ADT/iterator])
John Criswell9537b042004-07-23 15:40:57 +000052
53dnl Do special configuration of Makefiles
John Criswell2970d522003-09-06 14:46:19 +000054AC_CONFIG_MAKEFILE(Makefile)
55AC_CONFIG_MAKEFILE(Makefile.common)
Reid Spencera4070072004-08-24 16:31:01 +000056AC_CONFIG_MAKEFILE(examples/Makefile)
John Criswell2970d522003-09-06 14:46:19 +000057AC_CONFIG_MAKEFILE(lib/Makefile)
John Criswell2970d522003-09-06 14:46:19 +000058AC_CONFIG_MAKEFILE(runtime/Makefile)
John Criswell2970d522003-09-06 14:46:19 +000059AC_CONFIG_MAKEFILE(test/Makefile)
60AC_CONFIG_MAKEFILE(test/Makefile.tests)
John Criswelle078b432003-10-07 21:13:47 +000061AC_CONFIG_MAKEFILE(test/QMTest/llvm.py)
62AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py)
John Criswell2970d522003-09-06 14:46:19 +000063AC_CONFIG_MAKEFILE(tools/Makefile)
Misha Brukmane62f4dd2004-10-14 18:59:09 +000064AC_CONFIG_MAKEFILE(tools/Makefile.JIT)
Chris Lattner672edbc2003-10-06 02:09:25 +000065AC_CONFIG_MAKEFILE(utils/Makefile)
John Criswell2970d522003-09-06 14:46:19 +000066AC_CONFIG_MAKEFILE(projects/Makefile)
John Criswell7a3334d2003-07-22 19:13:20 +000067
Brian Gaeke2abe7ae2004-01-13 06:43:16 +000068dnl Find the install program (needs to be done before canonical stuff)
John Criswell7a3334d2003-07-22 19:13:20 +000069AC_PROG_INSTALL
70
71dnl Check which host for which we're compiling. This will tell us which LLVM
72dnl compiler will be used for compiling SSA into object code.
73AC_CANONICAL_TARGET
74
Brian Gaeke7027ed82003-11-17 00:30:48 +000075dnl Set the "OS" Makefile variable based on the system we are building on.
John Criswell7a3334d2003-07-22 19:13:20 +000076dnl We will use the build machine information to set some variables.
Reid Spencer67be17a2004-08-31 14:20:36 +000077
78AC_MSG_CHECKING([support for generic build operating system])
John Criswell7a3334d2003-07-22 19:13:20 +000079case $build in
Reid Spencer67be17a2004-08-31 14:20:36 +000080 *-*-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 Spencerf2531a12004-08-31 18:03:23 +000094 platform_type="FreeBSD"
Reid Spencer67be17a2004-08-31 14:20:36 +000095 ;;
96 *-*-interix*)
97 AC_SUBST(OS,[SunOS])
Reid Spencerf2531a12004-08-31 18:03:23 +000098 platform_type="Interix"
Reid Spencer67be17a2004-08-31 14:20:36 +000099 ;;
Brian Gaeke7027ed82003-11-17 00:30:48 +0000100 *-*-linux*)
101 AC_SUBST(OS,[Linux])
Reid Spencera872cbe2004-08-29 19:18:05 +0000102 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 Gaeke7027ed82003-11-17 00:30:48 +0000108 *-*-solaris*)
109 AC_SUBST(OS,[SunOS])
Reid Spencera872cbe2004-08-29 19:18:05 +0000110 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 Spencera872cbe2004-08-29 19:18:05 +0000116 *-*-win32*)
117 AC_SUBST(OS,[Win32])
118 platform_type="Win32"
119 ;;
Brian Gaekef8d86002004-09-08 20:32:11 +0000120 *-*-mingw*)
121 AC_SUBST(OS,[Win32])
122 platform_type="Win32"
123 ;;
Reid Spencera872cbe2004-08-29 19:18:05 +0000124 *)
125 AC_SUBST(OS,[Unknown])
126 platform_type="Unknown"
127 ;;
John Criswell7a3334d2003-07-22 19:13:20 +0000128esac
129
Reid Spencer1daffa52004-08-31 01:34:10 +0000130dnl Make sure we aren't attempting to configure for an unknown system
Reid Spencer67be17a2004-08-31 14:20:36 +0000131if test "$platform_type" = "Unknown" ; then
Reid Spencer1daffa52004-08-31 01:34:10 +0000132 AC_MSG_ERROR([Platform is unknown, configure can't continue])
133fi
134
Reid Spencera872cbe2004-08-29 19:18:05 +0000135dnl Make a link from lib/System/platform to lib/System/$platform_type
136dnl This helps the #inclusion of the system specific include files
137dnl for the operating system abstraction library
138AC_CONFIG_LINKS(lib/System/platform:lib/System/$platform_type)
139
Reid Spencer67be17a2004-08-31 14:20:36 +0000140
141AC_MSG_CHECKING(target architecture)
John Criswell7a3334d2003-07-22 19:13:20 +0000142dnl If we are targetting a Sparc machine running Solaris, pretend that it is
143dnl V9, since that is all that we support at the moment, and autoconf will only
144dnl tell us we're a sparc.
John Criswell7a3334d2003-07-22 19:13:20 +0000145case $target in
Brian Gaeke7027ed82003-11-17 00:30:48 +0000146 sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]])
147 ;;
John Criswell7a3334d2003-07-22 19:13:20 +0000148esac
149
John Criswell7a3334d2003-07-22 19:13:20 +0000150dnl Determine what our target architecture is and configure accordingly.
151dnl This will allow Makefiles to make a distinction between the hardware and
152dnl the OS.
John Criswell7a3334d2003-07-22 19:13:20 +0000153case $target in
Reid Spencer67be17a2004-08-31 14:20:36 +0000154 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 Criswell7a3334d2003-07-22 19:13:20 +0000170esac
171
Reid Spencer67be17a2004-08-31 14:20:36 +0000172AC_MSG_RESULT($ARCH)
173
John Criswell7a3334d2003-07-22 19:13:20 +0000174dnl Check for compilation tools
175AC_PROG_CXX
176AC_PROG_CC(gcc)
John Criswell7a3334d2003-07-22 19:13:20 +0000177dnl Ensure that compilation tools are GCC; we use GCC specific extensions
178if test "$GCC" != "yes"
179then
180 AC_MSG_ERROR([gcc required but not found])
181fi
Reid Spencer2024d0e2004-09-19 23:43:52 +0000182AC_PROG_CPP
183dnl Ensure that compilation tools are GCC; we use GCC specific extensions
John Criswell7a3334d2003-07-22 19:13:20 +0000184if test "$GXX" != "yes"
185then
186 AC_MSG_ERROR([g++ required but not found])
187fi
188
John Criswell6a47a972003-08-25 16:49:54 +0000189dnl Verify that GCC is version 3.0 or higher
190gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1`
191if test "$gccmajor" -lt "3"
192then
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000193 AC_MSG_ERROR([gcc 3.x required, but you have a lower version])
John Criswell6a47a972003-08-25 16:49:54 +0000194fi
195
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000196dnl Check for GNU Make. We use its extensions too, so don't build without it
Reid Spencer90de7fb2004-09-07 16:26:18 +0000197AC_CHECK_GNU_MAKE
John Criswell7a3334d2003-07-22 19:13:20 +0000198if test -z "$_cv_gnu_make_command"
199then
200 AC_MSG_ERROR([GNU Make required but not found])
201fi
202
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000203dnl Checks for other tools
John Criswell7a3334d2003-07-22 19:13:20 +0000204AC_PROG_FLEX
205AC_PROG_BISON
Reid Spencerc4b5cfc2004-11-18 09:47:37 +0000206AC_LIBTOOL_DLOPEN
John Criswell7a3334d2003-07-22 19:13:20 +0000207AC_PROG_LIBTOOL
Reid Spencer8d0d0052004-10-25 08:18:47 +0000208AC_PATH_PROG(TAR,[tar],[gtar])
John Criswell7a3334d2003-07-22 19:13:20 +0000209
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000210dnl Checks for tools we can get away with not having:
211AC_PATH_PROG(DOT,[dot],[true dot])
212AC_PATH_PROG(ETAGS,[etags],[true etags])
Brian Gaeke3f58a872004-01-22 21:55:15 +0000213dnl Check if we know how to tell etags we are using C++:
214etags_version=`$ETAGS --version 2>&1`
215case "$etags_version" in
216 *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;;
217 *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;;
218 *) ETAGSFLAGS="" ;;
219esac
220AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000221AC_PATH_PROG(PYTHON,[python],[true python])
Reid Spencer6bf36bd2004-11-07 23:29:39 +0000222if test "$PYTHON" = "false" ; then
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000223 AC_MSG_WARN([Python is required for the test suite, but it was not found])
John Criswell31494482003-09-23 15:28:52 +0000224fi
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000225AC_PATH_PROG(QMTEST,[qmtest],[true qmtest])
Reid Spencer6bf36bd2004-11-07 23:29:39 +0000226if test "$QMTEST" = "false" ; then
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000227 AC_MSG_WARN([QMTest is required for the test suite, but it was not found])
John Criswell31494482003-09-23 15:28:52 +0000228fi
Reid Spencer6bf36bd2004-11-07 23:29:39 +0000229AC_PATH_PROG(RUNTEST,[runtest],[true runtest])
230if test "$RUNTEST" = "false" ; then
231 AC_MSG_WARN([runtest (Deja-Gnu) is required for the test sute, but it was not found])
232fi
John Criswell6a47a972003-08-25 16:49:54 +0000233
234dnl Verify that the version of python available is high enough for qmtest
235pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2`
236pymajor=`echo $pyversion | cut -d. -f1`
237pyminor=`echo $pyversion | cut -d. -f2`
238
239if test "$pymajor" -ge "2"
240then
241 if test "$pymajor" -eq "2"
242 then
243 if test "$pyminor" -lt "2"
244 then
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000245 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswell6a47a972003-08-25 16:49:54 +0000246 fi
247 fi
248else
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000249 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswell6a47a972003-08-25 16:49:54 +0000250fi
John Criswell7a3334d2003-07-22 19:13:20 +0000251
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000252dnl Checks for libraries:
John Criswell7a3334d2003-07-22 19:13:20 +0000253dnl libelf is for sparc only; we can ignore it if we don't have it
254AC_CHECK_LIB(elf, elf_begin)
255
Reid Spencerc4b5cfc2004-11-18 09:47:37 +0000256dnl Check for bzip2 and zlib compression libraries needed for archive
257dnl and bytecode compression.
Reid Spencer48741202004-10-02 08:50:58 +0000258AC_CHECK_LIB(z,gzopen,[zlib_found=1],[zlib_found=0])
Reid Spencerc4b5cfc2004-11-18 09:47:37 +0000259if test $zlib_found -eq 1; then
260 AC_DEFINE([HAVE_ZLIB],[1],
261 [Define if zlib library is available on this platform.])
Reid Spencerdefd9692004-10-04 22:05:53 +0000262 AC_SUBST([HAVE_ZLIB],[1])
263else
264 AC_SUBST([HAVE_ZLIB],[0])
Reid Spencer48741202004-10-02 08:50:58 +0000265fi
Reid Spencerc4b5cfc2004-11-18 09:47:37 +0000266
267AC_CHECK_LIB(bz2,BZ2_bzCompressInit,[bzip2_found=1],[bzip2_found=0])
268if test $bzip2_found -eq 1 ; then
269 AC_DEFINE([HAVE_BZIP2],[1],
270 [Define if bzip2 library is available on this platform.])
Reid Spencerdefd9692004-10-04 22:05:53 +0000271 AC_SUBST([HAVE_BZIP2],[1])
272else
273 AC_SUBST([HAVE_BZIP2],[0])
Reid Spencer48741202004-10-02 08:50:58 +0000274fi
Reid Spencerc4b5cfc2004-11-18 09:47:37 +0000275
276dnl lt_dlopen may be required for plugin support.
277AC_SEARCH_LIBS(lt_dlopen,ltdl,AC_DEFINE([HAVE_LT_DLOPEN],[1],
278 [Define if lt_dlopen() is available on this platform]),
279 AC_MSG_WARN([lt_dlopen() not found - plugin support might
280 not be available]))
281
Brian Gaeke25f2a372003-10-07 05:03:36 +0000282dnl dlopen() is required for plugin support.
Brian Gaeked7a702d2003-10-08 21:44:07 +0000283AC_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 Criswell7a3334d2003-07-22 19:13:20 +0000284
285dnl mallinfo is optional; the code can compile (minus features) without it
Brian Gaeked7a702d2003-10-08 21:44:07 +0000286AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.]))
John Criswell7a3334d2003-07-22 19:13:20 +0000287
Brian Gaeke7ee7b402003-12-05 19:29:01 +0000288dnl pthread locking functions are optional - but llvm will not be thread-safe
289dnl without locks.
John Criswell71c8d5e2004-09-24 21:19:06 +0000290AC_SEARCH_LIBS(pthread_mutex_lock,pthread,AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1],[Have pthread_mutex_lock]))
291dnl AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK)
Brian Gaeke7ee7b402003-12-05 19:29:01 +0000292
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000293dnl Checks for header files.
294dnl We don't check for ancient stuff or things that are guaranteed to be there
295dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers.
John Criswell7a3334d2003-07-22 19:13:20 +0000296AC_HEADER_STDC
297AC_HEADER_SYS_WAIT
298
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000299dnl Checks for POSIX and other various system-specific header files
Reid Spencerc4b5cfc2004-11-18 09:47:37 +0000300AC_CHECK_HEADERS([fcntl.h limits.h sys/time.h unistd.h malloc.h sys/mman.h sys/resource.h dlfcn.h ltdl.h link.h execinfo.h windows.h bzlib.h zlib.h])
John Criswell7a3334d2003-07-22 19:13:20 +0000301
Brian Gaeke090ed132004-02-23 22:07:01 +0000302dnl Check for things that need to be included in public headers, and so
303dnl for which we may not have access to a HAVE_* preprocessor #define.
304dnl (primarily used in DataTypes.h)
John Criswell3ed86d72004-09-24 13:28:51 +0000305AC_CHECK_HEADER([sys/types.h])
306AC_CHECK_HEADER([inttypes.h])
307AC_CHECK_HEADER([stdint.h])
Brian Gaeke090ed132004-02-23 22:07:01 +0000308
John Criswell7a3334d2003-07-22 19:13:20 +0000309dnl Check for types
310AC_TYPE_PID_T
311AC_TYPE_SIZE_T
312AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
Reid Spencerab2228a2004-09-02 21:38:24 +0000313AC_CHECK_TYPES([uint64_t],,
314 AC_CHECK_TYPES([u_int64_t],,
315 AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found])))
John Criswell7a3334d2003-07-22 19:13:20 +0000316AC_HEADER_TIME
317AC_STRUCT_TM
318
John Criswell42859552003-10-13 16:22:01 +0000319dnl Check for various C features
320AC_C_PRINTF_A
321
John Criswell3b4195f32004-02-13 21:57:29 +0000322dnl Check for the endianness of the target
323AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
324
John Criswell7a3334d2003-07-22 19:13:20 +0000325dnl Check for C++ extensions
Brian Gaekeb6218572003-11-10 03:06:09 +0000326AC_CXX_HAVE_HASH_MAP
327AC_CXX_HAVE_HASH_SET
John Criswell7a3334d2003-07-22 19:13:20 +0000328AC_CXX_HAVE_STD_ITERATOR
329AC_CXX_HAVE_BI_ITERATOR
330AC_CXX_HAVE_FWD_ITERATOR
331
Brian Gaekebc9bff92004-06-22 23:43:04 +0000332AC_FUNC_ISNAN
Brian Gaeke499b01d2004-07-21 03:14:51 +0000333AC_FUNC_ISINF
Reid Spencerf9676532004-10-27 23:03:44 +0000334AC_FUNC_RAND48
Brian Gaekebc9bff92004-06-22 23:43:04 +0000335
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000336dnl Checks for library functions.
John Criswell7a3334d2003-07-22 19:13:20 +0000337AC_FUNC_ALLOCA
John Criswell7a3334d2003-07-22 19:13:20 +0000338AC_FUNC_MMAP
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000339if test "$ac_cv_func_mmap_fixed_mapped" = "no"
340then
John Criswellb82cbbf2004-05-27 00:57:50 +0000341 AC_MSG_WARN([mmap() required but not found])
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000342fi
John Criswell7a3334d2003-07-22 19:13:20 +0000343AC_FUNC_MMAP_FILE
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000344if test "$ac_cv_func_mmap_file" = "no"
John Criswell7a3334d2003-07-22 19:13:20 +0000345then
John Criswellb82cbbf2004-05-27 00:57:50 +0000346 AC_MSG_WARN([mmap() of files required but not found])
John Criswell7a3334d2003-07-22 19:13:20 +0000347fi
348AC_HEADER_MMAP_ANONYMOUS
349AC_TYPE_SIGNAL
Brian Gaekebc9bff92004-06-22 23:43:04 +0000350AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace isatty mkstemp getrusage)
John Criswell7a3334d2003-07-22 19:13:20 +0000351AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found]))
352
John Criswell6ee0ed52003-11-17 19:46:02 +0000353dnl Determine if the linker supports the -R option.
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000354AC_LINK_USE_R
John Criswell6ee0ed52003-11-17 19:46:02 +0000355
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000356dnl --enable/--with command-line options:
357dnl Check whether they want to do an optimized build:
Reid Spencer2024d0e2004-09-19 23:43:52 +0000358AC_ARG_ENABLE(optimized,AS_HELP_STRING(--enable-optimized,Compile with optimizations enabled (default is NO)),,enableval=no)
John Criswell5ec24d82003-07-22 20:59:52 +0000359if test ${enableval} = "no"
360then
361 AC_SUBST(ENABLE_OPTIMIZED,[[]])
362else
363 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
364fi
365
John Criswell5ec24d82003-07-22 20:59:52 +0000366dnl JIT Option
Reid Spencer2024d0e2004-09-19 23:43:52 +0000367AC_ARG_ENABLE(jit,AS_HELP_STRING(--enable-jit,Enable Just In Time Compiling (default is YES)),,enableval=default)
John Criswell5ec24d82003-07-22 20:59:52 +0000368if test ${enableval} = "no"
369then
370 AC_SUBST(JIT,[[]])
371else
John Criswell4f376922003-07-29 19:11:58 +0000372 case $target in
373 *i*86*)
374 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
375 ;;
376 *sparc*)
377 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
378 ;;
379 *)
380 AC_SUBST(JIT,[[]])
381 ;;
382 esac
John Criswell5ec24d82003-07-22 20:59:52 +0000383fi
John Criswell7a3334d2003-07-22 19:13:20 +0000384
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000385dnl Find the LLVM GCC-based C/C++ front end
Reid Spencer2024d0e2004-09-19 23:43:52 +0000386AC_ARG_WITH(llvmgccdir,AS_HELP_STRING(--with-llvmgccdir,Location of LLVM GCC front-end),AC_SUBST(LLVMGCCDIR,[$withval]))
Brian Gaekedfbd3d42003-11-16 18:37:46 +0000387AC_MSG_CHECKING([for llvm-gcc])
388LLVM_GCC_CHECK=no
389if test -d "$LLVMGCCDIR"
390then
391 if test -x "$LLVMGCCDIR/bin/gcc"
392 then
393 LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc"
394 fi
395fi
396llvmgccwarn=no
397AC_MSG_RESULT($LLVM_GCC_CHECK)
398if test "$LLVM_GCC_CHECK" = "no"
399then
400 llvmgccwarn=yes
401fi
Brian Gaekedfbd3d42003-11-16 18:37:46 +0000402AC_MSG_CHECKING([whether llvm-gcc is sane])
403LLVM_GCC_SANE=no
404if test -x "$LLVM_GCC_CHECK"
405then
406 cp /dev/null conftest.c
407 "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1
408 if test $? -eq 0
409 then
410 LLVM_GCC_SANE=yes
411 fi
412 rm conftest.c
Brian Gaeke423ceca2004-01-16 21:31:22 +0000413 llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1`
414 AC_SUBST(LLVMCC1,$llvmcc1path)
415 llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus`
416 AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
Brian Gaekedfbd3d42003-11-16 18:37:46 +0000417fi
418AC_MSG_RESULT($LLVM_GCC_SANE)
419if test "$LLVM_GCC_SANE" = "no"
420then
421 llvmgccwarn=yes
422fi
423
Brian Gaekecc3676b2004-01-21 19:38:56 +0000424dnl Get libtool's idea of what the shared library suffix is.
425dnl (This is a hack; it relies on undocumented behavior.)
426AC_MSG_CHECKING([for shared library suffix])
Reid Spencera9317d62004-09-20 03:05:46 +0000427eval "SHLIBEXT=$shrext_cmds"
Brian Gaekecc3676b2004-01-21 19:38:56 +0000428AC_MSG_RESULT($SHLIBEXT)
429dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint).
430AC_SUBST(SHLIBEXT,$SHLIBEXT)
431AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT",
432 [Extension that shared libraries have, e.g., ".so".])
433
Reid Spencercf05c122004-08-20 09:03:12 +0000434# Translate the various configuration directories and other basic
435# information into substitutions that will end up in config.h.in so
436# that these configured values can be hard-wired into a program.
437eval LLVM_PREFIX="${prefix}";
438eval LLVM_BINDIR="${prefix}/bin";
439eval LLVM_LIBDIR="${prefix}/lib";
440eval LLVM_DATADIR="${prefix}/data";
441eval LLVM_DOCSDIR="${prefix}/docs";
442eval LLVM_ETCDIR="${prefix}/etc";
443eval LLVM_INCLUDEDIR="${prefix}/include";
444eval LLVM_INFODIR="${prefix}/info";
445eval LLVM_MANDIR="${prefix}/man";
446LLVM_CONFIGTIME=`date`
447AC_SUBST(LLVM_PREFIX)
448AC_SUBST(LLVM_BINDIR)
449AC_SUBST(LLVM_LIBDIR)
450AC_SUBST(LLVM_DATADIR)
451AC_SUBST(LLVM_DOCSDIR)
452AC_SUBST(LLVM_ETCDIR)
453AC_SUBST(LLVM_INCLUDEDIR)
454AC_SUBST(LLVM_INFODIR)
455AC_SUBST(LLVM_MANDIR)
456AC_SUBST(LLVM_CONFIGTIME)
457AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", [Installation prefix directory])
458AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", [Installation directory for binary executables])
459AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR", [Installation directory for libraries])
460AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", [Installation directory for data files])
461AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR", [Installation directory for documentation])
Reid Spencer3b65b0a2004-08-20 09:08:57 +0000462AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", [Installation directory for config files])
Reid Spencercf05c122004-08-20 09:03:12 +0000463AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", [Installation directory for include files])
464AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", [Installation directory for .info files])
465AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", [Installation directory for man pages])
466AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", [Time at which LLVM was configured])
467
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000468dnl Create the output files
Reid Spencer2024d0e2004-09-19 23:43:52 +0000469AC_OUTPUT
Brian Gaekedfbd3d42003-11-16 18:37:46 +0000470
Reid Spencer38b846c2004-10-04 18:02:55 +0000471dnl Warn if we don't have a compression library
472if test $bzip2_found -ne 1 ; then
473 if test $zlib_found -ne 1 ; then
474 AC_MSG_WARN([*** Neither zlib nor bzip2 compression libraries were found.])
475 AC_MSG_WARN([*** Bytecode archives will not support compression!])
476 AC_MSG_WARN([*** To correct, install the libraries and and re-run configure.])
477 fi
478fi
479
Brian Gaeke2abe7ae2004-01-13 06:43:16 +0000480dnl Warn loudly if llvm-gcc was not obviously working
Brian Gaekedfbd3d42003-11-16 18:37:46 +0000481if test $llvmgccwarn = yes
482then
483 AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not])
484 AC_MSG_WARN([***** appear to be working.])
485 AC_MSG_WARN([***** ])
486 AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.])
487 AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,])
488 AC_MSG_WARN([***** but you should be able to build the llvm tools.])
489fi
Brian Gaekecc3676b2004-01-21 19:38:56 +0000490