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([1.9 no-define foreign])
21 AC_CONFIG_SRCDIR(gcj_mlc.c)
22 AC_CONFIG_MACRO_DIR([m4])
31 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
33 dnl automake 1.6 and later need the AM_PROG_AS macro.
34 ifdef([AM_PROG_AS],[AM_PROG_AS],[])
36 AC_CHECK_TOOL(RANLIB, ranlib, :) # :)
42 . [$]{srcdir}/configure.host
44 # We use a separate variable to pass down CPPFLAGS and CFLAGS from the main mono
45 # configure, because of autoconf brokeness
46 if test "x$CPPFLAGS_FOR_LIBGC" != "x"; then
47 CPPFLAGS=$CPPFLAGS_FOR_LIBGC
49 if test "x$CFLAGS_FOR_LIBGC" != "x"; then
50 CFLAGS=$CFLAGS_FOR_LIBGC
53 GC_CFLAGS=${gc_cflags}
56 case $enable_embed_check in
58 *) AC_MSG_ERROR([This module is now part of 'mono' and cannot be built as a stand-alone module any longer.]) ;;
61 THREADS=$with_libgc_threads
63 AC_ARG_ENABLE(win32-dllmain,
64 [ --enable-win32-dllmain Define the DllMain function in win32_threads.c even if the collector is not built as a dll],
67 AC_ARG_ENABLE(parallel-mark,
68 [ --enable-parallel-mark parallelize marking and free list construction],
71 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
76 AC_ARG_ENABLE(cplusplus,
77 [ --enable-cplusplus install C++ support],
80 AM_CPPFLAGS=-I${srcdir}/include
82 ## Libraries needed to support dynamic loading and/or threads.
89 AC_CHECK_LIB(pthread, pthread_self, THREADDLLIBS="-lpthread",,)
91 x86-*-linux* | ia64-*-linux* | i386-*-linux* | i486-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha*-*-linux* | s390*-*-linux* | sparc*-*-linux* | powerpc-*-linux*)
92 AC_DEFINE(GC_LINUX_THREADS)
94 if test "${enable_parallel_mark}" = yes; then
95 AC_DEFINE(PARALLEL_MARK)
97 AC_DEFINE(THREAD_LOCAL_ALLOC)
99 *-*-linux* | *-*-nacl*)
100 AC_DEFINE(GC_LINUX_THREADS)
101 AC_DEFINE(_REENTRANT)
104 AC_DEFINE(GC_AIX_THREADS)
105 AC_DEFINE(_REENTRANT)
108 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
109 AC_DEFINE(GC_HPUX_THREADS)
110 AC_DEFINE(_POSIX_C_SOURCE,199506L)
111 if test "${enable_parallel_mark}" = yes; then
112 AC_DEFINE(PARALLEL_MARK)
114 AC_DEFINE(THREAD_LOCAL_ALLOC)
115 THREADDLLIBS="-lpthread -lrt"
118 AC_DEFINE(GC_FREEBSD_THREADS)
119 if test "x$PTHREAD_CFLAGS" != "x"; then
120 AM_CPPFLAGS="$AM_CPPFLAGS $PTHREAD_CFLAGS"
122 if test "x$PTHREAD_LIBS" = "x"; then
123 THREADDLLIBS=-pthread
125 THREADDLLIBS="$PTHREAD_LIBS"
127 AC_DEFINE(THREAD_LOCAL_ALLOC)
130 AC_DEFINE(GC_SOLARIS_THREADS)
131 AC_DEFINE(GC_SOLARIS_PTHREADS)
134 AC_DEFINE(GC_IRIX_THREADS)
137 AC_DEFINE(GC_WIN32_THREADS)
140 AC_DEFINE(GC_DARWIN_THREADS)
141 AC_DEFINE(THREAD_LOCAL_ALLOC)
142 if test "${enable_parallel_mark}" = yes; then
143 AC_DEFINE(PARALLEL_MARK)
147 AC_DEFINE(GC_NETBSD_THREADS)
148 if test "${enable_parallel_mark}" = yes; then
149 AC_DEFINE(PARALLEL_MARK)
151 AC_DEFINE(THREAD_LOCAL_ALLOC)
154 AC_DEFINE(GC_OPENBSD_THREADS)
155 if test "${enable_parallel_mark}" = yes; then
156 AC_DEFINE(PARALLEL_MARK)
158 AC_DEFINE(THREAD_LOCAL_ALLOC)
161 AC_DEFINE(GC_OSF1_THREADS)
162 if test "${enable_parallel_mark}" = yes; then
163 AC_DEFINE(PARALLEL_MARK)
164 AC_DEFINE(THREAD_LOCAL_ALLOC)
165 # May want to enable it in other cases, too.
166 # Measurements havent yet been done.
168 AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
169 THREADDLLIBS="-lpthread -lrt"
172 AC_MSG_ERROR("Pthreads not supported by the GC on this platform.")
177 AC_DEFINE(GC_WIN32_THREADS)
178 dnl Wine getenv may not return NULL for missing entry
180 if test "${enable_win32_dllmain}" = yes; then
181 AC_DEFINE(GC_INSIDE_DLL)
186 AC_MSG_RESULT($THREADDLLIBS)
187 # Use pthread GCC switch
188 THREADDLLIBS=-pthread
189 if test "${enable_parallel_mark}" = yes; then
190 AC_DEFINE(PARALLEL_MARK)
192 AC_DEFINE(THREAD_LOCAL_ALLOC)
193 AC_DEFINE(GC_DGUX386_THREADS)
194 AC_DEFINE(DGUX_THREADS)
195 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
196 AM_CPPFLAGS="-pthread $AM_CPPFLAGS"
200 THREADDLLIBS=-lpthread
201 AC_DEFINE(GC_AIX_THREADS)
202 AC_DEFINE(_REENTRANT)
204 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
205 AC_MSG_ERROR(thread package $THREADS not yet supported)
208 AC_MSG_ERROR($THREADS is an unknown thread package)
211 AC_SUBST(THREADDLLIBS)
218 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
220 AC_MSG_CHECKING(for xlc)
225 ], [compiler_xlc=yes], [compiler_xlc=no])
226 AC_MSG_RESULT($compiler_xlc)
227 AM_CONDITIONAL(COMPILER_XLC,test $compiler_xlc = yes)
228 if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then
229 # the darwin stack-frame-walking code is completely broken on xlc
230 AC_DEFINE(DARWIN_DONT_PARSE_STACK)
233 # We never want libdl on darwin. It is a fake libdl that just ends up making
238 AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
242 AC_SUBST(EXTRA_TEST_LIBS)
247 dnl If the target is an eCos system, use the appropriate eCos
249 dnl FIXME: this should not be a local option but a global target
250 dnl system; at present there is no eCos target.
253 [ --with-ecos enable runtime eCos target support],
254 TARGET_ECOS="$with_ecos"
262 case "$TARGET_ECOS" in
267 CXXINCLUDES="-I${TARGET_ECOS}/include"
268 addobjs="$addobjs ecos.lo"
272 if test "${enable_cplusplus}" = yes; then
273 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
274 addtests="$addtests test_cpp"
277 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
281 AC_SUBST(AM_CPPFLAGS)
282 AC_SUBST(CXXINCLUDES)
284 # Configuration of shared libraries
286 AC_MSG_CHECKING(whether to build shared libraries)
299 # Configuration of machine-dependent code
301 AC_MSG_CHECKING(which machine-dependent code should be used)
305 machdep="alpha_mach_dep.lo"
306 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
307 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
311 machdep="alpha_mach_dep.lo"
313 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
314 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
317 machdep="mips_ultrix_mach_dep.lo"
318 AC_DEFINE(STACKBASE, __stackbase)
319 AC_DEFINE(DATASTART_IS_ETEXT)
322 machdep="mips_ultrix_mach-dep.lo"
324 mips-nec-sysv*|mips-unknown-sysv*)
329 machdep="mips_sgi_mach_dep.lo"
330 AC_DEFINE(NO_EXECUTE_PERMISSION)
333 machdep="sparc_netbsd_mach_dep.lo"
335 sparc-sun-solaris2.3)
336 machdep="sparc_mach_dep.lo"
337 AC_DEFINE(SUNOS53_SHARED_LIB)
339 sparc*-sun-solaris2.*)
340 machdep="sparc_mach_dep.lo"
343 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
347 AC_DEFINE(NO_EXECUTE_PERMISSION)
350 if test x"$machdep" = x; then
351 AC_MSG_RESULT($machdep)
352 machdep="mach_dep.lo"
354 addobjs="$addobjs $machdep"
356 # Adding object files directly to _LIBADD breaks -j builds, so we need to add the sources
357 # instead, but _SOURCES can't contain autoconf substitutions, so add them using automake
361 AC_SUBST(addincludes)
365 AM_CONDITIONAL(TARGET_IA64,test x$target_ia64 = xtrue)
368 # Use dolt (http://dolt.freedesktop.org/) instead of libtool for building.
372 # Check for AViiON Machines running DGUX
375 AC_CHECK_HEADER(sys/dg_sys_info.h,
378 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
379 if test $ac_is_dgux = yes; then
380 if test "$enable_full_debug" = "yes"; then
381 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
382 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
384 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
385 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
391 dnl We use these options to decide which functions to include.
392 AC_ARG_WITH(target-subdir,
393 [ --with-target-subdir=SUBDIR
394 configuring with a cross compiler])
395 AC_ARG_WITH(cross-host,
396 [ --with-cross-host=HOST configuring with a cross compiler])
398 # automake wants to see AC_EXEEXT. But we don't need it. And having
399 # it is actually a problem, because the compiler we're passed can't
400 # necessarily do a full link. So we fool automake here.
402 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
403 # to nothing, so nothing would remain between `then' and `fi' if it
404 # were not for the `:' below.
409 AC_MSG_CHECKING([for threads package to use])
410 AC_MSG_RESULT($THREADS)
412 dnl As of 4.13a2, the collector will not properly work on Solaris when
413 dnl built with gcc and -O. So we remove -O in the appropriate case.
414 dnl Not needed anymore on Solaris.
415 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
418 if test "$GCC" = yes; then
426 new_CFLAGS="$new_CFLAGS $i"
435 *) AC_MSG_RESULT(no) ;;
438 dnl We need to override the top-level CFLAGS. This is how we do it.
442 dnl Include defines that have become de facto standard.
443 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
445 AC_DEFINE(NO_SIGNALS)
446 AC_DEFINE(NO_EXECUTE_PERMISSION)
447 dnl AC_DEFINE(ALL_INTERIOR_POINTERS)
449 dnl By default, make the library as general as possible.
450 AC_DEFINE(JAVA_FINALIZATION)
451 AC_DEFINE(GC_GCJ_SUPPORT)
452 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
454 dnl This is something of a hack. When cross-compiling we turn off
455 dnl some functionality. We also enable the "small" configuration.
456 dnl These is only correct when targetting an embedded system. FIXME.
457 if test -n "${with_cross_host}"; then
460 AC_DEFINE(SMALL_CONFIG)
461 AC_DEFINE(NO_DEBUGGING)
465 AC_ARG_ENABLE(full-debug,
466 [ --enable-full-debug include full support for pointer backtracing etc.],
467 [ if test "$enable_full_debug" = "yes"; then
468 AC_MSG_WARN("Should define GC_DEBUG and use debug alloc. in clients.")
469 AC_DEFINE(KEEP_BACK_PTRS)
470 AC_DEFINE(DBG_HDRS_ALL)
473 AC_DEFINE(MAKE_BACK_GRAPH)
474 AC_DEFINE(SAVE_CALL_COUNT, 8)
475 AC_CHECK_LIB(unwind, backtrace, [
476 AC_DEFINE(GC_HAVE_BUILTIN_BACKTRACE)
478 AC_MSG_WARN("Client code may need to link against libunwind.")
481 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
482 AC_DEFINE(MAKE_BACK_GRAPH)
483 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
484 AC_DEFINE(SAVE_CALL_COUNT, 8)
487 AC_DEFINE(MAKE_BACK_GRAPH)
494 AC_ARG_ENABLE(redirect-malloc,
495 [ --enable-redirect-malloc redirect malloc and friends to GC routines])
497 if test "${enable_redirect_malloc}" = yes; then
498 if test "${enable_full_debug}" = yes; then
499 AC_DEFINE(REDIRECT_MALLOC, GC_debug_malloc_replacement)
500 AC_DEFINE(REDIRECT_REALLOC, GC_debug_realloc_replacement)
501 AC_DEFINE(REDIRECT_FREE, GC_debug_free)
503 AC_DEFINE(REDIRECT_MALLOC, GC_malloc)
509 AC_ARG_ENABLE(gc-assertions,
510 [ --enable-gc-assertions collector-internal assertion checking])
511 if test "${enable_gc_assertions}" = yes; then
512 AC_DEFINE(GC_ASSERTIONS)
515 AC_ARG_ENABLE(quiet-build, [ --enable-quiet-build Enable quiet libgc build (on by default)], enable_quiet_build=$enableval, enable_quiet_build=yes)
516 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
518 if test "${multilib}" = "yes"; then
519 multilib_arg="--enable-multilib"
527 include/private/Makefile
531 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}