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