blob: 82f1eeedfb2b0b1f9c219a653bed0d240fab137f [file] [log] [blame]
Brian Gaeke26be9c52004-01-13 06:43:16 +00001dnl Initialize autoconf
Reid Spencera91929d2004-08-20 09:03:12 +00002AC_INIT([[LLVM]],[[1.4]],[llvmbugs@cs.uiuc.edu])
John Criswell4ea390d2003-07-22 19:13:20 +00003
4dnl Place all of the extra autoconf files into the config subdirectory
Reid Spencerc1b0d492004-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 Criswell4ea390d2003-07-22 19:13:20 +00007AC_CONFIG_AUX_DIR([autoconf])
Reid Spencerc1b0d492004-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 Criswell4ea390d2003-07-22 19:13:20 +000011
John Criswell93e1c722003-09-15 17:04:06 +000012dnl Quit if the source directory has already been configured.
John Criswell1b824322003-09-15 17:19:42 +000013dnl NOTE: This relies upon undocumented autoconf behavior.
Reid Spencerc1b0d492004-09-19 23:43:52 +000014if test ${srcdir} != "." ; then
15 if test -f ${srcdir}/include/llvm/Config/config.h ; then
John Criswell1b824322003-09-15 17:19:42 +000016 AC_MSG_ERROR([Already configured in ${srcdir}])
17 fi
John Criswell93e1c722003-09-15 17:04:06 +000018fi
19
John Criswell33a911a2003-11-25 20:36:46 +000020dnl Configure all of the projects present in our source tree.
John Criswell33a911a2003-11-25 20:36:46 +000021for i in `ls ${srcdir}/projects`
22do
Reid Spencerf7b2de52004-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 Evlogimenos7e2315e2004-09-20 15:45:36 +000031 "Java") AC_CONFIG_SUBDIRS([projects/Java]) ;;
Reid Spencerf7b2de52004-09-07 16:26:18 +000032 "llvm-tv") AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;;
33 "llvm-fefw") AC_CONFIG_SUBDIRS([projects/llvm-fefw]) ;;
Reid Spencerc2186e22004-09-21 17:12:35 +000034 *)
Alkis Evlogimenosa281b6fa2004-09-27 07:35:19 +000035 AC_MSG_WARN([Unknown project (${i}) won't be configured automatically])
Reid Spencerc2186e22004-09-21 17:12:35 +000036 ;;
Reid Spencerf7b2de52004-09-07 16:26:18 +000037 esac
John Criswell33a911a2003-11-25 20:36:46 +000038 fi
39done
John Criswell559a6c12003-09-30 16:31:48 +000040
John Criswelldc76e322004-07-23 15:40:57 +000041dnl Configure header files
Reid Spencer551ccae2004-09-01 22:55:40 +000042AC_CONFIG_HEADERS(include/llvm/Config/config.h)
John Criswelldc76e322004-07-23 15:40:57 +000043
44dnl Configure other output file
John Criswell40468462004-09-24 21:19:06 +000045AC_CONFIG_FILES(Makefile.config)
John Criswell5fbb1f82004-09-24 13:28:51 +000046AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h])
John Criswell9f011862004-09-24 18:28:00 +000047AC_CONFIG_HEADERS([include/llvm/ADT/hash_map])
48AC_CONFIG_HEADERS([include/llvm/ADT/hash_set])
John Criswell40468462004-09-24 21:19:06 +000049AC_CONFIG_HEADERS([include/llvm/Support/ThreadSupport.h])
50AC_CONFIG_HEADERS([include/llvm/ADT/iterator])
John Criswelldc76e322004-07-23 15:40:57 +000051
52dnl Do special configuration of Makefiles
John Criswell2d533082003-09-06 14:46:19 +000053AC_CONFIG_MAKEFILE(Makefile)
54AC_CONFIG_MAKEFILE(Makefile.common)
Reid Spencer367754a2004-08-24 16:31:01 +000055AC_CONFIG_MAKEFILE(examples/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000056AC_CONFIG_MAKEFILE(lib/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000057AC_CONFIG_MAKEFILE(runtime/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000058AC_CONFIG_MAKEFILE(test/Makefile)
59AC_CONFIG_MAKEFILE(test/Makefile.tests)
John Criswellf424d742003-10-07 21:13:47 +000060AC_CONFIG_MAKEFILE(test/QMTest/llvm.py)
61AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py)
John Criswell2d533082003-09-06 14:46:19 +000062AC_CONFIG_MAKEFILE(tools/Makefile)
Misha Brukman824e83d2004-10-14 18:59:09 +000063AC_CONFIG_MAKEFILE(tools/Makefile.JIT)
Chris Lattner5c866e12003-10-06 02:09:25 +000064AC_CONFIG_MAKEFILE(utils/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000065AC_CONFIG_MAKEFILE(projects/Makefile)
John Criswell4ea390d2003-07-22 19:13:20 +000066
Brian Gaeke26be9c52004-01-13 06:43:16 +000067dnl Find the install program (needs to be done before canonical stuff)
John Criswell4ea390d2003-07-22 19:13:20 +000068AC_PROG_INSTALL
69
70dnl Check which host for which we're compiling. This will tell us which LLVM
71dnl compiler will be used for compiling SSA into object code.
72AC_CANONICAL_TARGET
73
Brian Gaeke3e66e8b2003-11-17 00:30:48 +000074dnl Set the "OS" Makefile variable based on the system we are building on.
John Criswell4ea390d2003-07-22 19:13:20 +000075dnl We will use the build machine information to set some variables.
Reid Spencer73fb5482004-08-31 14:20:36 +000076
77AC_MSG_CHECKING([support for generic build operating system])
John Criswell4ea390d2003-07-22 19:13:20 +000078case $build in
Reid Spencer73fb5482004-08-31 14:20:36 +000079 *-*-aix*)
80 AC_SUBST(OS,[AIX])
81 platform_type="AIX"
82 ;;
83 *-*-cygwin*)
84 AC_SUBST(OS,[Cygwin])
85 platform_type="Cygwin"
86 ;;
87 *-*-darwin*)
88 AC_SUBST(OS,[Darwin])
89 platform_type="Darwin"
90 ;;
91 *-*-freebsd*)
92 AC_SUBST(OS,[Linux])
Reid Spencera11e4db2004-08-31 18:03:23 +000093 platform_type="FreeBSD"
Reid Spencer73fb5482004-08-31 14:20:36 +000094 ;;
95 *-*-interix*)
96 AC_SUBST(OS,[SunOS])
Reid Spencera11e4db2004-08-31 18:03:23 +000097 platform_type="Interix"
Reid Spencer73fb5482004-08-31 14:20:36 +000098 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +000099 *-*-linux*)
100 AC_SUBST(OS,[Linux])
Reid Spencer59ee4362004-08-29 19:18:05 +0000101 platform_type="Linux"
102 if test -d /home/vadve/lattner/local/x86/llvm-gcc
103 then
104 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/])
105 fi
106 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000107 *-*-solaris*)
108 AC_SUBST(OS,[SunOS])
Reid Spencer59ee4362004-08-29 19:18:05 +0000109 platform_type="SunOS"
110 if test -d /home/vadve/lattner/local/sparc/llvm-gcc
111 then
112 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/])
113 fi
114 ;;
Reid Spencer59ee4362004-08-29 19:18:05 +0000115 *-*-win32*)
116 AC_SUBST(OS,[Win32])
117 platform_type="Win32"
118 ;;
Brian Gaeke2f686db2004-09-08 20:32:11 +0000119 *-*-mingw*)
120 AC_SUBST(OS,[Win32])
121 platform_type="Win32"
122 ;;
Reid Spencer59ee4362004-08-29 19:18:05 +0000123 *)
124 AC_SUBST(OS,[Unknown])
125 platform_type="Unknown"
126 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000127esac
128
Reid Spencer886e9512004-08-31 01:34:10 +0000129dnl Make sure we aren't attempting to configure for an unknown system
Reid Spencer73fb5482004-08-31 14:20:36 +0000130if test "$platform_type" = "Unknown" ; then
Reid Spencer886e9512004-08-31 01:34:10 +0000131 AC_MSG_ERROR([Platform is unknown, configure can't continue])
132fi
133
Reid Spencer59ee4362004-08-29 19:18:05 +0000134dnl Make a link from lib/System/platform to lib/System/$platform_type
135dnl This helps the #inclusion of the system specific include files
136dnl for the operating system abstraction library
137AC_CONFIG_LINKS(lib/System/platform:lib/System/$platform_type)
138
Reid Spencer73fb5482004-08-31 14:20:36 +0000139
140AC_MSG_CHECKING(target architecture)
John Criswell4ea390d2003-07-22 19:13:20 +0000141dnl If we are targetting a Sparc machine running Solaris, pretend that it is
142dnl V9, since that is all that we support at the moment, and autoconf will only
143dnl tell us we're a sparc.
John Criswell4ea390d2003-07-22 19:13:20 +0000144case $target in
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000145 sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]])
146 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000147esac
148
John Criswell4ea390d2003-07-22 19:13:20 +0000149dnl Determine what our target architecture is and configure accordingly.
150dnl This will allow Makefiles to make a distinction between the hardware and
151dnl the OS.
John Criswell4ea390d2003-07-22 19:13:20 +0000152case $target in
Reid Spencer73fb5482004-08-31 14:20:36 +0000153 i*86-*)
154 ARCH="x86"
155 AC_SUBST(ARCH,[x86])
156 ;;
157 sparc*-*)
158 ARCH="Sparc"
159 AC_SUBST(ARCH,[Sparc])
160 ;;
161 powerpc*-*)
162 ARCH="PowerPC"
163 AC_SUBST(ARCH,[PowerPC])
164 ;;
165 *)
166 ARCH="Unknown"
167 AC_SUBST(ARCH,[Unknown])
168 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000169esac
170
Reid Spencer73fb5482004-08-31 14:20:36 +0000171AC_MSG_RESULT($ARCH)
172
John Criswell4ea390d2003-07-22 19:13:20 +0000173dnl Check for compilation tools
174AC_PROG_CXX
175AC_PROG_CC(gcc)
John Criswell4ea390d2003-07-22 19:13:20 +0000176dnl Ensure that compilation tools are GCC; we use GCC specific extensions
177if test "$GCC" != "yes"
178then
179 AC_MSG_ERROR([gcc required but not found])
180fi
Reid Spencerc1b0d492004-09-19 23:43:52 +0000181AC_PROG_CPP
182dnl Ensure that compilation tools are GCC; we use GCC specific extensions
John Criswell4ea390d2003-07-22 19:13:20 +0000183if test "$GXX" != "yes"
184then
185 AC_MSG_ERROR([g++ required but not found])
186fi
187
John Criswellde00db22003-08-25 16:49:54 +0000188dnl Verify that GCC is version 3.0 or higher
189gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1`
190if test "$gccmajor" -lt "3"
191then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000192 AC_MSG_ERROR([gcc 3.x required, but you have a lower version])
John Criswellde00db22003-08-25 16:49:54 +0000193fi
194
Brian Gaeke26be9c52004-01-13 06:43:16 +0000195dnl Check for GNU Make. We use its extensions too, so don't build without it
Reid Spencerf7b2de52004-09-07 16:26:18 +0000196AC_CHECK_GNU_MAKE
John Criswell4ea390d2003-07-22 19:13:20 +0000197if test -z "$_cv_gnu_make_command"
198then
199 AC_MSG_ERROR([GNU Make required but not found])
200fi
201
Brian Gaeke26be9c52004-01-13 06:43:16 +0000202dnl Checks for other tools
John Criswell4ea390d2003-07-22 19:13:20 +0000203AC_PROG_FLEX
204AC_PROG_BISON
John Criswell4ea390d2003-07-22 19:13:20 +0000205AC_PROG_LIBTOOL
Reid Spencerad354c92004-10-25 08:18:47 +0000206AC_PATH_PROG(TAR,[tar],[gtar])
John Criswell4ea390d2003-07-22 19:13:20 +0000207
Brian Gaeke26be9c52004-01-13 06:43:16 +0000208dnl Checks for tools we can get away with not having:
209AC_PATH_PROG(DOT,[dot],[true dot])
210AC_PATH_PROG(ETAGS,[etags],[true etags])
Brian Gaeke027b7462004-01-22 21:55:15 +0000211dnl Check if we know how to tell etags we are using C++:
212etags_version=`$ETAGS --version 2>&1`
213case "$etags_version" in
214 *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;;
215 *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;;
216 *) ETAGSFLAGS="" ;;
217esac
218AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
Brian Gaeke26be9c52004-01-13 06:43:16 +0000219AC_PATH_PROG(PYTHON,[python],[true python])
220if test "$PYTHON" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000221then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000222 AC_MSG_WARN([Python is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000223fi
Brian Gaeke26be9c52004-01-13 06:43:16 +0000224AC_PATH_PROG(QMTEST,[qmtest],[true qmtest])
225if test "$QMTEST" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000226then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000227 AC_MSG_WARN([QMTest is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000228fi
John Criswellde00db22003-08-25 16:49:54 +0000229
230dnl Verify that the version of python available is high enough for qmtest
231pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2`
232pymajor=`echo $pyversion | cut -d. -f1`
233pyminor=`echo $pyversion | cut -d. -f2`
234
235if test "$pymajor" -ge "2"
236then
237 if test "$pymajor" -eq "2"
238 then
239 if test "$pyminor" -lt "2"
240 then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000241 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswellde00db22003-08-25 16:49:54 +0000242 fi
243 fi
244else
Brian Gaeke26be9c52004-01-13 06:43:16 +0000245 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswellde00db22003-08-25 16:49:54 +0000246fi
John Criswell4ea390d2003-07-22 19:13:20 +0000247
Brian Gaeke26be9c52004-01-13 06:43:16 +0000248dnl Checks for libraries:
John Criswell4ea390d2003-07-22 19:13:20 +0000249dnl libelf is for sparc only; we can ignore it if we don't have it
250AC_CHECK_LIB(elf, elf_begin)
251
Reid Spencerc28d7ad2004-10-02 08:50:58 +0000252dnl Check for bzip2 and zlib compression libraries needed for archive reading/writing
253AC_CHECK_LIB(bz2,BZ2_bzCompressInit,[bzip2_found=1],[bzip2_found=0])
Reid Spencer0d98aed2004-10-04 22:05:53 +0000254AC_CHECK_HEADERS([bzlib.h],[bzlib_h_found=1],[bzlib_h_found=0],[])
Reid Spencerc28d7ad2004-10-02 08:50:58 +0000255AC_CHECK_LIB(z,gzopen,[zlib_found=1],[zlib_found=0])
Reid Spencer0d98aed2004-10-04 22:05:53 +0000256AC_CHECK_HEADERS([zlib.h],[zlib_h_found=1],[zlib_h_found=0],[])
257if test $zlib_found -eq 1 -a $zlib_h_found -eq 1; then
Reid Spencerc28d7ad2004-10-02 08:50:58 +0000258 AC_DEFINE([HAVE_ZLIB],[1],[Define if zlib library is available on this platform.])
Reid Spencer0d98aed2004-10-04 22:05:53 +0000259 AC_SUBST([HAVE_ZLIB],[1])
260else
261 AC_SUBST([HAVE_ZLIB],[0])
Reid Spencerc28d7ad2004-10-02 08:50:58 +0000262fi
Reid Spencer0d98aed2004-10-04 22:05:53 +0000263if test $bzip2_found -eq 1 -a $bzlib_h_found -eq 1 ; then
Reid Spencerc28d7ad2004-10-02 08:50:58 +0000264 AC_DEFINE([HAVE_BZIP2],[1],[Define if bzip2 library is available on this platform.])
Reid Spencer0d98aed2004-10-04 22:05:53 +0000265 AC_SUBST([HAVE_BZIP2],[1])
266else
267 AC_SUBST([HAVE_BZIP2],[0])
Reid Spencerc28d7ad2004-10-02 08:50:58 +0000268fi
Brian Gaeke4c423782003-10-07 05:03:36 +0000269dnl dlopen() is required for plugin support.
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000270AC_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 Criswell4ea390d2003-07-22 19:13:20 +0000271
272dnl mallinfo is optional; the code can compile (minus features) without it
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000273AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.]))
John Criswell4ea390d2003-07-22 19:13:20 +0000274
Brian Gaeke5f268f72003-12-05 19:29:01 +0000275dnl pthread locking functions are optional - but llvm will not be thread-safe
276dnl without locks.
John Criswell40468462004-09-24 21:19:06 +0000277AC_SEARCH_LIBS(pthread_mutex_lock,pthread,AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1],[Have pthread_mutex_lock]))
278dnl AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK)
Brian Gaeke5f268f72003-12-05 19:29:01 +0000279
Brian Gaeke26be9c52004-01-13 06:43:16 +0000280dnl Checks for header files.
281dnl We don't check for ancient stuff or things that are guaranteed to be there
282dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers.
John Criswell4ea390d2003-07-22 19:13:20 +0000283AC_HEADER_STDC
284AC_HEADER_SYS_WAIT
285
Brian Gaeke26be9c52004-01-13 06:43:16 +0000286dnl Checks for POSIX and other various system-specific header files
John Criswellb2815e02004-05-27 20:40:39 +0000287AC_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 Criswell4ea390d2003-07-22 19:13:20 +0000288
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000289dnl Check for things that need to be included in public headers, and so
290dnl for which we may not have access to a HAVE_* preprocessor #define.
291dnl (primarily used in DataTypes.h)
John Criswell5fbb1f82004-09-24 13:28:51 +0000292AC_CHECK_HEADER([sys/types.h])
293AC_CHECK_HEADER([inttypes.h])
294AC_CHECK_HEADER([stdint.h])
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000295
John Criswell4ea390d2003-07-22 19:13:20 +0000296dnl Check for types
297AC_TYPE_PID_T
298AC_TYPE_SIZE_T
299AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
Reid Spencere2c6f512004-09-02 21:38:24 +0000300AC_CHECK_TYPES([uint64_t],,
301 AC_CHECK_TYPES([u_int64_t],,
302 AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found])))
John Criswell4ea390d2003-07-22 19:13:20 +0000303AC_HEADER_TIME
304AC_STRUCT_TM
305
John Criswella0137d32003-10-13 16:22:01 +0000306dnl Check for various C features
307AC_C_PRINTF_A
308
John Criswell0021c312004-02-13 21:57:29 +0000309dnl Check for the endianness of the target
310AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
311
John Criswell4ea390d2003-07-22 19:13:20 +0000312dnl Check for C++ extensions
Brian Gaeke278a4ac2003-11-10 03:06:09 +0000313AC_CXX_HAVE_HASH_MAP
314AC_CXX_HAVE_HASH_SET
John Criswell4ea390d2003-07-22 19:13:20 +0000315AC_CXX_HAVE_STD_ITERATOR
316AC_CXX_HAVE_BI_ITERATOR
317AC_CXX_HAVE_FWD_ITERATOR
318
Brian Gaeke8828eb52004-06-22 23:43:04 +0000319AC_FUNC_ISNAN
Brian Gaeke3869b272004-07-21 03:14:51 +0000320AC_FUNC_ISINF
Brian Gaeke8828eb52004-06-22 23:43:04 +0000321
Brian Gaeke26be9c52004-01-13 06:43:16 +0000322dnl Checks for library functions.
John Criswell4ea390d2003-07-22 19:13:20 +0000323AC_FUNC_ALLOCA
John Criswell4ea390d2003-07-22 19:13:20 +0000324AC_FUNC_MMAP
Brian Gaeke26be9c52004-01-13 06:43:16 +0000325if test "$ac_cv_func_mmap_fixed_mapped" = "no"
326then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000327 AC_MSG_WARN([mmap() required but not found])
Brian Gaeke26be9c52004-01-13 06:43:16 +0000328fi
John Criswell4ea390d2003-07-22 19:13:20 +0000329AC_FUNC_MMAP_FILE
Brian Gaeke26be9c52004-01-13 06:43:16 +0000330if test "$ac_cv_func_mmap_file" = "no"
John Criswell4ea390d2003-07-22 19:13:20 +0000331then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000332 AC_MSG_WARN([mmap() of files required but not found])
John Criswell4ea390d2003-07-22 19:13:20 +0000333fi
334AC_HEADER_MMAP_ANONYMOUS
335AC_TYPE_SIGNAL
Brian Gaeke8828eb52004-06-22 23:43:04 +0000336AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace isatty mkstemp getrusage)
John Criswell4ea390d2003-07-22 19:13:20 +0000337AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found]))
338
John Criswellcb7a1eb2003-11-17 19:46:02 +0000339dnl Determine if the linker supports the -R option.
Brian Gaeke26be9c52004-01-13 06:43:16 +0000340AC_LINK_USE_R
John Criswellcb7a1eb2003-11-17 19:46:02 +0000341
Brian Gaeke26be9c52004-01-13 06:43:16 +0000342dnl --enable/--with command-line options:
343dnl Check whether they want to do an optimized build:
Reid Spencerc1b0d492004-09-19 23:43:52 +0000344AC_ARG_ENABLE(optimized,AS_HELP_STRING(--enable-optimized,Compile with optimizations enabled (default is NO)),,enableval=no)
John Criswell79a8f092003-07-22 20:59:52 +0000345if test ${enableval} = "no"
346then
347 AC_SUBST(ENABLE_OPTIMIZED,[[]])
348else
349 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
350fi
351
John Criswell79a8f092003-07-22 20:59:52 +0000352dnl JIT Option
Reid Spencerc1b0d492004-09-19 23:43:52 +0000353AC_ARG_ENABLE(jit,AS_HELP_STRING(--enable-jit,Enable Just In Time Compiling (default is YES)),,enableval=default)
John Criswell79a8f092003-07-22 20:59:52 +0000354if test ${enableval} = "no"
355then
356 AC_SUBST(JIT,[[]])
357else
John Criswellc78022e2003-07-29 19:11:58 +0000358 case $target in
359 *i*86*)
360 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
361 ;;
362 *sparc*)
363 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
364 ;;
365 *)
366 AC_SUBST(JIT,[[]])
367 ;;
368 esac
John Criswell79a8f092003-07-22 20:59:52 +0000369fi
John Criswell4ea390d2003-07-22 19:13:20 +0000370
Brian Gaeke26be9c52004-01-13 06:43:16 +0000371dnl Find the LLVM GCC-based C/C++ front end
Reid Spencerc1b0d492004-09-19 23:43:52 +0000372AC_ARG_WITH(llvmgccdir,AS_HELP_STRING(--with-llvmgccdir,Location of LLVM GCC front-end),AC_SUBST(LLVMGCCDIR,[$withval]))
Brian Gaeke908647f2003-11-16 18:37:46 +0000373AC_MSG_CHECKING([for llvm-gcc])
374LLVM_GCC_CHECK=no
375if test -d "$LLVMGCCDIR"
376then
377 if test -x "$LLVMGCCDIR/bin/gcc"
378 then
379 LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc"
380 fi
381fi
382llvmgccwarn=no
383AC_MSG_RESULT($LLVM_GCC_CHECK)
384if test "$LLVM_GCC_CHECK" = "no"
385then
386 llvmgccwarn=yes
387fi
Brian Gaeke908647f2003-11-16 18:37:46 +0000388AC_MSG_CHECKING([whether llvm-gcc is sane])
389LLVM_GCC_SANE=no
390if test -x "$LLVM_GCC_CHECK"
391then
392 cp /dev/null conftest.c
393 "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1
394 if test $? -eq 0
395 then
396 LLVM_GCC_SANE=yes
397 fi
398 rm conftest.c
Brian Gaeked05e39d2004-01-16 21:31:22 +0000399 llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1`
400 AC_SUBST(LLVMCC1,$llvmcc1path)
401 llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus`
402 AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
Brian Gaeke908647f2003-11-16 18:37:46 +0000403fi
404AC_MSG_RESULT($LLVM_GCC_SANE)
405if test "$LLVM_GCC_SANE" = "no"
406then
407 llvmgccwarn=yes
408fi
409
Brian Gaekecea9a602004-01-21 19:38:56 +0000410dnl Get libtool's idea of what the shared library suffix is.
411dnl (This is a hack; it relies on undocumented behavior.)
412AC_MSG_CHECKING([for shared library suffix])
Reid Spencer26508352004-09-20 03:05:46 +0000413eval "SHLIBEXT=$shrext_cmds"
Brian Gaekecea9a602004-01-21 19:38:56 +0000414AC_MSG_RESULT($SHLIBEXT)
415dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint).
416AC_SUBST(SHLIBEXT,$SHLIBEXT)
417AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT",
418 [Extension that shared libraries have, e.g., ".so".])
419
Reid Spencera91929d2004-08-20 09:03:12 +0000420# Translate the various configuration directories and other basic
421# information into substitutions that will end up in config.h.in so
422# that these configured values can be hard-wired into a program.
423eval LLVM_PREFIX="${prefix}";
424eval LLVM_BINDIR="${prefix}/bin";
425eval LLVM_LIBDIR="${prefix}/lib";
426eval LLVM_DATADIR="${prefix}/data";
427eval LLVM_DOCSDIR="${prefix}/docs";
428eval LLVM_ETCDIR="${prefix}/etc";
429eval LLVM_INCLUDEDIR="${prefix}/include";
430eval LLVM_INFODIR="${prefix}/info";
431eval LLVM_MANDIR="${prefix}/man";
432LLVM_CONFIGTIME=`date`
433AC_SUBST(LLVM_PREFIX)
434AC_SUBST(LLVM_BINDIR)
435AC_SUBST(LLVM_LIBDIR)
436AC_SUBST(LLVM_DATADIR)
437AC_SUBST(LLVM_DOCSDIR)
438AC_SUBST(LLVM_ETCDIR)
439AC_SUBST(LLVM_INCLUDEDIR)
440AC_SUBST(LLVM_INFODIR)
441AC_SUBST(LLVM_MANDIR)
442AC_SUBST(LLVM_CONFIGTIME)
443AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", [Installation prefix directory])
444AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", [Installation directory for binary executables])
445AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR", [Installation directory for libraries])
446AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", [Installation directory for data files])
447AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR", [Installation directory for documentation])
Reid Spencer19d96ee2004-08-20 09:08:57 +0000448AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", [Installation directory for config files])
Reid Spencera91929d2004-08-20 09:03:12 +0000449AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", [Installation directory for include files])
450AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", [Installation directory for .info files])
451AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", [Installation directory for man pages])
452AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", [Time at which LLVM was configured])
453
Brian Gaeke26be9c52004-01-13 06:43:16 +0000454dnl Create the output files
Reid Spencerc1b0d492004-09-19 23:43:52 +0000455AC_OUTPUT
Brian Gaeke908647f2003-11-16 18:37:46 +0000456
Reid Spencer5cb99fb2004-10-04 18:02:55 +0000457dnl Warn if we don't have a compression library
458if test $bzip2_found -ne 1 ; then
459 if test $zlib_found -ne 1 ; then
460 AC_MSG_WARN([*** Neither zlib nor bzip2 compression libraries were found.])
461 AC_MSG_WARN([*** Bytecode archives will not support compression!])
462 AC_MSG_WARN([*** To correct, install the libraries and and re-run configure.])
463 fi
464fi
465
Brian Gaeke26be9c52004-01-13 06:43:16 +0000466dnl Warn loudly if llvm-gcc was not obviously working
Brian Gaeke908647f2003-11-16 18:37:46 +0000467if test $llvmgccwarn = yes
468then
469 AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not])
470 AC_MSG_WARN([***** appear to be working.])
471 AC_MSG_WARN([***** ])
472 AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.])
473 AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,])
474 AC_MSG_WARN([***** but you should be able to build the llvm tools.])
475fi
Brian Gaekecea9a602004-01-21 19:38:56 +0000476