OSDN Git Service

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