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