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 # enable_libgcj_sublibs_default Whether to build libgcj as a bunch of
27 # separate shared libraries or in one
29 # sysdeps_dir Directory containing system-dependent headers
30 # slow_pthread_self The synchronization code should try to avoid
31 # pthread_self calls by caching thread IDs in a hashtable
32 # can_unwind_signal Set to "yes" if the EH unwinder supports throwing
33 # from a signal handler.
34 # fallback_backtrace_h Header to use for fallback backtrace implementation
35 # (only for targets that don't support DWARF2 unwind)
36 # descriptor_h Header to use for looking past function descriptors
37 # use_libgcj_bc Whether to build a "libgcj-bc" library for BC-ABI
38 # binaries to link against.
45 enable_java_net_default=yes
46 enable_hash_synchronization_default=no
47 enable_libgcj_sublibs_default=no
51 fallback_backtrace_h=sysdep/generic/backtrace.h
53 case "${target_optspace}:${host}" in
55 libgcj_flags="${libgcj_flags} -Os"
57 :m32r-* | :d10v-* | :d30v-*)
58 libgcj_flags="${libgcj_flags} -Os"
67 # Set any host dependent compiler flags.
68 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
72 DIVIDESPEC=-fuse-divide-subroutine
73 EXCEPTIONSPEC=-fnon-call-exceptions
78 # This case statement supports per-CPU defaults.
81 with_libffi_default=no
84 CHECKREFSPEC=-fcheck-references
86 enable_java_net_default=no
87 enable_getenv_properties_default=no
88 enable_main_args_default=no
92 libgcj_interpreter=yes
94 fallback_backtrace_h=sysdep/arm/backtrace.h
95 libgcj_cxxflags=-Wno-abi
96 ATOMICSPEC=-fuse-atomic-builtins
97 # Work around a strange libtool feature that causes libraries
98 # to be linked with libgcc_s but not libgcc.
99 LDFLAGS="${LDFLAGS} -Wl,-lgcc"
101 mips-tx39-*|mipstx39-unknown-*)
102 libgcj_flags="${libgcj_flags} -G 0"
103 LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
104 AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
105 # Use "Ecos" processes since they are a no-op.
108 enable_java_net_default=no
109 enable_getenv_properties_default=no
112 libgcj_interpreter=yes
114 i686-*|i586-*|i486-*|i386-*)
116 # With -fomit-frame-pointer -maccumulate-outgoing-args (implied),
117 # the .text section of libgcj.so is 30k larger, and the .eh_frame
118 # section is 1.4M smaller.
119 libgcj_flags="${libgcj_flags} -ffloat-store -fomit-frame-pointer"
120 # On Solaris we have defined 'sun' which later conflicts with
121 # namespace usage. So to work this away we use the below undefine.
122 libgcj_flags="${libgcj_flags} -Usun"
123 libgcj_interpreter=yes
126 DIVIDESPEC=-fno-use-divide-subroutine
127 enable_hash_synchronization_default=yes
128 slow_pthread_self=yes
132 # For 64-bit we always use SSE registers for arithmetic,
133 # which doesn't have the extra precision problems of the fpu.
134 # But be careful about 32-bit multilibs.
137 libgcj_flags="${libgcj_flags} -ffloat-store" ;;
139 libgcj_flags="${libgcj_flags} -fomit-frame-pointer"
142 DIVIDESPEC=-fno-use-divide-subroutine
143 enable_hash_synchronization_default=yes
144 slow_pthread_self=yes
145 libgcj_interpreter=yes
149 libgcj_flags="${libgcj_flags} -mieee"
150 libgcj_interpreter=yes
151 enable_hash_synchronization_default=yes
156 libgcj_interpreter=yes
157 enable_hash_synchronization_default=no
161 libgcj_interpreter=yes
165 libgcj_interpreter=yes
166 if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
167 libgcj_flags="${libgcj_flags} -mminimal-toc"
169 enable_hash_synchronization_default=yes
170 slow_pthread_self=yes
174 libgcj_interpreter=yes
175 enable_hash_synchronization_default=yes
176 slow_pthread_self=yes
180 libgcj_interpreter=yes
181 DIVIDESPEC=-fno-use-divide-subroutine
182 enable_hash_synchronization_default=yes
186 # On Solaris we have defined 'sun' which later conflicts with
187 # namespace usage. So to work this away we use the below undefine.
188 libgcj_flags="${libgcj_flags} -Usun"
189 libgcj_interpreter=yes
193 libgcj_flags="${libgcj_flags} -funwind-tables"
194 libgcj_interpreter=yes
195 enable_hash_synchronization_default=yes
199 libgcj_flags="${libgcj_flags} -mieee"
200 libgcj_interpreter=yes
201 enable_hash_synchronization_default=yes
206 # This case statement supports generic port properties and may refine
207 # the above per-CPU defaults. Note: If your OS implements
208 # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
211 i[34567]86*-linux* | \
220 sh-linux* | sh[34]*-linux*)
221 can_unwind_signal=yes
222 libgcj_ld_symbolic='-Wl,-Bsymbolic'
223 if test x$slow_pthread_self = xyes \
224 && test x$cross_compiling != xyes; then
225 cat > conftest.c <<EOF
226 #define _GNU_SOURCE 1
229 #include <sys/resource.h>
233 tf (void *arg __attribute__ ((unused)))
238 if (pthread_getattr_np (pthread_self (), &a)
239 || pthread_attr_getstacksize (&a, &s)
240 || s > 2 * PTHREAD_STACK_MIN)
246 main (int argc, char **argv)
254 r.rlim_cur = 2 * PTHREAD_STACK_MIN;
255 r.rlim_max = 2 * PTHREAD_STACK_MIN;
256 if (setrlimit (RLIMIT_STACK, &r))
258 execl (argv[1], argv[0], NULL);
262 if (pthread_create (&p, NULL, tf, NULL)
263 || pthread_join (p, &ret))
268 $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
269 ./conftest ./conftest && slow_pthread_self=
270 rm -f conftest conftest.c
273 i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
274 libgcj_ld_symbolic='-Wl,-Bsymbolic'
277 i[34567]86-*-solaris2.1[0-9]* )
279 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
283 # disable interpreter, no closure support for N32 and N64 ABIs
284 libgcj_interpreter=no
289 CHECKREFSPEC=-fcheck-references
290 DIVIDESPEC=-fuse-divide-subroutine
294 can_unwind_signal=yes
295 DIVIDESPEC=-fno-use-divide-subroutine
296 enable_hash_synchronization_default=yes
299 enable_hash_synchronization_default=yes
301 can_unwind_signal=yes
304 enable_hash_synchronization_default=yes
309 can_unwind_signal=yes
310 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
312 x86_64-*-darwin[912]*)
313 enable_hash_synchronization_default=yes
315 can_unwind_signal=yes
316 DIVIDESPEC=-fuse-divide-subroutine
317 CHECKREFSPEC=-fcheck-references
323 libgcj_flags="${libgcj_flags} -fno-omit-frame-pointer"
324 # FIXME: win32_exception_handler( ) in win32.cc does not do the
325 # right stuff yet w.r.t. SEH. Live with the following for now.
327 CHECKREFSPEC=-fcheck-references
328 DIVIDESPEC=-fuse-divide-subroutine
331 # The cygwin linker doesn't do 8-byte alignment by default, so
332 # disable hash synchronization for now.
333 enable_hash_synchronization_default=no
338 can_unwind_signal=yes
339 DIVIDESPEC=-fuse-divide-subroutine
344 *-cygwin* | *-mingw*)
345 fallback_backtrace_h=sysdep/i386/backtrace.h
346 # We need a frame pointer on Windows, so override BACKTRACESPEC
348 # Win32 DLLs are limited to 64k exported symbols each.
349 enable_libgcj_sublibs_default=yes
355 descriptor_h=sysdep/descriptor-y.h
359 descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
363 descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
367 descriptor_h=sysdep/pa/descriptor.h
370 rs6000-* | powerpc*-*)
371 descriptor_h=sysdep/powerpc/descriptor.h
375 descriptor_h=sysdep/descriptor-n.h
380 *linux*|*-kfreebsd*-gnu|*-gnu*)
388 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
389 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
390 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"