OSDN Git Service

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