blob: 1335306b70a6337e13f7ff311dc2883b022b206d [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 ;;
Brian Gaeke2f686db2004-09-08 20:32:11 +0000113 *-*-mingw*)
114 AC_SUBST(OS,[Win32])
115 platform_type="Win32"
116 ;;
Reid Spencer59ee4362004-08-29 19:18:05 +0000117 *)
118 AC_SUBST(OS,[Unknown])
119 platform_type="Unknown"
120 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000121esac
122
Reid Spencer886e9512004-08-31 01:34:10 +0000123dnl Make sure we aren't attempting to configure for an unknown system
Reid Spencer73fb5482004-08-31 14:20:36 +0000124if test "$platform_type" = "Unknown" ; then
Reid Spencer886e9512004-08-31 01:34:10 +0000125 AC_MSG_ERROR([Platform is unknown, configure can't continue])
126fi
127
Reid Spencer59ee4362004-08-29 19:18:05 +0000128dnl Make a link from lib/System/platform to lib/System/$platform_type
129dnl This helps the #inclusion of the system specific include files
130dnl for the operating system abstraction library
131AC_CONFIG_LINKS(lib/System/platform:lib/System/$platform_type)
132
Reid Spencer73fb5482004-08-31 14:20:36 +0000133AC_MSG_RESULT($platform_type)
134
135AC_MSG_CHECKING(target architecture)
John Criswell4ea390d2003-07-22 19:13:20 +0000136dnl If we are targetting a Sparc machine running Solaris, pretend that it is
137dnl V9, since that is all that we support at the moment, and autoconf will only
138dnl tell us we're a sparc.
John Criswell4ea390d2003-07-22 19:13:20 +0000139case $target in
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000140 sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]])
141 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000142esac
143
John Criswell4ea390d2003-07-22 19:13:20 +0000144dnl Determine what our target architecture is and configure accordingly.
145dnl This will allow Makefiles to make a distinction between the hardware and
146dnl the OS.
John Criswell4ea390d2003-07-22 19:13:20 +0000147case $target in
Reid Spencer73fb5482004-08-31 14:20:36 +0000148 i*86-*)
149 ARCH="x86"
150 AC_SUBST(ARCH,[x86])
151 ;;
152 sparc*-*)
153 ARCH="Sparc"
154 AC_SUBST(ARCH,[Sparc])
155 ;;
156 powerpc*-*)
157 ARCH="PowerPC"
158 AC_SUBST(ARCH,[PowerPC])
159 ;;
160 *)
161 ARCH="Unknown"
162 AC_SUBST(ARCH,[Unknown])
163 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000164esac
165
Reid Spencer73fb5482004-08-31 14:20:36 +0000166AC_MSG_RESULT($ARCH)
167
John Criswell4ea390d2003-07-22 19:13:20 +0000168dnl Check for compilation tools
169AC_PROG_CXX
170AC_PROG_CC(gcc)
171AC_PROG_CPP
172
173dnl 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
John Criswell4ea390d2003-07-22 19:13:20 +0000178if test "$GXX" != "yes"
179then
180 AC_MSG_ERROR([g++ required but not found])
181fi
182
John Criswellde00db22003-08-25 16:49:54 +0000183dnl Verify that GCC is version 3.0 or higher
184gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1`
185if test "$gccmajor" -lt "3"
186then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000187 AC_MSG_ERROR([gcc 3.x required, but you have a lower version])
John Criswellde00db22003-08-25 16:49:54 +0000188fi
189
Brian Gaeke26be9c52004-01-13 06:43:16 +0000190dnl Check for GNU Make. We use its extensions too, so don't build without it
Reid Spencerf7b2de52004-09-07 16:26:18 +0000191AC_CHECK_GNU_MAKE
John Criswell4ea390d2003-07-22 19:13:20 +0000192if test -z "$_cv_gnu_make_command"
193then
194 AC_MSG_ERROR([GNU Make required but not found])
195fi
196
Brian Gaeke26be9c52004-01-13 06:43:16 +0000197dnl Checks for other tools
John Criswell4ea390d2003-07-22 19:13:20 +0000198AC_PROG_FLEX
199AC_PROG_BISON
John Criswell4ea390d2003-07-22 19:13:20 +0000200AC_PROG_LIBTOOL
201
Brian Gaeke26be9c52004-01-13 06:43:16 +0000202dnl Checks for tools we can get away with not having:
203AC_PATH_PROG(DOT,[dot],[true dot])
204AC_PATH_PROG(ETAGS,[etags],[true etags])
Brian Gaeke027b7462004-01-22 21:55:15 +0000205dnl Check if we know how to tell etags we are using C++:
206etags_version=`$ETAGS --version 2>&1`
207case "$etags_version" in
208 *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;;
209 *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;;
210 *) ETAGSFLAGS="" ;;
211esac
212AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
Brian Gaeke26be9c52004-01-13 06:43:16 +0000213AC_PATH_PROG(PYTHON,[python],[true python])
214if test "$PYTHON" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000215then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000216 AC_MSG_WARN([Python is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000217fi
Brian Gaeke26be9c52004-01-13 06:43:16 +0000218AC_PATH_PROG(QMTEST,[qmtest],[true qmtest])
219if test "$QMTEST" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000220then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000221 AC_MSG_WARN([QMTest is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000222fi
John Criswellde00db22003-08-25 16:49:54 +0000223
224dnl Verify that the version of python available is high enough for qmtest
225pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2`
226pymajor=`echo $pyversion | cut -d. -f1`
227pyminor=`echo $pyversion | cut -d. -f2`
228
229if test "$pymajor" -ge "2"
230then
231 if test "$pymajor" -eq "2"
232 then
233 if test "$pyminor" -lt "2"
234 then
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 +0000236 fi
237 fi
238else
Brian Gaeke26be9c52004-01-13 06:43:16 +0000239 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswellde00db22003-08-25 16:49:54 +0000240fi
John Criswell4ea390d2003-07-22 19:13:20 +0000241
242dnl Verify that the source directory is valid
243AC_CONFIG_SRCDIR(["Makefile.config.in"])
244
Brian Gaeke26be9c52004-01-13 06:43:16 +0000245dnl Checks for libraries:
John Criswell4ea390d2003-07-22 19:13:20 +0000246dnl libelf is for sparc only; we can ignore it if we don't have it
247AC_CHECK_LIB(elf, elf_begin)
248
Brian Gaeke4c423782003-10-07 05:03:36 +0000249dnl dlopen() is required for plugin support.
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000250AC_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 +0000251
252dnl mallinfo is optional; the code can compile (minus features) without it
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000253AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.]))
John Criswell4ea390d2003-07-22 19:13:20 +0000254
Brian Gaeke5f268f72003-12-05 19:29:01 +0000255dnl pthread locking functions are optional - but llvm will not be thread-safe
256dnl without locks.
Brian Gaeke2e3bdba2004-02-23 21:30:36 +0000257AC_SEARCH_LIBS(pthread_mutex_lock,pthread,HAVE_PTHREAD_MUTEX_LOCK=1,HAVE_PTHREAD_MUTEX_LOCK=0)
258AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK)
Brian Gaeke5f268f72003-12-05 19:29:01 +0000259
Brian Gaeke26be9c52004-01-13 06:43:16 +0000260dnl Checks for header files.
261dnl We don't check for ancient stuff or things that are guaranteed to be there
262dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers.
John Criswell4ea390d2003-07-22 19:13:20 +0000263AC_HEADER_STDC
264AC_HEADER_SYS_WAIT
265
Brian Gaeke26be9c52004-01-13 06:43:16 +0000266dnl Checks for POSIX and other various system-specific header files
John Criswellb2815e02004-05-27 20:40:39 +0000267AC_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 +0000268
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000269dnl Check for things that need to be included in public headers, and so
270dnl for which we may not have access to a HAVE_* preprocessor #define.
271dnl (primarily used in DataTypes.h)
272AC_CHECK_HEADER([sys/types.h],
273 [INCLUDE_SYS_TYPES_H='#include <sys/types.h>'],
274 [INCLUDE_SYS_TYPES_H=''])
275AC_SUBST(INCLUDE_SYS_TYPES_H)
276AC_CHECK_HEADER([inttypes.h],
277 [INCLUDE_INTTYPES_H='#include <inttypes.h>'],
278 [INCLUDE_INTTYPES_H=''])
279AC_SUBST(INCLUDE_INTTYPES_H)
John Criswell7ed43ad2004-07-19 16:12:29 +0000280AC_CHECK_HEADER([stdint.h],
281 [INCLUDE_STDINT_H='#include <stdint.h>'],
282 [INCLUDE_STDINT_H=''])
283AC_SUBST(INCLUDE_STDINT_H)
284
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000285
John Criswell4ea390d2003-07-22 19:13:20 +0000286dnl Check for types
287AC_TYPE_PID_T
288AC_TYPE_SIZE_T
289AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
Reid Spencere2c6f512004-09-02 21:38:24 +0000290AC_CHECK_TYPES([uint64_t],,
291 AC_CHECK_TYPES([u_int64_t],,
292 AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found])))
John Criswell4ea390d2003-07-22 19:13:20 +0000293AC_HEADER_TIME
294AC_STRUCT_TM
295
John Criswella0137d32003-10-13 16:22:01 +0000296dnl Check for various C features
297AC_C_PRINTF_A
298
John Criswell0021c312004-02-13 21:57:29 +0000299dnl Check for the endianness of the target
300AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
301
John Criswell4ea390d2003-07-22 19:13:20 +0000302dnl Check for C++ extensions
Brian Gaeke278a4ac2003-11-10 03:06:09 +0000303AC_CXX_HAVE_HASH_MAP
304AC_CXX_HAVE_HASH_SET
John Criswell4ea390d2003-07-22 19:13:20 +0000305AC_CXX_HAVE_STD_ITERATOR
306AC_CXX_HAVE_BI_ITERATOR
307AC_CXX_HAVE_FWD_ITERATOR
308
Brian Gaeke8828eb52004-06-22 23:43:04 +0000309AC_FUNC_ISNAN
Brian Gaeke3869b272004-07-21 03:14:51 +0000310AC_FUNC_ISINF
Brian Gaeke8828eb52004-06-22 23:43:04 +0000311
Brian Gaeke26be9c52004-01-13 06:43:16 +0000312dnl Checks for library functions.
John Criswell4ea390d2003-07-22 19:13:20 +0000313AC_FUNC_ALLOCA
John Criswell4ea390d2003-07-22 19:13:20 +0000314AC_FUNC_MMAP
Brian Gaeke26be9c52004-01-13 06:43:16 +0000315if test "$ac_cv_func_mmap_fixed_mapped" = "no"
316then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000317 AC_MSG_WARN([mmap() required but not found])
Brian Gaeke26be9c52004-01-13 06:43:16 +0000318fi
John Criswell4ea390d2003-07-22 19:13:20 +0000319AC_FUNC_MMAP_FILE
Brian Gaeke26be9c52004-01-13 06:43:16 +0000320if test "$ac_cv_func_mmap_file" = "no"
John Criswell4ea390d2003-07-22 19:13:20 +0000321then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000322 AC_MSG_WARN([mmap() of files required but not found])
John Criswell4ea390d2003-07-22 19:13:20 +0000323fi
324AC_HEADER_MMAP_ANONYMOUS
325AC_TYPE_SIGNAL
Brian Gaeke8828eb52004-06-22 23:43:04 +0000326AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace isatty mkstemp getrusage)
John Criswell4ea390d2003-07-22 19:13:20 +0000327AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found]))
328
John Criswellcb7a1eb2003-11-17 19:46:02 +0000329dnl Determine if the linker supports the -R option.
Brian Gaeke26be9c52004-01-13 06:43:16 +0000330AC_LINK_USE_R
John Criswellcb7a1eb2003-11-17 19:46:02 +0000331
Brian Gaeke26be9c52004-01-13 06:43:16 +0000332dnl --enable/--with command-line options:
333dnl Check whether they want to do an optimized build:
John Criswell79a8f092003-07-22 20:59:52 +0000334AC_ARG_ENABLE(optimized,AC_HELP_STRING([--enable-optimized],[Compile with optimizations enabled (default is NO)]),,enableval=no)
335if test ${enableval} = "no"
336then
337 AC_SUBST(ENABLE_OPTIMIZED,[[]])
338else
339 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
340fi
341
John Criswell79a8f092003-07-22 20:59:52 +0000342dnl JIT Option
John Criswellc78022e2003-07-29 19:11:58 +0000343AC_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 +0000344if test ${enableval} = "no"
345then
346 AC_SUBST(JIT,[[]])
347else
John Criswellc78022e2003-07-29 19:11:58 +0000348 case $target in
349 *i*86*)
350 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
351 ;;
352 *sparc*)
353 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
354 ;;
355 *)
356 AC_SUBST(JIT,[[]])
357 ;;
358 esac
John Criswell79a8f092003-07-22 20:59:52 +0000359fi
John Criswell4ea390d2003-07-22 19:13:20 +0000360
Brian Gaeke26be9c52004-01-13 06:43:16 +0000361dnl Find the LLVM GCC-based C/C++ front end
John Criswell4ea390d2003-07-22 19:13:20 +0000362AC_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 +0000363AC_MSG_CHECKING([for llvm-gcc])
364LLVM_GCC_CHECK=no
365if test -d "$LLVMGCCDIR"
366then
367 if test -x "$LLVMGCCDIR/bin/gcc"
368 then
369 LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc"
370 fi
371fi
372llvmgccwarn=no
373AC_MSG_RESULT($LLVM_GCC_CHECK)
374if test "$LLVM_GCC_CHECK" = "no"
375then
376 llvmgccwarn=yes
377fi
Brian Gaeke908647f2003-11-16 18:37:46 +0000378AC_MSG_CHECKING([whether llvm-gcc is sane])
379LLVM_GCC_SANE=no
380if test -x "$LLVM_GCC_CHECK"
381then
382 cp /dev/null conftest.c
383 "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1
384 if test $? -eq 0
385 then
386 LLVM_GCC_SANE=yes
387 fi
388 rm conftest.c
Brian Gaeked05e39d2004-01-16 21:31:22 +0000389 llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1`
390 AC_SUBST(LLVMCC1,$llvmcc1path)
391 llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus`
392 AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
Brian Gaeke908647f2003-11-16 18:37:46 +0000393fi
394AC_MSG_RESULT($LLVM_GCC_SANE)
395if test "$LLVM_GCC_SANE" = "no"
396then
397 llvmgccwarn=yes
398fi
399
Brian Gaekecea9a602004-01-21 19:38:56 +0000400dnl Get libtool's idea of what the shared library suffix is.
401dnl (This is a hack; it relies on undocumented behavior.)
402AC_MSG_CHECKING([for shared library suffix])
403eval "SHLIBEXT=$shrext"
404AC_MSG_RESULT($SHLIBEXT)
405dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint).
406AC_SUBST(SHLIBEXT,$SHLIBEXT)
407AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT",
408 [Extension that shared libraries have, e.g., ".so".])
409
Reid Spencera91929d2004-08-20 09:03:12 +0000410# Translate the various configuration directories and other basic
411# information into substitutions that will end up in config.h.in so
412# that these configured values can be hard-wired into a program.
413eval LLVM_PREFIX="${prefix}";
414eval LLVM_BINDIR="${prefix}/bin";
415eval LLVM_LIBDIR="${prefix}/lib";
416eval LLVM_DATADIR="${prefix}/data";
417eval LLVM_DOCSDIR="${prefix}/docs";
418eval LLVM_ETCDIR="${prefix}/etc";
419eval LLVM_INCLUDEDIR="${prefix}/include";
420eval LLVM_INFODIR="${prefix}/info";
421eval LLVM_MANDIR="${prefix}/man";
422LLVM_CONFIGTIME=`date`
423AC_SUBST(LLVM_PREFIX)
424AC_SUBST(LLVM_BINDIR)
425AC_SUBST(LLVM_LIBDIR)
426AC_SUBST(LLVM_DATADIR)
427AC_SUBST(LLVM_DOCSDIR)
428AC_SUBST(LLVM_ETCDIR)
429AC_SUBST(LLVM_INCLUDEDIR)
430AC_SUBST(LLVM_INFODIR)
431AC_SUBST(LLVM_MANDIR)
432AC_SUBST(LLVM_CONFIGTIME)
433AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", [Installation prefix directory])
434AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", [Installation directory for binary executables])
435AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR", [Installation directory for libraries])
436AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", [Installation directory for data files])
437AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR", [Installation directory for documentation])
Reid Spencer19d96ee2004-08-20 09:08:57 +0000438AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", [Installation directory for config files])
Reid Spencera91929d2004-08-20 09:03:12 +0000439AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", [Installation directory for include files])
440AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", [Installation directory for .info files])
441AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", [Installation directory for man pages])
442AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", [Time at which LLVM was configured])
443
Brian Gaeke26be9c52004-01-13 06:43:16 +0000444dnl Create the output files
John Criswelldc76e322004-07-23 15:40:57 +0000445AC_OUTPUT()
Brian Gaeke908647f2003-11-16 18:37:46 +0000446
Brian Gaeke26be9c52004-01-13 06:43:16 +0000447dnl Warn loudly if llvm-gcc was not obviously working
Brian Gaeke908647f2003-11-16 18:37:46 +0000448if test $llvmgccwarn = yes
449then
450 AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not])
451 AC_MSG_WARN([***** appear to be working.])
452 AC_MSG_WARN([***** ])
453 AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.])
454 AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,])
455 AC_MSG_WARN([***** but you should be able to build the llvm tools.])
456fi
Brian Gaekecea9a602004-01-21 19:38:56 +0000457