OSDN Git Service

2007-09-05 Samuel Thibault <samuel.thibault@ens-lyon.org>
[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         fallback_backtrace_h=sysdep/arm/backtrace.h
90         ;;
91   mips-tx39-*|mipstx39-unknown-*)
92         libgcj_flags="${libgcj_flags} -G 0"
93         LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
94         AM_RUNTESTFLAGS="--target_board=jmr3904-sim"    
95         # Use "Ecos" processes since they are a no-op.
96         PROCESS=Ecos
97         FILE=Posix
98         enable_java_net_default=no
99         enable_getenv_properties_default=no
100         ;;
101   mipsel-*|mips-*)
102         libgcj_interpreter=yes
103         ;;
104   i686-*|i586-*|i486-*|i386-*)
105         sysdeps_dir=i386
106         # With -fomit-frame-pointer -maccumulate-outgoing-args (implied),
107         # the .text section of libgcj.so is 30k larger, and the .eh_frame
108         # section is 1.4M smaller.
109         libgcj_flags="${libgcj_flags} -ffloat-store -fomit-frame-pointer"
110         # On Solaris we have defined 'sun' which later conflicts with 
111         # namespace usage. So to work this away we use the below undefine.
112         libgcj_flags="${libgcj_flags} -Usun"
113         libgcj_interpreter=yes
114         libgcj_cxxflags=
115         libgcj_cflags=
116         DIVIDESPEC=-fno-use-divide-subroutine
117         enable_hash_synchronization_default=yes
118         slow_pthread_self=yes
119         ;;
120   x86_64-*)
121         sysdeps_dir=x86-64
122         # For 64-bit we always use SSE registers for arithmetic,
123         # which doesn't have the extra precision problems of the fpu.
124         # But be careful about 32-bit multilibs.
125         case " $CC " in
126         *" -m32 "*)
127                 libgcj_flags="${libgcj_flags} -ffloat-store" ;;
128         esac
129         libgcj_flags="${libgcj_flags} -fomit-frame-pointer"
130         libgcj_cxxflags=
131         libgcj_cflags=
132         DIVIDESPEC=-fno-use-divide-subroutine
133         enable_hash_synchronization_default=yes
134         slow_pthread_self=yes
135         libgcj_interpreter=yes
136         ;;
137   alpha*-*)
138         sysdeps_dir=alpha
139         libgcj_flags="${libgcj_flags} -mieee"
140         libgcj_interpreter=yes
141         enable_hash_synchronization_default=yes
142         IEEESPEC=-mieee
143         ;;
144   hppa*-*)
145         sysdeps_dir=pa
146         libgcj_interpreter=yes
147         enable_hash_synchronization_default=no
148         ;;
149   powerpc64*-*)
150         sysdeps_dir=powerpc
151         libgcj_interpreter=yes
152         if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
153             libgcj_flags="${libgcj_flags} -mminimal-toc"
154         fi
155         enable_hash_synchronization_default=yes
156         slow_pthread_self=yes
157         ;;
158   powerpc*-*)
159         sysdeps_dir=powerpc
160         libgcj_interpreter=yes
161         enable_hash_synchronization_default=yes
162         slow_pthread_self=yes
163         ;;
164   s390*-*)
165         sysdeps_dir=s390
166         libgcj_interpreter=yes
167         DIVIDESPEC=-fno-use-divide-subroutine
168         enable_hash_synchronization_default=yes
169         ;;
170   sparc*-*)
171         sysdeps_dir=sparc
172         # On Solaris we have defined 'sun' which later conflicts with 
173         # namespace usage. So to work this away we use the below undefine.
174         libgcj_flags="${libgcj_flags} -Usun"
175         libgcj_interpreter=yes
176         ;;
177   ia64-*)
178         sysdeps_dir=ia64
179         libgcj_flags="${libgcj_flags} -funwind-tables"
180         libgcj_interpreter=yes
181         enable_hash_synchronization_default=yes
182         ;;
183   sh-* | sh[34]*-*)
184         sysdeps_dir=sh
185         libgcj_flags="${libgcj_flags} -mieee"
186         libgcj_interpreter=yes
187         enable_hash_synchronization_default=yes
188         IEEESPEC=-mieee
189         ;;
190 esac
191
192 # This case statement supports generic port properties and may refine
193 # the above per-CPU defaults.  Note: If your OS implements
194 # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
195 # here.
196 case "${host}" in
197   i[34567]86*-linux* | \
198   powerpc*-linux* | \
199   alpha*-linux* | \
200   s390*-linux* | \
201   sparc*-linux* | \
202   ia64-* | \
203   x86_64*-linux* | \
204   hppa*-linux* | \
205   sh-linux* | sh[34]*-linux*)
206         can_unwind_signal=yes
207         libgcj_ld_symbolic='-Wl,-Bsymbolic'
208         if test x$slow_pthread_self = xyes \
209            && test x$cross_compiling != xyes; then
210           cat > conftest.c <<EOF
211 #define _GNU_SOURCE 1
212 #include <pthread.h>
213 #include <stdlib.h>
214 #include <sys/resource.h>
215 #include <limits.h>
216
217 void *
218 tf (void *arg __attribute__ ((unused)))
219 {
220   pthread_attr_t a;
221   size_t s;
222
223   if (pthread_getattr_np (pthread_self (), &a)
224       || pthread_attr_getstacksize (&a, &s)
225       || s > 2 * PTHREAD_STACK_MIN)
226     exit (1);
227   exit (0);
228 }
229
230 int
231 main (int argc, char **argv)
232 {
233   pthread_t p;
234   void *ret;
235   struct rlimit r;
236
237   if (argc == 2)
238     {
239       r.rlim_cur = 2 * PTHREAD_STACK_MIN;
240       r.rlim_max = 2 * PTHREAD_STACK_MIN;
241       if (setrlimit (RLIMIT_STACK, &r))
242         exit (1);
243       execl (argv[1], argv[0], NULL);
244       exit (1);
245     }
246
247   if (pthread_create (&p, NULL, tf, NULL)
248       || pthread_join (p, &ret))
249     exit (1);
250   exit (1);
251 }
252 EOF
253           $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
254           ./conftest ./conftest && slow_pthread_self=
255           rm -f conftest conftest.c
256         fi
257         ;;
258    i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
259         libgcj_ld_symbolic='-Wl,-Bsymbolic'
260         slow_pthread_self=
261         ;;
262   i[34567]86-*-solaris2.1[0-9]* )
263         sysdeps_dir=x86-64
264         DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
265         ;;
266   mips-sgi-irix6* )
267         sysdeps_dir=mips
268         # disable interpreter, no closure support for N32 and N64 ABIs
269         libgcj_interpreter=no
270         ;;
271   arm*-linux* )
272         slow_pthread_self=no
273         can_unwind_signal=no
274         CHECKREFSPEC=-fcheck-references
275         DIVIDESPEC=-fuse-divide-subroutine
276         ;;
277   mips*-*-linux* )
278         sysdeps_dir=mips
279         can_unwind_signal=yes
280         DIVIDESPEC=-fno-use-divide-subroutine
281         case "${host}" in
282             mipsel*-linux* | mipsisa32el*-linux*)
283                 enable_hash_synchronization_default=yes
284             ;;
285         esac
286         ;;
287   powerpc*-*-darwin*)
288         enable_hash_synchronization_default=yes
289         slow_pthread_self=
290         can_unwind_signal=yes
291         ;;
292   i?86-*-darwin*)
293         enable_hash_synchronization_default=yes
294         slow_pthread_self=
295         can_unwind_signal=no
296         ;;
297   *-*-freebsd*)
298         slow_pthread_self=
299         ;;
300   *-mingw*)
301         libgcj_flags="${libgcj_flags} -fno-omit-frame-pointer"
302         # FIXME: win32_exception_handler( ) in win32.cc does not do the
303         # right stuff yet w.r.t. SEH. Live with the following for now.
304         can_unwind_signal=no
305         CHECKREFSPEC=-fcheck-references
306         DIVIDESPEC=-fuse-divide-subroutine
307         ;;
308   *-cygwin*)
309         # The cygwin linker doesn't do 8-byte alignment by default, so
310         # disable hash synchronization for now.
311         enable_hash_synchronization_default=no
312         slow_pthread_self=
313         ;;
314   hppa*-hp-hpux11.*)
315         slow_pthread_self=no
316         can_unwind_signal=yes
317         DIVIDESPEC=-fuse-divide-subroutine
318         ;;
319 esac
320
321 case "${host}" in
322   *-cygwin* | *-mingw*)
323         fallback_backtrace_h=sysdep/i386/backtrace.h  
324         # We need a frame pointer on Windows, so override BACKTRACESPEC
325         BACKTRACESPEC=
326   ;;
327 esac
328
329 case "${host}" in
330   ia64-*)
331         descriptor_h=sysdep/descriptor-y.h
332         ;;
333
334   hppa*64*-*-hpux*)
335         descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
336         ;;
337
338   hppa*-*-hpux*)
339         descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
340         ;;
341
342   hppa*-*)
343         descriptor_h=sysdep/pa/descriptor.h
344         ;;
345
346   rs6000-* | powerpc*-*)
347         descriptor_h=sysdep/powerpc/descriptor.h
348         ;;
349
350   *)
351         descriptor_h=sysdep/descriptor-n.h
352         ;;
353 esac
354
355 case "${host}" in
356   *linux*|*-kfreebsd*-gnu|*-gnu*)
357     use_libgcj_bc=yes
358   ;;
359   *)
360     use_libgcj_bc=no
361   ;;
362 esac    
363
364 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
365 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
366 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"