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.
18 # This works around the fact that libtool configuration may change LD
19 # for this particular configuration, but some shells, instead of
20 # keeping the changes in LD private, export them just because LD is
22 ORIGINAL_LD_FOR_MULTILIBS=$LD
24 dnl Can't be done in GC_CONFIGURE because that confuses automake.
31 dnl We use these options to decide which functions to include.
32 AC_ARG_WITH(target-subdir,
33 [ --with-target-subdir=SUBDIR
34 configuring with a cross compiler])
35 AC_ARG_WITH(cross-host,
36 [ --with-cross-host=HOST configuring with a cross compiler])
39 # automake wants to see AC_EXEEXT. But we don't need it. And having
40 # it is actually a problem, because the compiler we're passed can't
41 # necessarily do a full link. So we fool automake here.
43 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
44 # to nothing, so nothing would remain between `then' and `fi' if it
45 # were not for the `:' below.
50 AC_MSG_CHECKING([for thread model used by GCC])
51 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
52 if test -z "$THREADS"; then
55 AC_MSG_RESULT([$THREADS])
57 AC_ARG_ENABLE(parallel-mark,
58 [ --enable-parallel-mark parallelize marking and free list construction],
61 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
66 INCLUDES="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
76 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
77 AC_DEFINE(GC_LINUX_THREADS)
79 if test "${enable_parallel_mark}" = yes; then
80 AC_DEFINE(PARALLEL_MARK)
82 AC_DEFINE(THREAD_LOCAL_ALLOC)
85 AC_DEFINE(GC_LINUX_THREADS)
89 AC_DEFINE(GC_AIX_THREADS)
93 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
94 AC_DEFINE(GC_HPUX_THREADS)
95 AC_DEFINE(_POSIX_C_SOURCE,199506L)
96 if test "${enable_parallel_mark}" = yes; then
97 AC_DEFINE(PARALLEL_MARK)
99 AC_DEFINE(THREAD_LOCAL_ALLOC)
100 THREADLIBS="-lpthread -lrt"
103 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
104 AC_DEFINE(GC_FREEBSD_THREADS)
105 INCLUDES="$INCLUDES -pthread"
109 AC_DEFINE(GC_SOLARIS_THREADS)
110 AC_DEFINE(GC_SOLARIS_PTHREADS)
113 AC_DEFINE(GC_IRIX_THREADS)
116 AC_DEFINE(GC_WIN32_THREADS)
119 AC_DEFINE(GC_DARWIN_THREADS)
120 AC_DEFINE(THREAD_LOCAL_ALLOC)
121 if test "${enable_parallel_mark}" = yes; then
122 AC_DEFINE(PARALLEL_MARK)
126 AC_DEFINE(GC_OSF1_THREADS)
127 if test "${enable_parallel_mark}" = yes; then
128 AC_DEFINE(PARALLEL_MARK)
129 AC_DEFINE(THREAD_LOCAL_ALLOC)
130 # May want to enable it in other cases, too.
131 # Measurements havent yet been done.
133 INCLUDES="$INCLUDES -pthread"
134 THREADLIBS="-lpthread -lrt"
139 AC_DEFINE(GC_WIN32_THREADS)
140 dnl Old wine getenv may not return NULL for missing entry.
141 dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
145 AC_MSG_RESULT($THREADLIBS)
146 # Use pthread GCC switch
148 if test "${enable_parallel_mark}" = yes; then
149 AC_DEFINE(PARALLEL_MARK)
151 AC_DEFINE(THREAD_LOCAL_ALLOC)
152 AC_DEFINE(GC_DGUX386_THREADS)
153 AC_DEFINE(DGUX_THREADS)
154 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
155 INCLUDES="-pthread $INCLUDES"
160 AC_DEFINE(GC_AIX_THREADS)
161 AC_DEFINE(_REENTRANT)
163 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
164 AC_MSG_ERROR(thread package $THREADS not yet supported)
167 AC_MSG_ERROR($THREADS is an unknown thread package)
177 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
179 # We never want libdl on darwin. It is a fake libdl that just ends up making
184 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
188 AC_SUBST(EXTRA_TEST_LIBS)
190 target_all=libgcjgc.la
192 AC_SUBST(target_alias)
194 dnl If the target is an eCos system, use the appropriate eCos
196 dnl FIXME: this should not be a local option but a global target
197 dnl system; at present there is no eCos target.
200 [ --with-ecos enable runtime eCos target support],
201 TARGET_ECOS="$with_ecos"
209 case "$TARGET_ECOS" in
214 CXXINCLUDES="-I${TARGET_ECOS}/include"
215 addobjs="$addobjs ecos.lo"
219 if test "${enable_cplusplus}" = yes; then
220 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
221 addtests="$addtests test_cpp"
224 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
229 AC_SUBST(CXXINCLUDES)
231 # Configuration of shared libraries
233 AC_MSG_CHECKING(whether to build shared libraries)
246 # Configuration of machine-dependent code
248 AC_MSG_CHECKING(which machine-dependent code should be used)
252 machdep="alpha_mach_dep.lo"
253 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
254 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
258 machdep="alpha_mach_dep.lo"
260 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
261 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
264 machdep="mips_ultrix_mach_dep.lo"
265 AC_DEFINE(STACKBASE, __stackbase)
266 AC_DEFINE(DATASTART_IS_ETEXT)
269 machdep="mips_ultrix_mach-dep.lo"
271 mips-nec-sysv*|mips-unknown-sysv*)
276 machdep="mips_sgi_mach_dep.lo"
277 AC_DEFINE(NO_EXECUTE_PERMISSION)
280 machdep="sparc_netbsd_mach_dep.lo"
282 sparc-sun-solaris2.3)
283 machdep="sparc_mach_dep.lo"
284 AC_DEFINE(SUNOS53_SHARED_LIB)
286 sparc-sun-solaris2.*)
287 machdep="sparc_mach_dep.lo"
290 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
293 if test x"$machdep" = x; then
294 AC_MSG_RESULT($machdep)
295 machdep="mach_dep.lo"
297 addobjs="$addobjs $machdep"
299 AC_SUBST(addincludes)
306 # Check for AViiON Machines running DGUX
308 AC_MSG_CHECKING(if host is AViiON running DGUX)
310 AC_CHECK_HEADER(sys/dg_sys_info.h,
313 AC_MSG_RESULT($ac_is_dgux)
314 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
315 if test $ac_is_dgux = yes; then
316 if test "$enable_full_debug" = "yes"; then
317 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
318 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
320 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
321 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
327 dnl We use these options to decide which functions to include.
328 AC_ARG_WITH(target-subdir,
329 [ --with-target-subdir=SUBDIR
330 configuring with a cross compiler])
331 AC_ARG_WITH(cross-host,
332 [ --with-cross-host=HOST configuring with a cross compiler])
334 # automake wants to see AC_EXEEXT. But we don't need it. And having
335 # it is actually a problem, because the compiler we're passed can't
336 # necessarily do a full link. So we fool automake here.
338 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
339 # to nothing, so nothing would remain between `then' and `fi' if it
340 # were not for the `:' below.
345 dnl As of 4.13a2, the collector will not properly work on Solaris when
346 dnl built with gcc and -O. So we remove -O in the appropriate case.
348 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
350 sparc-sun-solaris2*|*aix*)
351 if test "$GCC" = yes; then
359 new_CFLAGS="$new_CFLAGS $i"
368 *) AC_MSG_RESULT(no) ;;
371 dnl We need to override the top-level CFLAGS. This is how we do it.
375 dnl Include defines that have become de facto standard.
376 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
378 AC_DEFINE(NO_SIGNALS)
379 AC_DEFINE(NO_EXECUTE_PERMISSION)
380 AC_DEFINE(ALL_INTERIOR_POINTERS)
382 dnl By default, make the library as general as possible.
383 AC_DEFINE(JAVA_FINALIZATION)
384 AC_DEFINE(GC_GCJ_SUPPORT)
385 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
387 dnl This is something of a hack. When cross-compiling we turn off
388 dnl some functionality. These is only correct when targetting an
389 dnl embedded system. FIXME.
390 if test -n "${with_cross_host}"; then
392 AC_DEFINE(NO_DEBUGGING)
395 AC_ARG_ENABLE(full-debug,
396 [ --enable-full-debug include full support for pointer backtracing etc.],
397 [ if test "$enable_full_debug" = "yes"; then
398 AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
399 AC_DEFINE(KEEP_BACK_PTRS)
400 AC_DEFINE(DBG_HDRS_ALL)
403 AC_DEFINE(MAKE_BACK_GRAPH)
405 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
406 AC_DEFINE(MAKE_BACK_GRAPH)
407 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
408 AC_DEFINE(SAVE_CALL_COUNT, 8)
411 AC_DEFINE(MAKE_BACK_GRAPH)
416 if test -n "$with_cross_host" &&
417 test x"$with_cross_host" != x"no"; then
418 toolexecdir='$(exec_prefix)/$(target_alias)'
419 toolexeclibdir='$(toolexecdir)/lib'
421 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
422 toolexeclibdir='$(libdir)'
424 multi_os_directory=`$CC -print-multi-os-directory`
425 case $multi_os_directory in
426 .) ;; # Avoid trailing /.
427 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
429 AC_SUBST(toolexecdir)
430 AC_SUBST(toolexeclibdir)
432 if test "${multilib}" = "yes"; then
433 multilib_arg="--enable-multilib"
438 AC_OUTPUT(Makefile include/Makefile, [
439 dnl Put all the -I and -D options in a file.
440 echo "$INCLUDES $DEFS" > boehm-cflags
442 if test -n "$CONFIG_FILES"; then
443 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
444 ac_file=Makefile . ${gc_basedir}/../config-ml.in
449 with_multisubdir=${with_multisubdir}
450 ac_configure_args="${multilib_arg} ${ac_configure_args}"
451 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
452 gc_basedir=${gc_basedir}
454 ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"