blob: 4ca4296cc6e2ed53fd9c1c3c2a21961ce0309d97 [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
5AC_CONFIG_AUX_DIR([autoconf])
6
John Criswell93e1c722003-09-15 17:04:06 +00007dnl Quit if the source directory has already been configured.
John Criswell1b824322003-09-15 17:19:42 +00008dnl NOTE: This relies upon undocumented autoconf behavior.
9if test ${srcdir} != "."
John Criswell93e1c722003-09-15 17:04:06 +000010then
Reid Spencer551ccae2004-09-01 22:55:40 +000011 if test -f ${srcdir}/include/llvm/Config/config.h
John Criswell1b824322003-09-15 17:19:42 +000012 then
13 AC_MSG_ERROR([Already configured in ${srcdir}])
14 fi
John Criswell93e1c722003-09-15 17:04:06 +000015fi
16
John Criswell33a911a2003-11-25 20:36:46 +000017dnl Configure all of the projects present in our source tree.
John Criswell33a911a2003-11-25 20:36:46 +000018for i in `ls ${srcdir}/projects`
19do
Reid Spencerf7b2de52004-09-07 16:26:18 +000020 if test -d ${srcdir}/projects/${i} ; then
21 case ${i} in
22 "CVS") ;;
23 "sample") AC_CONFIG_SUBDIRS([projects/sample]) ;;
24 "Stacker") AC_CONFIG_SUBDIRS([projects/Stacker]) ;;
25 "llvm-test") AC_CONFIG_SUBDIRS([projects/llvm-test]) ;;
26 "llvm-reopt") AC_CONFIG_SUBDIRS([projects/llvm-reopt]);;
27 "llvm-gcc") AC_CONFIG_SUBDIRS([projects/llvm-gcc]) ;;
28 "llvm-java") AC_CONFIG_SUBDIRS([projects/llvm-java]) ;;
29 "llvm-tv") AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;;
30 "llvm-fefw") AC_CONFIG_SUBDIRS([projects/llvm-fefw]) ;;
31 *) AC_CONFIG_SUBDIRS(${i}) ;;
32 esac
John Criswell33a911a2003-11-25 20:36:46 +000033 fi
34done
John Criswell559a6c12003-09-30 16:31:48 +000035
John Criswelldc76e322004-07-23 15:40:57 +000036dnl Configure header files
Reid Spencer551ccae2004-09-01 22:55:40 +000037AC_CONFIG_HEADERS(include/llvm/Config/config.h)
John Criswelldc76e322004-07-23 15:40:57 +000038
39dnl Configure other output file
40AC_CONFIG_FILES(Makefile.config
Reid Spencer551ccae2004-09-01 22:55:40 +000041 include/llvm/Support/DataTypes.h
42 include/llvm/Support/ThreadSupport.h
43 include/llvm/ADT/hash_map
44 include/llvm/ADT/hash_set
45 include/llvm/ADT/iterator)
John Criswelldc76e322004-07-23 15:40:57 +000046
47dnl Do special configuration of Makefiles
John Criswell2d533082003-09-06 14:46:19 +000048AC_CONFIG_MAKEFILE(Makefile)
49AC_CONFIG_MAKEFILE(Makefile.common)
Reid Spencer367754a2004-08-24 16:31:01 +000050AC_CONFIG_MAKEFILE(examples/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000051AC_CONFIG_MAKEFILE(lib/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000052AC_CONFIG_MAKEFILE(runtime/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000053AC_CONFIG_MAKEFILE(test/Makefile)
54AC_CONFIG_MAKEFILE(test/Makefile.tests)
John Criswellf424d742003-10-07 21:13:47 +000055AC_CONFIG_MAKEFILE(test/QMTest/llvm.py)
56AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py)
John Criswell2d533082003-09-06 14:46:19 +000057AC_CONFIG_MAKEFILE(tools/Makefile)
Chris Lattner5c866e12003-10-06 02:09:25 +000058AC_CONFIG_MAKEFILE(utils/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000059AC_CONFIG_MAKEFILE(projects/Makefile)
John Criswell4ea390d2003-07-22 19:13:20 +000060
Brian Gaeke26be9c52004-01-13 06:43:16 +000061dnl Find the install program (needs to be done before canonical stuff)
John Criswell4ea390d2003-07-22 19:13:20 +000062AC_PROG_INSTALL
63
64dnl Check which host for which we're compiling. This will tell us which LLVM
65dnl compiler will be used for compiling SSA into object code.
66AC_CANONICAL_TARGET
67
Brian Gaeke3e66e8b2003-11-17 00:30:48 +000068dnl Set the "OS" Makefile variable based on the system we are building on.
John Criswell4ea390d2003-07-22 19:13:20 +000069dnl We will use the build machine information to set some variables.
Reid Spencer73fb5482004-08-31 14:20:36 +000070
71AC_MSG_CHECKING([support for generic build operating system])
John Criswell4ea390d2003-07-22 19:13:20 +000072case $build in
Reid Spencer73fb5482004-08-31 14:20:36 +000073 *-*-aix*)
74 AC_SUBST(OS,[AIX])
75 platform_type="AIX"
76 ;;
77 *-*-cygwin*)
78 AC_SUBST(OS,[Cygwin])
79 platform_type="Cygwin"
80 ;;
81 *-*-darwin*)
82 AC_SUBST(OS,[Darwin])
83 platform_type="Darwin"
84 ;;
85 *-*-freebsd*)
86 AC_SUBST(OS,[Linux])
Reid Spencera11e4db2004-08-31 18:03:23 +000087 platform_type="FreeBSD"
Reid Spencer73fb5482004-08-31 14:20:36 +000088 ;;
89 *-*-interix*)
90 AC_SUBST(OS,[SunOS])
Reid Spencera11e4db2004-08-31 18:03:23 +000091 platform_type="Interix"
Reid Spencer73fb5482004-08-31 14:20:36 +000092 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +000093 *-*-linux*)
94 AC_SUBST(OS,[Linux])
Reid Spencer59ee4362004-08-29 19:18:05 +000095 platform_type="Linux"
96 if test -d /home/vadve/lattner/local/x86/llvm-gcc
97 then
98 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/])
99 fi
100 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000101 *-*-solaris*)
102 AC_SUBST(OS,[SunOS])
Reid Spencer59ee4362004-08-29 19:18:05 +0000103 platform_type="SunOS"
104 if test -d /home/vadve/lattner/local/sparc/llvm-gcc
105 then
106 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/])
107 fi
108 ;;
Reid Spencer59ee4362004-08-29 19:18:05 +0000109 *-*-win32*)
110 AC_SUBST(OS,[Win32])
111 platform_type="Win32"
112 ;;
113 *)
114 AC_SUBST(OS,[Unknown])
115 platform_type="Unknown"
116 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000117esac
118
Reid Spencer886e9512004-08-31 01:34:10 +0000119dnl Make sure we aren't attempting to configure for an unknown system
Reid Spencer73fb5482004-08-31 14:20:36 +0000120if test "$platform_type" = "Unknown" ; then
Reid Spencer886e9512004-08-31 01:34:10 +0000121 AC_MSG_ERROR([Platform is unknown, configure can't continue])
122fi
123
Reid Spencer59ee4362004-08-29 19:18:05 +0000124dnl Make a link from lib/System/platform to lib/System/$platform_type
125dnl This helps the #inclusion of the system specific include files
126dnl for the operating system abstraction library
127AC_CONFIG_LINKS(lib/System/platform:lib/System/$platform_type)
128
Reid Spencer73fb5482004-08-31 14:20:36 +0000129AC_MSG_RESULT($platform_type)
130
131AC_MSG_CHECKING(target architecture)
John Criswell4ea390d2003-07-22 19:13:20 +0000132dnl If we are targetting a Sparc machine running Solaris, pretend that it is
133dnl V9, since that is all that we support at the moment, and autoconf will only
134dnl tell us we're a sparc.
John Criswell4ea390d2003-07-22 19:13:20 +0000135case $target in
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000136 sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]])
137 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000138esac
139
John Criswell4ea390d2003-07-22 19:13:20 +0000140dnl Determine what our target architecture is and configure accordingly.
141dnl This will allow Makefiles to make a distinction between the hardware and
142dnl the OS.
John Criswell4ea390d2003-07-22 19:13:20 +0000143case $target in
Reid Spencer73fb5482004-08-31 14:20:36 +0000144 i*86-*)
145 ARCH="x86"
146 AC_SUBST(ARCH,[x86])
147 ;;
148 sparc*-*)
149 ARCH="Sparc"
150 AC_SUBST(ARCH,[Sparc])
151 ;;
152 powerpc*-*)
153 ARCH="PowerPC"
154 AC_SUBST(ARCH,[PowerPC])
155 ;;
156 *)
157 ARCH="Unknown"
158 AC_SUBST(ARCH,[Unknown])
159 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000160esac
161
Reid Spencer73fb5482004-08-31 14:20:36 +0000162AC_MSG_RESULT($ARCH)
163
John Criswell4ea390d2003-07-22 19:13:20 +0000164dnl Check for compilation tools
165AC_PROG_CXX
166AC_PROG_CC(gcc)
167AC_PROG_CPP
168
169dnl Ensure that compilation tools are GCC; we use GCC specific extensions
170if test "$GCC" != "yes"
171then
172 AC_MSG_ERROR([gcc required but not found])
173fi
John Criswell4ea390d2003-07-22 19:13:20 +0000174if test "$GXX" != "yes"
175then
176 AC_MSG_ERROR([g++ required but not found])
177fi
178
John Criswellde00db22003-08-25 16:49:54 +0000179dnl Verify that GCC is version 3.0 or higher
180gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1`
181if test "$gccmajor" -lt "3"
182then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000183 AC_MSG_ERROR([gcc 3.x required, but you have a lower version])
John Criswellde00db22003-08-25 16:49:54 +0000184fi
185
Brian Gaeke26be9c52004-01-13 06:43:16 +0000186dnl Check for GNU Make. We use its extensions too, so don't build without it
Reid Spencerf7b2de52004-09-07 16:26:18 +0000187AC_CHECK_GNU_MAKE
John Criswell4ea390d2003-07-22 19:13:20 +0000188if test -z "$_cv_gnu_make_command"
189then
190 AC_MSG_ERROR([GNU Make required but not found])
191fi
192
Brian Gaeke26be9c52004-01-13 06:43:16 +0000193dnl Checks for other tools
John Criswell4ea390d2003-07-22 19:13:20 +0000194AC_PROG_FLEX
195AC_PROG_BISON
John Criswell4ea390d2003-07-22 19:13:20 +0000196AC_PROG_LIBTOOL
197
Brian Gaeke26be9c52004-01-13 06:43:16 +0000198dnl Checks for tools we can get away with not having:
199AC_PATH_PROG(DOT,[dot],[true dot])
200AC_PATH_PROG(ETAGS,[etags],[true etags])
Brian Gaeke027b7462004-01-22 21:55:15 +0000201dnl Check if we know how to tell etags we are using C++:
202etags_version=`$ETAGS --version 2>&1`
203case "$etags_version" in
204 *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;;
205 *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;;
206 *) ETAGSFLAGS="" ;;
207esac
208AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
Brian Gaeke26be9c52004-01-13 06:43:16 +0000209AC_PATH_PROG(PYTHON,[python],[true python])
210if test "$PYTHON" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000211then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000212 AC_MSG_WARN([Python is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000213fi
Brian Gaeke26be9c52004-01-13 06:43:16 +0000214AC_PATH_PROG(QMTEST,[qmtest],[true qmtest])
215if test "$QMTEST" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000216then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000217 AC_MSG_WARN([QMTest is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000218fi
John Criswellde00db22003-08-25 16:49:54 +0000219
220dnl Verify that the version of python available is high enough for qmtest
221pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2`
222pymajor=`echo $pyversion | cut -d. -f1`
223pyminor=`echo $pyversion | cut -d. -f2`
224
225if test "$pymajor" -ge "2"
226then
227 if test "$pymajor" -eq "2"
228 then
229 if test "$pyminor" -lt "2"
230 then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000231 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswellde00db22003-08-25 16:49:54 +0000232 fi
233 fi
234else
Brian Gaeke26be9c52004-01-13 06:43:16 +0000235 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswellde00db22003-08-25 16:49:54 +0000236fi
John Criswell4ea390d2003-07-22 19:13:20 +0000237
238dnl Verify that the source directory is valid
239AC_CONFIG_SRCDIR(["Makefile.config.in"])
240
Brian Gaeke26be9c52004-01-13 06:43:16 +0000241dnl Checks for libraries:
John Criswell4ea390d2003-07-22 19:13:20 +0000242dnl libelf is for sparc only; we can ignore it if we don't have it
243AC_CHECK_LIB(elf, elf_begin)
244
Brian Gaeke4c423782003-10-07 05:03:36 +0000245dnl dlopen() is required for plugin support.
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000246AC_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 +0000247
248dnl mallinfo is optional; the code can compile (minus features) without it
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000249AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.]))
John Criswell4ea390d2003-07-22 19:13:20 +0000250
Brian Gaeke5f268f72003-12-05 19:29:01 +0000251dnl pthread locking functions are optional - but llvm will not be thread-safe
252dnl without locks.
Brian Gaeke2e3bdba2004-02-23 21:30:36 +0000253AC_SEARCH_LIBS(pthread_mutex_lock,pthread,HAVE_PTHREAD_MUTEX_LOCK=1,HAVE_PTHREAD_MUTEX_LOCK=0)
254AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK)
Brian Gaeke5f268f72003-12-05 19:29:01 +0000255
Brian Gaeke26be9c52004-01-13 06:43:16 +0000256dnl Checks for header files.
257dnl We don't check for ancient stuff or things that are guaranteed to be there
258dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers.
John Criswell4ea390d2003-07-22 19:13:20 +0000259AC_HEADER_STDC
260AC_HEADER_SYS_WAIT
261
Brian Gaeke26be9c52004-01-13 06:43:16 +0000262dnl Checks for POSIX and other various system-specific header files
John Criswellb2815e02004-05-27 20:40:39 +0000263AC_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 +0000264
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000265dnl Check for things that need to be included in public headers, and so
266dnl for which we may not have access to a HAVE_* preprocessor #define.
267dnl (primarily used in DataTypes.h)
268AC_CHECK_HEADER([sys/types.h],
269 [INCLUDE_SYS_TYPES_H='#include <sys/types.h>'],
270 [INCLUDE_SYS_TYPES_H=''])
271AC_SUBST(INCLUDE_SYS_TYPES_H)
272AC_CHECK_HEADER([inttypes.h],
273 [INCLUDE_INTTYPES_H='#include <inttypes.h>'],
274 [INCLUDE_INTTYPES_H=''])
275AC_SUBST(INCLUDE_INTTYPES_H)
John Criswell7ed43ad2004-07-19 16:12:29 +0000276AC_CHECK_HEADER([stdint.h],
277 [INCLUDE_STDINT_H='#include <stdint.h>'],
278 [INCLUDE_STDINT_H=''])
279AC_SUBST(INCLUDE_STDINT_H)
280
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000281
John Criswell4ea390d2003-07-22 19:13:20 +0000282dnl Check for types
283AC_TYPE_PID_T
284AC_TYPE_SIZE_T
285AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
Reid Spencere2c6f512004-09-02 21:38:24 +0000286AC_CHECK_TYPES([uint64_t],,
287 AC_CHECK_TYPES([u_int64_t],,
288 AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found])))
John Criswell4ea390d2003-07-22 19:13:20 +0000289AC_HEADER_TIME
290AC_STRUCT_TM
291
John Criswella0137d32003-10-13 16:22:01 +0000292dnl Check for various C features
293AC_C_PRINTF_A
294
John Criswell0021c312004-02-13 21:57:29 +0000295dnl Check for the endianness of the target
296AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
297
John Criswell4ea390d2003-07-22 19:13:20 +0000298dnl Check for C++ extensions
Brian Gaeke278a4ac2003-11-10 03:06:09 +0000299AC_CXX_HAVE_HASH_MAP
300AC_CXX_HAVE_HASH_SET
John Criswell4ea390d2003-07-22 19:13:20 +0000301AC_CXX_HAVE_STD_ITERATOR
302AC_CXX_HAVE_BI_ITERATOR
303AC_CXX_HAVE_FWD_ITERATOR
304
Brian Gaeke8828eb52004-06-22 23:43:04 +0000305AC_FUNC_ISNAN
Brian Gaeke3869b272004-07-21 03:14:51 +0000306AC_FUNC_ISINF
Brian Gaeke8828eb52004-06-22 23:43:04 +0000307
Brian Gaeke26be9c52004-01-13 06:43:16 +0000308dnl Checks for library functions.
John Criswell4ea390d2003-07-22 19:13:20 +0000309AC_FUNC_ALLOCA
John Criswell4ea390d2003-07-22 19:13:20 +0000310AC_FUNC_MMAP
Brian Gaeke26be9c52004-01-13 06:43:16 +0000311if test "$ac_cv_func_mmap_fixed_mapped" = "no"
312then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000313 AC_MSG_WARN([mmap() required but not found])
Brian Gaeke26be9c52004-01-13 06:43:16 +0000314fi
John Criswell4ea390d2003-07-22 19:13:20 +0000315AC_FUNC_MMAP_FILE
Brian Gaeke26be9c52004-01-13 06:43:16 +0000316if test "$ac_cv_func_mmap_file" = "no"
John Criswell4ea390d2003-07-22 19:13:20 +0000317then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000318 AC_MSG_WARN([mmap() of files required but not found])
John Criswell4ea390d2003-07-22 19:13:20 +0000319fi
320AC_HEADER_MMAP_ANONYMOUS
321AC_TYPE_SIGNAL
Brian Gaeke8828eb52004-06-22 23:43:04 +0000322AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace isatty mkstemp getrusage)
John Criswell4ea390d2003-07-22 19:13:20 +0000323AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found]))
324
John Criswellcb7a1eb2003-11-17 19:46:02 +0000325dnl Determine if the linker supports the -R option.
Brian Gaeke26be9c52004-01-13 06:43:16 +0000326AC_LINK_USE_R
John Criswellcb7a1eb2003-11-17 19:46:02 +0000327
Brian Gaeke26be9c52004-01-13 06:43:16 +0000328dnl --enable/--with command-line options:
329dnl Check whether they want to do an optimized build:
John Criswell79a8f092003-07-22 20:59:52 +0000330AC_ARG_ENABLE(optimized,AC_HELP_STRING([--enable-optimized],[Compile with optimizations enabled (default is NO)]),,enableval=no)
331if test ${enableval} = "no"
332then
333 AC_SUBST(ENABLE_OPTIMIZED,[[]])
334else
335 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
336fi
337
John Criswell79a8f092003-07-22 20:59:52 +0000338dnl JIT Option
John Criswellc78022e2003-07-29 19:11:58 +0000339AC_ARG_ENABLE(jit,AC_HELP_STRING([--enable-jit],[Enable Just In Time Compiling (default is YES)]),,enableval=default)
John Criswell79a8f092003-07-22 20:59:52 +0000340if test ${enableval} = "no"
341then
342 AC_SUBST(JIT,[[]])
343else
John Criswellc78022e2003-07-29 19:11:58 +0000344 case $target in
345 *i*86*)
346 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
347 ;;
348 *sparc*)
349 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
350 ;;
351 *)
352 AC_SUBST(JIT,[[]])
353 ;;
354 esac
John Criswell79a8f092003-07-22 20:59:52 +0000355fi
John Criswell4ea390d2003-07-22 19:13:20 +0000356
Brian Gaeke26be9c52004-01-13 06:43:16 +0000357dnl Find the LLVM GCC-based C/C++ front end
John Criswell4ea390d2003-07-22 19:13:20 +0000358AC_ARG_WITH(llvmgccdir,AC_HELP_STRING([--with-llvmgccdir],[Location of LLVM GCC front-end]),AC_SUBST(LLVMGCCDIR,[$withval]))
Brian Gaeke908647f2003-11-16 18:37:46 +0000359AC_MSG_CHECKING([for llvm-gcc])
360LLVM_GCC_CHECK=no
361if test -d "$LLVMGCCDIR"
362then
363 if test -x "$LLVMGCCDIR/bin/gcc"
364 then
365 LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc"
366 fi
367fi
368llvmgccwarn=no
369AC_MSG_RESULT($LLVM_GCC_CHECK)
370if test "$LLVM_GCC_CHECK" = "no"
371then
372 llvmgccwarn=yes
373fi
Brian Gaeke908647f2003-11-16 18:37:46 +0000374AC_MSG_CHECKING([whether llvm-gcc is sane])
375LLVM_GCC_SANE=no
376if test -x "$LLVM_GCC_CHECK"
377then
378 cp /dev/null conftest.c
379 "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1
380 if test $? -eq 0
381 then
382 LLVM_GCC_SANE=yes
383 fi
384 rm conftest.c
Brian Gaeked05e39d2004-01-16 21:31:22 +0000385 llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1`
386 AC_SUBST(LLVMCC1,$llvmcc1path)
387 llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus`
388 AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
Brian Gaeke908647f2003-11-16 18:37:46 +0000389fi
390AC_MSG_RESULT($LLVM_GCC_SANE)
391if test "$LLVM_GCC_SANE" = "no"
392then
393 llvmgccwarn=yes
394fi
395
Brian Gaekecea9a602004-01-21 19:38:56 +0000396dnl Get libtool's idea of what the shared library suffix is.
397dnl (This is a hack; it relies on undocumented behavior.)
398AC_MSG_CHECKING([for shared library suffix])
399eval "SHLIBEXT=$shrext"
400AC_MSG_RESULT($SHLIBEXT)
401dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint).
402AC_SUBST(SHLIBEXT,$SHLIBEXT)
403AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT",
404 [Extension that shared libraries have, e.g., ".so".])
405
Reid Spencera91929d2004-08-20 09:03:12 +0000406# Translate the various configuration directories and other basic
407# information into substitutions that will end up in config.h.in so
408# that these configured values can be hard-wired into a program.
409eval LLVM_PREFIX="${prefix}";
410eval LLVM_BINDIR="${prefix}/bin";
411eval LLVM_LIBDIR="${prefix}/lib";
412eval LLVM_DATADIR="${prefix}/data";
413eval LLVM_DOCSDIR="${prefix}/docs";
414eval LLVM_ETCDIR="${prefix}/etc";
415eval LLVM_INCLUDEDIR="${prefix}/include";
416eval LLVM_INFODIR="${prefix}/info";
417eval LLVM_MANDIR="${prefix}/man";
418LLVM_CONFIGTIME=`date`
419AC_SUBST(LLVM_PREFIX)
420AC_SUBST(LLVM_BINDIR)
421AC_SUBST(LLVM_LIBDIR)
422AC_SUBST(LLVM_DATADIR)
423AC_SUBST(LLVM_DOCSDIR)
424AC_SUBST(LLVM_ETCDIR)
425AC_SUBST(LLVM_INCLUDEDIR)
426AC_SUBST(LLVM_INFODIR)
427AC_SUBST(LLVM_MANDIR)
428AC_SUBST(LLVM_CONFIGTIME)
429AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", [Installation prefix directory])
430AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", [Installation directory for binary executables])
431AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR", [Installation directory for libraries])
432AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", [Installation directory for data files])
433AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR", [Installation directory for documentation])
Reid Spencer19d96ee2004-08-20 09:08:57 +0000434AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", [Installation directory for config files])
Reid Spencera91929d2004-08-20 09:03:12 +0000435AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", [Installation directory for include files])
436AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", [Installation directory for .info files])
437AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", [Installation directory for man pages])
438AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", [Time at which LLVM was configured])
439
Brian Gaeke26be9c52004-01-13 06:43:16 +0000440dnl Create the output files
John Criswelldc76e322004-07-23 15:40:57 +0000441AC_OUTPUT()
Brian Gaeke908647f2003-11-16 18:37:46 +0000442
Brian Gaeke26be9c52004-01-13 06:43:16 +0000443dnl Warn loudly if llvm-gcc was not obviously working
Brian Gaeke908647f2003-11-16 18:37:46 +0000444if test $llvmgccwarn = yes
445then
446 AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not])
447 AC_MSG_WARN([***** appear to be working.])
448 AC_MSG_WARN([***** ])
449 AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.])
450 AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,])
451 AC_MSG_WARN([***** but you should be able to build the llvm tools.])
452fi
Brian Gaekecea9a602004-01-21 19:38:56 +0000453