OSDN Git Service

f109c9003edce1c794bfd1aaa85e484df07c1f13
[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 # We don't set NO_EXECUTE_PERMISSION by default because gcj (and
250 # anything else that creates trampolines in gc-allocated memory)
251 # always needs exec permission.  The exceptions to this are IA-64 and
252 # some variations of Power PC, where trampolines don't contain
253 # executable code.
254 #
255 AC_MSG_CHECKING(which machine-dependent code should be used) 
256 machdep=
257 case "$host" in
258  alpha*-*-openbsd*)
259     machdep="alpha_mach_dep.lo"
260     if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
261        AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
262     fi
263     ;;
264  alpha*-*-linux*)
265     machdep="alpha_mach_dep.lo"
266     ;;
267  i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
268     AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
269     ;;
270  mipstx39-*-elf*)
271     machdep="mips_ultrix_mach_dep.lo"
272     AC_DEFINE(STACKBASE, __stackbase)
273     AC_DEFINE(DATASTART_IS_ETEXT)
274     ;;
275  mips-dec-ultrix*)
276     machdep="mips_ultrix_mach-dep.lo"
277     ;;
278  mips-nec-sysv*|mips-unknown-sysv*)
279     ;;
280  mips*-*-linux*) 
281     ;; 
282  mips-*-*)
283     machdep="mips_sgi_mach_dep.lo"
284     ;;
285  sparc-*-netbsd*)
286     machdep="sparc_netbsd_mach_dep.lo"
287     ;;
288  sparc-sun-solaris2.3)
289     machdep="sparc_mach_dep.lo"
290     AC_DEFINE(SUNOS53_SHARED_LIB)
291     ;;
292  sparc-sun-solaris2.*)
293     machdep="sparc_mach_dep.lo"
294     ;;
295  ia64-*-*)
296     AC_DEFINE(NO_EXECUTE_PERMISSION)
297     machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
298     ;;
299 esac
300 if test x"$machdep" = x; then
301 AC_MSG_RESULT($machdep)
302    machdep="mach_dep.lo"
303 fi
304 addobjs="$addobjs $machdep"
305 AC_SUBST(addobjs)
306 AC_SUBST(addincludes)
307 AC_SUBST(addlibs)
308 AC_SUBST(addtests)
309
310 AC_PROG_LIBTOOL
311
312 #
313 # Check for AViiON Machines running DGUX
314 #
315 AC_MSG_CHECKING(if host is AViiON running DGUX)
316 ac_is_dgux=no
317 AC_CHECK_HEADER(sys/dg_sys_info.h,
318 [ac_is_dgux=yes;])
319
320 AC_MSG_RESULT($ac_is_dgux) 
321     ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
322 if test $ac_is_dgux = yes; then
323     if test "$enable_full_debug" = "yes"; then
324       CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
325       CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
326     else
327       CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
328       CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
329     fi
330     AC_SUBST(CFLAGS)
331     AC_SUBST(CXXFLAGS)
332 fi
333
334 dnl We use these options to decide which functions to include.
335 AC_ARG_WITH(target-subdir,
336 [  --with-target-subdir=SUBDIR
337                           configuring with a cross compiler])
338 AC_ARG_WITH(cross-host,
339 [  --with-cross-host=HOST  configuring with a cross compiler])
340
341 # automake wants to see AC_EXEEXT.  But we don't need it.  And having
342 # it is actually a problem, because the compiler we're passed can't
343 # necessarily do a full link.  So we fool automake here.
344 if false; then
345   # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
346   # to nothing, so nothing would remain between `then' and `fi' if it
347   # were not for the `:' below.
348   :
349   AC_EXEEXT
350 fi
351
352 dnl As of 4.13a2, the collector will not properly work on Solaris when
353 dnl built with gcc and -O.  So we remove -O in the appropriate case.
354 dnl
355 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
356 case "$host" in
357  sparc-sun-solaris2*|*aix*)
358     if test "$GCC" = yes; then
359        AC_MSG_RESULT(yes)
360        new_CFLAGS=
361        for i in $CFLAGS; do
362           case "$i" in
363            -O*)
364               ;;
365            *)
366               new_CFLAGS="$new_CFLAGS $i"
367               ;;
368           esac
369        done
370        CFLAGS="$new_CFLAGS"
371     else
372        AC_MSG_RESULT(no)
373     fi
374     ;;
375  *) AC_MSG_RESULT(no) ;;
376 esac
377
378 dnl We need to override the top-level CFLAGS.  This is how we do it.
379 MY_CFLAGS="$CFLAGS"
380 AC_SUBST(MY_CFLAGS)
381
382 dnl Include defines that have become de facto standard.
383 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
384 AC_DEFINE(SILENT)
385 AC_DEFINE(NO_SIGNALS)
386 AC_DEFINE(ALL_INTERIOR_POINTERS)
387
388 dnl By default, make the library as general as possible.
389 AC_DEFINE(JAVA_FINALIZATION)
390 AC_DEFINE(GC_GCJ_SUPPORT)
391 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
392
393 dnl This is something of a hack.  When cross-compiling we turn off
394 dnl some functionality. These is only correct when targetting an
395 dnl embedded system.  FIXME.
396 if test -n "${with_cross_host}"; then
397    AC_DEFINE(NO_SIGSET)
398    AC_DEFINE(NO_DEBUGGING)
399 fi
400
401 AC_ARG_ENABLE(full-debug,
402 [  --enable-full-debug  include full support for pointer backtracing etc.],
403 [ if test "$enable_full_debug" = "yes"; then
404     AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
405     AC_DEFINE(KEEP_BACK_PTRS)
406     AC_DEFINE(DBG_HDRS_ALL)
407     case $host in
408       ia64-*-linux* )
409         AC_DEFINE(MAKE_BACK_GRAPH)
410       ;;
411       x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
412         AC_DEFINE(MAKE_BACK_GRAPH)
413         AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
414         AC_DEFINE(SAVE_CALL_COUNT, 8)
415       ;;
416       i[3456]86-*-dgux*)
417         AC_DEFINE(MAKE_BACK_GRAPH)
418       ;;
419     esac ]
420   fi)
421
422 if test -n "$with_cross_host" &&
423    test x"$with_cross_host" != x"no"; then
424   toolexecdir='$(exec_prefix)/$(target_alias)'
425   toolexeclibdir='$(toolexecdir)/lib'
426 else
427   toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
428   toolexeclibdir='$(libdir)'
429 fi
430 multi_os_directory=`$CC -print-multi-os-directory`
431 case $multi_os_directory in
432   .) ;; # Avoid trailing /.
433   *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
434 esac
435 AC_SUBST(toolexecdir)
436 AC_SUBST(toolexeclibdir)
437
438 if test "${multilib}" = "yes"; then
439   multilib_arg="--enable-multilib"
440 else
441   multilib_arg=
442 fi
443
444 AC_OUTPUT(Makefile include/Makefile, [
445 dnl Put all the -I and -D options in a file.
446 echo "$INCLUDES $DEFS" > boehm-cflags
447
448 if test -n "$CONFIG_FILES"; then
449   LD="${ORIGINAL_LD_FOR_MULTILIBS}"
450   ac_file=Makefile . ${gc_basedir}/../config-ml.in
451 fi],
452 srcdir=${srcdir}
453 host=${host}
454 target=${target}
455 with_multisubdir=${with_multisubdir}
456 ac_configure_args="${multilib_arg} ${ac_configure_args}"
457 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
458 gc_basedir=${gc_basedir}
459 CC="${CC}"
460 ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
461 DEFS="$DEFS"
462 INCLUDES="$INCLUDES"
463 )