]> git.ipfire.org Git - thirdparty/gcc.git/blame - libjava/configure.host
configure.host (libgcj_sublib_ltflags): New variable.
[thirdparty/gcc.git] / libjava / configure.host
CommitLineData
ee9dd372
TT
1# configure.host
2
3# This shell script handles all host based configuration for libgcj.
4# It sets various shell variables based on the the host and the
5# configuration options. You can modify this shell script without
6# needing to rerun autoconf.
7
8# This shell script should be invoked as
9# . configure.host
10# If it encounters an error, it will exit with a message.
11
12# It uses the following shell variables:
13# host The configuration host
14# host_cpu The configuration host CPU
15# target_optspace --enable-target-optspace ("yes", "no", "")
16
17# It sets the following shell variables:
18# libgcj_cflags Special CFLAGS to use when building
19# libgcj_cxxflags Special CXXFLAGS to use when building
20# libgcj_javaflags Special JAVAFLAGS to use when building
c4f0333b 21# libgcj_sublib_ltflags Special Libtool flags to use when building.
45597167
BM
22# libgcj_interpreter If the bytecode interpreter supports this platform.
23# enable_java_net_default If java.net native code should be enabled by
24# default.
25# enable_hash_synchronization_default If hash synchronization should be
26# enabled by default.
6a92b6c7
DK
27# enable_libgcj_sublibs_default Whether to build libgcj as a bunch of
28# separate shared libraries or in one
29# monolithic one.
45597167
BM
30# sysdeps_dir Directory containing system-dependent headers
31# slow_pthread_self The synchronization code should try to avoid
32# pthread_self calls by caching thread IDs in a hashtable
605dc89b
BM
33# can_unwind_signal Set to "yes" if the EH unwinder supports throwing
34# from a signal handler.
18744d9b
BM
35# fallback_backtrace_h Header to use for fallback backtrace implementation
36# (only for targets that don't support DWARF2 unwind)
eb2925b6 37# descriptor_h Header to use for looking past function descriptors
97c074fd
JJ
38# use_libgcj_bc Whether to build a "libgcj-bc" library for BC-ABI
39# binaries to link against.
ee9dd372
TT
40
41libgcj_flags=
42libgcj_cflags=
43libgcj_cxxflags=
44libgcj_javaflags=
c4f0333b 45libgcj_sublib_ltflags=
b11f6430 46libgcj_interpreter=
3610e0d5
TT
47enable_java_net_default=yes
48enable_hash_synchronization_default=no
6a92b6c7 49enable_libgcj_sublibs_default=no
45597167
BM
50sysdeps_dir=generic
51slow_pthread_self=
605dc89b 52can_unwind_signal=no
18744d9b 53fallback_backtrace_h=sysdep/generic/backtrace.h
ee9dd372
TT
54
55case "${target_optspace}:${host}" in
56 yes:*)
57 libgcj_flags="${libgcj_flags} -Os"
58 ;;
59 :m32r-* | :d10v-* | :d30v-*)
60 libgcj_flags="${libgcj_flags} -Os"
61 ;;
62 no:* | :*)
63 # Nothing.
64 ;;
65esac
66
67AM_RUNTESTFLAGS=
68
69# Set any host dependent compiler flags.
70# THIS TABLE IS SORTED. KEEP IT THAT WAY.
71
72echo "$target"
73
d342a2e1 74DIVIDESPEC=-fuse-divide-subroutine
e529c2c1 75EXCEPTIONSPEC=-fnon-call-exceptions
5cb27a46 76CHECKREFSPEC=
135709e8 77BACKTRACESPEC=
e8e76230 78ATOMICSPEC=
d342a2e1 79
c0904887 80# This case statement supports per-CPU defaults.
ee9dd372 81case "${host}" in
cd985f66 82 arm*-elf)
841b8360
RE
83 with_libffi_default=no
84 PROCESS=Ecos
85 FILE=Posix
86 CHECKREFSPEC=-fcheck-references
87 EXCEPTIONSPEC=
88 enable_java_net_default=no
89 enable_getenv_properties_default=no
90 enable_main_args_default=no
3d08716e 91 sysdeps_dir=arm
841b8360 92 ;;
945e62dd 93 arm*-linux*)
976731ee
AH
94 libgcj_interpreter=yes
95 sysdeps_dir=arm
f202305d 96 fallback_backtrace_h=sysdep/arm/backtrace.h
e8e76230
AH
97 libgcj_cxxflags=-Wno-abi
98 ATOMICSPEC=-fuse-atomic-builtins
99 # Work around a strange libtool feature that causes libraries
100 # to be linked with libgcc_s but not libgcc.
101 LDFLAGS="${LDFLAGS} -Wl,-lgcc"
976731ee 102 ;;
ee9dd372
TT
103 mips-tx39-*|mipstx39-unknown-*)
104 libgcj_flags="${libgcj_flags} -G 0"
105 LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
d342a2e1 106 AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
ab31268c
TT
107 # Use "Ecos" processes since they are a no-op.
108 PROCESS=Ecos
2d933a0b 109 FILE=Posix
4b68fe8a 110 enable_java_net_default=no
ffccc6be 111 enable_getenv_properties_default=no
ee9dd372 112 ;;
22083efc 113 mips*-*)
b4c85778
DD
114 libgcj_interpreter=yes
115 ;;
97ce4a51 116 i686-*|i586-*|i486-*|i386-*)
45597167 117 sysdeps_dir=i386
d3073c70
RH
118 # With -fomit-frame-pointer -maccumulate-outgoing-args (implied),
119 # the .text section of libgcj.so is 30k larger, and the .eh_frame
120 # section is 1.4M smaller.
121 libgcj_flags="${libgcj_flags} -ffloat-store -fomit-frame-pointer"
a3b7729c
RO
122 # On Solaris we have defined 'sun' which later conflicts with
123 # namespace usage. So to work this away we use the below undefine.
124 libgcj_flags="${libgcj_flags} -Usun"
b11f6430 125 libgcj_interpreter=yes
707691d8
MK
126 libgcj_cxxflags=
127 libgcj_cflags=
c677cd7f 128 DIVIDESPEC=-fno-use-divide-subroutine
3610e0d5 129 enable_hash_synchronization_default=yes
45597167 130 slow_pthread_self=yes
ee9dd372 131 ;;
7b204712
BT
132 x86_64-*)
133 sysdeps_dir=x86-64
d3073c70
RH
134 # For 64-bit we always use SSE registers for arithmetic,
135 # which doesn't have the extra precision problems of the fpu.
136 # But be careful about 32-bit multilibs.
137 case " $CC " in
138 *" -m32 "*)
139 libgcj_flags="${libgcj_flags} -ffloat-store" ;;
140 esac
141 libgcj_flags="${libgcj_flags} -fomit-frame-pointer"
707691d8
MK
142 libgcj_cxxflags=
143 libgcj_cflags=
e92857a1 144 DIVIDESPEC=-fno-use-divide-subroutine
7b204712
BT
145 enable_hash_synchronization_default=yes
146 slow_pthread_self=yes
7b22f8b0 147 libgcj_interpreter=yes
7b204712 148 ;;
48a9aced 149 alpha*-*)
45597167 150 sysdeps_dir=alpha
0be25992 151 libgcj_flags="${libgcj_flags} -mieee"
bc38c787 152 libgcj_interpreter=yes
092a1f5a 153 enable_hash_synchronization_default=yes
c4ebd83d 154 IEEESPEC=-mieee
bc38c787 155 ;;
68bfb94e 156 hppa*-*)
f94b0887
RC
157 sysdeps_dir=pa
158 libgcj_interpreter=yes
169b7512 159 enable_hash_synchronization_default=no
f94b0887 160 ;;
dbc293c8
RZ
161 m68k-*)
162 sysdeps_dir=m68k
163 libgcj_interpreter=yes
164 ;;
1d49f58a 165 powerpc64*-*)
1d49f58a 166 sysdeps_dir=powerpc
02731d29
JJ
167 libgcj_interpreter=yes
168 if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
169 libgcj_flags="${libgcj_flags} -mminimal-toc"
170 fi
1d49f58a
AM
171 enable_hash_synchronization_default=yes
172 slow_pthread_self=yes
173 ;;
c0904887 174 powerpc*-*)
45597167 175 sysdeps_dir=powerpc
23ab86e4 176 libgcj_interpreter=yes
45597167
BM
177 enable_hash_synchronization_default=yes
178 slow_pthread_self=yes
23ab86e4 179 ;;
5404cddb
UW
180 s390*-*)
181 sysdeps_dir=s390
182 libgcj_interpreter=yes
220a826e 183 DIVIDESPEC=-fno-use-divide-subroutine
5404cddb
UW
184 enable_hash_synchronization_default=yes
185 ;;
2eb1ea83 186 sparc*-*)
4838bfc0
AT
187 sysdeps_dir=sparc
188 # On Solaris we have defined 'sun' which later conflicts with
189 # namespace usage. So to work this away we use the below undefine.
190 libgcj_flags="${libgcj_flags} -Usun"
2eb1ea83 191 libgcj_interpreter=yes
3cf88fb4 192 ;;
6c80c45e 193 ia64-*)
45597167 194 sysdeps_dir=ia64
6c80c45e 195 libgcj_flags="${libgcj_flags} -funwind-tables"
6c80c45e 196 libgcj_interpreter=yes
3610e0d5 197 enable_hash_synchronization_default=yes
6c80c45e 198 ;;
d8278e27
KK
199 sh-* | sh[34]*-*)
200 sysdeps_dir=sh
201 libgcj_flags="${libgcj_flags} -mieee"
202 libgcj_interpreter=yes
d8278e27 203 enable_hash_synchronization_default=yes
760ceba9 204 IEEESPEC=-mieee
d8278e27 205 ;;
ee9dd372
TT
206esac
207
c0904887 208# This case statement supports generic port properties and may refine
605dc89b
BM
209# the above per-CPU defaults. Note: If your OS implements
210# MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
211# here.
c0904887 212case "${host}" in
605dc89b
BM
213 i[34567]86*-linux* | \
214 powerpc*-linux* | \
215 alpha*-linux* | \
e793a714 216 s390*-linux* | \
714708c8 217 sparc*-linux* | \
7b204712 218 ia64-* | \
4977bab6 219 x86_64*-linux* | \
8c5ac2c4 220 hppa*-linux* | \
dbc293c8 221 m68k*-linux* | \
4977bab6 222 sh-linux* | sh[34]*-linux*)
605dc89b 223 can_unwind_signal=yes
36739040 224 libgcj_ld_symbolic='-Wl,-Bsymbolic'
ba39351e
JJ
225 if test x$slow_pthread_self = xyes \
226 && test x$cross_compiling != xyes; then
227 cat > conftest.c <<EOF
228#define _GNU_SOURCE 1
229#include <pthread.h>
230#include <stdlib.h>
231#include <sys/resource.h>
232#include <limits.h>
233
234void *
235tf (void *arg __attribute__ ((unused)))
236{
237 pthread_attr_t a;
238 size_t s;
239
240 if (pthread_getattr_np (pthread_self (), &a)
241 || pthread_attr_getstacksize (&a, &s)
242 || s > 2 * PTHREAD_STACK_MIN)
243 exit (1);
244 exit (0);
245}
246
247int
248main (int argc, char **argv)
249{
250 pthread_t p;
251 void *ret;
252 struct rlimit r;
253
254 if (argc == 2)
255 {
256 r.rlim_cur = 2 * PTHREAD_STACK_MIN;
257 r.rlim_max = 2 * PTHREAD_STACK_MIN;
258 if (setrlimit (RLIMIT_STACK, &r))
259 exit (1);
260 execl (argv[1], argv[0], NULL);
261 exit (1);
262 }
263
264 if (pthread_create (&p, NULL, tf, NULL)
265 || pthread_join (p, &ret))
266 exit (1);
267 exit (1);
268}
269EOF
270 $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
271 ./conftest ./conftest && slow_pthread_self=
272 rm -f conftest conftest.c
273 fi
605dc89b 274 ;;
2395bcd4
PS
275 i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
276 libgcj_ld_symbolic='-Wl,-Bsymbolic'
277 slow_pthread_self=
278 ;;
e9c002e5
RO
279 i[34567]86-*-solaris2.1[0-9]* )
280 sysdeps_dir=x86-64
281 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
282 ;;
b2a95bc9
RO
283 mips-sgi-irix6* )
284 sysdeps_dir=mips
285 # disable interpreter, no closure support for N32 and N64 ABIs
286 libgcj_interpreter=no
287 ;;
f202305d
AH
288 arm*-linux* )
289 slow_pthread_self=no
290 can_unwind_signal=no
291 CHECKREFSPEC=-fcheck-references
292 DIVIDESPEC=-fuse-divide-subroutine
293 ;;
13229468
DD
294 mips*-*-linux* )
295 sysdeps_dir=mips
296 can_unwind_signal=yes
04efec81 297 DIVIDESPEC=-fno-use-divide-subroutine
22083efc 298 enable_hash_synchronization_default=yes
13229468 299 ;;
f8a57be8 300 powerpc*-*-darwin*)
0e497b6c 301 enable_hash_synchronization_default=yes
c0904887 302 slow_pthread_self=
f8a57be8 303 can_unwind_signal=yes
c0904887 304 ;;
9af06953
ST
305 i?86-*-darwin*)
306 enable_hash_synchronization_default=yes
307 slow_pthread_self=
308 can_unwind_signal=no
309 ;;
dc4e3423 310 i?86-*-darwin[912]*)
417e7bed
AT
311 can_unwind_signal=yes
312 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
313 ;;
dc4e3423 314 x86_64-*-darwin[912]*)
417e7bed
AT
315 enable_hash_synchronization_default=yes
316 slow_pthread_self=
317 can_unwind_signal=yes
318 DIVIDESPEC=-fuse-divide-subroutine
319 CHECKREFSPEC=-fcheck-references
320 ;;
c0904887 321 *-*-freebsd*)
c0904887
LR
322 slow_pthread_self=
323 ;;
6eb08535 324 *-mingw*)
20762656 325 libgcj_flags="${libgcj_flags} -fno-omit-frame-pointer"
6eb08535
RM
326 # FIXME: win32_exception_handler( ) in win32.cc does not do the
327 # right stuff yet w.r.t. SEH. Live with the following for now.
328 can_unwind_signal=no
329 CHECKREFSPEC=-fcheck-references
330 DIVIDESPEC=-fuse-divide-subroutine
331 ;;
5f555088
BM
332 *-cygwin*)
333 # The cygwin linker doesn't do 8-byte alignment by default, so
334 # disable hash synchronization for now.
335 enable_hash_synchronization_default=no
336 slow_pthread_self=
337 ;;
68bfb94e
AT
338 hppa*-hp-hpux11.*)
339 slow_pthread_self=no
340 can_unwind_signal=yes
341 DIVIDESPEC=-fuse-divide-subroutine
342 ;;
c0904887
LR
343esac
344
18744d9b
BM
345case "${host}" in
346 *-cygwin* | *-mingw*)
347 fallback_backtrace_h=sysdep/i386/backtrace.h
135709e8
BM
348 # We need a frame pointer on Windows, so override BACKTRACESPEC
349 BACKTRACESPEC=
6a92b6c7
DK
350 # Win32 DLLs are limited to 64k exported symbols each.
351 enable_libgcj_sublibs_default=yes
c4f0333b 352 libgcj_sublib_ltflags='-no-undefined -bindir $(bindir)'
18744d9b
BM
353 ;;
354esac
355
eb2925b6 356case "${host}" in
c348be20 357 ia64-*)
eb2925b6
RH
358 descriptor_h=sysdep/descriptor-y.h
359 ;;
360
68bfb94e
AT
361 hppa*64*-*-hpux*)
362 descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
363 ;;
364
365 hppa*-*-hpux*)
366 descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
367 ;;
368
c348be20
JDA
369 hppa*-*)
370 descriptor_h=sysdep/pa/descriptor.h
371 ;;
372
eb2925b6
RH
373 rs6000-* | powerpc*-*)
374 descriptor_h=sysdep/powerpc/descriptor.h
375 ;;
376
377 *)
378 descriptor_h=sysdep/descriptor-n.h
379 ;;
380esac
18744d9b 381
97c074fd 382case "${host}" in
e050d795 383 *linux*|*-kfreebsd*-gnu|*-gnu*)
97c074fd
JJ
384 use_libgcj_bc=yes
385 ;;
386 *)
387 use_libgcj_bc=no
388 ;;
389esac
390
ee9dd372
TT
391libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
392libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
393libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"