OSDN Git Service

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