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