OSDN Git Service

* configure.in: Add support for --enable-threads=posix on FreeBSD.
[pf3gnuchains/gcc-fork.git] / boehm-gc / configure.in
1 dnl Process this file with autoconf to produce configure.
2
3 AC_INIT(gc_mark.h)
4
5 dnl Can't be done in BOEHM_CONFIGURE because that confuses automake. 
6 AC_CONFIG_AUX_DIR(..)
7
8 AC_CANONICAL_SYSTEM
9
10 BOEHM_CONFIGURE(.)
11
12 AM_PROG_LIBTOOL
13
14 dnl We use these options to decide which functions to include.
15 AC_ARG_WITH(target-subdir,
16 [  --with-target-subdir=SUBDIR
17                           configuring with a cross compiler])
18 AC_ARG_WITH(cross-host,
19 [  --with-cross-host=HOST  configuring with a cross compiler])
20
21 AM_MAINTAINER_MODE
22 # automake wants to see AC_EXEEXT.  But we don't need it.  And having
23 # it is actually a problem, because the compiler we're passed can't
24 # necessarily do a full link.  So we fool automake here.
25 if test "x" = "y"; then
26    AC_EXEEXT
27 fi
28
29 AC_MSG_CHECKING([for thread model used by GCC])
30 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
31 AC_MSG_RESULT([$THREADS])
32
33 INCLUDES=
34 THREADLIBS=
35 case "$THREADS" in
36  no | none | single)
37     THREADS=none
38     ;;
39  posix | pthreads)
40     THREADS=posix
41     THREADLIBS=-lpthread
42     case "$host" in
43      *-*-linux*)
44         AC_DEFINE(LINUX_THREADS)
45         AC_DEFINE(_REENTRANT)
46         ;;
47      *-*-freebsd*)
48         AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
49         AC_DEFINE(FREEBSD_THREADS)
50         INCLUDES=-pthread
51         THREADLIBS=-pthread
52         ;;
53      *-*-solaris*)
54         AC_DEFINE(SOLARIS_THREADS)
55         AC_DEFINE(_SOLARIS_PTHREADS)
56         ;;
57      *-*-irix*)
58         AC_DEFINE(IRIX_THREADS)
59         ;;
60     esac
61     ;;
62  decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
63     AC_MSG_ERROR(thread package $THREADS not yet supported)
64     ;;
65  *)
66     AC_MSG_ERROR($THREADS is an unknown thread package)
67     ;;
68 esac
69 AC_SUBST(THREADLIBS)
70
71 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
72 AC_SUBST(EXTRA_TEST_LIBS)
73
74 AC_ARG_ENABLE(java-gc,
75 changequote(<<,>>)dnl
76 <<  --enable-java-gc=TYPE   choose garbage collector [boehm]>>,
77 changequote([,])
78   GC=$enableval,
79   GC=boehm)
80 target_all=
81 if test "$GC" = "boehm"; then
82    target_all=libgcjgc.la
83 fi
84 AC_SUBST(target_all)
85
86 dnl If the target is an eCos system, use the appropriate eCos
87 dnl I/O routines.
88 dnl FIXME: this should not be a local option but a global target
89 dnl system; at present there is no eCos target.
90 TARGET_ECOS="no"
91 AC_ARG_WITH(ecos,
92 [  --with-ecos             enable runtime eCos target support],
93 TARGET_ECOS="$with_ecos"
94 )
95
96 addobjs=
97 CXXINCLUDES=
98 case "$TARGET_ECOS" in
99    no)
100       ;;
101    *)
102       AC_DEFINE(ECOS)
103       CXXINCLUDES="-I${TARGET_ECOS}/include"
104       addobjs="$addobjs ecos.lo"
105       ;;
106 esac
107 AC_SUBST(CXX)
108
109 AC_SUBST(INCLUDES)
110 AC_SUBST(CXXINCLUDES)
111
112 machdep=
113 case "$host" in
114 # alpha_mach_dep.s assumes that pointers are not saved in fp registers.
115 # Gcc on a 21264 can spill pointers to fp registers.  Oops.
116 # alpha*-*-*)
117 #    machdep="alpha_mach_dep.lo"
118 #    ;;
119  mipstx39-*-elf*)
120     machdep="mips_ultrix_mach_dep.lo"
121     AC_DEFINE(STACKBASE, __stackbase)
122     AC_DEFINE(DATASTART_IS_ETEXT)
123     ;;
124  mips-dec-ultrix*)
125     machdep="mips_ultrix_mach-dep.lo"
126     ;;
127  mips-*-*)
128     machdep="mips_sgi_mach_dep.lo"
129     AC_DEFINE(NO_EXECUTE_PERMISSION)
130     ;;
131  sparc-sun-solaris2.3*)
132     AC_DEFINE(SUNOS53_SHARED_LIB)
133     ;;
134 esac
135 if test x"$machdep" = x; then
136    machdep="mach_dep.lo"
137 fi
138 addobjs="$addobjs $machdep"
139 AC_SUBST(addobjs)
140
141 dnl As of 4.13a2, the collector will not properly work on Solaris when
142 dnl built with gcc and -O.  So we remove -O in the appropriate case.
143 case "$host" in
144  sparc-sun-solaris2*)
145     if test "$GCC" = yes; then
146        new_CFLAGS=
147        for i in $CFLAGS; do
148           case "$i" in
149            -O*)
150               ;;
151            *)
152               new_CFLAGS="$new_CFLAGS $i"
153               ;;
154           esac
155        done
156        CFLAGS="$new_CFLAGS"
157     fi
158     ;;
159 esac
160
161 dnl We need to override the top-level CFLAGS.  This is how we do it.
162 MY_CFLAGS="$CFLAGS"
163 AC_SUBST(MY_CFLAGS)
164
165 dnl Define a few things to retarget the library towards
166 dnl embedded Java.
167 AC_DEFINE(SILENT)
168 AC_DEFINE(NO_SIGNALS)
169 AC_DEFINE(JAVA_FINALIZATION)
170 AC_DEFINE(GC_GCJ_SUPPORT)
171
172 dnl This is something of a hack.  When cross-compiling we turn off
173 dnl some functionality.  We also enable the "small" configuration.
174 dnl These is only correct when targetting an embedded system.  FIXME.
175 if test -n "${with_cross_host}"; then
176    AC_DEFINE(NO_SIGSET)
177    AC_DEFINE(NO_CLOCK)
178    AC_DEFINE(SMALL_CONFIG)
179    AC_DEFINE(NO_DEBUGGING)
180 fi
181
182 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
183
184 if test "${multilib}" = "yes"; then
185   multilib_arg="--enable-multilib"
186 else
187   multilib_arg=
188 fi
189
190 AC_OUTPUT(Makefile,
191 [
192 dnl Put all the -D options in a file.  These are required before
193 dnl boehm-config.h can be included.  This is a huge hack brought
194 dnl about by overall poor structuring of this entire library.
195 echo "$DEFS" > boehm-cflags
196
197 if test -n "$CONFIG_FILES"; then
198   ac_file=Makefile . ${boehm_gc_basedir}/../config-ml.in
199 fi],
200 srcdir=${srcdir}
201 host=${host}
202 target=${target}
203 with_multisubdir=${with_multisubdir}
204 ac_configure_args="${multilib_arg} ${ac_configure_args}"
205 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
206 boehm_gc_basedir=${boehm_gc_basedir}
207 CC="${CC}"
208 DEFS="$DEFS"
209 )