blob: 0645baadaa5a0edf70f0321fbac06d0680b8b6bc [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 *)
35 AC_MSG_WARN([Unknown projects (${i})won't be configured automatically])
36 ;;
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
45AC_CONFIG_FILES(Makefile.config
Reid Spencer551ccae2004-09-01 22:55:40 +000046 include/llvm/Support/DataTypes.h
47 include/llvm/Support/ThreadSupport.h
48 include/llvm/ADT/hash_map
49 include/llvm/ADT/hash_set
50 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)
Chris Lattner5c866e12003-10-06 02:09:25 +000063AC_CONFIG_MAKEFILE(utils/Makefile)
John Criswell2d533082003-09-06 14:46:19 +000064AC_CONFIG_MAKEFILE(projects/Makefile)
John Criswell4ea390d2003-07-22 19:13:20 +000065
Brian Gaeke26be9c52004-01-13 06:43:16 +000066dnl Find the install program (needs to be done before canonical stuff)
John Criswell4ea390d2003-07-22 19:13:20 +000067AC_PROG_INSTALL
68
69dnl Check which host for which we're compiling. This will tell us which LLVM
70dnl compiler will be used for compiling SSA into object code.
71AC_CANONICAL_TARGET
72
Brian Gaeke3e66e8b2003-11-17 00:30:48 +000073dnl Set the "OS" Makefile variable based on the system we are building on.
John Criswell4ea390d2003-07-22 19:13:20 +000074dnl We will use the build machine information to set some variables.
Reid Spencer73fb5482004-08-31 14:20:36 +000075
76AC_MSG_CHECKING([support for generic build operating system])
John Criswell4ea390d2003-07-22 19:13:20 +000077case $build in
Reid Spencer73fb5482004-08-31 14:20:36 +000078 *-*-aix*)
79 AC_SUBST(OS,[AIX])
80 platform_type="AIX"
81 ;;
82 *-*-cygwin*)
83 AC_SUBST(OS,[Cygwin])
84 platform_type="Cygwin"
85 ;;
86 *-*-darwin*)
87 AC_SUBST(OS,[Darwin])
88 platform_type="Darwin"
89 ;;
90 *-*-freebsd*)
91 AC_SUBST(OS,[Linux])
Reid Spencera11e4db2004-08-31 18:03:23 +000092 platform_type="FreeBSD"
Reid Spencer73fb5482004-08-31 14:20:36 +000093 ;;
94 *-*-interix*)
95 AC_SUBST(OS,[SunOS])
Reid Spencera11e4db2004-08-31 18:03:23 +000096 platform_type="Interix"
Reid Spencer73fb5482004-08-31 14:20:36 +000097 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +000098 *-*-linux*)
99 AC_SUBST(OS,[Linux])
Reid Spencer59ee4362004-08-29 19:18:05 +0000100 platform_type="Linux"
101 if test -d /home/vadve/lattner/local/x86/llvm-gcc
102 then
103 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/])
104 fi
105 ;;
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000106 *-*-solaris*)
107 AC_SUBST(OS,[SunOS])
Reid Spencer59ee4362004-08-29 19:18:05 +0000108 platform_type="SunOS"
109 if test -d /home/vadve/lattner/local/sparc/llvm-gcc
110 then
111 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/])
112 fi
113 ;;
Reid Spencer59ee4362004-08-29 19:18:05 +0000114 *-*-win32*)
115 AC_SUBST(OS,[Win32])
116 platform_type="Win32"
117 ;;
Brian Gaeke2f686db2004-09-08 20:32:11 +0000118 *-*-mingw*)
119 AC_SUBST(OS,[Win32])
120 platform_type="Win32"
121 ;;
Reid Spencer59ee4362004-08-29 19:18:05 +0000122 *)
123 AC_SUBST(OS,[Unknown])
124 platform_type="Unknown"
125 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000126esac
127
Reid Spencer886e9512004-08-31 01:34:10 +0000128dnl Make sure we aren't attempting to configure for an unknown system
Reid Spencer73fb5482004-08-31 14:20:36 +0000129if test "$platform_type" = "Unknown" ; then
Reid Spencer886e9512004-08-31 01:34:10 +0000130 AC_MSG_ERROR([Platform is unknown, configure can't continue])
131fi
132
Reid Spencer59ee4362004-08-29 19:18:05 +0000133dnl Make a link from lib/System/platform to lib/System/$platform_type
134dnl This helps the #inclusion of the system specific include files
135dnl for the operating system abstraction library
136AC_CONFIG_LINKS(lib/System/platform:lib/System/$platform_type)
137
Reid Spencer73fb5482004-08-31 14:20:36 +0000138
139AC_MSG_CHECKING(target architecture)
John Criswell4ea390d2003-07-22 19:13:20 +0000140dnl If we are targetting a Sparc machine running Solaris, pretend that it is
141dnl V9, since that is all that we support at the moment, and autoconf will only
142dnl tell us we're a sparc.
John Criswell4ea390d2003-07-22 19:13:20 +0000143case $target in
Brian Gaeke3e66e8b2003-11-17 00:30:48 +0000144 sparc*-*-solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]])
145 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000146esac
147
John Criswell4ea390d2003-07-22 19:13:20 +0000148dnl Determine what our target architecture is and configure accordingly.
149dnl This will allow Makefiles to make a distinction between the hardware and
150dnl the OS.
John Criswell4ea390d2003-07-22 19:13:20 +0000151case $target in
Reid Spencer73fb5482004-08-31 14:20:36 +0000152 i*86-*)
153 ARCH="x86"
154 AC_SUBST(ARCH,[x86])
155 ;;
156 sparc*-*)
157 ARCH="Sparc"
158 AC_SUBST(ARCH,[Sparc])
159 ;;
160 powerpc*-*)
161 ARCH="PowerPC"
162 AC_SUBST(ARCH,[PowerPC])
163 ;;
164 *)
165 ARCH="Unknown"
166 AC_SUBST(ARCH,[Unknown])
167 ;;
John Criswell4ea390d2003-07-22 19:13:20 +0000168esac
169
Reid Spencer73fb5482004-08-31 14:20:36 +0000170AC_MSG_RESULT($ARCH)
171
John Criswell4ea390d2003-07-22 19:13:20 +0000172dnl Check for compilation tools
173AC_PROG_CXX
174AC_PROG_CC(gcc)
John Criswell4ea390d2003-07-22 19:13:20 +0000175dnl Ensure that compilation tools are GCC; we use GCC specific extensions
176if test "$GCC" != "yes"
177then
178 AC_MSG_ERROR([gcc required but not found])
179fi
Reid Spencerc1b0d492004-09-19 23:43:52 +0000180AC_PROG_CPP
181dnl Ensure that compilation tools are GCC; we use GCC specific extensions
John Criswell4ea390d2003-07-22 19:13:20 +0000182if test "$GXX" != "yes"
183then
184 AC_MSG_ERROR([g++ required but not found])
185fi
186
John Criswellde00db22003-08-25 16:49:54 +0000187dnl Verify that GCC is version 3.0 or higher
188gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1`
189if test "$gccmajor" -lt "3"
190then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000191 AC_MSG_ERROR([gcc 3.x required, but you have a lower version])
John Criswellde00db22003-08-25 16:49:54 +0000192fi
193
Brian Gaeke26be9c52004-01-13 06:43:16 +0000194dnl Check for GNU Make. We use its extensions too, so don't build without it
Reid Spencerf7b2de52004-09-07 16:26:18 +0000195AC_CHECK_GNU_MAKE
John Criswell4ea390d2003-07-22 19:13:20 +0000196if test -z "$_cv_gnu_make_command"
197then
198 AC_MSG_ERROR([GNU Make required but not found])
199fi
200
Brian Gaeke26be9c52004-01-13 06:43:16 +0000201dnl Checks for other tools
John Criswell4ea390d2003-07-22 19:13:20 +0000202AC_PROG_FLEX
203AC_PROG_BISON
John Criswell4ea390d2003-07-22 19:13:20 +0000204AC_PROG_LIBTOOL
205
Brian Gaeke26be9c52004-01-13 06:43:16 +0000206dnl Checks for tools we can get away with not having:
207AC_PATH_PROG(DOT,[dot],[true dot])
208AC_PATH_PROG(ETAGS,[etags],[true etags])
Brian Gaeke027b7462004-01-22 21:55:15 +0000209dnl Check if we know how to tell etags we are using C++:
210etags_version=`$ETAGS --version 2>&1`
211case "$etags_version" in
212 *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;;
213 *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;;
214 *) ETAGSFLAGS="" ;;
215esac
216AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
Brian Gaeke26be9c52004-01-13 06:43:16 +0000217AC_PATH_PROG(PYTHON,[python],[true python])
218if test "$PYTHON" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000219then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000220 AC_MSG_WARN([Python is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000221fi
Brian Gaeke26be9c52004-01-13 06:43:16 +0000222AC_PATH_PROG(QMTEST,[qmtest],[true qmtest])
223if test "$QMTEST" = "false"
John Criswell39827c82003-09-23 15:28:52 +0000224then
Brian Gaeke26be9c52004-01-13 06:43:16 +0000225 AC_MSG_WARN([QMTest is required for the test suite, but it was not found])
John Criswell39827c82003-09-23 15:28:52 +0000226fi
John Criswellde00db22003-08-25 16:49:54 +0000227
228dnl Verify that the version of python available is high enough for qmtest
229pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2`
230pymajor=`echo $pyversion | cut -d. -f1`
231pyminor=`echo $pyversion | cut -d. -f2`
232
233if test "$pymajor" -ge "2"
234then
235 if test "$pymajor" -eq "2"
236 then
237 if test "$pyminor" -lt "2"
238 then
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 +0000240 fi
241 fi
242else
Brian Gaeke26be9c52004-01-13 06:43:16 +0000243 AC_MSG_WARN([QMTest requires Python 2.2 or later])
John Criswellde00db22003-08-25 16:49:54 +0000244fi
John Criswell4ea390d2003-07-22 19:13:20 +0000245
Brian Gaeke26be9c52004-01-13 06:43:16 +0000246dnl Checks for libraries:
John Criswell4ea390d2003-07-22 19:13:20 +0000247dnl libelf is for sparc only; we can ignore it if we don't have it
248AC_CHECK_LIB(elf, elf_begin)
249
Brian Gaeke4c423782003-10-07 05:03:36 +0000250dnl dlopen() is required for plugin support.
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000251AC_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 +0000252
253dnl mallinfo is optional; the code can compile (minus features) without it
Brian Gaekea25d7ca2003-10-08 21:44:07 +0000254AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],[Define if mallinfo() is available on this platform.]))
John Criswell4ea390d2003-07-22 19:13:20 +0000255
Brian Gaeke5f268f72003-12-05 19:29:01 +0000256dnl pthread locking functions are optional - but llvm will not be thread-safe
257dnl without locks.
Brian Gaeke2e3bdba2004-02-23 21:30:36 +0000258AC_SEARCH_LIBS(pthread_mutex_lock,pthread,HAVE_PTHREAD_MUTEX_LOCK=1,HAVE_PTHREAD_MUTEX_LOCK=0)
259AC_SUBST(HAVE_PTHREAD_MUTEX_LOCK)
Brian Gaeke5f268f72003-12-05 19:29:01 +0000260
Brian Gaeke26be9c52004-01-13 06:43:16 +0000261dnl Checks for header files.
262dnl We don't check for ancient stuff or things that are guaranteed to be there
263dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers.
John Criswell4ea390d2003-07-22 19:13:20 +0000264AC_HEADER_STDC
265AC_HEADER_SYS_WAIT
266
Brian Gaeke26be9c52004-01-13 06:43:16 +0000267dnl Checks for POSIX and other various system-specific header files
John Criswellb2815e02004-05-27 20:40:39 +0000268AC_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 +0000269
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000270dnl Check for things that need to be included in public headers, and so
271dnl for which we may not have access to a HAVE_* preprocessor #define.
272dnl (primarily used in DataTypes.h)
273AC_CHECK_HEADER([sys/types.h],
274 [INCLUDE_SYS_TYPES_H='#include <sys/types.h>'],
275 [INCLUDE_SYS_TYPES_H=''])
276AC_SUBST(INCLUDE_SYS_TYPES_H)
277AC_CHECK_HEADER([inttypes.h],
278 [INCLUDE_INTTYPES_H='#include <inttypes.h>'],
279 [INCLUDE_INTTYPES_H=''])
280AC_SUBST(INCLUDE_INTTYPES_H)
John Criswell7ed43ad2004-07-19 16:12:29 +0000281AC_CHECK_HEADER([stdint.h],
282 [INCLUDE_STDINT_H='#include <stdint.h>'],
283 [INCLUDE_STDINT_H=''])
284AC_SUBST(INCLUDE_STDINT_H)
285
Brian Gaeke1133eaf2004-02-23 22:07:01 +0000286
John Criswell4ea390d2003-07-22 19:13:20 +0000287dnl Check for types
288AC_TYPE_PID_T
289AC_TYPE_SIZE_T
290AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
Reid Spencere2c6f512004-09-02 21:38:24 +0000291AC_CHECK_TYPES([uint64_t],,
292 AC_CHECK_TYPES([u_int64_t],,
293 AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found])))
John Criswell4ea390d2003-07-22 19:13:20 +0000294AC_HEADER_TIME
295AC_STRUCT_TM
296
John Criswella0137d32003-10-13 16:22:01 +0000297dnl Check for various C features
298AC_C_PRINTF_A
299
John Criswell0021c312004-02-13 21:57:29 +0000300dnl Check for the endianness of the target
301AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
302
John Criswell4ea390d2003-07-22 19:13:20 +0000303dnl Check for C++ extensions
Brian Gaeke278a4ac2003-11-10 03:06:09 +0000304AC_CXX_HAVE_HASH_MAP
305AC_CXX_HAVE_HASH_SET
John Criswell4ea390d2003-07-22 19:13:20 +0000306AC_CXX_HAVE_STD_ITERATOR
307AC_CXX_HAVE_BI_ITERATOR
308AC_CXX_HAVE_FWD_ITERATOR
309
Brian Gaeke8828eb52004-06-22 23:43:04 +0000310AC_FUNC_ISNAN
Brian Gaeke3869b272004-07-21 03:14:51 +0000311AC_FUNC_ISINF
Brian Gaeke8828eb52004-06-22 23:43:04 +0000312
Brian Gaeke26be9c52004-01-13 06:43:16 +0000313dnl Checks for library functions.
John Criswell4ea390d2003-07-22 19:13:20 +0000314AC_FUNC_ALLOCA
John Criswell4ea390d2003-07-22 19:13:20 +0000315AC_FUNC_MMAP
Brian Gaeke26be9c52004-01-13 06:43:16 +0000316if test "$ac_cv_func_mmap_fixed_mapped" = "no"
317then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000318 AC_MSG_WARN([mmap() required but not found])
Brian Gaeke26be9c52004-01-13 06:43:16 +0000319fi
John Criswell4ea390d2003-07-22 19:13:20 +0000320AC_FUNC_MMAP_FILE
Brian Gaeke26be9c52004-01-13 06:43:16 +0000321if test "$ac_cv_func_mmap_file" = "no"
John Criswell4ea390d2003-07-22 19:13:20 +0000322then
John Criswellf3ecf3a2004-05-27 00:57:50 +0000323 AC_MSG_WARN([mmap() of files required but not found])
John Criswell4ea390d2003-07-22 19:13:20 +0000324fi
325AC_HEADER_MMAP_ANONYMOUS
326AC_TYPE_SIGNAL
Brian Gaeke8828eb52004-06-22 23:43:04 +0000327AC_CHECK_FUNCS(getcwd gettimeofday strdup strtoq strtoll backtrace isatty mkstemp getrusage)
John Criswell4ea390d2003-07-22 19:13:20 +0000328AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found]))
329
John Criswellcb7a1eb2003-11-17 19:46:02 +0000330dnl Determine if the linker supports the -R option.
Brian Gaeke26be9c52004-01-13 06:43:16 +0000331AC_LINK_USE_R
John Criswellcb7a1eb2003-11-17 19:46:02 +0000332
Brian Gaeke26be9c52004-01-13 06:43:16 +0000333dnl --enable/--with command-line options:
334dnl Check whether they want to do an optimized build:
Reid Spencerc1b0d492004-09-19 23:43:52 +0000335AC_ARG_ENABLE(optimized,AS_HELP_STRING(--enable-optimized,Compile with optimizations enabled (default is NO)),,enableval=no)
John Criswell79a8f092003-07-22 20:59:52 +0000336if test ${enableval} = "no"
337then
338 AC_SUBST(ENABLE_OPTIMIZED,[[]])
339else
340 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
341fi
342
John Criswell79a8f092003-07-22 20:59:52 +0000343dnl JIT Option
Reid Spencerc1b0d492004-09-19 23:43:52 +0000344AC_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 +0000345if test ${enableval} = "no"
346then
347 AC_SUBST(JIT,[[]])
348else
John Criswellc78022e2003-07-29 19:11:58 +0000349 case $target in
350 *i*86*)
351 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
352 ;;
353 *sparc*)
354 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
355 ;;
356 *)
357 AC_SUBST(JIT,[[]])
358 ;;
359 esac
John Criswell79a8f092003-07-22 20:59:52 +0000360fi
John Criswell4ea390d2003-07-22 19:13:20 +0000361
Brian Gaeke26be9c52004-01-13 06:43:16 +0000362dnl Find the LLVM GCC-based C/C++ front end
Reid Spencerc1b0d492004-09-19 23:43:52 +0000363AC_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 +0000364AC_MSG_CHECKING([for llvm-gcc])
365LLVM_GCC_CHECK=no
366if test -d "$LLVMGCCDIR"
367then
368 if test -x "$LLVMGCCDIR/bin/gcc"
369 then
370 LLVM_GCC_CHECK="$LLVMGCCDIR/bin/gcc"
371 fi
372fi
373llvmgccwarn=no
374AC_MSG_RESULT($LLVM_GCC_CHECK)
375if test "$LLVM_GCC_CHECK" = "no"
376then
377 llvmgccwarn=yes
378fi
Brian Gaeke908647f2003-11-16 18:37:46 +0000379AC_MSG_CHECKING([whether llvm-gcc is sane])
380LLVM_GCC_SANE=no
381if test -x "$LLVM_GCC_CHECK"
382then
383 cp /dev/null conftest.c
384 "$LLVM_GCC_CHECK" -S -o - conftest.c | grep implementation > /dev/null 2>&1
385 if test $? -eq 0
386 then
387 LLVM_GCC_SANE=yes
388 fi
389 rm conftest.c
Brian Gaeked05e39d2004-01-16 21:31:22 +0000390 llvmcc1path=`"$LLVM_GCC_CHECK" --print-prog-name=cc1`
391 AC_SUBST(LLVMCC1,$llvmcc1path)
392 llvmcc1pluspath=`"$LLVM_GCC_CHECK" --print-prog-name=cc1plus`
393 AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
Brian Gaeke908647f2003-11-16 18:37:46 +0000394fi
395AC_MSG_RESULT($LLVM_GCC_SANE)
396if test "$LLVM_GCC_SANE" = "no"
397then
398 llvmgccwarn=yes
399fi
400
Brian Gaekecea9a602004-01-21 19:38:56 +0000401dnl Get libtool's idea of what the shared library suffix is.
402dnl (This is a hack; it relies on undocumented behavior.)
403AC_MSG_CHECKING([for shared library suffix])
Reid Spencer26508352004-09-20 03:05:46 +0000404eval "SHLIBEXT=$shrext_cmds"
Brian Gaekecea9a602004-01-21 19:38:56 +0000405AC_MSG_RESULT($SHLIBEXT)
406dnl Propagate it to the Makefiles and config.h (for gccld & bugpoint).
407AC_SUBST(SHLIBEXT,$SHLIBEXT)
408AC_DEFINE_UNQUOTED(SHLIBEXT,"$SHLIBEXT",
409 [Extension that shared libraries have, e.g., ".so".])
410
Reid Spencera91929d2004-08-20 09:03:12 +0000411# Translate the various configuration directories and other basic
412# information into substitutions that will end up in config.h.in so
413# that these configured values can be hard-wired into a program.
414eval LLVM_PREFIX="${prefix}";
415eval LLVM_BINDIR="${prefix}/bin";
416eval LLVM_LIBDIR="${prefix}/lib";
417eval LLVM_DATADIR="${prefix}/data";
418eval LLVM_DOCSDIR="${prefix}/docs";
419eval LLVM_ETCDIR="${prefix}/etc";
420eval LLVM_INCLUDEDIR="${prefix}/include";
421eval LLVM_INFODIR="${prefix}/info";
422eval LLVM_MANDIR="${prefix}/man";
423LLVM_CONFIGTIME=`date`
424AC_SUBST(LLVM_PREFIX)
425AC_SUBST(LLVM_BINDIR)
426AC_SUBST(LLVM_LIBDIR)
427AC_SUBST(LLVM_DATADIR)
428AC_SUBST(LLVM_DOCSDIR)
429AC_SUBST(LLVM_ETCDIR)
430AC_SUBST(LLVM_INCLUDEDIR)
431AC_SUBST(LLVM_INFODIR)
432AC_SUBST(LLVM_MANDIR)
433AC_SUBST(LLVM_CONFIGTIME)
434AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", [Installation prefix directory])
435AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", [Installation directory for binary executables])
436AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR", [Installation directory for libraries])
437AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", [Installation directory for data files])
438AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR", [Installation directory for documentation])
Reid Spencer19d96ee2004-08-20 09:08:57 +0000439AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", [Installation directory for config files])
Reid Spencera91929d2004-08-20 09:03:12 +0000440AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", [Installation directory for include files])
441AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", [Installation directory for .info files])
442AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", [Installation directory for man pages])
443AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", [Time at which LLVM was configured])
444
Brian Gaeke26be9c52004-01-13 06:43:16 +0000445dnl Create the output files
Reid Spencerc1b0d492004-09-19 23:43:52 +0000446AC_OUTPUT
Brian Gaeke908647f2003-11-16 18:37:46 +0000447
Brian Gaeke26be9c52004-01-13 06:43:16 +0000448dnl Warn loudly if llvm-gcc was not obviously working
Brian Gaeke908647f2003-11-16 18:37:46 +0000449if test $llvmgccwarn = yes
450then
451 AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not])
452 AC_MSG_WARN([***** appear to be working.])
453 AC_MSG_WARN([***** ])
454 AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.])
455 AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,])
456 AC_MSG_WARN([***** but you should be able to build the llvm tools.])
457fi
Brian Gaekecea9a602004-01-21 19:38:56 +0000458