Mark as release
[official-gcc.git] / libjava / configure.host
blob0f21d5375ffcab855322a6c8ea9de1200d3bbd3a
1 # configure.host
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.
8 # This shell script should be invoked as
9 #   . configure.host
10 # If it encounters an error, it will exit with a message.
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", "")
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.
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
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
61 AM_RUNTESTFLAGS= 
63 # Set any host dependent compiler flags.
64 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
66 echo "$target"
68 DIVIDESPEC=-fuse-divide-subroutine
69 EXCEPTIONSPEC=-fnon-call-exceptions
70 CHECKREFSPEC=
71 BACKTRACESPEC=
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         libgcj_interpreter=yes
105         libgcj_cxxflags=
106         libgcj_cflags=
107         DIVIDESPEC=-fno-use-divide-subroutine
108         enable_hash_synchronization_default=yes
109         slow_pthread_self=yes
110         ;;
111   x86_64-*)
112         sysdeps_dir=x86-64
113         # For 64-bit we always use SSE registers for arithmetic,
114         # which doesn't have the extra precision problems of the fpu.
115         # But be careful about 32-bit multilibs.
116         case " $CC " in
117         *" -m32 "*)
118                 libgcj_flags="${libgcj_flags} -ffloat-store" ;;
119         esac
120         libgcj_flags="${libgcj_flags} -fomit-frame-pointer"
121         libgcj_cxxflags=
122         libgcj_cflags=
123         DIVIDESPEC=-fno-use-divide-subroutine
124         enable_hash_synchronization_default=yes
125         slow_pthread_self=yes
126         libgcj_interpreter=yes
127         ;;
128   alpha*-*)
129         sysdeps_dir=alpha
130         libgcj_flags="${libgcj_flags} -mieee"
131         libgcj_interpreter=yes
132         enable_hash_synchronization_default=yes
133         IEEESPEC=-mieee
134         ;;
135   hppa*-*)
136         sysdeps_dir=pa
137         libgcj_interpreter=yes
138         enable_hash_synchronization_default=no
139         ;;
140   powerpc64*-*)
141         sysdeps_dir=powerpc
142         libgcj_interpreter=yes
143         if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
144             libgcj_flags="${libgcj_flags} -mminimal-toc"
145         fi
146         enable_hash_synchronization_default=yes
147         slow_pthread_self=yes
148         ;;
149   powerpc*-*)
150         sysdeps_dir=powerpc
151         libgcj_interpreter=yes
152         enable_hash_synchronization_default=yes
153         slow_pthread_self=yes
154         ;;
155   s390*-*)
156         sysdeps_dir=s390
157         libgcj_interpreter=yes
158         DIVIDESPEC=-fno-use-divide-subroutine
159         enable_hash_synchronization_default=yes
160         ;;
161   sparc*-*)
162         libgcj_interpreter=yes
163         ;;
164   ia64-*)
165         sysdeps_dir=ia64
166         libgcj_flags="${libgcj_flags} -funwind-tables"
167         libgcj_interpreter=yes
168         enable_hash_synchronization_default=yes
169         ;;
170   sh-* | sh[34]*-*)
171         sysdeps_dir=sh
172         libgcj_flags="${libgcj_flags} -mieee"
173         libgcj_interpreter=yes
174         enable_hash_synchronization_default=yes
175         IEEESPEC=-mieee
176         ;;
177 esac
179 # This case statement supports generic port properties and may refine
180 # the above per-CPU defaults.  Note: If your OS implements
181 # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
182 # here.
183 case "${host}" in
184   i[34567]86*-linux* | \
185   powerpc*-linux* | \
186   alpha*-linux* | \
187   s390*-linux* | \
188   sparc*-linux* | \
189   ia64-* | \
190   x86_64*-linux* | \
191   hppa*-linux* | \
192   sh-linux* | sh[34]*-linux*)
193         can_unwind_signal=yes
194         libgcj_ld_symbolic='-Wl,-Bsymbolic'
195         if test x$slow_pthread_self = xyes \
196            && test x$cross_compiling != xyes; then
197           cat > conftest.c <<EOF
198 #define _GNU_SOURCE 1
199 #include <pthread.h>
200 #include <stdlib.h>
201 #include <sys/resource.h>
202 #include <limits.h>
204 void *
205 tf (void *arg __attribute__ ((unused)))
207   pthread_attr_t a;
208   size_t s;
210   if (pthread_getattr_np (pthread_self (), &a)
211       || pthread_attr_getstacksize (&a, &s)
212       || s > 2 * PTHREAD_STACK_MIN)
213     exit (1);
214   exit (0);
218 main (int argc, char **argv)
220   pthread_t p;
221   void *ret;
222   struct rlimit r;
224   if (argc == 2)
225     {
226       r.rlim_cur = 2 * PTHREAD_STACK_MIN;
227       r.rlim_max = 2 * PTHREAD_STACK_MIN;
228       if (setrlimit (RLIMIT_STACK, &r))
229         exit (1);
230       execl (argv[1], argv[0], NULL);
231       exit (1);
232     }
234   if (pthread_create (&p, NULL, tf, NULL)
235       || pthread_join (p, &ret))
236     exit (1);
237   exit (1);
240           $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
241           ./conftest ./conftest && slow_pthread_self=
242           rm -f conftest conftest.c
243         fi
244         ;;
245    i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
246         libgcj_ld_symbolic='-Wl,-Bsymbolic'
247         slow_pthread_self=
248         ;;
249   i[34567]86-*-solaris2.1[0-9]* )
250         sysdeps_dir=x86-64
251         DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
252         ;;
253   mips-sgi-irix6* )
254         sysdeps_dir=mips
255         # disable interpreter, no closure support for N32 and N64 ABIs
256         libgcj_interpreter=no
257         ;;
258   mips*-*-linux* )
259         sysdeps_dir=mips
260         can_unwind_signal=yes
261         DIVIDESPEC=-fno-use-divide-subroutine
262         case "${host}" in
263             mipsel*-linux* | mipsisa32el*-linux*)
264                 enable_hash_synchronization_default=yes
265             ;;
266         esac
267         ;;
268   powerpc*-*-darwin*)
269         enable_hash_synchronization_default=yes
270         slow_pthread_self=
271         can_unwind_signal=yes
272         ;;
273   i?86-*-darwin*)
274         enable_hash_synchronization_default=yes
275         slow_pthread_self=
276         can_unwind_signal=no
277         ;;
278   *-*-freebsd*)
279         slow_pthread_self=
280         ;;
281   *-mingw*)
282         libgcj_flags="${libgcj_flags} -fno-omit-frame-pointer"
283         # FIXME: win32_exception_handler( ) in win32.cc does not do the
284         # right stuff yet w.r.t. SEH. Live with the following for now.
285         can_unwind_signal=no
286         CHECKREFSPEC=-fcheck-references
287         DIVIDESPEC=-fuse-divide-subroutine
288         ;;
289   *-cygwin*)
290         # The cygwin linker doesn't do 8-byte alignment by default, so
291         # disable hash synchronization for now.
292         enable_hash_synchronization_default=no
293         slow_pthread_self=
294         ;;
295   hppa*-hp-hpux11.*)
296         slow_pthread_self=no
297         can_unwind_signal=yes
298         DIVIDESPEC=-fuse-divide-subroutine
299         ;;
300 esac
302 case "${host}" in
303   *-cygwin* | *-mingw*)
304         fallback_backtrace_h=sysdep/i386/backtrace.h  
305         # We need a frame pointer on Windows, so override BACKTRACESPEC
306         BACKTRACESPEC=
307   ;;
308 esac
310 case "${host}" in
311   ia64-*)
312         descriptor_h=sysdep/descriptor-y.h
313         ;;
315   hppa*64*-*-hpux*)
316         descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
317         ;;
319   hppa*-*-hpux*)
320         descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
321         ;;
323   hppa*-*)
324         descriptor_h=sysdep/pa/descriptor.h
325         ;;
327   rs6000-* | powerpc*-*)
328         descriptor_h=sysdep/powerpc/descriptor.h
329         ;;
331   *)
332         descriptor_h=sysdep/descriptor-n.h
333         ;;
334 esac
336 case "${host}" in
337   *linux*|*-kfreebsd*-gnu)
338     use_libgcj_bc=yes
339   ;;
340   *)
341     use_libgcj_bc=no
342   ;;
343 esac    
345 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
346 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
347 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"