blob: 6073f4fc78b6001d2fa2cfd30526e4333197413f [file] [log] [blame]
John Criswell4ea390d2003-07-22 19:13:20 +00001dnl Autoconf requirements
2dnl AC_INIT(package, version, bug-report-address)
3dnl information on the package
4dnl checks for programs
5dnl checks for libraries
6dnl checks for header files
7dnl checks for types
8dnl checks for structures
9dnl checks for compiler characteristics
10dnl checks for library functions
11dnl checks for system services
12dnl AC_CONFIG_FILES([file...])
13dnl AC_OUTPUT
14
15dnl **************************************************************************
16dnl * Initialize
17dnl **************************************************************************
18AC_INIT([[[LLVM]]],[[[1.0]]],[llvmbugs@cs.uiuc.edu])
19
20dnl Place all of the extra autoconf files into the config subdirectory
21AC_CONFIG_AUX_DIR([autoconf])
22
23dnl Configure a header file
24AC_CONFIG_HEADERS(include/Config/config.h)
25
26dnl **************************************************************************
27dnl * Determine which system we are building on
28dnl **************************************************************************
29
30dnl Check the install program (needs to be done before canonical stuff)
31AC_PROG_INSTALL
32
33dnl Check which host for which we're compiling. This will tell us which LLVM
34dnl compiler will be used for compiling SSA into object code.
35AC_CANONICAL_TARGET
36
37dnl
38dnl Now, for some of our own magic:
39dnl We will use the build machine information to set some variables.
40dnl
41case $build in
42 *i*86*) AC_SUBST(OS,[Linux])
John Criswell4ea390d2003-07-22 19:13:20 +000043 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/])
44 ;;
45
46 *sparc*) AC_SUBST(OS,[SunOS])
47 AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/])
48 ;;
49
50 *) AC_SUBST(OS,[Unknown])
51 ;;
52esac
53
54dnl
55dnl If we are targetting a Sparc machine running Solaris, pretend that it is
56dnl V9, since that is all that we support at the moment, and autoconf will only
57dnl tell us we're a sparc.
58dnl
59case $target in
60 *sparc*solaris*) AC_SUBST(target,[[sparcv9-sun-solaris2.8]])
61 ;;
62esac
63
64dnl
65dnl Determine what our target architecture is and configure accordingly.
66dnl This will allow Makefiles to make a distinction between the hardware and
67dnl the OS.
68dnl
69case $target in
70 *i*86*) AC_SUBST(ARCH,[x86])
71 ;;
72 *sparc*solaris*) AC_SUBST(ARCH,[Sparc])
73 ;;
74esac
75
76dnl **************************************************************************
77dnl * Check for programs.
78dnl **************************************************************************
79
80dnl Check for compilation tools
81AC_PROG_CXX
82AC_PROG_CC(gcc)
83AC_PROG_CPP
84
85dnl Ensure that compilation tools are GCC; we use GCC specific extensions
86if test "$GCC" != "yes"
87then
88 AC_MSG_ERROR([gcc required but not found])
89fi
90
91if test "$GXX" != "yes"
92then
93 AC_MSG_ERROR([g++ required but not found])
94fi
95
96dnl Check for GNU Make. We use its extensions to, so don't build without it
97CHECK_GNU_MAKE
98if test -z "$_cv_gnu_make_command"
99then
100 AC_MSG_ERROR([GNU Make required but not found])
101fi
102
103dnl Check for compiler-compiler tools (reminds me of Little Caesar's Pizza)
104AC_PROG_FLEX
105AC_PROG_BISON
106
107dnl Check for libtool
108AC_PROG_LIBTOOL
109
110dnl Check for our special programs
111AC_PATH_PROG(AR,[ar])
112AC_PATH_PROG(SED,[sed])
113AC_PATH_PROG(RM,[rm])
114AC_PATH_PROG(ECHO,[echo])
115AC_PATH_PROG(MKDIR,[mkdir])
116AC_PATH_PROG(DATE,[date])
117AC_PATH_PROG(MV,[mv])
118AC_PATH_PROG(DOT,[dot])
119AC_PATH_PROG(ETAGS,[etags])
120AC_PATH_PROG(PURIFY,[purify])
121
122dnl Verify that the source directory is valid
123AC_CONFIG_SRCDIR(["Makefile.config.in"])
124
125dnl **************************************************************************
126dnl * Check for libraries.
127dnl **************************************************************************
128
129dnl libelf is for sparc only; we can ignore it if we don't have it
130AC_CHECK_LIB(elf, elf_begin)
131
132dnl dlopen() is required. If we don't find it, quit.
133AC_SEARCH_LIBS(dlopen,dl,,AC_MSG_ERROR([dlopen() required but not found]))
134
135dnl mallinfo is optional; the code can compile (minus features) without it
136AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1]))
137
138dnl
139dnl The math libraries are used by the test code, but not by the actual LLVM
140dnl code.
141dnl
142dnl AC_CHECK_LIB(m, cos)
143
144dnl **************************************************************************
145dnl * Checks for header files.
146dnl * Chances are, if the standard C or POSIX type header files are missing,
147dnl * then LLVM just isn't going to compile. However, it is possible that
148dnl * the necessary functions/macros will be included from other
149dnl * (non-standard and non-obvious) header files.
150dnl *
151dnl * So, we'll be gracious, give it a chance, and try to go on without
152dnl * them.
153dnl **************************************************************************
154AC_HEADER_STDC
155AC_HEADER_SYS_WAIT
156
157dnl Check for ANSI C/POSIX header files
158AC_CHECK_HEADERS(assert.h fcntl.h limits.h sys/time.h unistd.h errno.h signal.h math.h)
159
160dnl Check for system specific header files
161AC_CHECK_HEADERS(malloc.h strings.h sys/mman.h sys/resource.h)
162
163dnl Check for header files associated with dlopen and friends
164AC_CHECK_HEADERS(dlfcn.h link.h)
165
166dnl **************************************************************************
167dnl * Checks for typedefs, structures, and compiler characteristics.
168dnl **************************************************************************
169
170dnl Check for const and inline keywords
171AC_C_CONST
172AC_C_INLINE
173
174dnl Check for machine endian-ness
175AC_C_BIGENDIAN(AC_DEFINE([ENDIAN_BIG]),AC_DEFINE(ENDIAN_LITTLE))
176
177dnl Check for types
178AC_TYPE_PID_T
179AC_TYPE_SIZE_T
180AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found]))
181AC_CHECK_TYPES([uint64_t],,AC_MSG_ERROR([Type uint64_t required but not found]))
182AC_HEADER_TIME
183AC_STRUCT_TM
184
185dnl Check for C++ extensions
186AC_CXX_HAVE_EXT_HASH_MAP
187AC_CXX_HAVE_EXT_HASH_SET
188AC_CXX_HAVE_EXT_SLIST
189AC_CXX_HAVE_STD_ITERATOR
190AC_CXX_HAVE_BI_ITERATOR
191AC_CXX_HAVE_FWD_ITERATOR
192
193dnl **************************************************************************
194dnl * Checks for library functions.
195dnl **************************************************************************
196AC_FUNC_ALLOCA
197AC_PROG_GCC_TRADITIONAL
198AC_FUNC_MEMCMP
199AC_FUNC_MMAP
200AC_FUNC_MMAP_FILE
201if test ${ac_cv_func_mmap_file} = "no"
202then
203 AC_MSG_ERROR([mmap() of files required but not found])
204fi
205AC_HEADER_MMAP_ANONYMOUS
206AC_TYPE_SIGNAL
207AC_CHECK_FUNCS(getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol)
208
209dnl
210dnl Need to check mmap for MAP_PRIVATE, MAP_ANONYMOUS, MAP_ANON, MAP_FIXED
211dnl MAP_FIXED is only needed for Sparc
212dnl MAP_ANON is used for Sparc and BSD
213dnl Everyone should have MAP_PRIVATE
214dnl
215
216dnl Check for certain functions (even if we've already found them) so that we
217dnl can quit with an error if they are unavailable.
218dnl
219dnl As the code is made more portable (i.e. less reliant on these functions,
220dnl these checks should go away.
221AC_CHECK_FUNC(mmap,,AC_MSG_ERROR([Function mmap() required but not found]))
222AC_CHECK_FUNC(mprotect,,AC_MSG_ERROR([Function mprotect() required but not found]))
223
224dnl **************************************************************************
225dnl * Enable various compile-time options
226dnl **************************************************************************
John Criswell79a8f092003-07-22 20:59:52 +0000227
228dnl Purify Option
229AC_ARG_ENABLE(purify,AC_HELP_STRING([--enable-purify],[Compile with purify (default is NO)]),,enableval="no")
230if test ${enableval} = "no"
231then
232 AC_SUBST(ENABLE_PURIFY,[[]])
233else
234 AC_SUBST(ENABLE_PURIFY,[[ENABLE_PURIFY=1]])
235fi
236
237dnl Optimized Option
238AC_ARG_ENABLE(optimized,AC_HELP_STRING([--enable-optimized],[Compile with optimizations enabled (default is NO)]),,enableval=no)
239if test ${enableval} = "no"
240then
241 AC_SUBST(ENABLE_OPTIMIZED,[[]])
242else
243 AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]])
244fi
245
246dnl Spec Benchmarks
247AC_ARG_ENABLE(spec,AC_HELP_STRING([--enable-spec],[Compile SPEC benchmarks (default is NO)]),,enableval=no)
248if test ${enableval} = "no"
249then
250 AC_SUBST(USE_SPEC,[[]])
251else
252 AC_SUBST(USE_SPEC,[[USE_SPEC=1]])
253fi
254
255dnl Precompiled Bytecode Option
256AC_ARG_ENABLE(precompiled_bytecode,AC_HELP_STRING([--enable-precompiled_bytecode],[Use pre-compiled bytecode (default is NO)]),,enableval=no)
257if test ${enableval} = "no"
258then
259 AC_SUBST(UPB,[[]])
260else
261 AC_SUBST(UPB,[[USE_PRECOMPILED_BYTECODE=1]])
262fi
263
264
265dnl LLC Diff Option
266AC_ARG_ENABLE(llc_diffs,AC_HELP_STRING([--enable-llc_diffs],[Enable LLC Diffs when testing (default is YES)]),,enableval=yes)
267if test ${enableval} = "no"
268then
269 AC_SUBST(DISABLE_LLC_DIFFS,[DISABLE_LLC_DIFFS:=1])
270else
271 AC_SUBST(DISABLE_LLC_DIFFS,[[]])
272fi
273
274dnl JIT Option
John Criswellc78022e2003-07-29 19:11:58 +0000275AC_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 +0000276
277if test ${enableval} = "no"
278then
279 AC_SUBST(JIT,[[]])
280else
John Criswellc78022e2003-07-29 19:11:58 +0000281 case $target in
282 *i*86*)
283 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
284 ;;
285 *sparc*)
286 AC_SUBST(JIT,[[TARGET_HAS_JIT=1]])
287 ;;
288 *)
289 AC_SUBST(JIT,[[]])
290 ;;
291 esac
John Criswell79a8f092003-07-22 20:59:52 +0000292fi
John Criswell4ea390d2003-07-22 19:13:20 +0000293
294dnl **************************************************************************
295dnl * Set the location of various third-party software packages
296dnl **************************************************************************
John Criswellc78022e2003-07-29 19:11:58 +0000297
298dnl Location of SPEC benchmarks
John Criswell4ea390d2003-07-22 19:13:20 +0000299AC_ARG_WITH(spec,AC_HELP_STRING([--with-spec],[Location of SPEC benchmarks]),AC_SUBST(SPEC_ROOT,[$withval]),AC_SUBST(SPEC_ROOT,[/home/vadve/shared/benchmarks/speccpu2000/benchspec]))
John Criswellc78022e2003-07-29 19:11:58 +0000300
301dnl Location of the LLVM C front end
John Criswell4ea390d2003-07-22 19:13:20 +0000302AC_ARG_WITH(llvmgccdir,AC_HELP_STRING([--with-llvmgccdir],[Location of LLVM GCC front-end]),AC_SUBST(LLVMGCCDIR,[$withval]))
John Criswellc78022e2003-07-29 19:11:58 +0000303
304dnl Location of the bytecode repository
John Criswell4ea390d2003-07-22 19:13:20 +0000305AC_ARG_WITH(bcrepos,AC_HELP_STRING([--with-bcrepos],[Location of Bytecode Repository]),AC_SUBST(BCR,[$withval]),AC_SUBST(BCR,[/home/vadve/lattner/LLVMPrograms]))
John Criswellc78022e2003-07-29 19:11:58 +0000306
307dnl Location of PAPI
John Criswell4ea390d2003-07-22 19:13:20 +0000308AC_ARG_WITH(papi,AC_HELP_STRING([--with-papi],[Location of PAPI]),AC_SUBST(PAPIDIR,[$withval]),AC_SUBST(PAPIDIR,[/home/vadve/shared/papi-2.3.4.1]))
John Criswellc78022e2003-07-29 19:11:58 +0000309
310dnl Location of the purify program
John Criswell4ea390d2003-07-22 19:13:20 +0000311AC_ARG_WITH(purify,AC_HELP_STRING([--with-purify],[Location of purify program]),AC_SUBST(PURIFY,[$withval]))
312
John Criswellc78022e2003-07-29 19:11:58 +0000313dnl Location for placing object files and built programs, libraries, etc
John Criswell54ac8b12003-07-31 16:45:37 +0000314if test ${USER}
John Criswellc78022e2003-07-29 19:11:58 +0000315then
John Criswell54ac8b12003-07-31 16:45:37 +0000316 if test -d /localhome/${USER}
317 then
318 AC_SUBST(OBJROOT,[/localhome/${USER}])
319 else
320 AC_SUBST(OBJROOT,[.])
321 fi
John Criswellc78022e2003-07-29 19:11:58 +0000322else
323 AC_SUBST(OBJROOT,[.])
324fi
325
326AC_ARG_WITH(objroot,AC_HELP_STRING([--with-objroot],[Location where object files should be placed (default is .)]),AC_SUBST(OBJROOT,[$withval]))
327
328dnl **************************************************************************
329dnl * Create the output files
330dnl **************************************************************************
John Criswell4ea390d2003-07-22 19:13:20 +0000331AC_OUTPUT(Makefile.config)