Daily bump.
[official-gcc.git] / libjava / configure.host
blob0c3b41c690e60b85a38dbb5009d58b2d5f328a2a
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_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.
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
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
69 AM_RUNTESTFLAGS= 
71 # Set any host dependent compiler flags.
72 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
74 echo "$target"
76 DIVIDESPEC=-fuse-divide-subroutine
77 EXCEPTIONSPEC=-fnon-call-exceptions
78 CHECKREFSPEC=
79 BACKTRACESPEC=
80 ATOMICSPEC=
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
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>
239 void *
240 tf (void *arg __attribute__ ((unused)))
242   pthread_attr_t a;
243   size_t s;
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);
253 main (int argc, char **argv)
255   pthread_t p;
256   void *ret;
257   struct rlimit r;
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     }
269   if (pthread_create (&p, NULL, tf, NULL)
270       || pthread_join (p, &ret))
271     exit (1);
272   exit (1);
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   i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
281         libgcj_ld_symbolic='-Wl,-Bsymbolic'
282         slow_pthread_self=
283         ;;
284   i[34567]86-*-solaris2.1[0-9]* )
285         sysdeps_dir=i386
286         DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
287         ;;
288   x86_64-*-solaris2.1[0-9]* )
289         sysdeps_dir=i386
290         DIVIDESPEC=-f%{m32:no-}use-divide-subroutine
291         ;;
292   arm*-linux* )
293         slow_pthread_self=no
294         can_unwind_signal=no
295         CHECKREFSPEC=-fcheck-references
296         DIVIDESPEC=-fuse-divide-subroutine
297         ;;
298   mips*-*-linux* )
299         sysdeps_dir=mips
300         can_unwind_signal=yes
301         DIVIDESPEC=-fno-use-divide-subroutine
302         enable_hash_synchronization_default=yes
303         ;;
304   powerpc*-*-darwin*)
305         enable_hash_synchronization_default=yes
306         slow_pthread_self=
307         can_unwind_signal=yes
308         ;;
309   i?86-*-darwin*)
310         enable_hash_synchronization_default=yes
311         slow_pthread_self=
312         can_unwind_signal=no
313         ;;
314   i?86-*-darwin[912]*)
315         can_unwind_signal=yes
316         DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
317         ;;
318   x86_64-*-darwin[912]*)
319         enable_hash_synchronization_default=yes
320         slow_pthread_self=
321         can_unwind_signal=yes
322         DIVIDESPEC=-fuse-divide-subroutine
323         CHECKREFSPEC=-fcheck-references
324         ;;
325   i?86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
326         can_unwind_signal=yes
327         ;;
328   *-*-freebsd*)
329         slow_pthread_self=
330         ;;
331   *-mingw*)
332         libgcj_flags="${libgcj_flags} -fno-omit-frame-pointer"
333         # FIXME: win32_exception_handler( ) in win32.cc does not do the
334         # right stuff yet w.r.t. SEH. Live with the following for now.
335         can_unwind_signal=no
336         CHECKREFSPEC=-fcheck-references
337         DIVIDESPEC=-fuse-divide-subroutine
338         ;;
339   *-cygwin*)
340         # The cygwin linker doesn't do 8-byte alignment by default, so
341         # disable hash synchronization for now.
342         enable_hash_synchronization_default=no
343         slow_pthread_self=
344         ;;
345   hppa*-hp-hpux11.*)
346         slow_pthread_self=no
347         can_unwind_signal=yes
348         DIVIDESPEC=-fuse-divide-subroutine
349         ;;
350   sparc*-sun-solaris2.*)
351         slow_pthread_self=
352         can_unwind_signal=yes
353         ;;
354 esac
356 case "${host}" in
357   *-cygwin* | *-mingw*)
358         fallback_backtrace_h=sysdep/i386/backtrace.h  
359         # We need a frame pointer on Windows, so override BACKTRACESPEC
360         BACKTRACESPEC=
361         # Win32 DLLs are limited to 64k exported symbols each.
362         enable_libgcj_sublibs_default=yes
363         libgcj_sublib_ltflags='$(lt_host_flags) \
364             -Wl,-u,__ZN3org4ietf4jgss10GSSManagerC1Ev,-L..,-lgcj-noncore-dummy'
365         libgcj_sublib_core_extra_deps=libgcj-noncore-dummy.dll.a
366   ;;
367 esac
369 case "${host}" in
370   ia64-*)
371         descriptor_h=sysdep/descriptor-y.h
372         ;;
374   hppa*64*-*-hpux*)
375         descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
376         ;;
378   hppa*-*-hpux*)
379         descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
380         ;;
382   hppa*-*)
383         descriptor_h=sysdep/pa/descriptor.h
384         ;;
386   rs6000-* | powerpc*-*)
387         descriptor_h=sysdep/powerpc/descriptor.h
388         ;;
390   *)
391         descriptor_h=sysdep/descriptor-n.h
392         ;;
393 esac
395 case "${host}" in
396   *linux*|*-kfreebsd*-gnu|*-gnu*)
397     use_libgcj_bc=yes
398   ;;
399   *)
400     use_libgcj_bc=no
401   ;;
402 esac    
404 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
405 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
406 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"