OSDN Git Service

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