OSDN Git Service

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