OSDN Git Service

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