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 # 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.
42 enable_java_net_default=yes
43 enable_hash_synchronization_default=no
47 fallback_backtrace_h=sysdep/generic/backtrace.h
49 case "${target_optspace}:${host}" in
51 libgcj_flags="${libgcj_flags} -Os"
53 :m32r-* | :d10v-* | :d30v-*)
54 libgcj_flags="${libgcj_flags} -Os"
63 # Set any host dependent compiler flags.
64 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
68 DIVIDESPEC=-fuse-divide-subroutine
69 EXCEPTIONSPEC=-fnon-call-exceptions
73 # This case statement supports per-CPU defaults.
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
87 libgcj_interpreter=yes
89 fallback_backtrace_h=sysdep/arm/backtrace.h
91 mips-tx39-*|mipstx39-unknown-*)
92 libgcj_flags="${libgcj_flags} -G 0"
93 LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
94 AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
95 # Use "Ecos" processes since they are a no-op.
98 enable_java_net_default=no
99 enable_getenv_properties_default=no
102 libgcj_interpreter=yes
104 i686-*|i586-*|i486-*|i386-*)
106 # With -fomit-frame-pointer -maccumulate-outgoing-args (implied),
107 # the .text section of libgcj.so is 30k larger, and the .eh_frame
108 # section is 1.4M smaller.
109 libgcj_flags="${libgcj_flags} -ffloat-store -fomit-frame-pointer"
110 # On Solaris we have defined 'sun' which later conflicts with
111 # namespace usage. So to work this away we use the below undefine.
112 libgcj_flags="${libgcj_flags} -Usun"
113 libgcj_interpreter=yes
116 DIVIDESPEC=-fno-use-divide-subroutine
117 enable_hash_synchronization_default=yes
118 slow_pthread_self=yes
122 # For 64-bit we always use SSE registers for arithmetic,
123 # which doesn't have the extra precision problems of the fpu.
124 # But be careful about 32-bit multilibs.
127 libgcj_flags="${libgcj_flags} -ffloat-store" ;;
129 libgcj_flags="${libgcj_flags} -fomit-frame-pointer"
132 DIVIDESPEC=-fno-use-divide-subroutine
133 enable_hash_synchronization_default=yes
134 slow_pthread_self=yes
135 libgcj_interpreter=yes
139 libgcj_flags="${libgcj_flags} -mieee"
140 libgcj_interpreter=yes
141 enable_hash_synchronization_default=yes
146 libgcj_interpreter=yes
147 enable_hash_synchronization_default=no
151 libgcj_interpreter=yes
155 libgcj_interpreter=yes
156 if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
157 libgcj_flags="${libgcj_flags} -mminimal-toc"
159 enable_hash_synchronization_default=yes
160 slow_pthread_self=yes
164 libgcj_interpreter=yes
165 enable_hash_synchronization_default=yes
166 slow_pthread_self=yes
170 libgcj_interpreter=yes
171 DIVIDESPEC=-fno-use-divide-subroutine
172 enable_hash_synchronization_default=yes
176 # On Solaris we have defined 'sun' which later conflicts with
177 # namespace usage. So to work this away we use the below undefine.
178 libgcj_flags="${libgcj_flags} -Usun"
179 libgcj_interpreter=yes
183 libgcj_flags="${libgcj_flags} -funwind-tables"
184 libgcj_interpreter=yes
185 enable_hash_synchronization_default=yes
189 libgcj_flags="${libgcj_flags} -mieee"
190 libgcj_interpreter=yes
191 enable_hash_synchronization_default=yes
196 # This case statement supports generic port properties and may refine
197 # the above per-CPU defaults. Note: If your OS implements
198 # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
201 i[34567]86*-linux* | \
210 sh-linux* | sh[34]*-linux*)
211 can_unwind_signal=yes
212 libgcj_ld_symbolic='-Wl,-Bsymbolic'
213 if test x$slow_pthread_self = xyes \
214 && test x$cross_compiling != xyes; then
215 cat > conftest.c <<EOF
216 #define _GNU_SOURCE 1
219 #include <sys/resource.h>
223 tf (void *arg __attribute__ ((unused)))
228 if (pthread_getattr_np (pthread_self (), &a)
229 || pthread_attr_getstacksize (&a, &s)
230 || s > 2 * PTHREAD_STACK_MIN)
236 main (int argc, char **argv)
244 r.rlim_cur = 2 * PTHREAD_STACK_MIN;
245 r.rlim_max = 2 * PTHREAD_STACK_MIN;
246 if (setrlimit (RLIMIT_STACK, &r))
248 execl (argv[1], argv[0], NULL);
252 if (pthread_create (&p, NULL, tf, NULL)
253 || pthread_join (p, &ret))
258 $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
259 ./conftest ./conftest && slow_pthread_self=
260 rm -f conftest conftest.c
263 i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
264 libgcj_ld_symbolic='-Wl,-Bsymbolic'
267 i[34567]86-*-solaris2.1[0-9]* )
269 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
273 # disable interpreter, no closure support for N32 and N64 ABIs
274 libgcj_interpreter=no
279 CHECKREFSPEC=-fcheck-references
280 DIVIDESPEC=-fuse-divide-subroutine
284 can_unwind_signal=yes
285 DIVIDESPEC=-fno-use-divide-subroutine
286 enable_hash_synchronization_default=yes
289 enable_hash_synchronization_default=yes
291 can_unwind_signal=yes
294 enable_hash_synchronization_default=yes
299 can_unwind_signal=yes
300 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
302 x86_64-*-darwin[912]*)
303 enable_hash_synchronization_default=yes
305 can_unwind_signal=yes
306 DIVIDESPEC=-fuse-divide-subroutine
307 CHECKREFSPEC=-fcheck-references
313 libgcj_flags="${libgcj_flags} -fno-omit-frame-pointer"
314 # FIXME: win32_exception_handler( ) in win32.cc does not do the
315 # right stuff yet w.r.t. SEH. Live with the following for now.
317 CHECKREFSPEC=-fcheck-references
318 DIVIDESPEC=-fuse-divide-subroutine
321 # The cygwin linker doesn't do 8-byte alignment by default, so
322 # disable hash synchronization for now.
323 enable_hash_synchronization_default=no
328 can_unwind_signal=yes
329 DIVIDESPEC=-fuse-divide-subroutine
334 *-cygwin* | *-mingw*)
335 fallback_backtrace_h=sysdep/i386/backtrace.h
336 # We need a frame pointer on Windows, so override BACKTRACESPEC
343 descriptor_h=sysdep/descriptor-y.h
347 descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
351 descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
355 descriptor_h=sysdep/pa/descriptor.h
358 rs6000-* | powerpc*-*)
359 descriptor_h=sysdep/powerpc/descriptor.h
363 descriptor_h=sysdep/descriptor-n.h
368 *linux*|*-kfreebsd*-gnu|*-gnu*)
376 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
377 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
378 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"