OSDN Git Service

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