OSDN Git Service

155653dbf26f2bb530f74cd831909ee171d4de15
[pf3gnuchains/gcc-fork.git] / 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
14 dnl Process this file with autoconf to produce configure.
15
16 AC_INIT(gcj_mlc.c)
17
18 dnl Can't be done in GC_CONFIGURE because that confuses automake. 
19 AC_CONFIG_AUX_DIR(.)
20
21 GC_CONFIGURE(.)
22
23 AM_PROG_LIBTOOL
24
25 dnl We use these options to decide which functions to include.
26 AC_ARG_WITH(target-subdir,
27 [  --with-target-subdir=SUBDIR
28                           configuring with a cross compiler])
29 AC_ARG_WITH(cross-host,
30 [  --with-cross-host=HOST  configuring with a cross compiler])
31
32 AM_MAINTAINER_MODE
33 # automake wants to see AC_EXEEXT.  But we don't need it.  And having
34 # it is actually a problem, because the compiler we're passed can't
35 # necessarily do a full link.  So we fool automake here.
36 if false; then
37   # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
38   # to nothing, so nothing would remain between `then' and `fi' if it
39   # were not for the `:' below.
40   :
41   AC_EXEEXT
42 fi
43
44 AC_MSG_CHECKING([for thread model used by GCC])
45 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
46 if test -z "$THREADS"; then
47    THREADS=no
48 fi
49 AC_MSG_RESULT([$THREADS])
50
51 AC_ARG_ENABLE(parallel-mark,
52 [  --enable-parallel-mark       parallelize marking and free list construction],
53    [case "$THREADS" in
54       no | none | single)
55         AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
56         ;;
57     esac]
58 )
59
60 INCLUDES=-I${srcdir}/include
61 THREADLIBS=
62 case "$THREADS" in
63  no | none | single)
64     THREADS=none
65     ;;
66  posix | pthreads)
67     THREADS=posix
68     THREADLIBS=-lpthread
69     case "$host" in
70      x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux*)
71         AC_DEFINE(GC_LINUX_THREADS)
72         AC_DEFINE(_REENTRANT)
73         if test "${enable_parallel_mark}"; then
74           AC_DEFINE(PARALLEL_MARK)
75         fi
76         AC_DEFINE(THREAD_LOCAL_ALLOC)
77         ;;
78      *-*-linux*)
79         AC_DEFINE(GC_LINUX_THREADS)
80         AC_DEFINE(_REENTRANT)
81         ;;
82      *-*-hpux*)
83         AC_MSG_WARN("Only HP/UX 11 threads are supported.")
84         AC_DEFINE(GC_HPUX_THREADS)
85         AC_DEFINE(_POSIX_C_SOURCE,199506L)
86         if test "${enable_parallel_mark}" = yes; then
87           AC_DEFINE(PARALLEL_MARK)
88         fi
89         AC_DEFINE(THREAD_LOCAL_ALLOC)
90         THREADLIBS="-lpthread -lrt"
91         ;;
92      *-*-freebsd*)
93         AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
94         AC_DEFINE(GC_FREEBSD_THREADS)
95         INCLUDES="$INCLUDES -pthread"
96         THREADLIBS=-pthread
97         ;;
98      *-*-solaris*)
99         AC_DEFINE(GC_SOLARIS_THREADS)
100         AC_DEFINE(GC_SOLARIS_PTHREADS)
101         ;;
102      *-*-irix*)
103         AC_DEFINE(GC_IRIX_THREADS)
104         ;;
105      *-*-cygwin*)
106         THREADLIBS=
107         ;;
108     esac
109     ;;
110  win32)
111     AC_DEFINE(GC_WIN32_THREADS)
112     ;;
113  decosf1 | irix | mach | os2 | solaris | dce | vxworks)
114     AC_MSG_ERROR(thread package $THREADS not yet supported)
115     ;;
116  *)
117     AC_MSG_ERROR($THREADS is an unknown thread package)
118     ;;
119 esac
120 AC_SUBST(THREADLIBS)
121
122 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
123 AC_SUBST(EXTRA_TEST_LIBS)
124
125 target_all=libgcjgc.la
126 AC_SUBST(target_all)
127 AC_SUBST(target_alias)
128
129 dnl If the target is an eCos system, use the appropriate eCos
130 dnl I/O routines.
131 dnl FIXME: this should not be a local option but a global target
132 dnl system; at present there is no eCos target.
133 TARGET_ECOS="no"
134 AC_ARG_WITH(ecos,
135 [  --with-ecos             enable runtime eCos target support],
136 TARGET_ECOS="$with_ecos"
137 )
138
139 addobjs=
140 CXXINCLUDES=
141 case "$TARGET_ECOS" in
142    no)
143       ;;
144    *)
145       AC_DEFINE(ECOS)
146       CXXINCLUDES="-I${TARGET_ECOS}/include"
147       addobjs="$addobjs ecos.lo"
148       ;;
149 esac
150 AC_SUBST(CXX)
151
152 AC_SUBST(INCLUDES)
153 AC_SUBST(CXXINCLUDES)
154
155 machdep=
156 case "$host" in
157  alpha*-*-openbsd*)
158     machdep="alpha_mach_dep.lo"
159     if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
160        AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
161        AM_DISABLE_SHARED
162     fi
163     ;;
164  alpha*-*-*)
165     machdep="alpha_mach_dep.lo"
166     ;;
167  i?86-*-solaris2.[[89]]*)
168     AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
169     ;;
170  mipstx39-*-elf*)
171     machdep="mips_ultrix_mach_dep.lo"
172     AC_DEFINE(STACKBASE, __stackbase)
173     AC_DEFINE(DATASTART_IS_ETEXT)
174     ;;
175  mips-dec-ultrix*)
176     machdep="mips_ultrix_mach-dep.lo"
177     ;;
178  mips-*-*)
179     machdep="mips_sgi_mach_dep.lo"
180     AC_DEFINE(NO_EXECUTE_PERMISSION)
181     ;;
182  sparc-sun-solaris2.3*)
183     machdep="sparc_mach_dep.lo"
184     AC_DEFINE(SUNOS53_SHARED_LIB)
185     ;;
186  sparc-sun-solaris2.*)
187     machdep="sparc_mach_dep.lo"
188     ;;
189  ia64-*-*)
190     machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
191     ;;
192 esac
193 if test x"$machdep" = x; then
194    machdep="mach_dep.lo"
195 fi
196 addobjs="$addobjs $machdep"
197 AC_SUBST(addobjs)
198
199 dnl As of 4.13a2, the collector will not properly work on Solaris when
200 dnl built with gcc and -O.  So we remove -O in the appropriate case.
201 case "$host" in
202  sparc-sun-solaris2*)
203     if test "$GCC" = yes; then
204        new_CFLAGS=
205        for i in $CFLAGS; do
206           case "$i" in
207            -O*)
208               ;;
209            *)
210               new_CFLAGS="$new_CFLAGS $i"
211               ;;
212           esac
213        done
214        CFLAGS="$new_CFLAGS"
215     fi
216     ;;
217 esac
218
219 dnl We need to override the top-level CFLAGS.  This is how we do it.
220 MY_CFLAGS="$CFLAGS"
221 AC_SUBST(MY_CFLAGS)
222
223 dnl Include defines that have become de facto standard.
224 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
225 AC_DEFINE(SILENT)
226 AC_DEFINE(NO_SIGNALS)
227 AC_DEFINE(NO_EXECUTE_PERMISSION)
228 AC_DEFINE(ALL_INTERIOR_POINTERS)
229
230 dnl By default, make the library as general as possible.
231 AC_DEFINE(JAVA_FINALIZATION)
232 AC_DEFINE(GC_GCJ_SUPPORT)
233 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
234
235 dnl This is something of a hack.  When cross-compiling we turn off
236 dnl some functionality. These is only correct when targetting an
237 dnl embedded system.  FIXME.
238 if test -n "${with_cross_host}"; then
239    AC_DEFINE(NO_SIGSET)
240    AC_DEFINE(NO_DEBUGGING)
241 fi
242
243 AC_ARG_ENABLE(full-debug,
244 [  --enable-full-debug  include full support for pointer backtracing etc.],
245 [ if test "$enable_full_debug" = "yes"; then
246     AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
247     AC_DEFINE(KEEP_BACK_PTRS)
248     AC_DEFINE(DBG_HDRS_ALL)
249     case $host in
250       ia64-*-linux* )
251         AC_DEFINE(MAKE_BACK_GRAPH)
252       ;;
253       x86-*-linux* | i586-*-linux* | i686-*-linux* )
254         AC_DEFINE(MAKE_BACK_GRAPH)
255         AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
256         AC_DEFINE(SAVE_CALL_COUNT, 8)
257       ;;
258     esac ]
259   fi)
260
261 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
262
263 if test "${multilib}" = "yes"; then
264   multilib_arg="--enable-multilib"
265 else
266   multilib_arg=
267 fi
268
269 AC_OUTPUT(Makefile include/Makefile, [
270 dnl Put all the -D options in a file.
271 echo "$DEFS" > boehm-cflags
272
273 if test -n "$CONFIG_FILES"; then
274   ac_file=Makefile . ${gc_basedir}/../config-ml.in
275 fi],
276 srcdir=${srcdir}
277 host=${host}
278 target=${target}
279 with_multisubdir=${with_multisubdir}
280 ac_configure_args="${multilib_arg} ${ac_configure_args}"
281 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
282 gc_basedir=${gc_basedir}
283 CC="${CC}"
284 DEFS="$DEFS"
285 )