OSDN Git Service

Forgot to add my own email address
[pf3gnuchains/gcc-fork.git] / boehm-gc / configure.ac
1 # Copyright (c) 1999, 2000, 2001, 2002, 2003 by Red Hat, Inc. All rights reserved.
2 # Copyright 2004 Nathanael Nerode
3
4 # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
5 # OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
6
7 # Permission is hereby granted to use or copy this program
8 # for any purpose,  provided the above notices are retained on all copies.
9 # Permission to modify the code and to distribute modified code is granted,
10 # provided the above notices are retained, and a notice that the code was
11 # modified is included with the above copyright notice.
12 #
13 # Original author: Tom Tromey
14 # Modified by Nathanael Nerode
15
16 dnl Process this file with autoconf to produce configure.
17
18 AC_PREREQ(2.59)
19 AC_INIT
20 AC_CONFIG_SRCDIR(gcj_mlc.c)
21 # This works around the fact that libtool configuration may change LD
22 # for this particular configuration, but some shells, instead of
23 # keeping the changes in LD private, export them just because LD is
24 # exported.
25 ORIGINAL_LD_FOR_MULTILIBS=$LD
26
27 AM_ENABLE_MULTILIB(, ..)
28
29 AC_CANONICAL_HOST
30 AC_CANONICAL_TARGET
31
32 # Get the 'noncanonical' system names.
33 ACX_NONCANONICAL_TARGET
34
35 # This works around an automake problem.
36 mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
37 AC_SUBST(mkinstalldirs)
38
39 AM_INIT_AUTOMAKE(gc, 6.3, no-define)
40
41 # The autoconf 2.5x version of the no-executables hack.
42 GCC_NO_EXECUTABLES
43
44 # Yak.  We must force CC and CXX to /not/ be precious variables; otherwise
45 # the wrong, non-multilib-adjusted value will be used in multilibs.
46 # As a side effect, we have to subst CFLAGS and CXXFLAGS ourselves.
47
48 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
49 m4_define([_AC_ARG_VAR_PRECIOUS],[])
50 AC_PROG_CC
51 AC_PROG_CXX
52 m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
53
54 AM_PROG_CC_C_O
55
56 AC_SUBST(CFLAGS)
57 AC_SUBST(CXXFLAGS)
58
59 # Newer automakes demand CCAS and CCASFLAGS.
60 : ${CCAS='$(CC)'}
61 : ${CCASFLAGS='$(CFLAGS)'}
62 AC_SUBST(CCAS)
63 AC_SUBST(CCASFLAGS)
64
65 AC_CHECK_TOOL(AS, as)
66 AC_CHECK_TOOL(AR, ar)
67 AC_CHECK_TOOL(RANLIB, ranlib, :)
68
69 AC_PROG_INSTALL
70
71 AM_MAINTAINER_MODE
72
73 . ${srcdir}/configure.host
74
75 case ${gc_basedir} in
76 /* | [A-Za-z]:[/\\]*) gc_flagbasedir=${gc_basedir} ;;
77 *) gc_flagbasedir='$(top_builddir)/'${gc_basedir} ;;
78 esac
79
80 gc_cflags="${gc_cflags} -Iinclude -I"'$(top_builddir)'"/./targ-include -I${gc_flagbasedir}/libc/include"
81 case "${host}" in
82   *-*-cygwin32*)
83     gc_cflags="${gc_cflags} -I${gc_flagbasedir}/../winsup/include"
84     ;;
85 esac
86
87 dnl gc_cflags="${gc_cflags} -fno-builtin"
88
89 GC_CFLAGS=${gc_cflags}
90 AC_SUBST(GC_CFLAGS)
91
92 AC_PROG_LIBTOOL
93
94 dnl We use these options to decide which functions to include.
95 AC_ARG_WITH(target-subdir,
96 [  --with-target-subdir=SUBDIR
97                           configuring with a cross compiler])
98 AC_ARG_WITH(cross-host,
99 [  --with-cross-host=HOST  configuring with a cross compiler])
100
101 AC_MSG_CHECKING([for thread model used by GCC])
102 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
103 if test -z "$THREADS"; then
104    THREADS=no
105 fi
106 AC_MSG_RESULT([$THREADS])
107
108 AC_ARG_ENABLE(parallel-mark,
109 [  --enable-parallel-mark       parallelize marking and free list construction],
110    [case "$THREADS" in
111       no | none | single)
112         AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
113         ;;
114     esac]
115 )
116
117 AM_CPPFLAGS="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
118 THREADLIBS=
119 case "$THREADS" in
120  no | none | single)
121     THREADS=none
122     ;;
123  posix | posix95 | pthreads)
124     THREADS=posix
125     THREADLIBS=-lpthread
126     case "$host" in
127      x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
128         AC_DEFINE(GC_LINUX_THREADS,1,[support for Xavier Leroy's Linux threads])
129         AC_DEFINE(_REENTRANT,1,[Use reentrant code])
130         if test "${enable_parallel_mark}" = yes; then
131           AC_DEFINE(PARALLEL_MARK,1,[allow the marker to run in multiple threads])
132         fi
133         AC_DEFINE(THREAD_LOCAL_ALLOC,1,[define GC_local_malloc() & GC_local_malloc_atomic()])
134         ;;
135      *-*-linux*)
136         AC_DEFINE(GC_LINUX_THREADS,1)
137         AC_DEFINE(_REENTRANT,1)
138         ;;
139      *-*-aix*)
140         AC_DEFINE(GC_AIX_THREADS,1,[support AIX threads])
141         AC_DEFINE(_REENTRANT,1)
142         ;;
143      *-*-hpux*)
144         AC_MSG_WARN("Only HP/UX 11 threads are supported.")
145         AC_DEFINE(GC_HPUX_THREADS,1,[enables support for HP/UX 11 pthreads])
146         AC_DEFINE(_POSIX_C_SOURCE,199506L,[POSIX version of C Source])
147         if test "${enable_parallel_mark}" = yes; then
148           AC_DEFINE(PARALLEL_MARK,1)
149         fi
150         AC_DEFINE(THREAD_LOCAL_ALLOC,1)
151         THREADLIBS="-lpthread -lrt"
152         ;;
153      *-*-freebsd*)
154         AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
155         AC_DEFINE(GC_FREEBSD_THREADS,1,[support FreeBSD threads])
156         AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
157         THREADLIBS=-pthread
158         ;;
159      *-*-solaris*)
160         AC_DEFINE(GC_SOLARIS_THREADS,1,[support for Solaris (thr_) threads])
161         AC_DEFINE(GC_SOLARIS_PTHREADS,1,[support for Solaris pthreads])
162         ;;
163      *-*-irix*)
164         AC_DEFINE(GC_IRIX_THREADS,1,[support for Irix pthreads])
165         ;;
166      *-*-cygwin*)
167         AC_DEFINE(GC_WIN32_THREADS,1,[support for win32 threads])
168         ;;
169      *-*-darwin*)
170         AC_DEFINE(GC_DARWIN_THREADS,1,[support for Mac OS X pthreads])
171         AC_DEFINE(THREAD_LOCAL_ALLOC,1)
172         if test "${enable_parallel_mark}" = yes; then
173           AC_DEFINE(PARALLEL_MARK,1)
174         fi
175         ;;
176      *-*-osf*)
177         AC_DEFINE(GC_OSF1_THREADS,1,[support for Tru64 pthreads])
178         if test "${enable_parallel_mark}" = yes; then
179           AC_DEFINE(PARALLEL_MARK,1)
180           AC_DEFINE(THREAD_LOCAL_ALLOC,1)
181           # May want to enable it in other cases, too.
182           # Measurements havent yet been done.
183         fi
184         AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
185         THREADLIBS="-lpthread -lrt"
186         ;;
187     esac
188     ;;
189  win32)
190     AC_DEFINE(GC_WIN32_THREADS,1)
191     dnl Old wine getenv may not return NULL for missing entry.
192     dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
193     ;;
194  dgux386)
195     THREADS=dgux386
196 AC_MSG_RESULT($THREADLIBS)
197     # Use pthread GCC  switch
198     THREADLIBS=-pthread
199     if test "${enable_parallel_mark}" = yes; then
200         AC_DEFINE(PARALLEL_MARK,1)
201     fi
202     AC_DEFINE(THREAD_LOCAL_ALLOC,1)
203     AC_DEFINE(GC_DGUX386_THREADS,1,[support for DB/UX on I386 threads])
204     AC_DEFINE(DGUX_THREADS,1,[No description])
205     # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
206     AM_CPPFLAGS="-pthread $AM_CPPFLAGS"
207     ;;
208  aix)
209     THREADS=posix
210     THREADLIBS=-lpthread
211     AC_DEFINE(GC_AIX_THREADS,1)
212     AC_DEFINE(_REENTRANT,1)
213     ;;
214  decosf1 | irix | mach | os2 | solaris | dce | vxworks)
215     AC_MSG_ERROR(thread package $THREADS not yet supported)
216     ;;
217  *)
218     AC_MSG_ERROR($THREADS is an unknown thread package)
219     ;;
220 esac
221 AC_SUBST(THREADLIBS)
222
223 case "$host" in
224    powerpc-*-darwin*)
225       powerpc_darwin=true
226       ;;
227 esac
228 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
229
230 # We never want libdl on darwin. It is a fake libdl that just ends up making
231 # dyld calls anyway
232 case "$host" in
233   *-*-darwin*) ;;
234   *)
235     AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
236     ;;
237 esac
238
239 AC_SUBST(EXTRA_TEST_LIBS)
240
241 target_all=libgcjgc.la
242 AC_SUBST(target_all)
243
244 dnl If the target is an eCos system, use the appropriate eCos
245 dnl I/O routines.
246 dnl FIXME: this should not be a local option but a global target
247 dnl system; at present there is no eCos target.
248 TARGET_ECOS="no"
249 AC_ARG_WITH(ecos,
250 [  --with-ecos             enable runtime eCos target support],
251 TARGET_ECOS="$with_ecos"
252 )
253
254 addobjs=
255 addlibs=
256 addincludes=
257 addtests=
258 case "$TARGET_ECOS" in
259    no)
260       ;;
261    *)
262       AC_DEFINE(ECOS,1,[Target is ECOS])
263       AM_CPPFLAGS="${AM_CPPFLAGS} -I${TARGET_ECOS}/include"
264       addobjs="$addobjs ecos.lo"
265       ;;
266 esac
267
268 if test "${enable_cplusplus}" = yes; then
269       addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
270       addtests="$addtests test_cpp"
271 fi
272
273 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
274
275 AC_SUBST(CXX)
276
277 AC_SUBST(AM_CPPFLAGS)
278
279 # Configuration of shared libraries
280 #
281 AC_MSG_CHECKING(whether to build shared libraries)
282 AC_ENABLE_SHARED
283
284 case "$host" in
285  alpha-*-openbsd*)
286      enable_shared=no
287      AC_MSG_RESULT(no)
288      ;;
289  *)
290      AC_MSG_RESULT(yes)
291      ;;
292 esac
293
294 # Configuration of machine-dependent code
295 #
296 # We don't set NO_EXECUTE_PERMISSION by default because gcj (and
297 # anything else that creates trampolines in gc-allocated memory)
298 # always needs exec permission.  The exceptions to this are IA-64 and
299 # some variations of Power PC, where trampolines don't contain
300 # executable code.
301 #
302 AC_MSG_CHECKING(which machine-dependent code should be used)
303 machdep=
304 case "$host" in
305  alpha*-*-openbsd*)
306     machdep="alpha_mach_dep.lo"
307     if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
308        AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
309     fi
310     ;;
311  alpha*-*-linux*)
312     machdep="alpha_mach_dep.lo"
313     ;;
314  i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
315     AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED,1,[PROC_VDB in Solaris 2.5 gives wrong values for dirty bits])
316     ;;
317  mipstx39-*-elf*)
318     machdep="mips_ultrix_mach_dep.lo"
319     AC_DEFINE(STACKBASE, __stackbase,[No description])
320     AC_DEFINE(DATASTART_IS_ETEXT,1,[No description])
321     ;;
322  mips-dec-ultrix*)
323     machdep="mips_ultrix_mach-dep.lo"
324     ;;
325  mips-nec-sysv*|mips-unknown-sysv*)
326     ;;
327  mips*-*-linux*)
328     ;;
329  mips-*-*)
330     machdep="mips_sgi_mach_dep.lo"
331     ;;
332  sparc-*-netbsd*)
333     machdep="sparc_netbsd_mach_dep.lo"
334     ;;
335  sparc-sun-solaris2.3)
336     machdep="sparc_mach_dep.lo"
337     AC_DEFINE(SUNOS53_SHARED_LIB,1,[Avoid Solaris 5.3 dynamic library bug])
338     ;;
339  sparc*-sun-solaris2.*)
340     machdep="sparc_mach_dep.lo"
341     ;;
342  ia64-*-*)
343     AC_DEFINE(NO_EXECUTE_PERMISSION,1,[cause some or all of the heap to not have execute permission])
344     machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
345     ;;
346 esac
347 if test x"$machdep" = x; then
348 AC_MSG_RESULT($machdep)
349    machdep="mach_dep.lo"
350 fi
351 addobjs="$addobjs $machdep"
352 AC_SUBST(addobjs)
353 AC_SUBST(addincludes)
354 AC_SUBST(addlibs)
355 AC_SUBST(addtests)
356
357 #
358 # Check for AViiON Machines running DGUX
359 #
360 AC_MSG_CHECKING(if host is AViiON running DGUX)
361 ac_is_dgux=no
362 AC_CHECK_HEADER(sys/dg_sys_info.h,
363 [ac_is_dgux=yes;])
364
365 AC_MSG_RESULT($ac_is_dgux)
366     ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
367 if test $ac_is_dgux = yes; then
368     if test "$enable_full_debug" = "yes"; then
369       CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
370       CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
371     else
372       CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
373       CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
374     fi
375     AC_SUBST(CFLAGS)
376     AC_SUBST(CXXFLAGS)
377 fi
378
379 dnl As of 4.13a2, the collector will not properly work on Solaris when
380 dnl built with gcc and -O.  So we remove -O in the appropriate case.
381 dnl Not needed anymore on Solaris.
382 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
383 case "$host" in
384  *aix*)
385     if test "$GCC" = yes; then
386        AC_MSG_RESULT(yes)
387        new_CFLAGS=
388        for i in $CFLAGS; do
389           case "$i" in
390            -O*)
391               ;;
392            *)
393               new_CFLAGS="$new_CFLAGS $i"
394               ;;
395           esac
396        done
397        CFLAGS="$new_CFLAGS"
398     else
399        AC_MSG_RESULT(no)
400     fi
401     ;;
402  *) AC_MSG_RESULT(no) ;;
403 esac
404
405 dnl We need to override the top-level CFLAGS.  This is how we do it.
406 MY_CFLAGS="$CFLAGS"
407 AC_SUBST(MY_CFLAGS)
408
409 dnl Include defines that have become de facto standard.
410 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
411 AC_DEFINE(SILENT,1,[disables statistics printing])
412 AC_DEFINE(NO_SIGNALS,1,[does not disable signals])
413 AC_DEFINE(ALL_INTERIOR_POINTERS,1,[allows all pointers to the interior of objects to be recognized])
414
415 dnl By default, make the library as general as possible.
416 AC_DEFINE(JAVA_FINALIZATION,1,[make it somewhat safer to finalize objects out of order])
417 AC_DEFINE(GC_GCJ_SUPPORT,1,[include support for gcj])
418 AC_DEFINE(ATOMIC_UNCOLLECTABLE,1,[include code for GC_malloc_atomic_uncollectable])
419
420 dnl This is something of a hack.  When cross-compiling we turn off
421 dnl some functionality. These is only correct when targetting an
422 dnl embedded system.  FIXME.
423 if test -n "${with_cross_host}"; then
424    AC_DEFINE(NO_SIGSET,1,[use empty GC_disable_signals and GC_enable_signals])
425    AC_DEFINE(NO_DEBUGGING,1,[removes GC_dump])
426 fi
427
428 AC_ARG_ENABLE(gc-debug,
429 [  --enable-gc-debug    include full support for pointer backtracing etc.],
430 [ if test "$enable_gc_debug" = "yes"; then
431     AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
432     AC_DEFINE(KEEP_BACK_PTRS,1,[Add code to save back pointers])
433     AC_DEFINE(DBG_HDRS_ALL,1,[Make sure that all objects have debug headers])
434     case $host in
435       ia64-*-linux* )
436         AC_DEFINE(MAKE_BACK_GRAPH,1,[Enable GC_PRINT_BACK_HEIGHT environment variable])
437       ;;
438       x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
439         AC_DEFINE(MAKE_BACK_GRAPH,1)
440         AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
441         AC_DEFINE(SAVE_CALL_COUNT, 8, [number of call frames saved with objects allocated through the debugging interface])
442       ;;
443       i[3456]86-*-dgux*)
444         AC_DEFINE(MAKE_BACK_GRAPH,1)
445       ;;
446     esac 
447   fi])
448
449 if test -n "$with_cross_host" &&
450    test x"$with_cross_host" != x"no"; then
451   toolexecdir='$(exec_prefix)/$(target_noncanonical)'
452   toolexeclibdir='$(toolexecdir)/lib'
453 else
454   toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
455   toolexeclibdir='$(libdir)'
456 fi
457 multi_os_directory=`$CC -print-multi-os-directory`
458 case $multi_os_directory in
459   .) ;; # Avoid trailing /.
460   *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
461 esac
462 AC_SUBST(toolexecdir)
463 AC_SUBST(toolexeclibdir)
464
465 if test "${multilib}" = "yes"; then
466   multilib_arg="--enable-multilib"
467 else
468   multilib_arg=
469 fi
470
471 AC_CONFIG_HEADERS([include/config.h include/gc_config.h])
472
473 AC_CONFIG_FILES(Makefile include/Makefile)
474 AC_OUTPUT