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.
18 AC_INIT(libgc-mono, 6.6, Hans_Boehm@hp.com)
20 AM_INIT_AUTOMAKE(libgc-mono, 6.6, no-define)
22 AC_CONFIG_SRCDIR(gcj_mlc.c)
31 dnl automake 1.6 and later need the AM_PROG_AS macro.
32 ifdef([AM_PROG_AS],[AM_PROG_AS],[])
34 AC_CHECK_TOOL(RANLIB, ranlib, :) # :)
40 . [$]{srcdir}/configure.host
42 GC_CFLAGS=${gc_cflags}
45 case $enable_embed_check in
47 *) AC_MSG_ERROR([This module is now part of `mono' and can't be built as a stand-alone module any longer.]) ;;
50 THREADS=$with_libgc_threads
52 AC_ARG_ENABLE(win32-dllmain,
53 [ --enable-win32-dllmain Define the DllMain function in win32_threads.c even if the collector is not built as a dll],
56 AC_ARG_ENABLE(parallel-mark,
57 [ --enable-parallel-mark parallelize marking and free list construction],
60 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
65 AC_ARG_ENABLE(cplusplus,
66 [ --enable-cplusplus install C++ support],
69 INCLUDES=-I${srcdir}/include
71 ## Libraries needed to support dynamic loading and/or threads.
78 THREADDLLIBS=-lpthread
80 x86-*-linux* | ia64-*-linux* | i386-*-linux* | i486-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha*-*-linux* | s390*-*-linux* | sparc*-*-linux* | powerpc-*-linux*)
81 AC_DEFINE(GC_LINUX_THREADS)
83 if test "${enable_parallel_mark}" = yes; then
84 AC_DEFINE(PARALLEL_MARK)
86 AC_DEFINE(THREAD_LOCAL_ALLOC)
89 AC_DEFINE(GC_LINUX_THREADS)
93 AC_DEFINE(GC_AIX_THREADS)
97 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
98 AC_DEFINE(GC_HPUX_THREADS)
99 AC_DEFINE(_POSIX_C_SOURCE,199506L)
100 if test "${enable_parallel_mark}" = yes; then
101 AC_DEFINE(PARALLEL_MARK)
103 AC_DEFINE(THREAD_LOCAL_ALLOC)
104 THREADDLLIBS="-lpthread -lrt"
107 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
108 AC_DEFINE(GC_FREEBSD_THREADS)
109 if test "x$PTHREAD_CFLAGS" = "x"; then
110 INCLUDES="$INCLUDES -pthread"
112 INCLUDES="$INCLUDES $PTHREAD_CFLAGS"
114 if test "x$PTHREAD_LIBS" = "x"; then
115 THREADDLLIBS=-pthread
117 THREADDLLIBS=$PTHREAD_LIBS
121 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
122 AC_DEFINE(GC_FREEBSD_THREADS)
123 INCLUDES="$INCLUDES -pthread"
124 THREADDLLIBS=-pthread
127 AC_DEFINE(GC_FREEBSD_THREADS)
128 if test "x$PTHREAD_CFLAGS" != "x"; then
129 INCLUDES="$INCLUDES $PTHREAD_CFLAGS"
131 if test "x$PTHREAD_LIBS" = "x"; then
132 THREADDLLIBS=-pthread
134 THREADDLLIBS="$PTHREAD_LIBS"
138 AC_DEFINE(GC_SOLARIS_THREADS)
139 AC_DEFINE(GC_SOLARIS_PTHREADS)
142 AC_DEFINE(GC_IRIX_THREADS)
145 AC_DEFINE(GC_WIN32_THREADS)
148 AC_DEFINE(GC_DARWIN_THREADS)
149 AC_DEFINE(THREAD_LOCAL_ALLOC)
150 if test "${enable_parallel_mark}" = yes; then
151 AC_DEFINE(PARALLEL_MARK)
155 AC_DEFINE(GC_NETBSD_THREADS)
156 if test "${enable_parallel_mark}" = yes; then
157 AC_DEFINE(PARALLEL_MARK)
159 AC_DEFINE(THREAD_LOCAL_ALLOC)
162 AC_DEFINE(GC_OSF1_THREADS)
163 if test "${enable_parallel_mark}" = yes; then
164 AC_DEFINE(PARALLEL_MARK)
165 AC_DEFINE(THREAD_LOCAL_ALLOC)
166 # May want to enable it in other cases, too.
167 # Measurements havent yet been done.
169 INCLUDES="$INCLUDES -pthread"
170 THREADDLLIBS="-lpthread -lrt"
173 AC_MSG_ERROR("Pthreads not supported by the GC on this platform.")
178 AC_DEFINE(GC_WIN32_THREADS)
179 dnl Wine getenv may not return NULL for missing entry
181 if test "${enable_win32_dllmain}" = yes; then
182 AC_DEFINE(GC_INSIDE_DLL)
187 AC_MSG_RESULT($THREADDLLIBS)
188 # Use pthread GCC switch
189 THREADDLLIBS=-pthread
190 if test "${enable_parallel_mark}" = yes; then
191 AC_DEFINE(PARALLEL_MARK)
193 AC_DEFINE(THREAD_LOCAL_ALLOC)
194 AC_DEFINE(GC_DGUX386_THREADS)
195 AC_DEFINE(DGUX_THREADS)
196 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
197 INCLUDES="-pthread $INCLUDES"
201 THREADDLLIBS=-lpthread
202 AC_DEFINE(GC_AIX_THREADS)
203 AC_DEFINE(_REENTRANT)
205 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
206 AC_MSG_ERROR(thread package $THREADS not yet supported)
209 AC_MSG_ERROR($THREADS is an unknown thread package)
212 AC_SUBST(THREADDLLIBS)
219 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
221 AC_MSG_CHECKING(for xlc)
226 ], [compiler_xlc=yes], [compiler_xlc=no])
227 AC_MSG_RESULT($compiler_xlc)
228 AM_CONDITIONAL(COMPILER_XLC,test $compiler_xlc = yes)
229 if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then
230 # the darwin stack-frame-walking code is completely broken on xlc
231 AC_DEFINE(DARWIN_DONT_PARSE_STACK)
234 # We never want libdl on darwin. It is a fake libdl that just ends up making
239 AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
243 AC_SUBST(EXTRA_TEST_LIBS)
248 dnl If the target is an eCos system, use the appropriate eCos
250 dnl FIXME: this should not be a local option but a global target
251 dnl system; at present there is no eCos target.
254 [ --with-ecos enable runtime eCos target support],
255 TARGET_ECOS="$with_ecos"
263 case "$TARGET_ECOS" in
268 CXXINCLUDES="-I${TARGET_ECOS}/include"
269 addobjs="$addobjs ecos.lo"
273 if test "${enable_cplusplus}" = yes; then
274 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
275 addtests="$addtests test_cpp"
278 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
283 AC_SUBST(CXXINCLUDES)
285 # Configuration of shared libraries
287 AC_MSG_CHECKING(whether to build shared libraries)
300 # Configuration of machine-dependent code
302 AC_MSG_CHECKING(which machine-dependent code should be used)
306 machdep="alpha_mach_dep.lo"
307 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
308 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
312 machdep="alpha_mach_dep.lo"
314 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
315 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
318 machdep="mips_ultrix_mach_dep.lo"
319 AC_DEFINE(STACKBASE, __stackbase)
320 AC_DEFINE(DATASTART_IS_ETEXT)
323 machdep="mips_ultrix_mach-dep.lo"
325 mips-nec-sysv*|mips-unknown-sysv*)
330 machdep="mips_sgi_mach_dep.lo"
331 AC_DEFINE(NO_EXECUTE_PERMISSION)
334 machdep="sparc_netbsd_mach_dep.lo"
336 sparc-sun-solaris2.3)
337 machdep="sparc_mach_dep.lo"
338 AC_DEFINE(SUNOS53_SHARED_LIB)
340 sparc*-sun-solaris2.*)
341 machdep="sparc_mach_dep.lo"
344 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
347 if test x"$machdep" = x; then
348 AC_MSG_RESULT($machdep)
349 machdep="mach_dep.lo"
351 addobjs="$addobjs $machdep"
353 AC_SUBST(addincludes)
360 # Check for AViiON Machines running DGUX
363 AC_CHECK_HEADER(sys/dg_sys_info.h,
366 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
367 if test $ac_is_dgux = yes; then
368 if test "$enable_full_debug" = "yes"; then
369 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
370 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
372 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
373 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
379 dnl We use these options to decide which functions to include.
380 AC_ARG_WITH(target-subdir,
381 [ --with-target-subdir=SUBDIR
382 configuring with a cross compiler])
383 AC_ARG_WITH(cross-host,
384 [ --with-cross-host=HOST configuring with a cross compiler])
386 # automake wants to see AC_EXEEXT. But we don't need it. And having
387 # it is actually a problem, because the compiler we're passed can't
388 # necessarily do a full link. So we fool automake here.
390 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
391 # to nothing, so nothing would remain between `then' and `fi' if it
392 # were not for the `:' below.
397 AC_MSG_CHECKING([for threads package to use])
398 AC_MSG_RESULT($THREADS)
400 dnl As of 4.13a2, the collector will not properly work on Solaris when
401 dnl built with gcc and -O. So we remove -O in the appropriate case.
402 dnl Not needed anymore on Solaris.
403 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
406 if test "$GCC" = yes; then
414 new_CFLAGS="$new_CFLAGS $i"
423 *) AC_MSG_RESULT(no) ;;
426 dnl We need to override the top-level CFLAGS. This is how we do it.
430 dnl Include defines that have become de facto standard.
431 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
433 AC_DEFINE(NO_SIGNALS)
434 AC_DEFINE(NO_EXECUTE_PERMISSION)
435 dnl AC_DEFINE(ALL_INTERIOR_POINTERS)
437 dnl By default, make the library as general as possible.
438 AC_DEFINE(JAVA_FINALIZATION)
439 AC_DEFINE(GC_GCJ_SUPPORT)
440 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
442 dnl This is something of a hack. When cross-compiling we turn off
443 dnl some functionality. We also enable the "small" configuration.
444 dnl These is only correct when targetting an embedded system. FIXME.
445 if test -n "${with_cross_host}"; then
448 AC_DEFINE(SMALL_CONFIG)
449 AC_DEFINE(NO_DEBUGGING)
453 AC_ARG_ENABLE(full-debug,
454 [ --enable-full-debug include full support for pointer backtracing etc.],
455 [ if test "$enable_full_debug" = "yes"; then
456 AC_MSG_WARN("Should define GC_DEBUG and use debug alloc. in clients.")
457 AC_DEFINE(KEEP_BACK_PTRS)
458 AC_DEFINE(DBG_HDRS_ALL)
461 AC_DEFINE(MAKE_BACK_GRAPH)
462 AC_DEFINE(SAVE_CALL_COUNT, 8)
463 AC_CHECK_LIB(unwind, backtrace, [
464 AC_DEFINE(GC_HAVE_BUILTIN_BACKTRACE)
466 AC_MSG_WARN("Client code may need to link against libunwind.")
469 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
470 AC_DEFINE(MAKE_BACK_GRAPH)
471 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
472 AC_DEFINE(SAVE_CALL_COUNT, 8)
475 AC_DEFINE(MAKE_BACK_GRAPH)
482 AC_ARG_ENABLE(redirect-malloc,
483 [ --enable-redirect-malloc redirect malloc and friends to GC routines])
485 if test "${enable_redirect_malloc}" = yes; then
486 if test "${enable_full_debug}" = yes; then
487 AC_DEFINE(REDIRECT_MALLOC, GC_debug_malloc_replacement)
488 AC_DEFINE(REDIRECT_REALLOC, GC_debug_realloc_replacement)
489 AC_DEFINE(REDIRECT_FREE, GC_debug_free)
491 AC_DEFINE(REDIRECT_MALLOC, GC_malloc)
497 AC_ARG_ENABLE(gc-assertions,
498 [ --enable-gc-assertions collector-internal assertion checking])
499 if test "${enable_gc_assertions}" = yes; then
500 AC_DEFINE(GC_ASSERTIONS)
503 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
505 if test "${multilib}" = "yes"; then
506 multilib_arg="--enable-multilib"
513 include/private/Makefile
517 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}