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 # We use a separate variable to pass down CPPFLAGS and CFLAGS from the main mono
43 # configure, because of autoconf brokeness
44 if test "x$CPPFLAGS_FOR_LIBGC" != "x"; then
45 CPPFLAGS=$CPPFLAGS_FOR_LIBGC
47 if test "x$CFLAGS_FOR_LIBGC" != "x"; then
48 CFLAGS=$CFLAGS_FOR_LIBGC
51 GC_CFLAGS=${gc_cflags}
54 case $enable_embed_check in
56 *) AC_MSG_ERROR([This module is now part of 'mono' and cannot be built as a stand-alone module any longer.]) ;;
59 THREADS=$with_libgc_threads
61 AC_ARG_ENABLE(win32-dllmain,
62 [ --enable-win32-dllmain Define the DllMain function in win32_threads.c even if the collector is not built as a dll],
65 AC_ARG_ENABLE(parallel-mark,
66 [ --enable-parallel-mark parallelize marking and free list construction],
69 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
74 AC_ARG_ENABLE(cplusplus,
75 [ --enable-cplusplus install C++ support],
78 INCLUDES=-I${srcdir}/include
80 ## Libraries needed to support dynamic loading and/or threads.
87 THREADDLLIBS=-lpthread
89 x86-*-linux* | ia64-*-linux* | i386-*-linux* | i486-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha*-*-linux* | s390*-*-linux* | sparc*-*-linux* | powerpc-*-linux*)
90 AC_DEFINE(GC_LINUX_THREADS)
92 if test "${enable_parallel_mark}" = yes; then
93 AC_DEFINE(PARALLEL_MARK)
95 AC_DEFINE(THREAD_LOCAL_ALLOC)
98 AC_DEFINE(GC_LINUX_THREADS)
102 AC_DEFINE(GC_AIX_THREADS)
103 AC_DEFINE(_REENTRANT)
106 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
107 AC_DEFINE(GC_HPUX_THREADS)
108 AC_DEFINE(_POSIX_C_SOURCE,199506L)
109 if test "${enable_parallel_mark}" = yes; then
110 AC_DEFINE(PARALLEL_MARK)
112 AC_DEFINE(THREAD_LOCAL_ALLOC)
113 THREADDLLIBS="-lpthread -lrt"
116 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
117 AC_DEFINE(GC_FREEBSD_THREADS)
118 if test "x$PTHREAD_CFLAGS" = "x"; then
119 INCLUDES="$INCLUDES -pthread"
121 INCLUDES="$INCLUDES $PTHREAD_CFLAGS"
123 if test "x$PTHREAD_LIBS" = "x"; then
124 THREADDLLIBS=-pthread
126 THREADDLLIBS=$PTHREAD_LIBS
130 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
131 AC_DEFINE(GC_FREEBSD_THREADS)
132 INCLUDES="$INCLUDES -pthread"
133 THREADDLLIBS=-pthread
136 AC_DEFINE(GC_FREEBSD_THREADS)
137 if test "x$PTHREAD_CFLAGS" != "x"; then
138 INCLUDES="$INCLUDES $PTHREAD_CFLAGS"
140 if test "x$PTHREAD_LIBS" = "x"; then
141 THREADDLLIBS=-pthread
143 THREADDLLIBS="$PTHREAD_LIBS"
147 AC_DEFINE(GC_SOLARIS_THREADS)
148 AC_DEFINE(GC_SOLARIS_PTHREADS)
151 AC_DEFINE(GC_IRIX_THREADS)
154 AC_DEFINE(GC_WIN32_THREADS)
157 AC_DEFINE(GC_DARWIN_THREADS)
158 AC_DEFINE(THREAD_LOCAL_ALLOC)
159 if test "${enable_parallel_mark}" = yes; then
160 AC_DEFINE(PARALLEL_MARK)
164 AC_DEFINE(GC_NETBSD_THREADS)
165 if test "${enable_parallel_mark}" = yes; then
166 AC_DEFINE(PARALLEL_MARK)
168 AC_DEFINE(THREAD_LOCAL_ALLOC)
171 AC_DEFINE(GC_OSF1_THREADS)
172 if test "${enable_parallel_mark}" = yes; then
173 AC_DEFINE(PARALLEL_MARK)
174 AC_DEFINE(THREAD_LOCAL_ALLOC)
175 # May want to enable it in other cases, too.
176 # Measurements havent yet been done.
178 INCLUDES="$INCLUDES -pthread"
179 THREADDLLIBS="-lpthread -lrt"
182 AC_MSG_ERROR("Pthreads not supported by the GC on this platform.")
187 AC_DEFINE(GC_WIN32_THREADS)
188 dnl Wine getenv may not return NULL for missing entry
190 if test "${enable_win32_dllmain}" = yes; then
191 AC_DEFINE(GC_INSIDE_DLL)
196 AC_MSG_RESULT($THREADDLLIBS)
197 # Use pthread GCC switch
198 THREADDLLIBS=-pthread
199 if test "${enable_parallel_mark}" = yes; then
200 AC_DEFINE(PARALLEL_MARK)
202 AC_DEFINE(THREAD_LOCAL_ALLOC)
203 AC_DEFINE(GC_DGUX386_THREADS)
204 AC_DEFINE(DGUX_THREADS)
205 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
206 INCLUDES="-pthread $INCLUDES"
210 THREADDLLIBS=-lpthread
211 AC_DEFINE(GC_AIX_THREADS)
212 AC_DEFINE(_REENTRANT)
214 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
215 AC_MSG_ERROR(thread package $THREADS not yet supported)
218 AC_MSG_ERROR($THREADS is an unknown thread package)
221 AC_SUBST(THREADDLLIBS)
228 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
230 AC_MSG_CHECKING(for xlc)
235 ], [compiler_xlc=yes], [compiler_xlc=no])
236 AC_MSG_RESULT($compiler_xlc)
237 AM_CONDITIONAL(COMPILER_XLC,test $compiler_xlc = yes)
238 if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then
239 # the darwin stack-frame-walking code is completely broken on xlc
240 AC_DEFINE(DARWIN_DONT_PARSE_STACK)
243 # We never want libdl on darwin. It is a fake libdl that just ends up making
248 AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
252 AC_SUBST(EXTRA_TEST_LIBS)
257 dnl If the target is an eCos system, use the appropriate eCos
259 dnl FIXME: this should not be a local option but a global target
260 dnl system; at present there is no eCos target.
263 [ --with-ecos enable runtime eCos target support],
264 TARGET_ECOS="$with_ecos"
272 case "$TARGET_ECOS" in
277 CXXINCLUDES="-I${TARGET_ECOS}/include"
278 addobjs="$addobjs ecos.lo"
282 if test "${enable_cplusplus}" = yes; then
283 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
284 addtests="$addtests test_cpp"
287 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
292 AC_SUBST(CXXINCLUDES)
294 # Configuration of shared libraries
296 AC_MSG_CHECKING(whether to build shared libraries)
309 # Configuration of machine-dependent code
311 AC_MSG_CHECKING(which machine-dependent code should be used)
315 machdep="alpha_mach_dep.lo"
316 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
317 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
321 machdep="alpha_mach_dep.lo"
323 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
324 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
327 machdep="mips_ultrix_mach_dep.lo"
328 AC_DEFINE(STACKBASE, __stackbase)
329 AC_DEFINE(DATASTART_IS_ETEXT)
332 machdep="mips_ultrix_mach-dep.lo"
334 mips-nec-sysv*|mips-unknown-sysv*)
339 machdep="mips_sgi_mach_dep.lo"
340 AC_DEFINE(NO_EXECUTE_PERMISSION)
343 machdep="sparc_netbsd_mach_dep.lo"
345 sparc-sun-solaris2.3)
346 machdep="sparc_mach_dep.lo"
347 AC_DEFINE(SUNOS53_SHARED_LIB)
349 sparc*-sun-solaris2.*)
350 machdep="sparc_mach_dep.lo"
353 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
356 if test x"$machdep" = x; then
357 AC_MSG_RESULT($machdep)
358 machdep="mach_dep.lo"
360 addobjs="$addobjs $machdep"
362 AC_SUBST(addincludes)
369 # Check for AViiON Machines running DGUX
372 AC_CHECK_HEADER(sys/dg_sys_info.h,
375 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
376 if test $ac_is_dgux = yes; then
377 if test "$enable_full_debug" = "yes"; then
378 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
379 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
381 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
382 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
388 dnl We use these options to decide which functions to include.
389 AC_ARG_WITH(target-subdir,
390 [ --with-target-subdir=SUBDIR
391 configuring with a cross compiler])
392 AC_ARG_WITH(cross-host,
393 [ --with-cross-host=HOST configuring with a cross compiler])
395 # automake wants to see AC_EXEEXT. But we don't need it. And having
396 # it is actually a problem, because the compiler we're passed can't
397 # necessarily do a full link. So we fool automake here.
399 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
400 # to nothing, so nothing would remain between `then' and `fi' if it
401 # were not for the `:' below.
406 AC_MSG_CHECKING([for threads package to use])
407 AC_MSG_RESULT($THREADS)
409 dnl As of 4.13a2, the collector will not properly work on Solaris when
410 dnl built with gcc and -O. So we remove -O in the appropriate case.
411 dnl Not needed anymore on Solaris.
412 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
415 if test "$GCC" = yes; then
423 new_CFLAGS="$new_CFLAGS $i"
432 *) AC_MSG_RESULT(no) ;;
435 dnl We need to override the top-level CFLAGS. This is how we do it.
439 dnl Include defines that have become de facto standard.
440 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
442 AC_DEFINE(NO_SIGNALS)
443 AC_DEFINE(NO_EXECUTE_PERMISSION)
444 dnl AC_DEFINE(ALL_INTERIOR_POINTERS)
446 dnl By default, make the library as general as possible.
447 AC_DEFINE(JAVA_FINALIZATION)
448 AC_DEFINE(GC_GCJ_SUPPORT)
449 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
451 dnl This is something of a hack. When cross-compiling we turn off
452 dnl some functionality. We also enable the "small" configuration.
453 dnl These is only correct when targetting an embedded system. FIXME.
454 if test -n "${with_cross_host}"; then
457 AC_DEFINE(SMALL_CONFIG)
458 AC_DEFINE(NO_DEBUGGING)
462 AC_ARG_ENABLE(full-debug,
463 [ --enable-full-debug include full support for pointer backtracing etc.],
464 [ if test "$enable_full_debug" = "yes"; then
465 AC_MSG_WARN("Should define GC_DEBUG and use debug alloc. in clients.")
466 AC_DEFINE(KEEP_BACK_PTRS)
467 AC_DEFINE(DBG_HDRS_ALL)
470 AC_DEFINE(MAKE_BACK_GRAPH)
471 AC_DEFINE(SAVE_CALL_COUNT, 8)
472 AC_CHECK_LIB(unwind, backtrace, [
473 AC_DEFINE(GC_HAVE_BUILTIN_BACKTRACE)
475 AC_MSG_WARN("Client code may need to link against libunwind.")
478 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
479 AC_DEFINE(MAKE_BACK_GRAPH)
480 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
481 AC_DEFINE(SAVE_CALL_COUNT, 8)
484 AC_DEFINE(MAKE_BACK_GRAPH)
491 AC_ARG_ENABLE(redirect-malloc,
492 [ --enable-redirect-malloc redirect malloc and friends to GC routines])
494 if test "${enable_redirect_malloc}" = yes; then
495 if test "${enable_full_debug}" = yes; then
496 AC_DEFINE(REDIRECT_MALLOC, GC_debug_malloc_replacement)
497 AC_DEFINE(REDIRECT_REALLOC, GC_debug_realloc_replacement)
498 AC_DEFINE(REDIRECT_FREE, GC_debug_free)
500 AC_DEFINE(REDIRECT_MALLOC, GC_malloc)
506 AC_ARG_ENABLE(gc-assertions,
507 [ --enable-gc-assertions collector-internal assertion checking])
508 if test "${enable_gc_assertions}" = yes; then
509 AC_DEFINE(GC_ASSERTIONS)
512 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
514 if test "${multilib}" = "yes"; then
515 multilib_arg="--enable-multilib"
522 include/private/Makefile
526 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}