1 # Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved.
3 # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
4 # OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
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.
12 # Original author: Tom Tromey
13 # Modified by: Grzegorz Jakacki <jakacki at acm dot org>
15 dnl Process this file with autoconf to produce configure.
20 AC_INIT(gc,6.2,Hans.Boehm@hp.com)
21 ## version must conform to [0-9]+[.][0-9]+(alpha[0-9]+)?
22 AC_CONFIG_SRCDIR(gcj_mlc.c)
25 AC_REVISION($Revision: 995 $)
37 AC_CHECK_TOOL(RANLIB, ranlib, :) # :)
43 . [$]{srcdir}/configure.host
45 GC_CFLAGS=${gc_cflags}
48 AC_ARG_ENABLE(threads, [ --enable-threads=TYPE choose threading package],
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
55 AC_MSG_RESULT([$THREADS])])
57 AC_ARG_ENABLE(parallel-mark,
58 [ --enable-parallel-mark parallelize marking and free list construction],
61 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
66 AC_ARG_ENABLE(cplusplus,
67 [ --enable-cplusplus install C++ support],
70 INCLUDES=-I${srcdir}/include
80 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
81 AC_DEFINE([GC_LINUX_THREADS], 1, [gc linux threads])
82 AC_DEFINE([_REENTRANT], 1, [reentrant])
83 if test "${enable_parallel_mark}" = yes; then
84 AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
86 AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
89 AC_DEFINE([GC_LINUX_THREADS], 1, [gc linux threads])
90 AC_DEFINE([_REENTRANT], 1, [reentrant])
93 AC_DEFINE([GC_AIX_THREADS], 1, [gc aix threads])
94 AC_DEFINE([_REENTRANT], 1, [reentrant])
97 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
98 AC_DEFINE([GC_HPUX_THREADS], 1, [gc hpux threads])
99 AC_DEFINE([_POSIX_C_SOURCE], 199506L, [posix c source])
100 if test "${enable_parallel_mark}" = yes; then
101 AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
103 AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
104 THREADLIBS="-lpthread -lrt"
107 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
108 AC_DEFINE([GC_FREEBSD_THREADS], 1, [gc freebsd threads])
109 INCLUDES="$INCLUDES -pthread"
113 AC_DEFINE([GC_SOLARIS_THREADS], 1, [gc solaris threads])
114 AC_DEFINE([GC_SOLARIS_PTHREADS], 1, [gc solaris pthreads])
117 AC_DEFINE([GC_IRIX_THREADS], 1, [gc irix threads])
120 AC_DEFINE([GC_WIN32_THREADS], 1, [gc win32 threads])
123 AC_DEFINE([GC_DARWIN_THREADS], 1, [gc darwin threads])
124 AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
125 if test "${enable_parallel_mark}" = yes; then
126 AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
130 AC_DEFINE([GC_OSF1_THREADS], 1, [gc osf1 threads])
131 if test "${enable_parallel_mark}" = yes; then
132 AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
133 AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
134 # May want to enable it in other cases, too.
135 # Measurements havent yet been done.
137 INCLUDES="$INCLUDES -pthread"
138 THREADLIBS="-lpthread -lrt"
143 AC_DEFINE([GC_WIN32_THREADS], 1, [gc win32 threads])
144 dnl Wine getenv may not return NULL for missing entry
145 AC_DEFINE([NO_GETENV], 1, [no getenv])
149 AC_MSG_RESULT($THREADLIBS)
150 # Use pthread GCC switch
152 if test "${enable_parallel_mark}" = yes; then
153 AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
155 AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
156 AC_DEFINE([GC_DGUX386_THREADS], 1, [gc dgux386 threads])
157 AC_DEFINE([DGUX_THREADS], 1, [dgux threads])
158 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
159 INCLUDES="-pthread $INCLUDES"
164 AC_DEFINE([GC_AIX_THREADS], 1, [gc aix threads])
165 AC_DEFINE([_REENTRANT], 1, [reentrant])
167 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
168 AC_MSG_ERROR(thread package $THREADS not yet supported)
171 AC_MSG_ERROR($THREADS is an unknown thread package)
181 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
183 # We never want libdl on darwin. It is a fake libdl that just ends up making
188 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
192 AC_SUBST(EXTRA_TEST_LIBS)
197 dnl If the target is an eCos system, use the appropriate eCos
199 dnl FIXME: this should not be a local option but a global target
200 dnl system; at present there is no eCos target.
203 [ --with-ecos enable runtime eCos target support],
204 TARGET_ECOS="$with_ecos"
212 case "$TARGET_ECOS" in
216 AC_DEFINE([ECOS], 1, [ecos])
217 CXXINCLUDES="-I${TARGET_ECOS}/include"
218 addobjs="$addobjs ecos.lo"
222 if test "${enable_cplusplus}" = yes; then
223 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
224 addtests="$addtests test_cpp"
227 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
232 AC_SUBST(CXXINCLUDES)
234 # Configuration of shared libraries
236 AC_MSG_CHECKING(whether to build shared libraries)
249 # Configuration of machine-dependent code
251 AC_MSG_CHECKING(which machine-dependent code should be used)
255 machdep="alpha_mach_dep.lo"
256 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
257 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
261 machdep="alpha_mach_dep.lo"
263 i?86-*-solaris2.[[89]]*)
264 AC_DEFINE([SOLARIS25_PROC_VDB_BUG_FIXED], 1, [solaris 2.5 proc vdb bug fixed])
267 machdep="mips_ultrix_mach_dep.lo"
268 AC_DEFINE([STACKBASE], __stackbase, [stackbase])
269 AC_DEFINE([DATASTART_IS_ETEXT], 1, [datastart is etext])
272 machdep="mips_ultrix_mach-dep.lo"
274 mips-nec-sysv*|mips-unknown-sysv*)
279 machdep="mips_sgi_mach_dep.lo"
280 AC_DEFINE([NO_EXECUTE_PERMISSION], 1, [no execute permission])
283 machdep="sparc_netbsd_mach_dep.lo"
285 sparc-sun-solaris2.3*)
286 machdep="sparc_mach_dep.lo"
287 AC_DEFINE([SUNOS53_SHARED_LIB], 1, [sun os 5.3 shared lib])
289 sparc-sun-solaris2.*)
290 machdep="sparc_mach_dep.lo"
293 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
296 if test x"$machdep" = x; then
297 AC_MSG_RESULT($machdep)
298 machdep="mach_dep.lo"
300 addobjs="$addobjs $machdep"
302 AC_SUBST(addincludes)
309 # Check for AViiON Machines running DGUX
311 AC_MSG_CHECKING(if host is AViiON running DGUX)
313 AC_CHECK_HEADER(sys/dg_sys_info.h,
316 AC_MSG_RESULT($ac_is_dgux)
317 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
318 if test $ac_is_dgux = yes; then
319 if test "$enable_full_debug" = "yes"; then
320 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
321 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
323 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
324 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
330 dnl We use these options to decide which functions to include.
331 AC_ARG_WITH(target-subdir,
332 [ --with-target-subdir=SUBDIR
333 configuring with a cross compiler])
334 AC_ARG_WITH(cross-host,
335 [ --with-cross-host=HOST configuring with a cross compiler])
337 # automake wants to see AC_EXEEXT. But we don't need it. And having
338 # it is actually a problem, because the compiler we're passed can't
339 # necessarily do a full link. So we fool automake here.
341 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
342 # to nothing, so nothing would remain between `then' and `fi' if it
343 # were not for the `:' below.
348 dnl As of 4.13a2, the collector will not properly work on Solaris when
349 dnl built with gcc and -O. So we remove -O in the appropriate case.
351 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
354 if test "$GCC" = yes; then
362 new_CFLAGS="$new_CFLAGS $i"
371 *) AC_MSG_RESULT(no) ;;
374 dnl We need to override the top-level CFLAGS. This is how we do it.
378 dnl Include defines that have become de facto standard.
379 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
380 AC_DEFINE([SILENT], 1, [silent])
381 AC_DEFINE([NO_SIGNALS], 1, [no signals])
382 AC_DEFINE([NO_EXECUTE_PERMISSION], 1, [no exceute permission])
383 AC_DEFINE([ALL_INTERIOR_POINTERS], 1, [all interior pointers])
385 dnl By default, make the library as general as possible.
386 AC_DEFINE([JAVA_FINALIZATION], 1, [java finalization])
387 AC_DEFINE([GC_GCJ_SUPPORT], 1, [gc gcj support])
388 AC_DEFINE([ATOMIC_UNCOLLECTABLE], 1, [atomic uncollectable])
390 dnl This is something of a hack. When cross-compiling we turn off
391 dnl some functionality. We also enable the "small" configuration.
392 dnl These is only correct when targetting an embedded system. FIXME.
393 if test -n "${with_cross_host}"; then
394 AC_DEFINE([NO_SIGSET], 1, [no sigset])
395 AC_DEFINE([NO_CLOCK], 1, [no clock])
396 AC_DEFINE([SMALL_CONFIG], 1, [small config])
397 AC_DEFINE([NO_DEBUGGING], 1, [no debugging])
400 AC_ARG_ENABLE(full-debug,
401 [ --enable-full-debug include full support for pointer backtracing etc.],
402 [ if test "$enable_full_debug" = "yes"; then
403 AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
404 AC_DEFINE([KEEP_BACK_PTRS], 1, [keep back ptrs])
405 AC_DEFINE([DBG_HDRS_ALL], 1, [dbg hdrs all])
408 AC_DEFINE([MAKE_BACK_GRAPH], 1, [make back graph])
410 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
411 AC_DEFINE([MAKE_BACK_GRAPH], 1, [make back graph])
412 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
413 AC_DEFINE([SAVE_CALL_COUNT], 8, [save call count])
416 AC_DEFINE([MAKE_BACK_GRAPH], 1, [make back graph])
421 AC_ARG_ENABLE(redirect-malloc,
422 [ --enable-redirect-malloc redirect malloc and friends to GC routines])
424 if test "${enable_redirect_malloc}" = yes; then
425 if test "${enable_full_debug}" = yes; then
426 AC_DEFINE([REDIRECT_MALLOC], GC_debug_malloc_replacement, [redirect malloc])
427 AC_DEFINE([REDIRECT_REALLOC], GC_debug_realloc_replacement, [redirect realloc])
428 AC_DEFINE([REDIRECT_FREE], GC_debug_free, [redirect free])
430 AC_DEFINE([REDIRECT_MALLOC], GC_malloc, [redirect malloc])
434 AC_ARG_ENABLE(gc-assertions,
435 [ --enable-gc-assertions collector-internal assertion checking])
436 if test "${enable_gc_assertions}" = yes; then
437 AC_DEFINE([GC_ASSERTIONS], 1, [gc assertions])
440 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
442 AC_OUTPUT([Makefile doc/Makefile include/Makefile],,
445 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}