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_sublib_ltflags Special Libtool flags to use when building.
22 # libgcj_interpreter If the bytecode interpreter supports this platform.
23 # enable_java_net_default If java.net native code should be enabled by
25 # enable_hash_synchronization_default If hash synchronization should be
27 # enable_libgcj_sublibs_default Whether to build libgcj as a bunch of
28 # separate shared libraries or in one
30 # sysdeps_dir Directory containing system-dependent headers
31 # slow_pthread_self The synchronization code should try to avoid
32 # pthread_self calls by caching thread IDs in a hashtable
33 # can_unwind_signal Set to "yes" if the EH unwinder supports throwing
34 # from a signal handler.
35 # fallback_backtrace_h Header to use for fallback backtrace implementation
36 # (only for targets that don't support DWARF2 unwind)
37 # descriptor_h Header to use for looking past function descriptors
38 # use_libgcj_bc Whether to build a "libgcj-bc" library for BC-ABI
39 # binaries to link against.
45 libgcj_sublib_ltflags=
47 enable_java_net_default=yes
48 enable_hash_synchronization_default=no
49 enable_libgcj_sublibs_default=no
53 fallback_backtrace_h=sysdep/generic/backtrace.h
55 case "${target_optspace}:${host}" in
57 libgcj_flags="${libgcj_flags} -Os"
59 :m32r-* | :d10v-* | :d30v-*)
60 libgcj_flags="${libgcj_flags} -Os"
69 # Set any host dependent compiler flags.
70 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
74 DIVIDESPEC=-fuse-divide-subroutine
75 EXCEPTIONSPEC=-fnon-call-exceptions
80 # This case statement supports per-CPU defaults.
83 with_libffi_default=no
86 CHECKREFSPEC=-fcheck-references
88 enable_java_net_default=no
89 enable_getenv_properties_default=no
90 enable_main_args_default=no
94 libgcj_interpreter=yes
96 fallback_backtrace_h=sysdep/arm/backtrace.h
97 libgcj_cxxflags=-Wno-abi
98 ATOMICSPEC=-fuse-atomic-builtins
99 # Work around a strange libtool feature that causes libraries
100 # to be linked with libgcc_s but not libgcc.
101 LDFLAGS="${LDFLAGS} -Wl,-lgcc"
103 mips-tx39-*|mipstx39-unknown-*)
104 libgcj_flags="${libgcj_flags} -G 0"
105 LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
106 AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
107 # Use "Ecos" processes since they are a no-op.
110 enable_java_net_default=no
111 enable_getenv_properties_default=no
114 libgcj_interpreter=yes
116 i686-*|i586-*|i486-*|i386-*)
118 # With -fomit-frame-pointer -maccumulate-outgoing-args (implied),
119 # the .text section of libgcj.so is 30k larger, and the .eh_frame
120 # section is 1.4M smaller.
121 libgcj_flags="${libgcj_flags} -ffloat-store -fomit-frame-pointer"
122 # On Solaris we have defined 'sun' which later conflicts with
123 # namespace usage. So to work this away we use the below undefine.
124 libgcj_flags="${libgcj_flags} -Usun"
125 libgcj_interpreter=yes
128 DIVIDESPEC=-fno-use-divide-subroutine
129 enable_hash_synchronization_default=yes
130 slow_pthread_self=yes
134 # For 64-bit we always use SSE registers for arithmetic,
135 # which doesn't have the extra precision problems of the fpu.
136 # But be careful about 32-bit multilibs.
139 libgcj_flags="${libgcj_flags} -ffloat-store" ;;
141 libgcj_flags="${libgcj_flags} -fomit-frame-pointer"
144 DIVIDESPEC=-fno-use-divide-subroutine
145 enable_hash_synchronization_default=yes
146 slow_pthread_self=yes
147 libgcj_interpreter=yes
151 libgcj_flags="${libgcj_flags} -mieee"
152 libgcj_interpreter=yes
153 enable_hash_synchronization_default=yes
158 libgcj_interpreter=yes
159 enable_hash_synchronization_default=no
163 libgcj_interpreter=yes
167 libgcj_interpreter=yes
168 if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
169 libgcj_flags="${libgcj_flags} -mminimal-toc"
171 enable_hash_synchronization_default=yes
172 slow_pthread_self=yes
176 libgcj_interpreter=yes
177 enable_hash_synchronization_default=yes
178 slow_pthread_self=yes
182 libgcj_interpreter=yes
183 DIVIDESPEC=-fno-use-divide-subroutine
184 enable_hash_synchronization_default=yes
188 # On Solaris we have defined 'sun' which later conflicts with
189 # namespace usage. So to work this away we use the below undefine.
190 libgcj_flags="${libgcj_flags} -Usun"
191 libgcj_interpreter=yes
195 libgcj_flags="${libgcj_flags} -funwind-tables"
196 libgcj_interpreter=yes
197 enable_hash_synchronization_default=yes
201 libgcj_flags="${libgcj_flags} -mieee"
202 libgcj_interpreter=yes
203 enable_hash_synchronization_default=yes
208 # This case statement supports generic port properties and may refine
209 # the above per-CPU defaults. Note: If your OS implements
210 # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
213 i[34567]86*-linux* | \
222 sh-linux* | sh[34]*-linux*)
223 can_unwind_signal=yes
224 libgcj_ld_symbolic='-Wl,-Bsymbolic'
225 if test x$slow_pthread_self = xyes \
226 && test x$cross_compiling != xyes; then
227 cat > conftest.c <<EOF
228 #define _GNU_SOURCE 1
231 #include <sys/resource.h>
235 tf (void *arg __attribute__ ((unused)))
240 if (pthread_getattr_np (pthread_self (), &a)
241 || pthread_attr_getstacksize (&a, &s)
242 || s > 2 * PTHREAD_STACK_MIN)
248 main (int argc, char **argv)
256 r.rlim_cur = 2 * PTHREAD_STACK_MIN;
257 r.rlim_max = 2 * PTHREAD_STACK_MIN;
258 if (setrlimit (RLIMIT_STACK, &r))
260 execl (argv[1], argv[0], NULL);
264 if (pthread_create (&p, NULL, tf, NULL)
265 || pthread_join (p, &ret))
270 $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
271 ./conftest ./conftest && slow_pthread_self=
272 rm -f conftest conftest.c
275 i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
276 libgcj_ld_symbolic='-Wl,-Bsymbolic'
279 i[34567]86-*-solaris2.1[0-9]* )
281 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
285 # disable interpreter, no closure support for N32 and N64 ABIs
286 libgcj_interpreter=no
291 CHECKREFSPEC=-fcheck-references
292 DIVIDESPEC=-fuse-divide-subroutine
296 can_unwind_signal=yes
297 DIVIDESPEC=-fno-use-divide-subroutine
298 enable_hash_synchronization_default=yes
301 enable_hash_synchronization_default=yes
303 can_unwind_signal=yes
306 enable_hash_synchronization_default=yes
311 can_unwind_signal=yes
312 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
314 x86_64-*-darwin[912]*)
315 enable_hash_synchronization_default=yes
317 can_unwind_signal=yes
318 DIVIDESPEC=-fuse-divide-subroutine
319 CHECKREFSPEC=-fcheck-references
325 libgcj_flags="${libgcj_flags} -fno-omit-frame-pointer"
326 # FIXME: win32_exception_handler( ) in win32.cc does not do the
327 # right stuff yet w.r.t. SEH. Live with the following for now.
329 CHECKREFSPEC=-fcheck-references
330 DIVIDESPEC=-fuse-divide-subroutine
333 # The cygwin linker doesn't do 8-byte alignment by default, so
334 # disable hash synchronization for now.
335 enable_hash_synchronization_default=no
340 can_unwind_signal=yes
341 DIVIDESPEC=-fuse-divide-subroutine
346 *-cygwin* | *-mingw*)
347 fallback_backtrace_h=sysdep/i386/backtrace.h
348 # We need a frame pointer on Windows, so override BACKTRACESPEC
350 # Win32 DLLs are limited to 64k exported symbols each.
351 enable_libgcj_sublibs_default=yes
352 libgcj_sublib_ltflags='-no-undefined -bindir $(bindir)'
358 descriptor_h=sysdep/descriptor-y.h
362 descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
366 descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
370 descriptor_h=sysdep/pa/descriptor.h
373 rs6000-* | powerpc*-*)
374 descriptor_h=sysdep/powerpc/descriptor.h
378 descriptor_h=sysdep/descriptor-n.h
383 *linux*|*-kfreebsd*-gnu|*-gnu*)
391 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
392 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
393 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"