configure.host: Add bits for FreeBSD amd64 and i386.
[gcc.git] / libjava / configure.host
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
21 # libgcj_sublib_ltflags Special Libtool flags to use when building sublibs
22 # libgcj_sublib_core_extra_deps Extra dependencies to add to core sublib
23 # libgcj_interpreter If the bytecode interpreter supports this platform.
24 # enable_java_net_default If java.net native code should be enabled by
25 # default.
26 # enable_hash_synchronization_default If hash synchronization should be
27 # enabled by default.
28 # enable_libgcj_sublibs_default Whether to build libgcj as a bunch of
29 # separate shared libraries or in one
30 # monolithic one.
31 # sysdeps_dir Directory containing system-dependent headers
32 # slow_pthread_self The synchronization code should try to avoid
33 # pthread_self calls by caching thread IDs in a hashtable
34 # can_unwind_signal Set to "yes" if the EH unwinder supports throwing
35 # from a signal handler.
36 # fallback_backtrace_h Header to use for fallback backtrace implementation
37 # (only for targets that don't support DWARF2 unwind)
38 # descriptor_h Header to use for looking past function descriptors
39 # use_libgcj_bc Whether to build a "libgcj-bc" library for BC-ABI
40 # binaries to link against.
41
42 libgcj_flags=
43 libgcj_cflags=
44 libgcj_cxxflags=
45 libgcj_javaflags=
46 libgcj_sublib_ltflags=
47 libgcj_sublib_core_extra_deps=
48 libgcj_interpreter=
49 enable_java_net_default=yes
50 enable_hash_synchronization_default=no
51 enable_libgcj_sublibs_default=no
52 sysdeps_dir=generic
53 slow_pthread_self=
54 can_unwind_signal=no
55 fallback_backtrace_h=sysdep/generic/backtrace.h
56
57 case "${target_optspace}:${host}" in
58 yes:*)
59 libgcj_flags="${libgcj_flags} -Os"
60 ;;
61 :m32r-* | :d10v-* | :d30v-*)
62 libgcj_flags="${libgcj_flags} -Os"
63 ;;
64 no:* | :*)
65 # Nothing.
66 ;;
67 esac
68
69 AM_RUNTESTFLAGS=
70
71 # Set any host dependent compiler flags.
72 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
73
74 echo "$target"
75
76 DIVIDESPEC=-fuse-divide-subroutine
77 EXCEPTIONSPEC=-fnon-call-exceptions
78 CHECKREFSPEC=
79 BACKTRACESPEC=
80 ATOMICSPEC=
81
82 # This case statement supports per-CPU defaults.
83 case "${host}" in
84 aarch64*-linux*)
85 libgcj_interpreter=yes
86 sysdeps_dir=aarch64
87 ATOMICSPEC=-fuse-atomic-builtins
88 ;;
89 arm*-elf)
90 with_libffi_default=no
91 PROCESS=Ecos
92 FILE=Posix
93 CHECKREFSPEC=-fcheck-references
94 EXCEPTIONSPEC=
95 enable_java_net_default=no
96 enable_getenv_properties_default=no
97 enable_main_args_default=no
98 sysdeps_dir=arm
99 ;;
100 arm*-linux*)
101 libgcj_interpreter=yes
102 sysdeps_dir=arm
103 fallback_backtrace_h=sysdep/arm/backtrace.h
104 libgcj_cxxflags=-Wno-abi
105 ATOMICSPEC=-fuse-atomic-builtins
106 # Work around a strange libtool feature that causes libraries
107 # to be linked with libgcc_s but not libgcc.
108 LDFLAGS="${LDFLAGS} -Wl,-lgcc"
109 ;;
110 mips-tx39-*|mipstx39-unknown-*)
111 libgcj_flags="${libgcj_flags} -G 0"
112 LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
113 AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
114 # Use "Ecos" processes since they are a no-op.
115 PROCESS=Ecos
116 FILE=Posix
117 enable_java_net_default=no
118 enable_getenv_properties_default=no
119 ;;
120 mips*-*)
121 libgcj_interpreter=yes
122 ;;
123 i686-*|i586-*|i486-*|i386-*)
124 sysdeps_dir=i386
125 # With -fomit-frame-pointer -maccumulate-outgoing-args (implied),
126 # the .text section of libgcj.so is 30k larger, and the .eh_frame
127 # section is 1.4M smaller.
128 libgcj_flags="${libgcj_flags} -ffloat-store -fomit-frame-pointer"
129 # On Solaris we have defined 'sun' which later conflicts with
130 # namespace usage. So to work this away we use the below undefine.
131 libgcj_flags="${libgcj_flags} -Usun"
132 libgcj_interpreter=yes
133 libgcj_cxxflags=
134 libgcj_cflags=
135 DIVIDESPEC=-fno-use-divide-subroutine
136 enable_hash_synchronization_default=yes
137 slow_pthread_self=yes
138 ;;
139 x86_64-*)
140 sysdeps_dir=i386
141 # For 64-bit we always use SSE registers for arithmetic,
142 # which doesn't have the extra precision problems of the fpu.
143 # But be careful about 32-bit multilibs.
144 case " $CC " in
145 *" -m32 "*)
146 libgcj_flags="${libgcj_flags} -ffloat-store" ;;
147 esac
148 libgcj_flags="${libgcj_flags} -fomit-frame-pointer"
149 # On Solaris we have defined 'sun' which later conflicts with
150 # namespace usage. So to work this away we use the below undefine.
151 libgcj_flags="${libgcj_flags} -Usun"
152 libgcj_cxxflags=
153 libgcj_cflags=
154 DIVIDESPEC=-fno-use-divide-subroutine
155 enable_hash_synchronization_default=yes
156 slow_pthread_self=yes
157 libgcj_interpreter=yes
158 ;;
159 alpha*-*)
160 sysdeps_dir=alpha
161 libgcj_flags="${libgcj_flags} -mieee"
162 libgcj_interpreter=yes
163 enable_hash_synchronization_default=yes
164 IEEESPEC=-mieee
165 ;;
166 hppa*-*)
167 sysdeps_dir=pa
168 libgcj_interpreter=yes
169 enable_hash_synchronization_default=no
170 ;;
171 m68k-*)
172 sysdeps_dir=m68k
173 libgcj_interpreter=yes
174 ;;
175 powerpc64*-*)
176 sysdeps_dir=powerpc
177 libgcj_interpreter=yes
178 if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
179 libgcj_flags="${libgcj_flags} -mminimal-toc"
180 fi
181 enable_hash_synchronization_default=yes
182 slow_pthread_self=yes
183 ;;
184 powerpc*-*)
185 sysdeps_dir=powerpc
186 libgcj_interpreter=yes
187 enable_hash_synchronization_default=yes
188 slow_pthread_self=yes
189 ;;
190 s390*-*)
191 sysdeps_dir=s390
192 libgcj_interpreter=yes
193 DIVIDESPEC=-fno-use-divide-subroutine
194 enable_hash_synchronization_default=yes
195 ;;
196 sparc*-*)
197 sysdeps_dir=sparc
198 # On Solaris we have defined 'sun' which later conflicts with
199 # namespace usage. So to work this away we use the below undefine.
200 libgcj_flags="${libgcj_flags} -Usun"
201 libgcj_interpreter=yes
202 ;;
203 ia64-*)
204 sysdeps_dir=ia64
205 libgcj_flags="${libgcj_flags} -funwind-tables"
206 libgcj_interpreter=yes
207 enable_hash_synchronization_default=yes
208 ;;
209 sh-* | sh[34]*-*)
210 sysdeps_dir=sh
211 libgcj_flags="${libgcj_flags} -mieee"
212 libgcj_interpreter=yes
213 enable_hash_synchronization_default=yes
214 IEEESPEC=-mieee
215 ;;
216 esac
217
218 # This case statement supports generic port properties and may refine
219 # the above per-CPU defaults. Note: If your OS implements
220 # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
221 # here.
222 case "${host}" in
223 i[34567]86*-linux* | \
224 powerpc*-linux* | \
225 alpha*-linux* | \
226 s390*-linux* | \
227 sparc*-linux* | \
228 ia64-* | \
229 x86_64*-linux* | \
230 hppa*-linux* | \
231 m68k*-linux* | \
232 sh-linux* | sh[34]*-linux*)
233 can_unwind_signal=yes
234 libgcj_ld_symbolic='-Wl,-Bsymbolic'
235 if test x$slow_pthread_self = xyes \
236 && test x$cross_compiling != xyes; then
237 cat > conftest.c <<EOF
238 #define _GNU_SOURCE 1
239 #include <pthread.h>
240 #include <stdlib.h>
241 #include <sys/resource.h>
242 #include <limits.h>
243
244 void *
245 tf (void *arg __attribute__ ((unused)))
246 {
247 pthread_attr_t a;
248 size_t s;
249
250 if (pthread_getattr_np (pthread_self (), &a)
251 || pthread_attr_getstacksize (&a, &s)
252 || s > 2 * PTHREAD_STACK_MIN)
253 exit (1);
254 exit (0);
255 }
256
257 int
258 main (int argc, char **argv)
259 {
260 pthread_t p;
261 void *ret;
262 struct rlimit r;
263
264 if (argc == 2)
265 {
266 r.rlim_cur = 2 * PTHREAD_STACK_MIN;
267 r.rlim_max = 2 * PTHREAD_STACK_MIN;
268 if (setrlimit (RLIMIT_STACK, &r))
269 exit (1);
270 execl (argv[1], argv[0], NULL);
271 exit (1);
272 }
273
274 if (pthread_create (&p, NULL, tf, NULL)
275 || pthread_join (p, &ret))
276 exit (1);
277 exit (1);
278 }
279 EOF
280 $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
281 ./conftest ./conftest && slow_pthread_self=
282 rm -f conftest conftest.c
283 fi
284 ;;
285 i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
286 libgcj_ld_symbolic='-Wl,-Bsymbolic'
287 slow_pthread_self=
288 ;;
289 i[34567]86-*-solaris2.1[0-9]* )
290 sysdeps_dir=i386
291 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
292 ;;
293 x86_64-*-solaris2.1[0-9]* )
294 sysdeps_dir=i386
295 DIVIDESPEC=-f%{m32:no-}use-divide-subroutine
296 ;;
297 aarch64*-linux* )
298 slow_pthread_self=no
299 can_unwind_signal=no
300 CHECKREFSPEC=-fcheck-references
301 DIVIDESPEC=-fuse-divide-subroutine
302 ;;
303 arm*-linux* )
304 slow_pthread_self=no
305 can_unwind_signal=no
306 CHECKREFSPEC=-fcheck-references
307 DIVIDESPEC=-fuse-divide-subroutine
308 ;;
309 mips*-*-linux* )
310 sysdeps_dir=mips
311 can_unwind_signal=yes
312 DIVIDESPEC=-fno-use-divide-subroutine
313 enable_hash_synchronization_default=yes
314 ;;
315 powerpc*-*-darwin*)
316 enable_hash_synchronization_default=yes
317 slow_pthread_self=
318 can_unwind_signal=yes
319 ;;
320 i?86-*-darwin*)
321 enable_hash_synchronization_default=yes
322 slow_pthread_self=
323 can_unwind_signal=no
324 ;;
325 i?86-*-darwin[912]*)
326 can_unwind_signal=yes
327 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
328 ;;
329 x86_64-*-darwin[912]*)
330 enable_hash_synchronization_default=yes
331 slow_pthread_self=
332 can_unwind_signal=yes
333 DIVIDESPEC=-fuse-divide-subroutine
334 CHECKREFSPEC=-fcheck-references
335 ;;
336 i?86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
337 can_unwind_signal=yes
338 ;;
339 *-*-freebsd*)
340 slow_pthread_self=
341 can_unwind_signal=yes
342 DIVIDESPEC=-fuse-divide-subroutine
343 ;;
344 *-mingw*)
345 libgcj_flags="${libgcj_flags} -fno-omit-frame-pointer"
346 # FIXME: win32_exception_handler( ) in win32.cc does not do the
347 # right stuff yet w.r.t. SEH. Live with the following for now.
348 can_unwind_signal=no
349 CHECKREFSPEC=-fcheck-references
350 DIVIDESPEC=-fuse-divide-subroutine
351 ;;
352 *-cygwin*)
353 # The cygwin linker doesn't do 8-byte alignment by default, so
354 # disable hash synchronization for now.
355 enable_hash_synchronization_default=no
356 slow_pthread_self=
357 ;;
358 hppa*-hp-hpux11.*)
359 slow_pthread_self=no
360 can_unwind_signal=yes
361 DIVIDESPEC=-fuse-divide-subroutine
362 ;;
363 sparc*-sun-solaris2.*)
364 slow_pthread_self=
365 can_unwind_signal=yes
366 ;;
367 esac
368
369 case "${host}" in
370 x86_64-*-cygwin* | x86_64-*-mingw*)
371 # Win32 DLLs are limited to 64k exported symbols each.
372 enable_libgcj_sublibs_default=yes
373 libgcj_sublib_ltflags='$(lt_host_flags) \
374 -Wl,-u,_ZN3org4ietf4jgss10GSSManagerC1Ev,-L..,-lgcj-noncore-dummy'
375 libgcj_sublib_core_extra_deps=libgcj-noncore-dummy.dll.a
376 ;;
377 *-cygwin* | *-mingw*)
378 fallback_backtrace_h=sysdep/i386/backtrace.h
379 # We need a frame pointer on Windows, so override BACKTRACESPEC
380 BACKTRACESPEC=
381 # Win32 DLLs are limited to 64k exported symbols each.
382 enable_libgcj_sublibs_default=yes
383 libgcj_sublib_ltflags='$(lt_host_flags) \
384 -Wl,-u,__ZN3org4ietf4jgss10GSSManagerC1Ev,-L..,-lgcj-noncore-dummy'
385 libgcj_sublib_core_extra_deps=libgcj-noncore-dummy.dll.a
386 ;;
387 esac
388
389 case "${host}" in
390 ia64-*)
391 descriptor_h=sysdep/descriptor-y.h
392 ;;
393
394 hppa*64*-*-hpux*)
395 descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
396 ;;
397
398 hppa*-*-hpux*)
399 descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
400 ;;
401
402 hppa*-*)
403 descriptor_h=sysdep/pa/descriptor.h
404 ;;
405
406 rs6000-* | powerpc*-*)
407 descriptor_h=sysdep/powerpc/descriptor.h
408 ;;
409
410 *)
411 descriptor_h=sysdep/descriptor-n.h
412 ;;
413 esac
414
415 case "${host}" in
416 *linux*|*-kfreebsd*-gnu|*-gnu*)
417 use_libgcj_bc=yes
418 ;;
419 *)
420 use_libgcj_bc=no
421 ;;
422 esac
423
424 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
425 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
426 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"