]>
Commit | Line | Data |
---|---|---|
13b6e5b4 | 1 | # Copyright (c) 1999, 2000, 2001, 2002, 2003 by Red Hat, Inc. All rights reserved. |
5a2586cf TT |
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 | ||
1530be84 TT |
14 | dnl Process this file with autoconf to produce configure. |
15 | ||
9110a741 | 16 | AC_INIT(gcj_mlc.c) |
1530be84 | 17 | |
6706f116 AO |
18 | # This works around the fact that libtool configuration may change LD |
19 | # for this particular configuration, but some shells, instead of | |
20 | # keeping the changes in LD private, export them just because LD is | |
21 | # exported. | |
22 | ORIGINAL_LD_FOR_MULTILIBS=$LD | |
23 | ||
5a2586cf TT |
24 | dnl Can't be done in GC_CONFIGURE because that confuses automake. |
25 | AC_CONFIG_AUX_DIR(.) | |
26 | ||
27 | GC_CONFIGURE(.) | |
1530be84 | 28 | |
66deb2be TT |
29 | AM_PROG_LIBTOOL |
30 | ||
1530be84 TT |
31 | dnl We use these options to decide which functions to include. |
32 | AC_ARG_WITH(target-subdir, | |
61e922d2 RO |
33 | [ --with-target-subdir=SUBDIR |
34 | configuring with a cross compiler]) | |
1530be84 | 35 | AC_ARG_WITH(cross-host, |
61e922d2 | 36 | [ --with-cross-host=HOST configuring with a cross compiler]) |
1530be84 TT |
37 | |
38 | AM_MAINTAINER_MODE | |
39 | # automake wants to see AC_EXEEXT. But we don't need it. And having | |
40 | # it is actually a problem, because the compiler we're passed can't | |
41 | # necessarily do a full link. So we fool automake here. | |
01ef8751 AO |
42 | if false; then |
43 | # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands | |
44 | # to nothing, so nothing would remain between `then' and `fi' if it | |
45 | # were not for the `:' below. | |
46 | : | |
47 | AC_EXEEXT | |
1530be84 TT |
48 | fi |
49 | ||
0ff95153 TT |
50 | AC_MSG_CHECKING([for thread model used by GCC]) |
51 | THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` | |
52 | if test -z "$THREADS"; then | |
53 | THREADS=no | |
54 | fi | |
55 | AC_MSG_RESULT([$THREADS]) | |
5a2586cf TT |
56 | |
57 | AC_ARG_ENABLE(parallel-mark, | |
58 | [ --enable-parallel-mark parallelize marking and free list construction], | |
59 | [case "$THREADS" in | |
60 | no | none | single) | |
61 | AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec]) | |
62 | ;; | |
63 | esac] | |
64 | ) | |
1530be84 | 65 | |
7160c99d | 66 | INCLUDES="-I`cd $srcdir && ${PWDCMD-pwd}`/include" |
e301621d | 67 | THREADLIBS= |
1530be84 TT |
68 | case "$THREADS" in |
69 | no | none | single) | |
70 | THREADS=none | |
71 | ;; | |
72 | posix | pthreads) | |
73 | THREADS=posix | |
62aa6b06 | 74 | THREADLIBS=-lpthread |
1530be84 | 75 | case "$host" in |
30c3de1f | 76 | x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*) |
5a2586cf TT |
77 | AC_DEFINE(GC_LINUX_THREADS) |
78 | AC_DEFINE(_REENTRANT) | |
30c3de1f | 79 | if test "${enable_parallel_mark}" = yes; then |
5a2586cf TT |
80 | AC_DEFINE(PARALLEL_MARK) |
81 | fi | |
82 | AC_DEFINE(THREAD_LOCAL_ALLOC) | |
83 | ;; | |
1530be84 | 84 | *-*-linux*) |
5a2586cf | 85 | AC_DEFINE(GC_LINUX_THREADS) |
1530be84 TT |
86 | AC_DEFINE(_REENTRANT) |
87 | ;; | |
30c3de1f JS |
88 | *-*-aix*) |
89 | AC_DEFINE(GC_AIX_THREADS) | |
90 | AC_DEFINE(_REENTRANT) | |
91 | ;; | |
5a2586cf TT |
92 | *-*-hpux*) |
93 | AC_MSG_WARN("Only HP/UX 11 threads are supported.") | |
94 | AC_DEFINE(GC_HPUX_THREADS) | |
95 | AC_DEFINE(_POSIX_C_SOURCE,199506L) | |
96 | if test "${enable_parallel_mark}" = yes; then | |
97 | AC_DEFINE(PARALLEL_MARK) | |
98 | fi | |
99 | AC_DEFINE(THREAD_LOCAL_ALLOC) | |
100 | THREADLIBS="-lpthread -lrt" | |
101 | ;; | |
62aa6b06 | 102 | *-*-freebsd*) |
79f777fd | 103 | AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.") |
4c7726b1 | 104 | AC_DEFINE(GC_FREEBSD_THREADS) |
9110a741 | 105 | INCLUDES="$INCLUDES -pthread" |
62aa6b06 LR |
106 | THREADLIBS=-pthread |
107 | ;; | |
1530be84 | 108 | *-*-solaris*) |
5a2586cf TT |
109 | AC_DEFINE(GC_SOLARIS_THREADS) |
110 | AC_DEFINE(GC_SOLARIS_PTHREADS) | |
1530be84 | 111 | ;; |
14caa62f | 112 | *-*-irix*) |
5a2586cf | 113 | AC_DEFINE(GC_IRIX_THREADS) |
14caa62f | 114 | ;; |
a2d6e915 | 115 | *-*-cygwin*) |
30c3de1f JS |
116 | AC_DEFINE(GC_WIN32_THREADS) |
117 | ;; | |
118 | *-*-darwin*) | |
119 | AC_DEFINE(GC_DARWIN_THREADS) | |
120 | AC_DEFINE(THREAD_LOCAL_ALLOC) | |
121 | if test "${enable_parallel_mark}" = yes; then | |
122 | AC_DEFINE(PARALLEL_MARK) | |
123 | fi | |
124 | ;; | |
125 | *-*-osf*) | |
126 | AC_DEFINE(GC_OSF1_THREADS) | |
127 | if test "${enable_parallel_mark}" = yes; then | |
128 | AC_DEFINE(PARALLEL_MARK) | |
129 | AC_DEFINE(THREAD_LOCAL_ALLOC) | |
130 | # May want to enable it in other cases, too. | |
131 | # Measurements havent yet been done. | |
132 | fi | |
133 | INCLUDES="$INCLUDES -pthread" | |
134 | THREADLIBS="-lpthread -lrt" | |
a2d6e915 | 135 | ;; |
1530be84 TT |
136 | esac |
137 | ;; | |
df61a3d2 AM |
138 | win32) |
139 | AC_DEFINE(GC_WIN32_THREADS) | |
30c3de1f | 140 | dnl Wine getenv may not return NULL for missing entry |
512e32d2 | 141 | AC_DEFINE(NO_GETENV) |
30c3de1f JS |
142 | ;; |
143 | dgux386) | |
144 | THREADS=dgux386 | |
145 | AC_MSG_RESULT($THREADLIBS) | |
146 | # Use pthread GCC switch | |
147 | THREADLIBS=-pthread | |
148 | if test "${enable_parallel_mark}" = yes; then | |
149 | AC_DEFINE(PARALLEL_MARK) | |
e83a44d2 | 150 | fi |
30c3de1f JS |
151 | AC_DEFINE(THREAD_LOCAL_ALLOC) |
152 | AC_DEFINE(GC_DGUX386_THREADS) | |
153 | AC_DEFINE(DGUX_THREADS) | |
154 | # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread | |
155 | INCLUDES="-pthread $INCLUDES" | |
156 | ;; | |
157 | aix) | |
158 | THREADS=posix | |
159 | THREADLIBS=-lpthread | |
160 | AC_DEFINE(GC_AIX_THREADS) | |
161 | AC_DEFINE(_REENTRANT) | |
df61a3d2 AM |
162 | ;; |
163 | decosf1 | irix | mach | os2 | solaris | dce | vxworks) | |
1530be84 TT |
164 | AC_MSG_ERROR(thread package $THREADS not yet supported) |
165 | ;; | |
166 | *) | |
167 | AC_MSG_ERROR($THREADS is an unknown thread package) | |
168 | ;; | |
169 | esac | |
e301621d | 170 | AC_SUBST(THREADLIBS) |
1530be84 | 171 | |
30c3de1f JS |
172 | case "$host" in |
173 | powerpc-*-darwin*) | |
174 | powerpc_darwin=true | |
175 | ;; | |
176 | esac | |
177 | AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue) | |
178 | ||
179 | # We never want libdl on darwin. It is a fake libdl that just ends up making | |
180 | # dyld calls anyway | |
181 | case "$host" in | |
182 | *-*-darwin*) ;; | |
183 | *) | |
184 | AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl") | |
185 | ;; | |
186 | esac | |
187 | ||
f2beb7ef APB |
188 | AC_SUBST(EXTRA_TEST_LIBS) |
189 | ||
5a2586cf | 190 | target_all=libgcjgc.la |
1530be84 | 191 | AC_SUBST(target_all) |
f28c857f | 192 | AC_SUBST(target_alias) |
1530be84 TT |
193 | |
194 | dnl If the target is an eCos system, use the appropriate eCos | |
195 | dnl I/O routines. | |
196 | dnl FIXME: this should not be a local option but a global target | |
197 | dnl system; at present there is no eCos target. | |
198 | TARGET_ECOS="no" | |
199 | AC_ARG_WITH(ecos, | |
61e922d2 | 200 | [ --with-ecos enable runtime eCos target support], |
1530be84 TT |
201 | TARGET_ECOS="$with_ecos" |
202 | ) | |
203 | ||
204 | addobjs= | |
30c3de1f JS |
205 | addlibs= |
206 | addincludes= | |
207 | addtests= | |
1530be84 TT |
208 | CXXINCLUDES= |
209 | case "$TARGET_ECOS" in | |
210 | no) | |
211 | ;; | |
212 | *) | |
213 | AC_DEFINE(ECOS) | |
214 | CXXINCLUDES="-I${TARGET_ECOS}/include" | |
66deb2be | 215 | addobjs="$addobjs ecos.lo" |
1530be84 TT |
216 | ;; |
217 | esac | |
30c3de1f JS |
218 | |
219 | if test "${enable_cplusplus}" = yes; then | |
220 | addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h" | |
221 | addtests="$addtests test_cpp" | |
222 | fi | |
223 | ||
224 | AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes) | |
225 | ||
1530be84 TT |
226 | AC_SUBST(CXX) |
227 | ||
228 | AC_SUBST(INCLUDES) | |
229 | AC_SUBST(CXXINCLUDES) | |
230 | ||
30c3de1f JS |
231 | # Configuration of shared libraries |
232 | # | |
233 | AC_MSG_CHECKING(whether to build shared libraries) | |
234 | AC_ENABLE_SHARED | |
235 | ||
236 | case "$host" in | |
237 | alpha-*-openbsd*) | |
238 | enable_shared=no | |
239 | AC_MSG_RESULT(no) | |
240 | ;; | |
241 | *) | |
242 | AC_MSG_RESULT(yes) | |
243 | ;; | |
244 | esac | |
245 | ||
246 | # Configuration of machine-dependent code | |
247 | # | |
248 | AC_MSG_CHECKING(which machine-dependent code should be used) | |
1530be84 TT |
249 | machdep= |
250 | case "$host" in | |
adb60117 RH |
251 | alpha*-*-openbsd*) |
252 | machdep="alpha_mach_dep.lo" | |
4c7726b1 BM |
253 | if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then |
254 | AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled) | |
4c7726b1 BM |
255 | fi |
256 | ;; | |
30c3de1f | 257 | alpha*-*-linux*) |
adb60117 RH |
258 | machdep="alpha_mach_dep.lo" |
259 | ;; | |
51ac684e | 260 | i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?) |
adb60117 RH |
261 | AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED) |
262 | ;; | |
1530be84 | 263 | mipstx39-*-elf*) |
66deb2be | 264 | machdep="mips_ultrix_mach_dep.lo" |
1530be84 TT |
265 | AC_DEFINE(STACKBASE, __stackbase) |
266 | AC_DEFINE(DATASTART_IS_ETEXT) | |
267 | ;; | |
276836f0 RO |
268 | mips-dec-ultrix*) |
269 | machdep="mips_ultrix_mach-dep.lo" | |
270 | ;; | |
30c3de1f | 271 | mips-nec-sysv*|mips-unknown-sysv*) |
5316699d | 272 | ;; |
30c3de1f JS |
273 | mips*-*-linux*) |
274 | ;; | |
276836f0 RO |
275 | mips-*-*) |
276 | machdep="mips_sgi_mach_dep.lo" | |
277 | AC_DEFINE(NO_EXECUTE_PERMISSION) | |
d42058b1 | 278 | ;; |
30c3de1f JS |
279 | sparc-*-netbsd*) |
280 | machdep="sparc_netbsd_mach_dep.lo" | |
281 | ;; | |
51ac684e | 282 | sparc-sun-solaris2.3) |
79f777fd | 283 | machdep="sparc_mach_dep.lo" |
1530be84 TT |
284 | AC_DEFINE(SUNOS53_SHARED_LIB) |
285 | ;; | |
79f777fd BM |
286 | sparc-sun-solaris2.*) |
287 | machdep="sparc_mach_dep.lo" | |
288 | ;; | |
289 | ia64-*-*) | |
4c7726b1 BM |
290 | machdep="mach_dep.lo ia64_save_regs_in_stack.lo" |
291 | ;; | |
1530be84 TT |
292 | esac |
293 | if test x"$machdep" = x; then | |
30c3de1f | 294 | AC_MSG_RESULT($machdep) |
66deb2be | 295 | machdep="mach_dep.lo" |
1530be84 TT |
296 | fi |
297 | addobjs="$addobjs $machdep" | |
298 | AC_SUBST(addobjs) | |
30c3de1f JS |
299 | AC_SUBST(addincludes) |
300 | AC_SUBST(addlibs) | |
301 | AC_SUBST(addtests) | |
302 | ||
303 | AC_PROG_LIBTOOL | |
304 | ||
305 | # | |
306 | # Check for AViiON Machines running DGUX | |
307 | # | |
308 | AC_MSG_CHECKING(if host is AViiON running DGUX) | |
309 | ac_is_dgux=no | |
310 | AC_CHECK_HEADER(sys/dg_sys_info.h, | |
311 | [ac_is_dgux=yes;]) | |
312 | ||
313 | AC_MSG_RESULT($ac_is_dgux) | |
314 | ## :GOTCHA: we do not check anything but sys/dg_sys_info.h | |
315 | if test $ac_is_dgux = yes; then | |
316 | if test "$enable_full_debug" = "yes"; then | |
317 | CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" | |
318 | CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" | |
319 | else | |
320 | CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" | |
321 | CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" | |
322 | fi | |
323 | AC_SUBST(CFLAGS) | |
324 | AC_SUBST(CXXFLAGS) | |
325 | fi | |
326 | ||
327 | dnl We use these options to decide which functions to include. | |
328 | AC_ARG_WITH(target-subdir, | |
329 | [ --with-target-subdir=SUBDIR | |
330 | configuring with a cross compiler]) | |
331 | AC_ARG_WITH(cross-host, | |
332 | [ --with-cross-host=HOST configuring with a cross compiler]) | |
333 | ||
334 | # automake wants to see AC_EXEEXT. But we don't need it. And having | |
335 | # it is actually a problem, because the compiler we're passed can't | |
336 | # necessarily do a full link. So we fool automake here. | |
337 | if false; then | |
338 | # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands | |
339 | # to nothing, so nothing would remain between `then' and `fi' if it | |
340 | # were not for the `:' below. | |
341 | : | |
342 | AC_EXEEXT | |
343 | fi | |
1530be84 TT |
344 | |
345 | dnl As of 4.13a2, the collector will not properly work on Solaris when | |
346 | dnl built with gcc and -O. So we remove -O in the appropriate case. | |
30c3de1f JS |
347 | dnl |
348 | AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary) | |
1530be84 | 349 | case "$host" in |
30c3de1f | 350 | sparc-sun-solaris2*|*aix*) |
1530be84 | 351 | if test "$GCC" = yes; then |
30c3de1f | 352 | AC_MSG_RESULT(yes) |
1530be84 TT |
353 | new_CFLAGS= |
354 | for i in $CFLAGS; do | |
355 | case "$i" in | |
356 | -O*) | |
357 | ;; | |
358 | *) | |
359 | new_CFLAGS="$new_CFLAGS $i" | |
360 | ;; | |
361 | esac | |
362 | done | |
363 | CFLAGS="$new_CFLAGS" | |
30c3de1f JS |
364 | else |
365 | AC_MSG_RESULT(no) | |
1530be84 TT |
366 | fi |
367 | ;; | |
30c3de1f | 368 | *) AC_MSG_RESULT(no) ;; |
1530be84 TT |
369 | esac |
370 | ||
371 | dnl We need to override the top-level CFLAGS. This is how we do it. | |
372 | MY_CFLAGS="$CFLAGS" | |
373 | AC_SUBST(MY_CFLAGS) | |
374 | ||
5a2586cf TT |
375 | dnl Include defines that have become de facto standard. |
376 | dnl ALL_INTERIOR_POINTERS can be overridden in startup code. | |
1530be84 TT |
377 | AC_DEFINE(SILENT) |
378 | AC_DEFINE(NO_SIGNALS) | |
5a2586cf TT |
379 | AC_DEFINE(NO_EXECUTE_PERMISSION) |
380 | AC_DEFINE(ALL_INTERIOR_POINTERS) | |
381 | ||
382 | dnl By default, make the library as general as possible. | |
1530be84 | 383 | AC_DEFINE(JAVA_FINALIZATION) |
0476f098 | 384 | AC_DEFINE(GC_GCJ_SUPPORT) |
5a2586cf | 385 | AC_DEFINE(ATOMIC_UNCOLLECTABLE) |
1530be84 | 386 | |
1530be84 | 387 | dnl This is something of a hack. When cross-compiling we turn off |
df61a3d2 AM |
388 | dnl some functionality. These is only correct when targetting an |
389 | dnl embedded system. FIXME. | |
1530be84 TT |
390 | if test -n "${with_cross_host}"; then |
391 | AC_DEFINE(NO_SIGSET) | |
0476f098 | 392 | AC_DEFINE(NO_DEBUGGING) |
1530be84 TT |
393 | fi |
394 | ||
5a2586cf TT |
395 | AC_ARG_ENABLE(full-debug, |
396 | [ --enable-full-debug include full support for pointer backtracing etc.], | |
397 | [ if test "$enable_full_debug" = "yes"; then | |
398 | AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.") | |
399 | AC_DEFINE(KEEP_BACK_PTRS) | |
400 | AC_DEFINE(DBG_HDRS_ALL) | |
401 | case $host in | |
79f777fd BM |
402 | ia64-*-linux* ) |
403 | AC_DEFINE(MAKE_BACK_GRAPH) | |
404 | ;; | |
48528b67 | 405 | x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* ) |
79f777fd | 406 | AC_DEFINE(MAKE_BACK_GRAPH) |
5a2586cf TT |
407 | AC_MSG_WARN("Client must not use -fomit-frame-pointer.") |
408 | AC_DEFINE(SAVE_CALL_COUNT, 8) | |
409 | ;; | |
30c3de1f JS |
410 | i[3456]86-*-dgux*) |
411 | AC_DEFINE(MAKE_BACK_GRAPH) | |
412 | ;; | |
5a2586cf TT |
413 | esac ] |
414 | fi) | |
415 | ||
13b6e5b4 AO |
416 | if test -n "$with_cross_host" && |
417 | test x"$with_cross_host" != x"no"; then | |
418 | toolexecdir='$(exec_prefix)/$(target_alias)' | |
419 | toolexeclibdir='$(toolexecdir)/lib' | |
420 | else | |
421 | toolexecdir='$(libdir)/gcc-lib/$(target_alias)' | |
422 | toolexeclibdir='$(libdir)' | |
423 | fi | |
ff8b9ca8 AS |
424 | multi_os_directory=`$CC -print-multi-os-directory` |
425 | case $multi_os_directory in | |
426 | .) ;; # Avoid trailing /. | |
427 | *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; | |
428 | esac | |
13b6e5b4 AO |
429 | AC_SUBST(toolexecdir) |
430 | AC_SUBST(toolexeclibdir) | |
b48ed568 | 431 | |
1530be84 TT |
432 | if test "${multilib}" = "yes"; then |
433 | multilib_arg="--enable-multilib" | |
434 | else | |
435 | multilib_arg= | |
436 | fi | |
437 | ||
1a8a749c | 438 | AC_OUTPUT(Makefile include/Makefile, [ |
7160c99d RO |
439 | dnl Put all the -I and -D options in a file. |
440 | echo "$INCLUDES $DEFS" > boehm-cflags | |
1530be84 TT |
441 | |
442 | if test -n "$CONFIG_FILES"; then | |
6706f116 | 443 | LD="${ORIGINAL_LD_FOR_MULTILIBS}" |
5a2586cf | 444 | ac_file=Makefile . ${gc_basedir}/../config-ml.in |
1530be84 TT |
445 | fi], |
446 | srcdir=${srcdir} | |
447 | host=${host} | |
448 | target=${target} | |
449 | with_multisubdir=${with_multisubdir} | |
450 | ac_configure_args="${multilib_arg} ${ac_configure_args}" | |
451 | CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} | |
5a2586cf | 452 | gc_basedir=${gc_basedir} |
1530be84 | 453 | CC="${CC}" |
3343fdd2 | 454 | ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" |
1530be84 | 455 | DEFS="$DEFS" |
7160c99d | 456 | INCLUDES="$INCLUDES" |
1530be84 | 457 | ) |