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
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
24 # enable_hash_synchronization_default If hash synchronization should be
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 # disable_dladdr Set to "yes" if dladdr should not be used
33 # fallback_backtrace_h Header to use for fallback backtrace implementation
34 # (only for targets that don't support DWARF2 unwind)
35 # descriptor_h Header to use for looking past function descriptors
42 enable_java_net_default=yes
43 enable_hash_synchronization_default=no
48 fallback_backtrace_h=sysdep/generic/backtrace.h
50 case "${target_optspace}:${host}" in
52 libgcj_flags="${libgcj_flags} -Os"
54 :m32r-* | :d10v-* | :d30v-*)
55 libgcj_flags="${libgcj_flags} -Os"
64 # Set any host dependent compiler flags.
65 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
69 DIVIDESPEC=-fuse-divide-subroutine
70 EXCEPTIONSPEC=-fnon-call-exceptions
73 # This case statement supports per-CPU defaults.
75 arm*-elf | strongarm*-elf | xscale*-elf)
76 with_libffi_default=no
79 CHECKREFSPEC=-fcheck-references
81 enable_java_net_default=no
82 enable_getenv_properties_default=no
83 enable_main_args_default=no
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.
92 enable_java_net_default=no
93 enable_getenv_properties_default=no
95 i686-*|i586-*|i486-*|i386-*)
97 libgcj_flags="${libgcj_flags} -ffloat-store -fno-omit-frame-pointer"
98 libgcj_interpreter=yes
101 DIVIDESPEC=-fno-use-divide-subroutine
102 enable_hash_synchronization_default=yes
103 slow_pthread_self=yes
107 libgcj_flags="${libgcj_flags} -ffloat-store -fno-omit-frame-pointer"
110 DIVIDESPEC=-f%{m32:no-}use-divide-subroutine
111 enable_hash_synchronization_default=yes
112 slow_pthread_self=yes
113 libgcj_interpreter=yes
117 libgcj_flags="${libgcj_flags} -mieee"
118 libgcj_interpreter=yes
119 enable_hash_synchronization_default=yes
124 libgcj_interpreter=yes
125 enable_hash_synchronization_default=yes
129 libgcj_interpreter=yes
130 if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
131 libgcj_flags="${libgcj_flags} -mminimal-toc"
133 enable_hash_synchronization_default=yes
134 slow_pthread_self=yes
138 libgcj_interpreter=yes
139 enable_hash_synchronization_default=yes
140 slow_pthread_self=yes
144 libgcj_interpreter=yes
145 DIVIDESPEC=-fno-use-divide-subroutine
146 enable_hash_synchronization_default=yes
149 libgcj_interpreter=yes
153 libgcj_flags="${libgcj_flags} -funwind-tables"
154 libgcj_interpreter=yes
155 enable_hash_synchronization_default=yes
159 libgcj_flags="${libgcj_flags} -mieee"
160 libgcj_interpreter=yes
161 enable_hash_synchronization_default=yes
166 # This case statement supports generic port properties and may refine
167 # the above per-CPU defaults. Note: If your OS implements
168 # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
171 i[34567]86*-linux* | \
179 sh-linux* | sh[34]*-linux*)
180 can_unwind_signal=yes
181 libgcj_ld_symbolic='-Wl,-Bsymbolic'
182 if test x$slow_pthread_self = xyes \
183 && test x$cross_compiling != xyes; then
184 cat > conftest.c <<EOF
185 #define _GNU_SOURCE 1
188 #include <sys/resource.h>
192 tf (void *arg __attribute__ ((unused)))
197 if (pthread_getattr_np (pthread_self (), &a)
198 || pthread_attr_getstacksize (&a, &s)
199 || s > 2 * PTHREAD_STACK_MIN)
205 main (int argc, char **argv)
213 r.rlim_cur = 2 * PTHREAD_STACK_MIN;
214 r.rlim_max = 2 * PTHREAD_STACK_MIN;
215 if (setrlimit (RLIMIT_STACK, &r))
217 execl (argv[1], argv[0], NULL);
221 if (pthread_create (&p, NULL, tf, NULL)
222 || pthread_join (p, &ret))
227 $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
228 ./conftest ./conftest && slow_pthread_self=
229 rm -f conftest conftest.c
234 can_unwind_signal=yes
235 DIVIDESPEC=-fno-use-divide-subroutine
237 mipsel*-linux* | mipsisa32el*-linux*)
238 enable_hash_synchronization_default=yes
244 enable_hash_synchronization_default=yes
246 can_unwind_signal=yes
252 # FIXME: win32_exception_handler( ) in win32.cc does not do the
253 # right stuff yet w.r.t. SEH. Live with the following for now.
255 CHECKREFSPEC=-fcheck-references
256 DIVIDESPEC=-fuse-divide-subroutine
259 # The cygwin linker doesn't do 8-byte alignment by default, so
260 # disable hash synchronization for now.
261 enable_hash_synchronization_default=no
267 *-cygwin* | *-mingw*)
268 fallback_backtrace_h=sysdep/i386/backtrace.h
274 descriptor_h=sysdep/descriptor-y.h
277 rs6000-* | powerpc*-*)
278 descriptor_h=sysdep/powerpc/descriptor.h
282 descriptor_h=sysdep/descriptor-n.h
286 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
287 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
288 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"