]> git.ipfire.org Git - thirdparty/gcc.git/blame - boehm-gc/configure.in
configure.ac: Bump AC_PREREQ to 2.59.
[thirdparty/gcc.git] / boehm-gc / configure.in
CommitLineData
13b6e5b4 1# Copyright (c) 1999, 2000, 2001, 2002, 2003 by Red Hat, Inc. All rights reserved.
d38d6003 2# Copyright 2004 Nathanael Nerode
5a2586cf
TT
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
d38d6003 14# Modified by Nathanael Nerode
5a2586cf 15
1530be84
TT
16dnl Process this file with autoconf to produce configure.
17
8ab705be 18AC_PREREQ(2.59)
9110a741 19AC_INIT(gcj_mlc.c)
1530be84 20
6706f116
AO
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.
25ORIGINAL_LD_FOR_MULTILIBS=$LD
26
b1891e51
NN
27dnl Default to --enable-multilib
28AC_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
36dnl We may get other options which we don't document:
37dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
38
39dnl I needed to add the -n test to allow configuration in src directory - HB
40if 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
46else
47 gc_basedir="[$]{srcdir}/."
48fi
49AC_SUBST(gc_basedir)
50AC_CONFIG_AUX_DIR($gc_basedir/..)
51if :; 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(..)
55fi
56
57AC_CANONICAL_SYSTEM
58
d38d6003
NN
59# Get the 'noncanonical' system names.
60sinclude(../config/acx.m4)
61_GCC_TOPLEV_NONCANONICAL_BUILD
62_GCC_TOPLEV_NONCANONICAL_HOST
63_GCC_TOPLEV_NONCANONICAL_TARGET
64
b1891e51
NN
65# This works around an automake problem.
66mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
67AC_SUBST(mkinstalldirs)
68
a749e46c
NN
69AM_INIT_AUTOMAKE(gc, 6.1a1, no-define)
70
71# The autoconf 2.5x version of the no-executables hack.
72sinclude(../config/no-executables.m4)
73GCC_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
79m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
80m4_define([_AC_ARG_VAR_PRECIOUS],[])
81AC_PROG_CC
82AC_PROG_CXX
83m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
84
85AC_SUBST(CFLAGS)
86AC_SUBST(CXXFLAGS)
87
7664e6f8
NN
88# Newer automakes demand CCAS and CCASFLAGS.
89: ${CCAS='$(CC)'}
90: ${CCASFLAGS='$(CFLAGS)'}
91AC_SUBST(CCAS)
92AC_SUBST(CCASFLAGS)
93
a749e46c
NN
94AC_CHECK_TOOL(AS, as)
95AC_CHECK_TOOL(AR, ar)
96AC_CHECK_TOOL(RANLIB, ranlib, :)
97
98AC_PROG_INSTALL
99
100AM_MAINTAINER_MODE
101
102. [$]{srcdir}/configure.host
103
104case [$]{gc_basedir} in
105/* | [A-Za-z]:[/\\]*) gc_flagbasedir=[$]{gc_basedir} ;;
106*) gc_flagbasedir='[$](top_builddir)/'[$]{gc_basedir} ;;
107esac
108
109gc_cflags="[$]{gc_cflags} -I"'[$](top_builddir)'"/./targ-include -I[$]{gc_flagbasedir}/libc/include"
110case "${host}" in
111 *-*-cygwin32*)
112 gc_cflags="[$]{gc_cflags} -I[$]{gc_flagbasedir}/../winsup/include"
113 ;;
114esac
115
116dnl gc_cflags="[$]{gc_cflags} -fno-builtin"
117
118GC_CFLAGS=${gc_cflags}
119AC_SUBST(GC_CFLAGS)
1530be84 120
66deb2be
TT
121AM_PROG_LIBTOOL
122
1530be84
TT
123dnl We use these options to decide which functions to include.
124AC_ARG_WITH(target-subdir,
61e922d2
RO
125[ --with-target-subdir=SUBDIR
126 configuring with a cross compiler])
1530be84 127AC_ARG_WITH(cross-host,
61e922d2 128[ --with-cross-host=HOST configuring with a cross compiler])
1530be84 129
0ff95153
TT
130AC_MSG_CHECKING([for thread model used by GCC])
131THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
132if test -z "$THREADS"; then
133 THREADS=no
134fi
135AC_MSG_RESULT([$THREADS])
5a2586cf
TT
136
137AC_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)
1530be84 145
7160c99d 146INCLUDES="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
e301621d 147THREADLIBS=
1530be84
TT
148case "$THREADS" in
149 no | none | single)
150 THREADS=none
151 ;;
152 posix | pthreads)
153 THREADS=posix
62aa6b06 154 THREADLIBS=-lpthread
1530be84 155 case "$host" in
30c3de1f 156 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
5a2586cf
TT
157 AC_DEFINE(GC_LINUX_THREADS)
158 AC_DEFINE(_REENTRANT)
30c3de1f 159 if test "${enable_parallel_mark}" = yes; then
5a2586cf
TT
160 AC_DEFINE(PARALLEL_MARK)
161 fi
162 AC_DEFINE(THREAD_LOCAL_ALLOC)
163 ;;
1530be84 164 *-*-linux*)
5a2586cf 165 AC_DEFINE(GC_LINUX_THREADS)
1530be84
TT
166 AC_DEFINE(_REENTRANT)
167 ;;
30c3de1f
JS
168 *-*-aix*)
169 AC_DEFINE(GC_AIX_THREADS)
170 AC_DEFINE(_REENTRANT)
171 ;;
5a2586cf
TT
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 ;;
62aa6b06 182 *-*-freebsd*)
79f777fd 183 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
4c7726b1 184 AC_DEFINE(GC_FREEBSD_THREADS)
9110a741 185 INCLUDES="$INCLUDES -pthread"
62aa6b06
LR
186 THREADLIBS=-pthread
187 ;;
1530be84 188 *-*-solaris*)
5a2586cf
TT
189 AC_DEFINE(GC_SOLARIS_THREADS)
190 AC_DEFINE(GC_SOLARIS_PTHREADS)
1530be84 191 ;;
14caa62f 192 *-*-irix*)
5a2586cf 193 AC_DEFINE(GC_IRIX_THREADS)
14caa62f 194 ;;
a2d6e915 195 *-*-cygwin*)
30c3de1f
JS
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"
a2d6e915 215 ;;
1530be84
TT
216 esac
217 ;;
df61a3d2
AM
218 win32)
219 AC_DEFINE(GC_WIN32_THREADS)
aa44273b
HB
220 dnl Old wine getenv may not return NULL for missing entry.
221 dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
30c3de1f
JS
222 ;;
223 dgux386)
224 THREADS=dgux386
225AC_MSG_RESULT($THREADLIBS)
226 # Use pthread GCC switch
227 THREADLIBS=-pthread
228 if test "${enable_parallel_mark}" = yes; then
229 AC_DEFINE(PARALLEL_MARK)
e83a44d2 230 fi
30c3de1f
JS
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)
df61a3d2
AM
242 ;;
243 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
1530be84
TT
244 AC_MSG_ERROR(thread package $THREADS not yet supported)
245 ;;
246 *)
247 AC_MSG_ERROR($THREADS is an unknown thread package)
248 ;;
249esac
e301621d 250AC_SUBST(THREADLIBS)
1530be84 251
8c048b48 252case "$host" in
30c3de1f
JS
253 powerpc-*-darwin*)
254 powerpc_darwin=true
255 ;;
256esac
257AM_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
261case "$host" in
262 *-*-darwin*) ;;
8c048b48 263 *)
30c3de1f
JS
264 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
265 ;;
266esac
267
f2beb7ef
APB
268AC_SUBST(EXTRA_TEST_LIBS)
269
5a2586cf 270target_all=libgcjgc.la
1530be84 271AC_SUBST(target_all)
d38d6003 272AC_SUBST(target_noncanonical)
1530be84
TT
273
274dnl If the target is an eCos system, use the appropriate eCos
275dnl I/O routines.
276dnl FIXME: this should not be a local option but a global target
277dnl system; at present there is no eCos target.
278TARGET_ECOS="no"
279AC_ARG_WITH(ecos,
61e922d2 280[ --with-ecos enable runtime eCos target support],
1530be84
TT
281TARGET_ECOS="$with_ecos"
282)
283
284addobjs=
30c3de1f
JS
285addlibs=
286addincludes=
287addtests=
1530be84
TT
288CXXINCLUDES=
289case "$TARGET_ECOS" in
290 no)
291 ;;
292 *)
293 AC_DEFINE(ECOS)
294 CXXINCLUDES="-I${TARGET_ECOS}/include"
66deb2be 295 addobjs="$addobjs ecos.lo"
1530be84
TT
296 ;;
297esac
30c3de1f
JS
298
299if test "${enable_cplusplus}" = yes; then
300 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
301 addtests="$addtests test_cpp"
302fi
303
304AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
305
1530be84
TT
306AC_SUBST(CXX)
307
308AC_SUBST(INCLUDES)
309AC_SUBST(CXXINCLUDES)
310
30c3de1f
JS
311# Configuration of shared libraries
312#
313AC_MSG_CHECKING(whether to build shared libraries)
314AC_ENABLE_SHARED
315
316case "$host" in
317 alpha-*-openbsd*)
318 enable_shared=no
319 AC_MSG_RESULT(no)
320 ;;
321 *)
322 AC_MSG_RESULT(yes)
323 ;;
324esac
325
326# Configuration of machine-dependent code
327#
b27317b5
AH
328# We don't set NO_EXECUTE_PERMISSION by default because gcj (and
329# anything else that creates trampolines in gc-allocated memory)
1bec19cc 330# always needs exec permission. The exceptions to this are IA-64 and
b27317b5
AH
331# some variations of Power PC, where trampolines don't contain
332# executable code.
333#
8c048b48 334AC_MSG_CHECKING(which machine-dependent code should be used)
1530be84
TT
335machdep=
336case "$host" in
adb60117
RH
337 alpha*-*-openbsd*)
338 machdep="alpha_mach_dep.lo"
4c7726b1
BM
339 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
340 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
4c7726b1
BM
341 fi
342 ;;
30c3de1f 343 alpha*-*-linux*)
adb60117
RH
344 machdep="alpha_mach_dep.lo"
345 ;;
51ac684e 346 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
adb60117
RH
347 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
348 ;;
1530be84 349 mipstx39-*-elf*)
66deb2be 350 machdep="mips_ultrix_mach_dep.lo"
1530be84
TT
351 AC_DEFINE(STACKBASE, __stackbase)
352 AC_DEFINE(DATASTART_IS_ETEXT)
353 ;;
276836f0
RO
354 mips-dec-ultrix*)
355 machdep="mips_ultrix_mach-dep.lo"
356 ;;
30c3de1f 357 mips-nec-sysv*|mips-unknown-sysv*)
5316699d 358 ;;
8c048b48
NN
359 mips*-*-linux*)
360 ;;
276836f0
RO
361 mips-*-*)
362 machdep="mips_sgi_mach_dep.lo"
d42058b1 363 ;;
30c3de1f
JS
364 sparc-*-netbsd*)
365 machdep="sparc_netbsd_mach_dep.lo"
366 ;;
51ac684e 367 sparc-sun-solaris2.3)
79f777fd 368 machdep="sparc_mach_dep.lo"
1530be84
TT
369 AC_DEFINE(SUNOS53_SHARED_LIB)
370 ;;
79f777fd
BM
371 sparc-sun-solaris2.*)
372 machdep="sparc_mach_dep.lo"
373 ;;
374 ia64-*-*)
b27317b5 375 AC_DEFINE(NO_EXECUTE_PERMISSION)
4c7726b1
BM
376 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
377 ;;
1530be84
TT
378esac
379if test x"$machdep" = x; then
30c3de1f 380AC_MSG_RESULT($machdep)
66deb2be 381 machdep="mach_dep.lo"
1530be84
TT
382fi
383addobjs="$addobjs $machdep"
384AC_SUBST(addobjs)
30c3de1f
JS
385AC_SUBST(addincludes)
386AC_SUBST(addlibs)
387AC_SUBST(addtests)
388
389AC_PROG_LIBTOOL
390
391#
392# Check for AViiON Machines running DGUX
393#
394AC_MSG_CHECKING(if host is AViiON running DGUX)
395ac_is_dgux=no
396AC_CHECK_HEADER(sys/dg_sys_info.h,
397[ac_is_dgux=yes;])
398
8c048b48 399AC_MSG_RESULT($ac_is_dgux)
30c3de1f
JS
400 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
401if 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)
411fi
412
413dnl We use these options to decide which functions to include.
414AC_ARG_WITH(target-subdir,
415[ --with-target-subdir=SUBDIR
416 configuring with a cross compiler])
417AC_ARG_WITH(cross-host,
418[ --with-cross-host=HOST configuring with a cross compiler])
419
1530be84
TT
420dnl As of 4.13a2, the collector will not properly work on Solaris when
421dnl built with gcc and -O. So we remove -O in the appropriate case.
30c3de1f
JS
422dnl
423AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
1530be84 424case "$host" in
30c3de1f 425 sparc-sun-solaris2*|*aix*)
1530be84 426 if test "$GCC" = yes; then
30c3de1f 427 AC_MSG_RESULT(yes)
1530be84
TT
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"
30c3de1f
JS
439 else
440 AC_MSG_RESULT(no)
1530be84
TT
441 fi
442 ;;
30c3de1f 443 *) AC_MSG_RESULT(no) ;;
1530be84
TT
444esac
445
446dnl We need to override the top-level CFLAGS. This is how we do it.
447MY_CFLAGS="$CFLAGS"
448AC_SUBST(MY_CFLAGS)
449
5a2586cf
TT
450dnl Include defines that have become de facto standard.
451dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
1530be84
TT
452AC_DEFINE(SILENT)
453AC_DEFINE(NO_SIGNALS)
5a2586cf
TT
454AC_DEFINE(ALL_INTERIOR_POINTERS)
455
456dnl By default, make the library as general as possible.
1530be84 457AC_DEFINE(JAVA_FINALIZATION)
0476f098 458AC_DEFINE(GC_GCJ_SUPPORT)
5a2586cf 459AC_DEFINE(ATOMIC_UNCOLLECTABLE)
1530be84 460
1530be84 461dnl This is something of a hack. When cross-compiling we turn off
df61a3d2
AM
462dnl some functionality. These is only correct when targetting an
463dnl embedded system. FIXME.
1530be84
TT
464if test -n "${with_cross_host}"; then
465 AC_DEFINE(NO_SIGSET)
0476f098 466 AC_DEFINE(NO_DEBUGGING)
1530be84
TT
467fi
468
5a2586cf
TT
469AC_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
79f777fd
BM
476 ia64-*-linux* )
477 AC_DEFINE(MAKE_BACK_GRAPH)
478 ;;
48528b67 479 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
79f777fd 480 AC_DEFINE(MAKE_BACK_GRAPH)
5a2586cf
TT
481 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
482 AC_DEFINE(SAVE_CALL_COUNT, 8)
483 ;;
30c3de1f
JS
484 i[3456]86-*-dgux*)
485 AC_DEFINE(MAKE_BACK_GRAPH)
486 ;;
5a2586cf
TT
487 esac ]
488 fi)
489
13b6e5b4
AO
490if test -n "$with_cross_host" &&
491 test x"$with_cross_host" != x"no"; then
d38d6003 492 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
13b6e5b4
AO
493 toolexeclibdir='$(toolexecdir)/lib'
494else
d38d6003 495 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
13b6e5b4
AO
496 toolexeclibdir='$(libdir)'
497fi
ff8b9ca8
AS
498multi_os_directory=`$CC -print-multi-os-directory`
499case $multi_os_directory in
500 .) ;; # Avoid trailing /.
501 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
502esac
13b6e5b4
AO
503AC_SUBST(toolexecdir)
504AC_SUBST(toolexeclibdir)
b48ed568 505
1530be84
TT
506if test "${multilib}" = "yes"; then
507 multilib_arg="--enable-multilib"
508else
509 multilib_arg=
510fi
511
1a8a749c 512AC_OUTPUT(Makefile include/Makefile, [
7160c99d
RO
513dnl Put all the -I and -D options in a file.
514echo "$INCLUDES $DEFS" > boehm-cflags
1530be84
TT
515
516if test -n "$CONFIG_FILES"; then
6706f116 517 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
5a2586cf 518 ac_file=Makefile . ${gc_basedir}/../config-ml.in
1530be84
TT
519fi],
520srcdir=${srcdir}
521host=${host}
522target=${target}
523with_multisubdir=${with_multisubdir}
524ac_configure_args="${multilib_arg} ${ac_configure_args}"
525CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
5a2586cf 526gc_basedir=${gc_basedir}
1530be84 527CC="${CC}"
3343fdd2 528ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
1530be84 529DEFS="$DEFS"
7160c99d 530INCLUDES="$INCLUDES"
1530be84 531)