OSDN Git Service

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