new Stack memory allocation, use of unused arg regs as temp disabled
[cacao.git] / src / boehm-gc / configure.in
1 # Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved.
2
3 # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
4 # OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
5
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.
11 #
12 # Original author: Tom Tromey
13 # Modified by: Grzegorz Jakacki <jakacki at acm dot org>
14
15 dnl Process this file with autoconf to produce configure.
16
17 # Initialization
18 # ==============
19
20 AC_INIT(gc,6.3,Hans.Boehm@hp.com) 
21     ## version must conform to [0-9]+[.][0-9]+(alpha[0-9]+)?
22 AC_CONFIG_SRCDIR(gcj_mlc.c)
23 AC_CANONICAL_TARGET 
24 AC_PREREQ(2.53)
25 AC_REVISION($Revision: 1621 $)
26 GC_SET_VERSION
27 AM_INIT_AUTOMAKE
28
29 AM_CONFIG_HEADER([include/config.h])
30
31 AC_SUBST(PACKAGE)
32 AC_SUBST(GC_VERSION)
33
34 AC_PROG_CC
35 AC_PROG_CXX
36
37 AC_C_INLINE
38
39 AM_PROG_AS
40 AC_CHECK_TOOL(AR, ar)
41 AC_CHECK_TOOL(RANLIB, ranlib, :)  # :)
42
43 AC_PROG_LIBTOOL
44 AC_PROG_INSTALL
45
46 AM_MAINTAINER_MODE
47
48 . [$]{srcdir}/configure.host
49
50 GC_CFLAGS=${gc_cflags}
51 AC_SUBST(GC_CFLAGS)
52
53 AC_ARG_ENABLE(boehm-threads, [  --enable-boehm-threads=TYPE   choose threading package],
54   THREADS=$enableval,
55   [ AC_MSG_CHECKING([for thread model used by GCC])
56     THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
57     if test -z "$THREADS"; then
58       THREADS=no
59     fi
60     AC_MSG_RESULT([$THREADS])])
61
62 AC_ARG_ENABLE(parallel-mark,
63 [  --enable-parallel-mark       parallelize marking and free list construction],
64    [case "$THREADS" in
65       no | none | single)
66         AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
67         ;;
68     esac]
69 )
70
71 AC_ARG_ENABLE(cplusplus,
72 [  --enable-cplusplus           install C++ support],
73 )
74
75 INCLUDES=-I${srcdir}/include
76 THREADLIBS=
77 case "$THREADS" in
78  no | none | single)
79     THREADS=none
80     ;;
81  posix | pthreads)
82     THREADS=posix
83     THREADLIBS=-lpthread
84     case "$host" in
85      x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
86         AC_DEFINE([GC_LINUX_THREADS], 1, [gc linux threads])
87         AC_DEFINE([_REENTRANT], 1, [reentrant])
88         if test "${enable_parallel_mark}" = yes; then
89           AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
90         fi
91         AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
92         ;;
93      *-*-linux*)
94         AC_DEFINE([GC_LINUX_THREADS], 1, [gc linux threads])
95         AC_DEFINE([_REENTRANT], 1, [reentrant])
96         ;;
97      *-*-aix*)
98         AC_DEFINE([GC_AIX_THREADS], 1, [gc aix threads])
99         AC_DEFINE([_REENTRANT], 1, [reentrant])
100         ;;
101      *-*-hpux*)
102         AC_MSG_WARN("Only HP/UX 11 threads are supported.")
103         AC_DEFINE([GC_HPUX_THREADS], 1, [gc hpux threads])
104         AC_DEFINE([_POSIX_C_SOURCE], 199506L, [posix c source])
105         if test "${enable_parallel_mark}" = yes; then
106           AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
107         fi
108         AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
109         THREADLIBS="-lpthread -lrt"
110         ;;
111      *-*-freebsd*)
112         AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
113         AC_DEFINE([GC_FREEBSD_THREADS], 1, [gc freebsd threads])
114         INCLUDES="$INCLUDES -pthread"
115         THREADLIBS=-pthread
116         ;;
117      *-*-solaris*)
118         AC_DEFINE([GC_SOLARIS_THREADS], 1, [gc solaris threads])
119         AC_DEFINE([GC_SOLARIS_PTHREADS], 1, [gc solaris pthreads])
120         ;;
121      *-*-irix*)
122         AC_DEFINE([GC_IRIX_THREADS], 1, [gc irix threads])
123         ;;
124      *-*-cygwin*)
125         AC_DEFINE([GC_WIN32_THREADS], 1, [gc win32 threads])
126         ;;
127      *-*-darwin*)
128         AC_DEFINE([GC_DARWIN_THREADS], 1, [gc darwin threads])
129         AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
130         if test "${enable_parallel_mark}" = yes; then
131           AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
132         fi
133         ;;
134      *-*-osf*)
135         AC_DEFINE([GC_OSF1_THREADS], 1, [gc osf1 threads])
136         if test "${enable_parallel_mark}" = yes; then
137           AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
138           AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
139           # May want to enable it in other cases, too.
140           # Measurements havent yet been done.
141         fi
142         INCLUDES="$INCLUDES -pthread"
143         THREADLIBS="-lpthread -lrt"
144         ;;
145     esac
146     ;;
147  win32)
148     AC_DEFINE([GC_WIN32_THREADS], 1, [gc win32 threads])
149     dnl Wine getenv may not return NULL for missing entry
150     AC_DEFINE([NO_GETENV], 1, [no getenv])
151     ;;
152  dgux386)
153     THREADS=dgux386
154     AC_MSG_RESULT($THREADLIBS)
155     # Use pthread GCC  switch
156     THREADLIBS=-pthread
157     if test "${enable_parallel_mark}" = yes; then
158         AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
159     fi
160     AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
161     AC_DEFINE([GC_DGUX386_THREADS], 1, [gc dgux386 threads])
162     AC_DEFINE([DGUX_THREADS], 1, [dgux threads])
163     # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
164     INCLUDES="-pthread $INCLUDES"
165     ;;
166  aix)
167     THREADS=posix
168     THREADLIBS=-lpthread
169     AC_DEFINE([GC_AIX_THREADS], 1, [gc aix threads])
170     AC_DEFINE([_REENTRANT], 1, [reentrant])
171     ;;
172  decosf1 | irix | mach | os2 | solaris | dce | vxworks)
173     AC_MSG_ERROR(thread package $THREADS not yet supported)
174     ;;
175  *)
176     AC_MSG_ERROR($THREADS is an unknown thread package)
177     ;;
178 esac
179 AC_SUBST(THREADLIBS)
180
181 case "$host" in 
182    powerpc-*-darwin*)
183       powerpc_darwin=true
184       ;;
185 esac
186 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
187
188 # We never want libdl on darwin. It is a fake libdl that just ends up making
189 # dyld calls anyway
190 case "$host" in
191   *-*-darwin*) ;;
192   *) 
193     AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
194     ;;
195 esac
196
197 AC_SUBST(EXTRA_TEST_LIBS)
198
199 target_all=libgc.la
200 AC_SUBST(target_all)
201
202 dnl If the target is an eCos system, use the appropriate eCos
203 dnl I/O routines.
204 dnl FIXME: this should not be a local option but a global target
205 dnl system; at present there is no eCos target.
206 TARGET_ECOS="no"
207 AC_ARG_WITH(ecos,
208 [  --with-ecos             enable runtime eCos target support],
209 TARGET_ECOS="$with_ecos"
210 )
211
212 addobjs=
213 addlibs=
214 addincludes=
215 addtests=
216 CXXINCLUDES=
217 case "$TARGET_ECOS" in
218    no)
219       ;;
220    *)
221       AC_DEFINE([ECOS], 1, [ecos])
222       CXXINCLUDES="-I${TARGET_ECOS}/include"
223       addobjs="$addobjs ecos.lo"
224       ;;
225 esac
226
227 if test "${enable_cplusplus}" = yes; then
228       addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
229       addtests="$addtests test_cpp"
230 fi
231
232 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
233
234 AC_SUBST(CXX)
235
236 AC_SUBST(INCLUDES)
237 AC_SUBST(CXXINCLUDES)
238
239 # Configuration of shared libraries
240 #
241 AC_MSG_CHECKING(whether to build shared libraries)
242 AC_ENABLE_SHARED
243
244 case "$host" in
245  alpha-*-openbsd*)
246      enable_shared=no
247      AC_MSG_RESULT(no)
248      ;;
249  *)
250      AC_MSG_RESULT(yes)
251      ;;
252 esac
253
254 # Configuration of machine-dependent code
255 #
256 AC_MSG_CHECKING(which machine-dependent code should be used) 
257 machdep=
258 case "$host" in
259  alpha-*-openbsd*)
260     machdep="alpha_mach_dep.lo"
261     if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
262        AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
263     fi
264     ;;
265  alpha*-*-linux*)
266     machdep="alpha_mach_dep.lo"
267     ;;
268  i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
269     AC_DEFINE([SOLARIS25_PROC_VDB_BUG_FIXED], 1, [solaris 2.5 proc vdb bug fixed])
270     ;;
271  mipstx39-*-elf*)
272     machdep="mips_ultrix_mach_dep.lo"
273     AC_DEFINE([STACKBASE], __stackbase, [stackbase])
274     AC_DEFINE([DATASTART_IS_ETEXT], 1, [datastart is etext])
275     ;;
276  mips-dec-ultrix*)
277     machdep="mips_ultrix_mach-dep.lo"
278     ;;
279  mips-nec-sysv*|mips-unknown-sysv*)
280     ;;
281  mips*-*-linux*) 
282     ;; 
283  mips-*-*)
284     machdep="mips_sgi_mach_dep.lo"
285     AC_DEFINE([NO_EXECUTE_PERMISSION], 1, [no execute permission])
286     ;;
287  sparc-*-netbsd*)
288     machdep="sparc_netbsd_mach_dep.lo"
289     ;;
290  sparc-sun-solaris2.3)
291     machdep="sparc_mach_dep.lo"
292     AC_DEFINE([SUNOS53_SHARED_LIB], 1, [sun os 5.3 shared lib])
293     ;;
294  sparc-sun-solaris2.*)
295     machdep="sparc_mach_dep.lo"
296     ;;
297  ia64-*-*)
298     machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
299     ;;
300 esac
301 if test x"$machdep" = x; then
302 AC_MSG_RESULT($machdep)
303    machdep="mach_dep.lo"
304 fi
305 addobjs="$addobjs $machdep"
306 AC_SUBST(addobjs)
307 AC_SUBST(addincludes)
308 AC_SUBST(addlibs)
309 AC_SUBST(addtests)
310
311 AC_PROG_LIBTOOL
312
313 #
314 # Check for AViiON Machines running DGUX
315 #
316 ac_is_dgux=no
317 AC_CHECK_HEADER(sys/dg_sys_info.h,
318 [ac_is_dgux=yes;])
319
320     ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
321 if test $ac_is_dgux = yes; then
322     if test "$enable_full_debug" = "yes"; then
323       CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
324       CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
325     else
326       CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
327       CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
328     fi
329     AC_SUBST(CFLAGS)
330     AC_SUBST(CXXFLAGS)
331 fi
332
333 dnl We use these options to decide which functions to include.
334 AC_ARG_WITH(target-subdir,
335 [  --with-target-subdir=SUBDIR
336                           configuring with a cross compiler])
337 AC_ARG_WITH(cross-host,
338 [  --with-cross-host=HOST  configuring with a cross compiler])
339
340 # automake wants to see AC_EXEEXT.  But we don't need it.  And having
341 # it is actually a problem, because the compiler we're passed can't
342 # necessarily do a full link.  So we fool automake here.
343 if false; then
344   # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
345   # to nothing, so nothing would remain between `then' and `fi' if it
346   # were not for the `:' below.
347   :
348   AC_EXEEXT
349 fi
350
351 dnl As of 4.13a2, the collector will not properly work on Solaris when
352 dnl built with gcc and -O.  So we remove -O in the appropriate case.
353 dnl
354 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
355 case "$host" in
356  sparc-sun-solaris2*|*aix*)
357     if test "$GCC" = yes; then
358        AC_MSG_RESULT(yes)
359        new_CFLAGS=
360        for i in $CFLAGS; do
361           case "$i" in
362            -O*)
363               ;;
364            *)
365               new_CFLAGS="$new_CFLAGS $i"
366               ;;
367           esac
368        done
369        CFLAGS="$new_CFLAGS"
370     else
371        AC_MSG_RESULT(no)
372     fi
373     ;;
374  *) AC_MSG_RESULT(no) ;;
375 esac
376
377 dnl We need to override the top-level CFLAGS.  This is how we do it.
378 MY_CFLAGS="$CFLAGS"
379 AC_SUBST(MY_CFLAGS)
380
381 dnl Include defines that have become de facto standard.
382 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
383 AC_DEFINE([SILENT], 1, [silent])
384 AC_DEFINE([NO_SIGNALS], 1, [no signals])
385 AC_DEFINE([NO_EXECUTE_PERMISSION], 1, [no exceute permission])
386 AC_DEFINE([ALL_INTERIOR_POINTERS], 1, [all interior pointers])
387
388 dnl By default, make the library as general as possible.
389 AC_DEFINE([JAVA_FINALIZATION], 1, [java finalization])
390 AC_DEFINE([GC_GCJ_SUPPORT], 1, [gc gcj support])
391 AC_DEFINE([ATOMIC_UNCOLLECTABLE], 1, [atomic uncollectable])
392
393 dnl This is something of a hack.  When cross-compiling we turn off
394 dnl some functionality.  We also enable the "small" configuration.
395 dnl These is only correct when targetting an embedded system.  FIXME.
396 if test -n "${with_cross_host}"; then
397    AC_DEFINE([NO_SIGSET], 1, [no sigset])
398    AC_DEFINE([NO_CLOCK], 1, [no clock])
399    AC_DEFINE([SMALL_CONFIG], 1, [small config])
400    AC_DEFINE([NO_DEBUGGING], 1, [no debugging])
401 fi
402
403 UNWINDLIBS=
404 AC_ARG_ENABLE(full-debug,
405 [  --enable-full-debug  include full support for pointer backtracing etc.],
406 [ if test "$enable_full_debug" = "yes"; then
407     AC_MSG_WARN("Should define GC_DEBUG and use debug alloc. in clients.")
408     AC_DEFINE([KEEP_BACK_PTRS], 1, [keep back ptrs])
409     AC_DEFINE([DBG_HDRS_ALL], 1, [dbg hdrs all])
410     case $host in
411       ia64-*-linux* )
412         AC_DEFINE([MAKE_BACK_GRAPH], 1, [make back graph])
413         AC_DEFINE([SAVE_CALL_COUNT], 8, [save call count])
414         AC_CHECK_LIB(unwind, backtrace, [
415           AC_DEFINE([GC_HAVE_BUILTIN_BACKTRACE], 1, [have builtin backtrace])
416           UNWINDLIBS=-lunwind
417           AC_MSG_WARN("Client code may need to link against libunwind.")
418         ])
419       ;;
420       x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
421         AC_DEFINE([MAKE_BACK_GRAPH], 1, [make back graph])
422         AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
423         AC_DEFINE([SAVE_CALL_COUNT], 8, [save call count])
424       ;;
425       i[3456]86-*-dgux*)
426         AC_DEFINE([MAKE_BACK_GRAPH], 1, [make back graph])
427       ;;
428     esac ]
429   fi)
430
431 AC_SUBST(UNWINDLIBS)
432
433 AC_ARG_ENABLE(redirect-malloc,
434 [  --enable-redirect-malloc  redirect malloc and friends to GC routines])
435
436 if test "${enable_redirect_malloc}" = yes; then
437     if test "${enable_full_debug}" = yes; then
438         AC_DEFINE([REDIRECT_MALLOC], GC_debug_malloc_replacement, [redirect malloc])
439         AC_DEFINE([REDIRECT_REALLOC], GC_debug_realloc_replacement, [redirect realloc])
440         AC_DEFINE([REDIRECT_FREE], GC_debug_free, [redirect free])
441     else
442         AC_DEFINE([REDIRECT_MALLOC], GC_malloc, [redirect malloc])
443     fi
444 fi
445
446 AC_ARG_ENABLE(gc-assertions,
447 [  --enable-gc-assertions  collector-internal assertion checking])
448 if test "${enable_gc_assertions}" = yes; then
449     AC_DEFINE([GC_ASSERTIONS], 1, [gc assertions])
450 fi
451
452 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
453
454 AC_OUTPUT([Makefile doc/Makefile include/Makefile],,
455 srcdir=${srcdir}
456 host=${host}
457 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
458 CC="${CC}"
459 DEFS="$DEFS"
460 )