OSDN Git Service

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