OSDN Git Service

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