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 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
26 # enable_hash_synchronization_default If hash synchronization should be
28 # enable_libgcj_sublibs_default Whether to build libgcj as a bunch of
29 # separate shared libraries or in 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.
46 libgcj_sublib_ltflags=
47 libgcj_sublib_core_extra_deps=
49 enable_java_net_default=yes
50 enable_hash_synchronization_default=no
51 enable_libgcj_sublibs_default=no
55 fallback_backtrace_h=sysdep/generic/backtrace.h
57 case "${target_optspace}:${host}" in
59 libgcj_flags="${libgcj_flags} -Os"
61 :m32r-* | :d10v-* | :d30v-*)
62 libgcj_flags="${libgcj_flags} -Os"
71 # Set any host dependent compiler flags.
72 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
76 DIVIDESPEC=-fuse-divide-subroutine
77 EXCEPTIONSPEC=-fnon-call-exceptions
82 # This case statement supports per-CPU defaults.
85 with_libffi_default=no
88 CHECKREFSPEC=-fcheck-references
90 enable_java_net_default=no
91 enable_getenv_properties_default=no
92 enable_main_args_default=no
96 libgcj_interpreter=yes
98 fallback_backtrace_h=sysdep/arm/backtrace.h
99 libgcj_cxxflags=-Wno-abi
100 ATOMICSPEC=-fuse-atomic-builtins
101 # Work around a strange libtool feature that causes libraries
102 # to be linked with libgcc_s but not libgcc.
103 LDFLAGS="${LDFLAGS} -Wl,-lgcc"
105 mips-tx39-*|mipstx39-unknown-*)
106 libgcj_flags="${libgcj_flags} -G 0"
107 LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
108 AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
109 # Use "Ecos" processes since they are a no-op.
112 enable_java_net_default=no
113 enable_getenv_properties_default=no
116 libgcj_interpreter=yes
118 i686-*|i586-*|i486-*|i386-*)
120 # With -fomit-frame-pointer -maccumulate-outgoing-args (implied),
121 # the .text section of libgcj.so is 30k larger, and the .eh_frame
122 # section is 1.4M smaller.
123 libgcj_flags="${libgcj_flags} -ffloat-store -fomit-frame-pointer"
124 # On Solaris we have defined 'sun' which later conflicts with
125 # namespace usage. So to work this away we use the below undefine.
126 libgcj_flags="${libgcj_flags} -Usun"
127 libgcj_interpreter=yes
130 DIVIDESPEC=-fno-use-divide-subroutine
131 enable_hash_synchronization_default=yes
132 slow_pthread_self=yes
136 # For 64-bit we always use SSE registers for arithmetic,
137 # which doesn't have the extra precision problems of the fpu.
138 # But be careful about 32-bit multilibs.
141 libgcj_flags="${libgcj_flags} -ffloat-store" ;;
143 libgcj_flags="${libgcj_flags} -fomit-frame-pointer"
146 DIVIDESPEC=-fno-use-divide-subroutine
147 enable_hash_synchronization_default=yes
148 slow_pthread_self=yes
149 libgcj_interpreter=yes
153 libgcj_flags="${libgcj_flags} -mieee"
154 libgcj_interpreter=yes
155 enable_hash_synchronization_default=yes
160 libgcj_interpreter=yes
161 enable_hash_synchronization_default=no
165 libgcj_interpreter=yes
169 libgcj_interpreter=yes
170 if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
171 libgcj_flags="${libgcj_flags} -mminimal-toc"
173 enable_hash_synchronization_default=yes
174 slow_pthread_self=yes
178 libgcj_interpreter=yes
179 enable_hash_synchronization_default=yes
180 slow_pthread_self=yes
184 libgcj_interpreter=yes
185 DIVIDESPEC=-fno-use-divide-subroutine
186 enable_hash_synchronization_default=yes
190 # On Solaris we have defined 'sun' which later conflicts with
191 # namespace usage. So to work this away we use the below undefine.
192 libgcj_flags="${libgcj_flags} -Usun"
193 libgcj_interpreter=yes
197 libgcj_flags="${libgcj_flags} -funwind-tables"
198 libgcj_interpreter=yes
199 enable_hash_synchronization_default=yes
203 libgcj_flags="${libgcj_flags} -mieee"
204 libgcj_interpreter=yes
205 enable_hash_synchronization_default=yes
210 # This case statement supports generic port properties and may refine
211 # the above per-CPU defaults. Note: If your OS implements
212 # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
215 i[34567]86*-linux* | \
224 sh-linux* | sh[34]*-linux*)
225 can_unwind_signal=yes
226 libgcj_ld_symbolic='-Wl,-Bsymbolic'
227 if test x$slow_pthread_self = xyes \
228 && test x$cross_compiling != xyes; then
229 cat > conftest.c <<EOF
230 #define _GNU_SOURCE 1
233 #include <sys/resource.h>
237 tf (void *arg __attribute__ ((unused)))
242 if (pthread_getattr_np (pthread_self (), &a)
243 || pthread_attr_getstacksize (&a, &s)
244 || s > 2 * PTHREAD_STACK_MIN)
250 main (int argc, char **argv)
258 r.rlim_cur = 2 * PTHREAD_STACK_MIN;
259 r.rlim_max = 2 * PTHREAD_STACK_MIN;
260 if (setrlimit (RLIMIT_STACK, &r))
262 execl (argv[1], argv[0], NULL);
266 if (pthread_create (&p, NULL, tf, NULL)
267 || pthread_join (p, &ret))
272 $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
273 ./conftest ./conftest && slow_pthread_self=
274 rm -f conftest conftest.c
277 i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
278 libgcj_ld_symbolic='-Wl,-Bsymbolic'
281 i[34567]86-*-solaris2.1[0-9]* )
283 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
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
343 sparc*-sun-solaris2.*)
345 can_unwind_signal=yes
350 *-cygwin* | *-mingw*)
351 fallback_backtrace_h=sysdep/i386/backtrace.h
352 # We need a frame pointer on Windows, so override BACKTRACESPEC
354 # Win32 DLLs are limited to 64k exported symbols each.
355 enable_libgcj_sublibs_default=yes
356 libgcj_sublib_ltflags='-no-undefined -bindir $(bindir) \
357 -Wl,-u,__ZN3org4ietf4jgss10GSSManagerC1Ev,-L..,-lgcj-noncore-dummy'
358 libgcj_sublib_core_extra_deps=libgcj-noncore-dummy.dll.a
364 descriptor_h=sysdep/descriptor-y.h
368 descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
372 descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
376 descriptor_h=sysdep/pa/descriptor.h
379 rs6000-* | powerpc*-*)
380 descriptor_h=sysdep/powerpc/descriptor.h
384 descriptor_h=sysdep/descriptor-n.h
389 *linux*|*-kfreebsd*-gnu|*-gnu*)
397 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
398 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
399 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"