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