OSDN Git Service

Mark 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_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=i386
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         # On Solaris we have defined 'sun' which later conflicts with 
145         # namespace usage. So to work this away we use the below undefine.
146         libgcj_flags="${libgcj_flags} -Usun"
147         libgcj_cxxflags=
148         libgcj_cflags=
149         DIVIDESPEC=-fno-use-divide-subroutine
150         enable_hash_synchronization_default=yes
151         slow_pthread_self=yes
152         libgcj_interpreter=yes
153         ;;
154   alpha*-*)
155         sysdeps_dir=alpha
156         libgcj_flags="${libgcj_flags} -mieee"
157         libgcj_interpreter=yes
158         enable_hash_synchronization_default=yes
159         IEEESPEC=-mieee
160         ;;
161   hppa*-*)
162         sysdeps_dir=pa
163         libgcj_interpreter=yes
164         enable_hash_synchronization_default=no
165         ;;
166   m68k-*)
167         sysdeps_dir=m68k
168         libgcj_interpreter=yes
169         ;;
170   powerpc64*-*)
171         sysdeps_dir=powerpc
172         libgcj_interpreter=yes
173         if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
174             libgcj_flags="${libgcj_flags} -mminimal-toc"
175         fi
176         enable_hash_synchronization_default=yes
177         slow_pthread_self=yes
178         ;;
179   powerpc*-*)
180         sysdeps_dir=powerpc
181         libgcj_interpreter=yes
182         enable_hash_synchronization_default=yes
183         slow_pthread_self=yes
184         ;;
185   s390*-*)
186         sysdeps_dir=s390
187         libgcj_interpreter=yes
188         DIVIDESPEC=-fno-use-divide-subroutine
189         enable_hash_synchronization_default=yes
190         ;;
191   sparc*-*)
192         sysdeps_dir=sparc
193         # On Solaris we have defined 'sun' which later conflicts with 
194         # namespace usage. So to work this away we use the below undefine.
195         libgcj_flags="${libgcj_flags} -Usun"
196         libgcj_interpreter=yes
197         ;;
198   ia64-*)
199         sysdeps_dir=ia64
200         libgcj_flags="${libgcj_flags} -funwind-tables"
201         libgcj_interpreter=yes
202         enable_hash_synchronization_default=yes
203         ;;
204   sh-* | sh[34]*-*)
205         sysdeps_dir=sh
206         libgcj_flags="${libgcj_flags} -mieee"
207         libgcj_interpreter=yes
208         enable_hash_synchronization_default=yes
209         IEEESPEC=-mieee
210         ;;
211 esac
212
213 # This case statement supports generic port properties and may refine
214 # the above per-CPU defaults.  Note: If your OS implements
215 # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
216 # here.
217 case "${host}" in
218   i[34567]86*-linux* | \
219   powerpc*-linux* | \
220   alpha*-linux* | \
221   s390*-linux* | \
222   sparc*-linux* | \
223   ia64-* | \
224   x86_64*-linux* | \
225   hppa*-linux* | \
226   m68k*-linux* | \
227   sh-linux* | sh[34]*-linux*)
228         can_unwind_signal=yes
229         libgcj_ld_symbolic='-Wl,-Bsymbolic'
230         if test x$slow_pthread_self = xyes \
231            && test x$cross_compiling != xyes; then
232           cat > conftest.c <<EOF
233 #define _GNU_SOURCE 1
234 #include <pthread.h>
235 #include <stdlib.h>
236 #include <sys/resource.h>
237 #include <limits.h>
238
239 void *
240 tf (void *arg __attribute__ ((unused)))
241 {
242   pthread_attr_t a;
243   size_t s;
244
245   if (pthread_getattr_np (pthread_self (), &a)
246       || pthread_attr_getstacksize (&a, &s)
247       || s > 2 * PTHREAD_STACK_MIN)
248     exit (1);
249   exit (0);
250 }
251
252 int
253 main (int argc, char **argv)
254 {
255   pthread_t p;
256   void *ret;
257   struct rlimit r;
258
259   if (argc == 2)
260     {
261       r.rlim_cur = 2 * PTHREAD_STACK_MIN;
262       r.rlim_max = 2 * PTHREAD_STACK_MIN;
263       if (setrlimit (RLIMIT_STACK, &r))
264         exit (1);
265       execl (argv[1], argv[0], NULL);
266       exit (1);
267     }
268
269   if (pthread_create (&p, NULL, tf, NULL)
270       || pthread_join (p, &ret))
271     exit (1);
272   exit (1);
273 }
274 EOF
275           $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
276           ./conftest ./conftest && slow_pthread_self=
277           rm -f conftest conftest.c
278         fi
279         ;;
280   alpha*-dec-osf*)
281         can_unwind_signal=yes
282         ;;
283   i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
284         libgcj_ld_symbolic='-Wl,-Bsymbolic'
285         slow_pthread_self=
286         ;;
287   i[34567]86-*-solaris2.1[0-9]* )
288         sysdeps_dir=i386
289         DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
290         ;;
291   x86_64-*-solaris2.1[0-9]* )
292         sysdeps_dir=i386
293         DIVIDESPEC=-f%{m32:no-}use-divide-subroutine
294         ;;
295   mips-sgi-irix6* )
296         can_unwind_signal=yes
297         sysdeps_dir=mips
298         ;;
299   arm*-linux* )
300         slow_pthread_self=no
301         can_unwind_signal=no
302         CHECKREFSPEC=-fcheck-references
303         DIVIDESPEC=-fuse-divide-subroutine
304         ;;
305   mips*-*-linux* )
306         sysdeps_dir=mips
307         can_unwind_signal=yes
308         DIVIDESPEC=-fno-use-divide-subroutine
309         enable_hash_synchronization_default=yes
310         ;;
311   powerpc*-*-darwin*)
312         enable_hash_synchronization_default=yes
313         slow_pthread_self=
314         can_unwind_signal=yes
315         ;;
316   i?86-*-darwin*)
317         enable_hash_synchronization_default=yes
318         slow_pthread_self=
319         can_unwind_signal=no
320         ;;
321   i?86-*-darwin[912]*)
322         can_unwind_signal=yes
323         DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
324         ;;
325   x86_64-*-darwin[912]*)
326         enable_hash_synchronization_default=yes
327         slow_pthread_self=
328         can_unwind_signal=yes
329         DIVIDESPEC=-fuse-divide-subroutine
330         CHECKREFSPEC=-fcheck-references
331         ;;
332   i?86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
333         can_unwind_signal=yes
334         ;;
335   *-*-freebsd*)
336         slow_pthread_self=
337         ;;
338   *-mingw*)
339         libgcj_flags="${libgcj_flags} -fno-omit-frame-pointer"
340         # FIXME: win32_exception_handler( ) in win32.cc does not do the
341         # right stuff yet w.r.t. SEH. Live with the following for now.
342         can_unwind_signal=no
343         CHECKREFSPEC=-fcheck-references
344         DIVIDESPEC=-fuse-divide-subroutine
345         ;;
346   *-cygwin*)
347         # The cygwin linker doesn't do 8-byte alignment by default, so
348         # disable hash synchronization for now.
349         enable_hash_synchronization_default=no
350         slow_pthread_self=
351         ;;
352   hppa*-hp-hpux11.*)
353         slow_pthread_self=no
354         can_unwind_signal=yes
355         DIVIDESPEC=-fuse-divide-subroutine
356         ;;
357   sparc*-sun-solaris2.*)
358         slow_pthread_self=
359         can_unwind_signal=yes
360         ;;
361 esac
362
363 case "${host}" in
364   *-cygwin* | *-mingw*)
365         fallback_backtrace_h=sysdep/i386/backtrace.h  
366         # We need a frame pointer on Windows, so override BACKTRACESPEC
367         BACKTRACESPEC=
368         # Win32 DLLs are limited to 64k exported symbols each.
369         enable_libgcj_sublibs_default=yes
370         libgcj_sublib_ltflags='$(lt_host_flags) \
371             -Wl,-u,__ZN3org4ietf4jgss10GSSManagerC1Ev,-L..,-lgcj-noncore-dummy'
372         libgcj_sublib_core_extra_deps=libgcj-noncore-dummy.dll.a
373   ;;
374 esac
375
376 case "${host}" in
377   ia64-*)
378         descriptor_h=sysdep/descriptor-y.h
379         ;;
380
381   hppa*64*-*-hpux*)
382         descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
383         ;;
384
385   hppa*-*-hpux*)
386         descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
387         ;;
388
389   hppa*-*)
390         descriptor_h=sysdep/pa/descriptor.h
391         ;;
392
393   rs6000-* | powerpc*-*)
394         descriptor_h=sysdep/powerpc/descriptor.h
395         ;;
396
397   *)
398         descriptor_h=sysdep/descriptor-n.h
399         ;;
400 esac
401
402 case "${host}" in
403   *linux*|*-kfreebsd*-gnu|*-gnu*)
404     use_libgcj_bc=yes
405   ;;
406   *)
407     use_libgcj_bc=no
408   ;;
409 esac    
410
411 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
412 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
413 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"