OSDN Git Service

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