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 libgcj_interpreter=yes
87 ATOMICSPEC=-fuse-atomic-builtins
90 with_libffi_default=no
93 CHECKREFSPEC=-fcheck-references
95 enable_java_net_default=no
96 enable_getenv_properties_default=no
97 enable_main_args_default=no
101 libgcj_interpreter=yes
103 fallback_backtrace_h=sysdep/arm/backtrace.h
104 libgcj_cxxflags=-Wno-abi
105 ATOMICSPEC=-fuse-atomic-builtins
106 # Work around a strange libtool feature that causes libraries
107 # to be linked with libgcc_s but not libgcc.
108 LDFLAGS="${LDFLAGS} -Wl,-lgcc"
110 mips-tx39-*|mipstx39-unknown-*)
111 libgcj_flags="${libgcj_flags} -G 0"
112 LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
113 AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
114 # Use "Ecos" processes since they are a no-op.
117 enable_java_net_default=no
118 enable_getenv_properties_default=no
121 libgcj_interpreter=yes
123 i686-*|i586-*|i486-*|i386-*)
125 # With -fomit-frame-pointer -maccumulate-outgoing-args (implied),
126 # the .text section of libgcj.so is 30k larger, and the .eh_frame
127 # section is 1.4M smaller.
128 libgcj_flags="${libgcj_flags} -ffloat-store -fomit-frame-pointer"
129 # On Solaris we have defined 'sun' which later conflicts with
130 # namespace usage. So to work this away we use the below undefine.
131 libgcj_flags="${libgcj_flags} -Usun"
132 libgcj_interpreter=yes
135 DIVIDESPEC=-fno-use-divide-subroutine
136 enable_hash_synchronization_default=yes
137 slow_pthread_self=yes
141 # For 64-bit we always use SSE registers for arithmetic,
142 # which doesn't have the extra precision problems of the fpu.
143 # But be careful about 32-bit multilibs.
146 libgcj_flags="${libgcj_flags} -ffloat-store" ;;
148 libgcj_flags="${libgcj_flags} -fomit-frame-pointer"
149 # On Solaris we have defined 'sun' which later conflicts with
150 # namespace usage. So to work this away we use the below undefine.
151 libgcj_flags="${libgcj_flags} -Usun"
154 DIVIDESPEC=-fno-use-divide-subroutine
155 enable_hash_synchronization_default=yes
156 slow_pthread_self=yes
157 libgcj_interpreter=yes
161 libgcj_flags="${libgcj_flags} -mieee"
162 libgcj_interpreter=yes
163 enable_hash_synchronization_default=yes
168 libgcj_interpreter=yes
169 enable_hash_synchronization_default=no
173 libgcj_interpreter=yes
177 libgcj_interpreter=yes
178 if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
179 libgcj_flags="${libgcj_flags} -mminimal-toc"
181 enable_hash_synchronization_default=yes
182 slow_pthread_self=yes
186 libgcj_interpreter=yes
187 enable_hash_synchronization_default=yes
188 slow_pthread_self=yes
192 libgcj_interpreter=yes
193 DIVIDESPEC=-fno-use-divide-subroutine
194 enable_hash_synchronization_default=yes
198 # On Solaris we have defined 'sun' which later conflicts with
199 # namespace usage. So to work this away we use the below undefine.
200 libgcj_flags="${libgcj_flags} -Usun"
201 libgcj_interpreter=yes
205 libgcj_flags="${libgcj_flags} -funwind-tables"
206 libgcj_interpreter=yes
207 enable_hash_synchronization_default=yes
211 libgcj_flags="${libgcj_flags} -mieee"
212 libgcj_interpreter=yes
213 enable_hash_synchronization_default=yes
218 # This case statement supports generic port properties and may refine
219 # the above per-CPU defaults. Note: If your OS implements
220 # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
223 i[34567]86*-linux* | \
232 sh-linux* | sh[34]*-linux*)
233 can_unwind_signal=yes
234 libgcj_ld_symbolic='-Wl,-Bsymbolic'
235 if test x$slow_pthread_self = xyes \
236 && test x$cross_compiling != xyes; then
237 cat > conftest.c <<EOF
238 #define _GNU_SOURCE 1
241 #include <sys/resource.h>
245 tf (void *arg __attribute__ ((unused)))
250 if (pthread_getattr_np (pthread_self (), &a)
251 || pthread_attr_getstacksize (&a, &s)
252 || s > 2 * PTHREAD_STACK_MIN)
258 main (int argc, char **argv)
266 r.rlim_cur = 2 * PTHREAD_STACK_MIN;
267 r.rlim_max = 2 * PTHREAD_STACK_MIN;
268 if (setrlimit (RLIMIT_STACK, &r))
270 execl (argv[1], argv[0], NULL);
274 if (pthread_create (&p, NULL, tf, NULL)
275 || pthread_join (p, &ret))
280 $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
281 ./conftest ./conftest && slow_pthread_self=
282 rm -f conftest conftest.c
285 i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
286 libgcj_ld_symbolic='-Wl,-Bsymbolic'
289 i[34567]86-*-solaris2.1[0-9]* )
291 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
293 x86_64-*-solaris2.1[0-9]* )
295 DIVIDESPEC=-f%{m32:no-}use-divide-subroutine
300 CHECKREFSPEC=-fcheck-references
301 DIVIDESPEC=-fuse-divide-subroutine
306 CHECKREFSPEC=-fcheck-references
307 DIVIDESPEC=-fuse-divide-subroutine
311 can_unwind_signal=yes
312 DIVIDESPEC=-fno-use-divide-subroutine
313 enable_hash_synchronization_default=yes
316 enable_hash_synchronization_default=yes
318 can_unwind_signal=yes
321 enable_hash_synchronization_default=yes
326 can_unwind_signal=yes
327 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
329 x86_64-*-darwin[912]*)
330 enable_hash_synchronization_default=yes
332 can_unwind_signal=yes
333 DIVIDESPEC=-fuse-divide-subroutine
334 CHECKREFSPEC=-fcheck-references
336 i?86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
337 can_unwind_signal=yes
343 libgcj_flags="${libgcj_flags} -fno-omit-frame-pointer"
344 # FIXME: win32_exception_handler( ) in win32.cc does not do the
345 # right stuff yet w.r.t. SEH. Live with the following for now.
347 CHECKREFSPEC=-fcheck-references
348 DIVIDESPEC=-fuse-divide-subroutine
351 # The cygwin linker doesn't do 8-byte alignment by default, so
352 # disable hash synchronization for now.
353 enable_hash_synchronization_default=no
358 can_unwind_signal=yes
359 DIVIDESPEC=-fuse-divide-subroutine
361 sparc*-sun-solaris2.*)
363 can_unwind_signal=yes
368 *-cygwin* | *-mingw*)
369 fallback_backtrace_h=sysdep/i386/backtrace.h
370 # We need a frame pointer on Windows, so override BACKTRACESPEC
372 # Win32 DLLs are limited to 64k exported symbols each.
373 enable_libgcj_sublibs_default=yes
374 libgcj_sublib_ltflags='$(lt_host_flags) \
375 -Wl,-u,__ZN3org4ietf4jgss10GSSManagerC1Ev,-L..,-lgcj-noncore-dummy'
376 libgcj_sublib_core_extra_deps=libgcj-noncore-dummy.dll.a
382 descriptor_h=sysdep/descriptor-y.h
386 descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
390 descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
394 descriptor_h=sysdep/pa/descriptor.h
397 rs6000-* | powerpc*-*)
398 descriptor_h=sysdep/powerpc/descriptor.h
402 descriptor_h=sysdep/descriptor-n.h
407 *linux*|*-kfreebsd*-gnu|*-gnu*)
415 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
416 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
417 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"