* Makefile.in (PREPROCESSOR_DEFINES): New macro.
[official-gcc.git] / boehm-gc / configure.in
blob182277a3cd41c45518387415a2dc9ea7fae532de
1 dnl Process this file with autoconf to produce configure.
3 AC_INIT(gc_mark.h)
5 dnl Can't be done in BOEHM_CONFIGURE because that confuses automake. 
6 AC_CONFIG_AUX_DIR(..)
8 AC_CANONICAL_SYSTEM
10 BOEHM_CONFIGURE(.)
12 AM_PROG_LIBTOOL
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])
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
29 AC_MSG_CHECKING([for threads package to use])
30 AC_ARG_ENABLE(threads, [  --enable-threads=TYPE   choose threading package],
31   THREADS=$enableval,
32   dnl FIXME: figure out native threads to use here.
33   THREADS=no)
35 if test "$THREADS" = yes; then
36    case "$host" in
37     *-*-vxworks*)
38        THREADS=vxworks
39        ;;
40     *-*-linux*)
41        # FIXME: this isn't correct in all cases.
42        THREADS=posix
43        ;;
44     *-*-win*)
45        THREADS=win32
46        ;;
47     *-*-irix*)
48        # FIXME: for now, choose POSIX, because we implement that.
49        # Later, choose irix threads.
50        THREADS=posix
51        ;;
52     *-*-solaris*)
53        # FIXME: for now, choose POSIX, because we implement that.
54        # Later, choose solaris threads.
55        THREADS=posix
56        ;;
57     *)
58        # For now.
59        THREADS=none
60        ;;
61    esac
64 INCLUDES=
65 case "$THREADS" in
66  no | none | single)
67     THREADS=none
68     ;;
69  posix | pthreads)
70     THREADS=posix
71     case "$host" in
72      *-*-linux*)
73         AC_DEFINE(LINUX_THREADS)
74         AC_DEFINE(_REENTRANT)
75         ;;
76      *-*-solaris*)
77         AC_DEFINE(SOLARIS_THREADS)
78         AC_DEFINE(_SOLARIS_PTHREADS)
79         ;;
80      *-*-irix*)
81         AC_DEFINE(IRIX_THREADS)
82         ;;
83     esac
84     ;;
85  qt)
86     AC_DEFINE(QUICK_THREADS)
87     INCLUDES="-I${boehm_gc_basedir}/../qthreads"
88     ;;
89  decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
90     AC_MSG_ERROR(thread package $THREADS not yet supported)
91     ;;
92  *)
93     AC_MSG_ERROR($THREADS is an unknown thread package)
94     ;;
95 esac
96 AC_MSG_RESULT($THREADS)
98 AC_ARG_ENABLE(java-gc,
99 changequote(<<,>>)dnl
100 <<  --enable-java-gc=TYPE   choose garbage collector [boehm]>>,
101 changequote([,])
102   GC=$enableval,
103   GC=boehm)
104 target_all=
105 if test "$GC" = "boehm"; then
106    target_all=libgcjgc.la
108 AC_SUBST(target_all)
110 dnl If the target is an eCos system, use the appropriate eCos
111 dnl I/O routines.
112 dnl FIXME: this should not be a local option but a global target
113 dnl system; at present there is no eCos target.
114 TARGET_ECOS="no"
115 AC_ARG_WITH(ecos,
116 [  --with-ecos             enable runtime eCos target support],
117 TARGET_ECOS="$with_ecos"
120 addobjs=
121 CXXINCLUDES=
122 case "$TARGET_ECOS" in
123    no)
124       ;;
125    *)
126       AC_DEFINE(ECOS)
127       CXXINCLUDES="-I${TARGET_ECOS}/include"
128       addobjs="$addobjs ecos.lo"
129       ;;
130 esac
131 AC_SUBST(CXX)
133 AC_SUBST(INCLUDES)
134 AC_SUBST(CXXINCLUDES)
136 machdep=
137 case "$host" in
138  alpha*-*-*)
139     machdep="alpha_mach_dep.lo"
140     ;;
141  mipstx39-*-elf*)
142     machdep="mips_ultrix_mach_dep.lo"
143     AC_DEFINE(STACKBASE, __stackbase)
144     AC_DEFINE(DATASTART_IS_ETEXT)
145     ;;
146  mips-dec-ultrix*)
147     machdep="mips_ultrix_mach-dep.lo"
148     ;;
149  mips-*-*)
150     machdep="mips_sgi_mach_dep.lo"
151     AC_DEFINE(NO_EXECUTE_PERMISSION)
152     ;;
153  sparc-sun-solaris2.3*)
154     AC_DEFINE(SUNOS53_SHARED_LIB)
155     ;;
156 esac
157 if test x"$machdep" = x; then
158    machdep="mach_dep.lo"
160 addobjs="$addobjs $machdep"
161 AC_SUBST(addobjs)
163 dnl As of 4.13a2, the collector will not properly work on Solaris when
164 dnl built with gcc and -O.  So we remove -O in the appropriate case.
165 case "$host" in
166  sparc-sun-solaris2*)
167     if test "$GCC" = yes; then
168        new_CFLAGS=
169        for i in $CFLAGS; do
170           case "$i" in
171            -O*)
172               ;;
173            *)
174               new_CFLAGS="$new_CFLAGS $i"
175               ;;
176           esac
177        done
178        CFLAGS="$new_CFLAGS"
179     fi
180     ;;
181 esac
183 dnl We need to override the top-level CFLAGS.  This is how we do it.
184 MY_CFLAGS="$CFLAGS"
185 AC_SUBST(MY_CFLAGS)
187 dnl Define a few things to retarget the library towards
188 dnl embedded Java.
189 AC_DEFINE(SILENT)
190 AC_DEFINE(NO_SIGNALS)
191 AC_DEFINE(NO_DEBUGGING)
192 AC_DEFINE(JAVA_FINALIZATION)
194 dnl Create boehm-config.h so that libjava can find it.
195 dnl It is required to use gc_priv.h, which is required to write
196 dnl a new marking function.  So config.h in this package is
197 dnl poorly named.
198 AC_LINK_FILES(config.h, boehm-config.h)
200 dnl This is something of a hack.  When cross-compiling we turn off
201 dnl some functionality.  We also enable the "small" configuration.
202 dnl These is only correct when targetting an embedded system.  FIXME.
203 if test -n "${with_cross_host}"; then
204    AC_DEFINE(NO_SIGSET)
205    AC_DEFINE(NO_CLOCK)
206    AC_DEFINE(SMALL_CONFIG)
209 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
211 if test "${multilib}" = "yes"; then
212   multilib_arg="--enable-multilib"
213 else
214   multilib_arg=
217 AC_OUTPUT(Makefile,
219 dnl Put all the -D options in a file.  These are required before
220 dnl boehm-config.h can be included.  This is a huge hack brought
221 dnl about by overall poor structuring of this entire library.
222 echo "$DEFS" > boehm-cflags
224 if test -n "$CONFIG_FILES"; then
225   ac_file=Makefile . ${boehm_gc_basedir}/../config-ml.in
226 fi],
227 srcdir=${srcdir}
228 host=${host}
229 target=${target}
230 with_multisubdir=${with_multisubdir}
231 ac_configure_args="${multilib_arg} ${ac_configure_args}"
232 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
233 boehm_gc_basedir=${boehm_gc_basedir}
234 CC="${CC}"
235 DEFS="$DEFS"