blob: 17ac33f83fbaa90b31f41cfe9919f00534965030 [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]) ;;
31 "llvm-java") AC_CONFIG_SUBDIRS([projects/llvm-java]) ;;
32 "llvm-tv") AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;;
33 "llvm-fefw") AC_CONFIG_SUBDIRS([projects/llvm-fefw]) ;;
34 *) AC_CONFIG_SUBDIRS(${i}) ;;
35 esac
John Criswell33a911a2003-11-25 20:36:46 +000036 fi
37done
John Criswell559a6c12003-09-30 16:31:48 +000038
John Criswelldc76e322004-07-23 15:40:57 +000039dnl Configure header files
Reid Spencer551ccae2004-09-01 22:55:40 +000040AC_CONFIG_HEADERS(include/llvm/Config/config.h)
John Criswelldc76e322004-07-23 15:40:57 +000041
42dnl Configure other output file
43AC_CONFIG_FILES(Makefile.config
Reid Spencer551ccae2004-09-01 22:55:40 +000044 include/llvm/Support/DataTypes.h
45 include/llvm/Support/ThreadSupport.h
46 include/llvm/ADT/hash_map
47 include/llvm/ADT/hash_set
48 include/llvm/ADT/iterator)
John Criswelldc76e322004-07-23 15:40:57 +000049
50dnl Do special configuration of Makefiles
John Criswell2d533082003-09-06 14:46:19 +000051AC_CONFIG_MAKEFILE(Makefile)
52AC_CONFIG_MAKEFILE(Makefile.common)
Reid Spencer367754a2004-08-24 16:31:01 +000053AC_CONFIG_MAKEFILE(examples/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000054AC_CONFIG_MAKEFILE(lib/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000055AC_CONFIG_MAKEFILE(runtime/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000056AC_CONFIG_MAKEFILE(test/Makefile)
57AC_CONFIG_MAKEFILE(test/Makefile.tests)
John Criswellf424d742003-10-07 21:13:47 +000058AC_CONFIG_MAKEFILE(test/QMTest/llvm.py)
59AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py)
John Criswell2d533082003-09-06 14:46:19 +000060AC_CONFIG_MAKEFILE(tools/Makefile)
Chris Lattner5c866e12003-10-06 02:09:25 +000061AC_CONFIG_MAKEFILE(utils/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000062AC_CONFIG_MAKEFILE(projects/Makefile)
John Criswell4ea390d2003-07-22 19:13:20 +000063
Brian Gaeke26be9c52004-01-13 06:43:16 +000064dnl Find the install program (needs to be done before canonical stuff)
John Criswell4ea390d2003-07-22 19:13:20 +000065AC_PROG_INSTALL
66
67dnl Check which host for which we're compiling. This will tell us which LLVM
68dnl compiler will be used for compiling SSA into object code.
69AC_CANONICAL_TARGET
70
Brian Gaeke3e66e8b2003-11-17 00:30:48 +000071dnl Set the "OS" Makefile variable based on the system we are building on.
John Criswell4ea390d2003-07-22 19:13:20 +000072dnl We will use the build machine information to set some variables.
Reid Spencer73fb5482004-08-31 14:20:36 +000073
74AC_MSG_CHECKING([support for generic build operating system])
John Criswell4ea390d2003-07-22 19:13:20 +000075case $build in
Reid Spencer73fb5482004-08-31 14:20:36 +000076 *-*-aix*)
77 AC_SUBST(OS,[AIX])
78 platform_type="AIX"
79 ;;
80 *-*-cygwin*)
81 AC_SUBST(OS,[Cygwin])
82 platform_type="Cygwin"
83 ;;
84 *-*-darwin*)
85 AC_SUBST(OS,[Darwin])
86 platform_type="Darwin"
87 ;;
88 *-*-freebsd*)
89 AC_SUBST(OS,[Linux])
Reid Spencera11e4db2004-08-31 18:03:23 +000090 platform_type="FreeBSD"
Reid Spencer73fb5482004-08-31 14:20:36 +000091 ;;
92 *-*-interix*)
93 AC_SUBST(OS,[SunOS])
Reid Spencera11e4db2004-08-31 18:03:23 +000094 platform_type="Interix"
Reid Spencer73fb5482004-08-31 14:20:36 +000095 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +000096 *-*-linux*)
97 AC_SUBST(OS,[Linux])
Reid Spencer59ee4362004-08-29 19:18:05 +000098 platform_type="Linux"
99 if test -d /home/vadve/lattner/local/x86/llvm-gcc
100 then
101 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/])
102 fi
103 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000104 *-*-solaris*)
105 AC_SUBST(OS,[SunOS])
Reid Spencer59ee4362004-08-29 19:18:05 +0000106 platform_type="SunOS"
107 if test -d /home/vadve/lattner/local/sparc/llvm-gcc
108 then
109 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/])
110 fi
111 ;;
Reid Spencer59ee4362004-08-29 19:18:05 +0000112 *-*-win32*)
113 AC_SUBST(OS,[Win32])
114 platform_type="Win32"
115 ;;
Brian Gaeke2f686db2004-09-08 20:32:11 +0000116 *-*-mingw*)
117 AC_SUBST(OS,[Win32])
118 platform_type="Win32"
119 ;;
Reid Spencer59ee4362004-08-29 19:18:05 +0000120 *)
121 AC_SUBST(OS,[Unknown])
122 platform_type="Unknown"
123 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000124esac
125
Reid Spencer886e9512004-08-31 01:34:10 +0000126dnl Make sure we aren't attempting to configure for an unknown system
Reid Spencer73fb5482004-08-31 14:20:36 +0000127if test "$platform_type" = "Unknown" ; then
Reid Spencer886e9512004-08-31 01:34:10 +0000128 AC_MSG_ERROR([Platform is unknown, configure can't continue])
129fi
130
Reid Spencer59ee4362004-08-29 19:18:05 +0000131dnl Make a link from lib/System/platform to lib/System/$platform_type
132dnl This helps the #inclusion of the system specific include files
133dnl for the operating system abstraction library
134AC_CONFIG_LINKS(lib/System/platform:lib/System/$platform_type)
135
Reid Spencer73fb5482004-08-31 14:20:36 +0000136
137AC_MSG_CHECKING(target architecture)
John Criswell4ea390d2003-07-22 19:13:20 +0000138dnl If we are targetting a Sparc machine running Solaris, pretend that it is
139dnl V9, since that is all that we support at the moment, and autoconf will only
140dnl tell us we're a sparc.
John Criswell4ea390d2003-07-22 19:13:20 +0000141case $target in
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000142 sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]])
143 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000144esac
145
John Criswell4ea390d2003-07-22 19:13:20 +0000146dnl Determine what our target architecture is and configure accordingly.
147dnl This will allow Makefiles to make a distinction between the hardware and
148dnl the OS.
John Criswell4ea390d2003-07-22 19:13:20 +0000149case $target in
Reid Spencer73fb5482004-08-31 14:20:36 +0000150 i*86-*)
151 ARCH="x86"
152 AC_SUBST(ARCH,[x86])
153 ;;
154 sparc*-*)
155 ARCH="Sparc"
156 AC_SUBST(ARCH,[Sparc])
157 ;;
158 powerpc*-*)
159 ARCH="PowerPC"
160 AC_SUBST(ARCH,[PowerPC])
161 ;;
162 *)
163 ARCH="Unknown"
164 AC_SUBST(ARCH,[Unknown])
165 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000166esac
167
Reid Spencer73fb5482004-08-31 14:20:36 +0000168AC_MSG_RESULT($ARCH)
169
John Criswell4ea390d2003-07-22 19:13:20 +0000170dnl Check for compilation tools
171AC_PROG_CXX
172AC_PROG_CC(gcc)
John Criswell4ea390d2003-07-22 19:13:20 +0000173dnl Ensure that compilation tools are GCC; we use GCC specific extensions
174if test "$GCC" != "yes"
175then
176 AC_MSG_ERROR([gcc required but not found])
177fi
Reid Spencerc1b0d492004-09-19 23:43:52 +0000178AC_PROG_CPP
179dnl Ensure that compilation tools are GCC; we use GCC specific extensions
John Criswell4ea390d2003-07-22 19:13:20 +0000180if test "$GXX" != "yes"
181then
182 AC_MSG_ERROR([g++ required but not found])
183fi
184
John Criswellde00db22003-08-25 16:49:54 +0000185dnl Verify that GCC is version 3.0 or higher
186gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1`
187if test "$gccmajor" -lt "3"
188then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000189 AC_MSG_ERROR([gcc 3.x required, but you have a lower version])
John Criswellde00db22003-08-25 16:49:54 +0000190fi
191
Brian Gaeke26be9c52004-01-13 06:43:16 +0000192dnl Check for GNU Make. We use its extensions too, so don't build without it
Reid Spencerf7b2de52004-09-07 16:26:18 +0000193AC_CHECK_GNU_MAKE
John Criswell4ea390d2003-07-22 19:13:20 +0000194if test -z "$_cv_gnu_make_command"
195then
196 AC_MSG_ERROR([GNU Make required but not found])
197fi
198
Brian Gaeke26be9c52004-01-13 06:43:16 +0000199dnl Checks for other tools
John Criswell4ea390d2003-07-22 19:13:20 +0000200AC_PROG_FLEX
201AC_PROG_BISON
John Criswell4ea390d2003-07-22 19:13:20 +0000202AC_PROG_LIBTOOL
203
Brian Gaeke26be9c52004-01-13 06:43:16 +0000204dnl Checks for tools we can get away with not having:
205AC_PATH_PROG(DOT,[dot],[true dot])
206AC_PATH_PROG(ETAGS,[etags],[true etags])
Brian Gaeke027b7462004-01-22 21:55:15 +0000207dnl Check if we know how to tell etags we are using C++:
208etags_version=`$ETAGS --version 2>&1`
209case "$etags_version" in
210 *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;;
211 *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;;
212 *) ETAGSFLAGS="" ;;
213esac
214AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
Brian Gaeke26be9c52004-01-13 06:43:16 +0000215AC_PATH_PROG(PYTHON,[python],[true python])
216if test "$PYTHON" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000217then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000218 AC_MSG_WARN([Python is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000219fi
Brian Gaeke26be9c52004-01-13 06:43:16 +0000220AC_PATH_PROG(QMTEST,[qmtest],[true qmtest])
221if test "$QMTEST" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000222then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000223 AC_MSG_WARN([QMTest is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000224fi
John Criswellde00db22003-08-25 16:49:54 +0000225
226dnl Verify that the version of python available is high enough for qmtest
227pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2`
228pymajor=`echo $pyversion | cut -d. -f1`
229pyminor=`echo $pyversion | cut -d. -f2`
230
231if test "$pymajor" -ge "2"
232then
233 if test "$pymajor" -eq "2"
234 then
235 if test "$pyminor" -lt "2"
236 then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000237 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswellde00db22003-08-25 16:49:54 +0000238 fi
239 fi
240else
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 +0000242fi
John Criswell4ea390d2003-07-22 19:13:20 +0000243
Brian Gaeke26be9c52004-01-13 06:43:16 +0000244dnl Checks for libraries:
John Criswell4ea390d2003-07-22 19:13:20 +0000245dnl libelf is for sparc only; we can ignore it if we don't have it
246AC_CHECK_LIB(elf, elf_begin)
247
Brian Gaeke4c423782003-10-07 05:03:36 +0000248dnl dlopen() is required for plugin support.
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000249AC_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 +0000250
251dnl mallinfo is optional; the code can compile (minus features) without it
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000252AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.]))
John Criswell4ea390d2003-07-22 19:13:20 +0000253
Brian Gaeke5f268f72003-12-05 19:29:01 +0000254dnl pthread locking functions are optional - but llvm will not be thread-safe
255dnl without locks.
Brian Gaeke2e3bdba2004-02-23 21:30:36 +0000256AC_SEARCH_LIBS(pthread_mutex_lock,pthread,HAVE_PTHREAD_MUTEX_LOCK=1,HAVE_PTHREAD_MUTEX_LOCK=0)
257AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK)
Brian Gaeke5f268f72003-12-05 19:29:01 +0000258
Brian Gaeke26be9c52004-01-13 06:43:16 +0000259dnl Checks for header files.
260dnl We don't check for ancient stuff or things that are guaranteed to be there
261dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers.
John Criswell4ea390d2003-07-22 19:13:20 +0000262AC_HEADER_STDC
263AC_HEADER_SYS_WAIT
264
Brian Gaeke26be9c52004-01-13 06:43:16 +0000265dnl Checks for POSIX and other various system-specific header files
John Criswellb2815e02004-05-27 20:40:39 +0000266AC_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 +0000267
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000268dnl Check for things that need to be included in public headers, and so
269dnl for which we may not have access to a HAVE_* preprocessor #define.
270dnl (primarily used in DataTypes.h)
271AC_CHECK_HEADER([sys/types.h],
272 [INCLUDE_SYS_TYPES_H='#include <sys/types.h>'],
273 [INCLUDE_SYS_TYPES_H=''])
274AC_SUBST(INCLUDE_SYS_TYPES_H)
275AC_CHECK_HEADER([inttypes.h],
276 [INCLUDE_INTTYPES_H='#include <inttypes.h>'],
277 [INCLUDE_INTTYPES_H=''])
278AC_SUBST(INCLUDE_INTTYPES_H)
John Criswell7ed43ad2004-07-19 16:12:29 +0000279AC_CHECK_HEADER([stdint.h],
280 [INCLUDE_STDINT_H='#include <stdint.h>'],
281 [INCLUDE_STDINT_H=''])
282AC_SUBST(INCLUDE_STDINT_H)
283
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000284
John Criswell4ea390d2003-07-22 19:13:20 +0000285dnl Check for types
286AC_TYPE_PID_T
287AC_TYPE_SIZE_T
288AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
Reid Spencere2c6f512004-09-02 21:38:24 +0000289AC_CHECK_TYPES([uint64_t],,
290 AC_CHECK_TYPES([u_int64_t],,
291 AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found])))
John Criswell4ea390d2003-07-22 19:13:20 +0000292AC_HEADER_TIME
293AC_STRUCT_TM
294
John Criswella0137d32003-10-13 16:22:01 +0000295dnl Check for various C features
296AC_C_PRINTF_A
297
John Criswell0021c312004-02-13 21:57:29 +0000298dnl Check for the endianness of the target
299AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
300
John Criswell4ea390d2003-07-22 19:13:20 +0000301dnl Check for C++ extensions
Brian Gaeke278a4ac2003-11-10 03:06:09 +0000302AC_CXX_HAVE_HASH_MAP
303AC_CXX_HAVE_HASH_SET
John Criswell4ea390d2003-07-22 19:13:20 +0000304AC_CXX_HAVE_STD_ITERATOR
305AC_CXX_HAVE_BI_ITERATOR
306AC_CXX_HAVE_FWD_ITERATOR
307
Brian Gaeke8828eb52004-06-22 23:43:04 +0000308AC_FUNC_ISNAN
Brian Gaeke3869b272004-07-21 03:14:51 +0000309AC_FUNC_ISINF
Brian Gaeke8828eb52004-06-22 23:43:04 +0000310
Brian Gaeke26be9c52004-01-13 06:43:16 +0000311dnl Checks for library functions.
John Criswell4ea390d2003-07-22 19:13:20 +0000312AC_FUNC_ALLOCA
John Criswell4ea390d2003-07-22 19:13:20 +0000313AC_FUNC_MMAP
Brian Gaeke26be9c52004-01-13 06:43:16 +0000314if test "$ac_cv_func_mmap_fixed_mapped" = "no"
315then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000316 AC_MSG_WARN([mmap() required but not found])
Brian Gaeke26be9c52004-01-13 06:43:16 +0000317fi
John Criswell4ea390d2003-07-22 19:13:20 +0000318AC_FUNC_MMAP_FILE
Brian Gaeke26be9c52004-01-13 06:43:16 +0000319if test "$ac_cv_func_mmap_file" = "no"
John Criswell4ea390d2003-07-22 19:13:20 +0000320then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000321 AC_MSG_WARN([mmap() of files required but not found])
John Criswell4ea390d2003-07-22 19:13:20 +0000322fi
323AC_HEADER_MMAP_ANONYMOUS
324AC_TYPE_SIGNAL
Brian Gaeke8828eb52004-06-22 23:43:04 +0000325AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace isatty mkstemp getrusage)
John Criswell4ea390d2003-07-22 19:13:20 +0000326AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found]))
327
John Criswellcb7a1eb2003-11-17 19:46:02 +0000328dnl Determine if the linker supports the -R option.
Brian Gaeke26be9c52004-01-13 06:43:16 +0000329AC_LINK_USE_R
John Criswellcb7a1eb2003-11-17 19:46:02 +0000330
Brian Gaeke26be9c52004-01-13 06:43:16 +0000331dnl --enable/--with command-line options:
332dnl Check whether they want to do an optimized build:
Reid Spencerc1b0d492004-09-19 23:43:52 +0000333AC_ARG_ENABLE(optimized,AS_HELP_STRING(--enable-optimized,Compile with optimizations enabled (default is NO)),,enableval=no)
John Criswell79a8f092003-07-22 20:59:52 +0000334if test ${enableval} = "no"
335then
336 AC_SUBST(ENABLE_OPTIMIZED,[[]])
337else
338 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
339fi
340
John Criswell79a8f092003-07-22 20:59:52 +0000341dnl JIT Option
Reid Spencerc1b0d492004-09-19 23:43:52 +0000342AC_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 +0000343if test ${enableval} = "no"
344then
345 AC_SUBST(JIT,[[]])
346else
John Criswellc78022e2003-07-29 19:11:58 +0000347 case $target in
348 *i*86*)
349 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
350 ;;
351 *sparc*)
352 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
353 ;;
354 *)
355 AC_SUBST(JIT,[[]])
356 ;;
357 esac
John Criswell79a8f092003-07-22 20:59:52 +0000358fi
John Criswell4ea390d2003-07-22 19:13:20 +0000359
Brian Gaeke26be9c52004-01-13 06:43:16 +0000360dnl Find the LLVM GCC-based C/C++ front end
Reid Spencerc1b0d492004-09-19 23:43:52 +0000361AC_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 +0000362AC_MSG_CHECKING([for llvm-gcc])
363LLVM_GCC_CHECK=no
364if test -d "$LLVMGCCDIR"
365then
366 if test -x "$LLVMGCCDIR/bin/gcc"
367 then
368 LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc"
369 fi
370fi
371llvmgccwarn=no
372AC_MSG_RESULT($LLVM_GCC_CHECK)
373if test "$LLVM_GCC_CHECK" = "no"
374then
375 llvmgccwarn=yes
376fi
Brian Gaeke908647f2003-11-16 18:37:46 +0000377AC_MSG_CHECKING([whether llvm-gcc is sane])
378LLVM_GCC_SANE=no
379if test -x "$LLVM_GCC_CHECK"
380then
381 cp /dev/null conftest.c
382 "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1
383 if test $? -eq 0
384 then
385 LLVM_GCC_SANE=yes
386 fi
387 rm conftest.c
Brian Gaeked05e39d2004-01-16 21:31:22 +0000388 llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1`
389 AC_SUBST(LLVMCC1,$llvmcc1path)
390 llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus`
391 AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
Brian Gaeke908647f2003-11-16 18:37:46 +0000392fi
393AC_MSG_RESULT($LLVM_GCC_SANE)
394if test "$LLVM_GCC_SANE" = "no"
395then
396 llvmgccwarn=yes
397fi
398
Brian Gaekecea9a602004-01-21 19:38:56 +0000399dnl Get libtool's idea of what the shared library suffix is.
400dnl (This is a hack; it relies on undocumented behavior.)
401AC_MSG_CHECKING([for shared library suffix])
Reid Spencer26508352004-09-20 03:05:46 +0000402eval "SHLIBEXT=$shrext_cmds"
Brian Gaekecea9a602004-01-21 19:38:56 +0000403AC_MSG_RESULT($SHLIBEXT)
404dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint).
405AC_SUBST(SHLIBEXT,$SHLIBEXT)
406AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT",
407 [Extension that shared libraries have, e.g., ".so".])
408
Reid Spencera91929d2004-08-20 09:03:12 +0000409# Translate the various configuration directories and other basic
410# information into substitutions that will end up in config.h.in so
411# that these configured values can be hard-wired into a program.
412eval LLVM_PREFIX="${prefix}";
413eval LLVM_BINDIR="${prefix}/bin";
414eval LLVM_LIBDIR="${prefix}/lib";
415eval LLVM_DATADIR="${prefix}/data";
416eval LLVM_DOCSDIR="${prefix}/docs";
417eval LLVM_ETCDIR="${prefix}/etc";
418eval LLVM_INCLUDEDIR="${prefix}/include";
419eval LLVM_INFODIR="${prefix}/info";
420eval LLVM_MANDIR="${prefix}/man";
421LLVM_CONFIGTIME=`date`
422AC_SUBST(LLVM_PREFIX)
423AC_SUBST(LLVM_BINDIR)
424AC_SUBST(LLVM_LIBDIR)
425AC_SUBST(LLVM_DATADIR)
426AC_SUBST(LLVM_DOCSDIR)
427AC_SUBST(LLVM_ETCDIR)
428AC_SUBST(LLVM_INCLUDEDIR)
429AC_SUBST(LLVM_INFODIR)
430AC_SUBST(LLVM_MANDIR)
431AC_SUBST(LLVM_CONFIGTIME)
432AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", [Installation prefix directory])
433AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", [Installation directory for binary executables])
434AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR", [Installation directory for libraries])
435AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", [Installation directory for data files])
436AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR", [Installation directory for documentation])
Reid Spencer19d96ee2004-08-20 09:08:57 +0000437AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", [Installation directory for config files])
Reid Spencera91929d2004-08-20 09:03:12 +0000438AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", [Installation directory for include files])
439AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", [Installation directory for .info files])
440AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", [Installation directory for man pages])
441AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", [Time at which LLVM was configured])
442
Brian Gaeke26be9c52004-01-13 06:43:16 +0000443dnl Create the output files
Reid Spencerc1b0d492004-09-19 23:43:52 +0000444AC_OUTPUT
Brian Gaeke908647f2003-11-16 18:37:46 +0000445
Brian Gaeke26be9c52004-01-13 06:43:16 +0000446dnl Warn loudly if llvm-gcc was not obviously working
Brian Gaeke908647f2003-11-16 18:37:46 +0000447if test $llvmgccwarn = yes
448then
449 AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not])
450 AC_MSG_WARN([***** appear to be working.])
451 AC_MSG_WARN([***** ])
452 AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.])
453 AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,])
454 AC_MSG_WARN([***** but you should be able to build the llvm tools.])
455fi
Brian Gaekecea9a602004-01-21 19:38:56 +0000456