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_OSF1_THREADS)
156 if test "${enable_parallel_mark}" = yes; then
157 AC_DEFINE(PARALLEL_MARK)
158 AC_DEFINE(THREAD_LOCAL_ALLOC)
159 # May want to enable it in other cases, too.
160 # Measurements havent yet been done.
162 INCLUDES="$INCLUDES -pthread"
163 THREADDLLIBS="-lpthread -lrt"
166 AC_MSG_ERROR("Pthreads not supported by the GC on this platform.")
171 AC_DEFINE(GC_WIN32_THREADS)
172 dnl Wine getenv may not return NULL for missing entry
174 if test "${enable_win32_dllmain}" = yes; then
175 AC_DEFINE(GC_INSIDE_DLL)
180 AC_MSG_RESULT($THREADDLLIBS)
181 # Use pthread GCC switch
182 THREADDLLIBS=-pthread
183 if test "${enable_parallel_mark}" = yes; then
184 AC_DEFINE(PARALLEL_MARK)
186 AC_DEFINE(THREAD_LOCAL_ALLOC)
187 AC_DEFINE(GC_DGUX386_THREADS)
188 AC_DEFINE(DGUX_THREADS)
189 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
190 INCLUDES="-pthread $INCLUDES"
194 THREADDLLIBS=-lpthread
195 AC_DEFINE(GC_AIX_THREADS)
196 AC_DEFINE(_REENTRANT)
198 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
199 AC_MSG_ERROR(thread package $THREADS not yet supported)
202 AC_MSG_ERROR($THREADS is an unknown thread package)
205 AC_SUBST(THREADDLLIBS)
212 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
214 AC_MSG_CHECKING(for xlc)
219 ], [compiler_xlc=yes], [compiler_xlc=no])
220 AC_MSG_RESULT($compiler_xlc)
221 AM_CONDITIONAL(COMPILER_XLC,test $compiler_xlc = yes)
222 if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then
223 # the darwin stack-frame-walking code is completely broken on xlc
224 AC_DEFINE(DARWIN_DONT_PARSE_STACK)
227 # We never want libdl on darwin. It is a fake libdl that just ends up making
232 AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
236 AC_SUBST(EXTRA_TEST_LIBS)
241 dnl If the target is an eCos system, use the appropriate eCos
243 dnl FIXME: this should not be a local option but a global target
244 dnl system; at present there is no eCos target.
247 [ --with-ecos enable runtime eCos target support],
248 TARGET_ECOS="$with_ecos"
256 case "$TARGET_ECOS" in
261 CXXINCLUDES="-I${TARGET_ECOS}/include"
262 addobjs="$addobjs ecos.lo"
266 if test "${enable_cplusplus}" = yes; then
267 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
268 addtests="$addtests test_cpp"
271 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
276 AC_SUBST(CXXINCLUDES)
278 # Configuration of shared libraries
280 AC_MSG_CHECKING(whether to build shared libraries)
293 # Configuration of machine-dependent code
295 AC_MSG_CHECKING(which machine-dependent code should be used)
299 machdep="alpha_mach_dep.lo"
300 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
301 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
305 machdep="alpha_mach_dep.lo"
307 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
308 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
311 machdep="mips_ultrix_mach_dep.lo"
312 AC_DEFINE(STACKBASE, __stackbase)
313 AC_DEFINE(DATASTART_IS_ETEXT)
316 machdep="mips_ultrix_mach-dep.lo"
318 mips-nec-sysv*|mips-unknown-sysv*)
323 machdep="mips_sgi_mach_dep.lo"
324 AC_DEFINE(NO_EXECUTE_PERMISSION)
327 machdep="sparc_netbsd_mach_dep.lo"
329 sparc-sun-solaris2.3)
330 machdep="sparc_mach_dep.lo"
331 AC_DEFINE(SUNOS53_SHARED_LIB)
333 sparc*-sun-solaris2.*)
334 machdep="sparc_mach_dep.lo"
337 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
340 if test x"$machdep" = x; then
341 AC_MSG_RESULT($machdep)
342 machdep="mach_dep.lo"
344 addobjs="$addobjs $machdep"
346 AC_SUBST(addincludes)
353 # Check for AViiON Machines running DGUX
356 AC_CHECK_HEADER(sys/dg_sys_info.h,
359 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
360 if test $ac_is_dgux = yes; then
361 if test "$enable_full_debug" = "yes"; then
362 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
363 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
365 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
366 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
372 dnl We use these options to decide which functions to include.
373 AC_ARG_WITH(target-subdir,
374 [ --with-target-subdir=SUBDIR
375 configuring with a cross compiler])
376 AC_ARG_WITH(cross-host,
377 [ --with-cross-host=HOST configuring with a cross compiler])
379 # automake wants to see AC_EXEEXT. But we don't need it. And having
380 # it is actually a problem, because the compiler we're passed can't
381 # necessarily do a full link. So we fool automake here.
383 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
384 # to nothing, so nothing would remain between `then' and `fi' if it
385 # were not for the `:' below.
390 AC_MSG_CHECKING([for threads package to use])
391 AC_MSG_RESULT($THREADS)
393 dnl As of 4.13a2, the collector will not properly work on Solaris when
394 dnl built with gcc and -O. So we remove -O in the appropriate case.
395 dnl Not needed anymore on Solaris.
396 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
399 if test "$GCC" = yes; then
407 new_CFLAGS="$new_CFLAGS $i"
416 *) AC_MSG_RESULT(no) ;;
419 dnl We need to override the top-level CFLAGS. This is how we do it.
423 dnl Include defines that have become de facto standard.
424 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
426 AC_DEFINE(NO_SIGNALS)
427 AC_DEFINE(NO_EXECUTE_PERMISSION)
428 dnl AC_DEFINE(ALL_INTERIOR_POINTERS)
430 dnl By default, make the library as general as possible.
431 AC_DEFINE(JAVA_FINALIZATION)
432 AC_DEFINE(GC_GCJ_SUPPORT)
433 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
435 dnl This is something of a hack. When cross-compiling we turn off
436 dnl some functionality. We also enable the "small" configuration.
437 dnl These is only correct when targetting an embedded system. FIXME.
438 if test -n "${with_cross_host}"; then
441 AC_DEFINE(SMALL_CONFIG)
442 AC_DEFINE(NO_DEBUGGING)
446 AC_ARG_ENABLE(full-debug,
447 [ --enable-full-debug include full support for pointer backtracing etc.],
448 [ if test "$enable_full_debug" = "yes"; then
449 AC_MSG_WARN("Should define GC_DEBUG and use debug alloc. in clients.")
450 AC_DEFINE(KEEP_BACK_PTRS)
451 AC_DEFINE(DBG_HDRS_ALL)
454 AC_DEFINE(MAKE_BACK_GRAPH)
455 AC_DEFINE(SAVE_CALL_COUNT, 8)
456 AC_CHECK_LIB(unwind, backtrace, [
457 AC_DEFINE(GC_HAVE_BUILTIN_BACKTRACE)
459 AC_MSG_WARN("Client code may need to link against libunwind.")
462 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
463 AC_DEFINE(MAKE_BACK_GRAPH)
464 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
465 AC_DEFINE(SAVE_CALL_COUNT, 8)
468 AC_DEFINE(MAKE_BACK_GRAPH)
475 AC_ARG_ENABLE(redirect-malloc,
476 [ --enable-redirect-malloc redirect malloc and friends to GC routines])
478 if test "${enable_redirect_malloc}" = yes; then
479 if test "${enable_full_debug}" = yes; then
480 AC_DEFINE(REDIRECT_MALLOC, GC_debug_malloc_replacement)
481 AC_DEFINE(REDIRECT_REALLOC, GC_debug_realloc_replacement)
482 AC_DEFINE(REDIRECT_FREE, GC_debug_free)
484 AC_DEFINE(REDIRECT_MALLOC, GC_malloc)
490 AC_ARG_ENABLE(gc-assertions,
491 [ --enable-gc-assertions collector-internal assertion checking])
492 if test "${enable_gc_assertions}" = yes; then
493 AC_DEFINE(GC_ASSERTIONS)
496 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
498 if test "${multilib}" = "yes"; then
499 multilib_arg="--enable-multilib"
506 include/private/Makefile
510 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}