1 # Copyright (c) 1999, 2000, 2001, 2002, 2003 by Red Hat, Inc. All rights reserved.
3 # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
4 # OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
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.
12 # Original author: Tom Tromey
14 dnl Process this file with autoconf to produce configure.
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
23 ORIGINAL_LD_FOR_MULTILIBS=$LD
25 dnl Can't be done in GC_CONFIGURE because that confuses automake.
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])
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.
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.
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
56 AC_MSG_RESULT([$THREADS])
58 AC_ARG_ENABLE(parallel-mark,
59 [ --enable-parallel-mark parallelize marking and free list construction],
62 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
67 INCLUDES="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
77 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
78 AC_DEFINE(GC_LINUX_THREADS)
80 if test "${enable_parallel_mark}" = yes; then
81 AC_DEFINE(PARALLEL_MARK)
83 AC_DEFINE(THREAD_LOCAL_ALLOC)
86 AC_DEFINE(GC_LINUX_THREADS)
90 AC_DEFINE(GC_AIX_THREADS)
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)
100 AC_DEFINE(THREAD_LOCAL_ALLOC)
101 THREADLIBS="-lpthread -lrt"
104 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
105 AC_DEFINE(GC_FREEBSD_THREADS)
106 INCLUDES="$INCLUDES -pthread"
110 AC_DEFINE(GC_SOLARIS_THREADS)
111 AC_DEFINE(GC_SOLARIS_PTHREADS)
114 AC_DEFINE(GC_IRIX_THREADS)
117 AC_DEFINE(GC_WIN32_THREADS)
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)
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.
134 INCLUDES="$INCLUDES -pthread"
135 THREADLIBS="-lpthread -lrt"
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.
146 AC_MSG_RESULT($THREADLIBS)
147 # Use pthread GCC switch
149 if test "${enable_parallel_mark}" = yes; then
150 AC_DEFINE(PARALLEL_MARK)
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"
161 AC_DEFINE(GC_AIX_THREADS)
162 AC_DEFINE(_REENTRANT)
164 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
165 AC_MSG_ERROR(thread package $THREADS not yet supported)
168 AC_MSG_ERROR($THREADS is an unknown thread package)
178 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
180 # We never want libdl on darwin. It is a fake libdl that just ends up making
185 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
189 AC_SUBST(EXTRA_TEST_LIBS)
191 target_all=libgcjgc.la
193 AC_SUBST(target_alias)
195 dnl If the target is an eCos system, use the appropriate eCos
197 dnl FIXME: this should not be a local option but a global target
198 dnl system; at present there is no eCos target.
201 [ --with-ecos enable runtime eCos target support],
202 TARGET_ECOS="$with_ecos"
210 case "$TARGET_ECOS" in
215 CXXINCLUDES="-I${TARGET_ECOS}/include"
216 addobjs="$addobjs ecos.lo"
220 if test "${enable_cplusplus}" = yes; then
221 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
222 addtests="$addtests test_cpp"
225 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
230 AC_SUBST(CXXINCLUDES)
232 # Configuration of shared libraries
234 AC_MSG_CHECKING(whether to build shared libraries)
247 # Configuration of machine-dependent code
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
255 AC_MSG_CHECKING(which machine-dependent code should be used)
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)
265 machdep="alpha_mach_dep.lo"
267 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
268 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
271 machdep="mips_ultrix_mach_dep.lo"
272 AC_DEFINE(STACKBASE, __stackbase)
273 AC_DEFINE(DATASTART_IS_ETEXT)
276 machdep="mips_ultrix_mach-dep.lo"
278 mips-nec-sysv*|mips-unknown-sysv*)
283 machdep="mips_sgi_mach_dep.lo"
286 machdep="sparc_netbsd_mach_dep.lo"
288 sparc-sun-solaris2.3)
289 machdep="sparc_mach_dep.lo"
290 AC_DEFINE(SUNOS53_SHARED_LIB)
292 sparc-sun-solaris2.*)
293 machdep="sparc_mach_dep.lo"
296 AC_DEFINE(NO_EXECUTE_PERMISSION)
297 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
300 if test x"$machdep" = x; then
301 AC_MSG_RESULT($machdep)
302 machdep="mach_dep.lo"
304 addobjs="$addobjs $machdep"
306 AC_SUBST(addincludes)
313 # Check for AViiON Machines running DGUX
315 AC_MSG_CHECKING(if host is AViiON running DGUX)
317 AC_CHECK_HEADER(sys/dg_sys_info.h,
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"
327 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
328 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
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])
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.
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.
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.
355 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
357 sparc-sun-solaris2*|*aix*)
358 if test "$GCC" = yes; then
366 new_CFLAGS="$new_CFLAGS $i"
375 *) AC_MSG_RESULT(no) ;;
378 dnl We need to override the top-level CFLAGS. This is how we do it.
382 dnl Include defines that have become de facto standard.
383 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
385 AC_DEFINE(NO_SIGNALS)
386 AC_DEFINE(ALL_INTERIOR_POINTERS)
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)
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
398 AC_DEFINE(NO_DEBUGGING)
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)
409 AC_DEFINE(MAKE_BACK_GRAPH)
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)
417 AC_DEFINE(MAKE_BACK_GRAPH)
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'
427 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
428 toolexeclibdir='$(libdir)'
430 multi_os_directory=`$CC -print-multi-os-directory`
431 case $multi_os_directory in
432 .) ;; # Avoid trailing /.
433 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
435 AC_SUBST(toolexecdir)
436 AC_SUBST(toolexeclibdir)
438 if test "${multilib}" = "yes"; then
439 multilib_arg="--enable-multilib"
444 AC_OUTPUT(Makefile include/Makefile, [
445 dnl Put all the -I and -D options in a file.
446 echo "$INCLUDES $DEFS" > boehm-cflags
448 if test -n "$CONFIG_FILES"; then
449 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
450 ac_file=Makefile . ${gc_basedir}/../config-ml.in
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}
460 ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"