Makefile.am, [...]: Imported GC 6.0 and merged local changes.
[gcc.git] / boehm-gc / configure.in
1 # Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved.
2 #
3 # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
4 # OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
5 #
6 # Permission is hereby granted to use or copy this program
7 # for any purpose, provided the above notices are retained on all copies.
8 # Permission to modify the code and to distribute modified code is granted,
9 # provided the above notices are retained, and a notice that the code was
10 # modified is included with the above copyright notice.
11 #
12 # Original author: Tom Tromey
13
14 dnl Process this file with autoconf to produce configure.
15
16 AC_INIT(gcj_mlc.c)
17
18 dnl Can't be done in GC_CONFIGURE because that confuses automake.
19 AC_CONFIG_AUX_DIR(.)
20
21 GC_CONFIGURE(.)
22
23 AM_PROG_LIBTOOL
24
25 dnl We use these options to decide which functions to include.
26 AC_ARG_WITH(target-subdir,
27 [ --with-target-subdir=SUBDIR
28 configuring with a cross compiler])
29 AC_ARG_WITH(cross-host,
30 [ --with-cross-host=HOST configuring with a cross compiler])
31
32 AM_MAINTAINER_MODE
33 # automake wants to see AC_EXEEXT. But we don't need it. And having
34 # it is actually a problem, because the compiler we're passed can't
35 # necessarily do a full link. So we fool automake here.
36 if false; then
37 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
38 # to nothing, so nothing would remain between `then' and `fi' if it
39 # were not for the `:' below.
40 :
41 AC_EXEEXT
42 fi
43
44 AC_MSG_CHECKING([for threads package to use])
45 AC_ARG_ENABLE(threads, [ --enable-threads=TYPE choose threading package],
46 THREADS=$enableval,
47 [ AC_MSG_CHECKING([for thread model used by GCC])
48 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
49 if test -z "$THREADS"; then
50 THREADS=no
51 fi
52 AC_MSG_RESULT([$THREADS])])
53
54 AC_ARG_ENABLE(parallel-mark,
55 [ --enable-parallel-mark parallelize marking and free list construction],
56 [case "$THREADS" in
57 no | none | single)
58 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
59 ;;
60 esac]
61 )
62
63 INCLUDES=-I${srcdir}/include
64 THREADLIBS=
65 case "$THREADS" in
66 no | none | single)
67 THREADS=none
68 ;;
69 posix | pthreads)
70 THREADS=posix
71 THREADLIBS=-lpthread
72 case "$host" in
73 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux*)
74 AC_DEFINE(GC_LINUX_THREADS)
75 AC_DEFINE(_REENTRANT)
76 if test "${enable_parallel_mark}"; then
77 AC_DEFINE(PARALLEL_MARK)
78 fi
79 AC_DEFINE(THREAD_LOCAL_ALLOC)
80 ;;
81 *-*-linux*)
82 AC_DEFINE(GC_LINUX_THREADS)
83 AC_DEFINE(_REENTRANT)
84 ;;
85 *-*-hpux*)
86 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
87 AC_DEFINE(GC_HPUX_THREADS)
88 AC_DEFINE(_POSIX_C_SOURCE,199506L)
89 if test "${enable_parallel_mark}" = yes; then
90 AC_DEFINE(PARALLEL_MARK)
91 fi
92 AC_DEFINE(THREAD_LOCAL_ALLOC)
93 THREADLIBS="-lpthread -lrt"
94 ;;
95 *-*-freebsd*)
96 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
97 AC_DEFINE(FREEBSD_THREADS)
98 INCLUDES="$INCLUDES -pthread"
99 THREADLIBS=-pthread
100 ;;
101 *-*-solaris*)
102 AC_DEFINE(GC_SOLARIS_THREADS)
103 AC_DEFINE(GC_SOLARIS_PTHREADS)
104 ;;
105 *-*-irix*)
106 AC_DEFINE(GC_IRIX_THREADS)
107 ;;
108 *-*-cygwin*)
109 THREADLIBS=
110 ;;
111 esac
112 ;;
113 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
114 AC_MSG_ERROR(thread package $THREADS not yet supported)
115 ;;
116 *)
117 AC_MSG_ERROR($THREADS is an unknown thread package)
118 ;;
119 esac
120 AC_SUBST(THREADLIBS)
121
122 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
123 AC_SUBST(EXTRA_TEST_LIBS)
124
125 target_all=libgcjgc.la
126 AC_SUBST(target_all)
127
128 dnl If the target is an eCos system, use the appropriate eCos
129 dnl I/O routines.
130 dnl FIXME: this should not be a local option but a global target
131 dnl system; at present there is no eCos target.
132 TARGET_ECOS="no"
133 AC_ARG_WITH(ecos,
134 [ --with-ecos enable runtime eCos target support],
135 TARGET_ECOS="$with_ecos"
136 )
137
138 addobjs=
139 CXXINCLUDES=
140 case "$TARGET_ECOS" in
141 no)
142 ;;
143 *)
144 AC_DEFINE(ECOS)
145 CXXINCLUDES="-I${TARGET_ECOS}/include"
146 addobjs="$addobjs ecos.lo"
147 ;;
148 esac
149 AC_SUBST(CXX)
150
151 AC_SUBST(INCLUDES)
152 AC_SUBST(CXXINCLUDES)
153
154 machdep=
155 case "$host" in
156 alpha*-*-*)
157 machdep="alpha_mach_dep.lo"
158 ;;
159 mipstx39-*-elf*)
160 machdep="mips_ultrix_mach_dep.lo"
161 AC_DEFINE(STACKBASE, __stackbase)
162 AC_DEFINE(DATASTART_IS_ETEXT)
163 ;;
164 mips-dec-ultrix*)
165 machdep="mips_ultrix_mach-dep.lo"
166 ;;
167 mips-*-*)
168 machdep="mips_sgi_mach_dep.lo"
169 AC_DEFINE(NO_EXECUTE_PERMISSION)
170 ;;
171 sparc-sun-solaris2.3*)
172 AC_DEFINE(SUNOS53_SHARED_LIB)
173 ;;
174 esac
175 if test x"$machdep" = x; then
176 machdep="mach_dep.lo"
177 fi
178 addobjs="$addobjs $machdep"
179 AC_SUBST(addobjs)
180
181 dnl As of 4.13a2, the collector will not properly work on Solaris when
182 dnl built with gcc and -O. So we remove -O in the appropriate case.
183 case "$host" in
184 sparc-sun-solaris2*)
185 if test "$GCC" = yes; then
186 new_CFLAGS=
187 for i in $CFLAGS; do
188 case "$i" in
189 -O*)
190 ;;
191 *)
192 new_CFLAGS="$new_CFLAGS $i"
193 ;;
194 esac
195 done
196 CFLAGS="$new_CFLAGS"
197 fi
198 ;;
199 esac
200
201 dnl We need to override the top-level CFLAGS. This is how we do it.
202 MY_CFLAGS="$CFLAGS"
203 AC_SUBST(MY_CFLAGS)
204
205 dnl Include defines that have become de facto standard.
206 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
207 AC_DEFINE(SILENT)
208 AC_DEFINE(NO_SIGNALS)
209 AC_DEFINE(NO_EXECUTE_PERMISSION)
210 AC_DEFINE(ALL_INTERIOR_POINTERS)
211
212 dnl By default, make the library as general as possible.
213 AC_DEFINE(JAVA_FINALIZATION)
214 AC_DEFINE(GC_GCJ_SUPPORT)
215 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
216
217 dnl This is something of a hack. When cross-compiling we turn off
218 dnl some functionality. We also enable the "small" configuration.
219 dnl These is only correct when targetting an embedded system. FIXME.
220 if test -n "${with_cross_host}"; then
221 AC_DEFINE(NO_SIGSET)
222 AC_DEFINE(NO_CLOCK)
223 AC_DEFINE(SMALL_CONFIG)
224 AC_DEFINE(NO_DEBUGGING)
225 fi
226
227 AC_ARG_ENABLE(full-debug,
228 [ --enable-full-debug include full support for pointer backtracing etc.],
229 [ if test "$enable_full_debug" = "yes"; then
230 AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
231 AC_DEFINE(KEEP_BACK_PTRS)
232 AC_DEFINE(DBG_HDRS_ALL)
233 case $host in
234 x86-*-linux* | i586-*-linux* | i686-*-linux* )
235 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
236 AC_DEFINE(SAVE_CALL_COUNT, 8)
237 ;;
238 esac ]
239 fi)
240
241 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
242
243 if test "${multilib}" = "yes"; then
244 multilib_arg="--enable-multilib"
245 else
246 multilib_arg=
247 fi
248
249 AC_OUTPUT(Makefile, [
250 dnl Put all the -D options in a file.
251 echo "$DEFS" > boehm-cflags
252
253 if test -n "$CONFIG_FILES"; then
254 ac_file=Makefile . ${gc_basedir}/../config-ml.in
255 fi],
256 srcdir=${srcdir}
257 host=${host}
258 target=${target}
259 with_multisubdir=${with_multisubdir}
260 ac_configure_args="${multilib_arg} ${ac_configure_args}"
261 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
262 gc_basedir=${gc_basedir}
263 CC="${CC}"
264 DEFS="$DEFS"
265 )