OSDN Git Service

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