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"
144 # On Solaris we have defined 'sun' which later conflicts with
145 # namespace usage. So to work this away we use the below undefine.
146 libgcj_flags="${libgcj_flags} -Usun"
149 DIVIDESPEC=-fno-use-divide-subroutine
150 enable_hash_synchronization_default=yes
151 slow_pthread_self=yes
152 libgcj_interpreter=yes
156 libgcj_flags="${libgcj_flags} -mieee"
157 libgcj_interpreter=yes
158 enable_hash_synchronization_default=yes
163 libgcj_interpreter=yes
164 enable_hash_synchronization_default=no
168 libgcj_interpreter=yes
172 libgcj_interpreter=yes
173 if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
174 libgcj_flags="${libgcj_flags} -mminimal-toc"
176 enable_hash_synchronization_default=yes
177 slow_pthread_self=yes
181 libgcj_interpreter=yes
182 enable_hash_synchronization_default=yes
183 slow_pthread_self=yes
187 libgcj_interpreter=yes
188 DIVIDESPEC=-fno-use-divide-subroutine
189 enable_hash_synchronization_default=yes
193 # On Solaris we have defined 'sun' which later conflicts with
194 # namespace usage. So to work this away we use the below undefine.
195 libgcj_flags="${libgcj_flags} -Usun"
196 libgcj_interpreter=yes
200 libgcj_flags="${libgcj_flags} -funwind-tables"
201 libgcj_interpreter=yes
202 enable_hash_synchronization_default=yes
206 libgcj_flags="${libgcj_flags} -mieee"
207 libgcj_interpreter=yes
208 enable_hash_synchronization_default=yes
213 # This case statement supports generic port properties and may refine
214 # the above per-CPU defaults. Note: If your OS implements
215 # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
218 i[34567]86*-linux* | \
227 sh-linux* | sh[34]*-linux*)
228 can_unwind_signal=yes
229 libgcj_ld_symbolic='-Wl,-Bsymbolic'
230 if test x$slow_pthread_self = xyes \
231 && test x$cross_compiling != xyes; then
232 cat > conftest.c <<EOF
233 #define _GNU_SOURCE 1
236 #include <sys/resource.h>
240 tf (void *arg __attribute__ ((unused)))
245 if (pthread_getattr_np (pthread_self (), &a)
246 || pthread_attr_getstacksize (&a, &s)
247 || s > 2 * PTHREAD_STACK_MIN)
253 main (int argc, char **argv)
261 r.rlim_cur = 2 * PTHREAD_STACK_MIN;
262 r.rlim_max = 2 * PTHREAD_STACK_MIN;
263 if (setrlimit (RLIMIT_STACK, &r))
265 execl (argv[1], argv[0], NULL);
269 if (pthread_create (&p, NULL, tf, NULL)
270 || pthread_join (p, &ret))
275 $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
276 ./conftest ./conftest && slow_pthread_self=
277 rm -f conftest conftest.c
280 i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
281 libgcj_ld_symbolic='-Wl,-Bsymbolic'
284 i[34567]86-*-solaris2.1[0-9]* )
286 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
288 x86_64-*-solaris2.1[0-9]* )
290 DIVIDESPEC=-f%{m32:no-}use-divide-subroutine
295 CHECKREFSPEC=-fcheck-references
296 DIVIDESPEC=-fuse-divide-subroutine
300 can_unwind_signal=yes
301 DIVIDESPEC=-fno-use-divide-subroutine
302 enable_hash_synchronization_default=yes
305 enable_hash_synchronization_default=yes
307 can_unwind_signal=yes
310 enable_hash_synchronization_default=yes
315 can_unwind_signal=yes
316 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
318 x86_64-*-darwin[912]*)
319 enable_hash_synchronization_default=yes
321 can_unwind_signal=yes
322 DIVIDESPEC=-fuse-divide-subroutine
323 CHECKREFSPEC=-fcheck-references
325 i?86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
326 can_unwind_signal=yes
332 libgcj_flags="${libgcj_flags} -fno-omit-frame-pointer"
333 # FIXME: win32_exception_handler( ) in win32.cc does not do the
334 # right stuff yet w.r.t. SEH. Live with the following for now.
336 CHECKREFSPEC=-fcheck-references
337 DIVIDESPEC=-fuse-divide-subroutine
340 # The cygwin linker doesn't do 8-byte alignment by default, so
341 # disable hash synchronization for now.
342 enable_hash_synchronization_default=no
347 can_unwind_signal=yes
348 DIVIDESPEC=-fuse-divide-subroutine
350 sparc*-sun-solaris2.*)
352 can_unwind_signal=yes
357 *-cygwin* | *-mingw*)
358 fallback_backtrace_h=sysdep/i386/backtrace.h
359 # We need a frame pointer on Windows, so override BACKTRACESPEC
361 # Win32 DLLs are limited to 64k exported symbols each.
362 enable_libgcj_sublibs_default=yes
363 libgcj_sublib_ltflags='$(lt_host_flags) \
364 -Wl,-u,__ZN3org4ietf4jgss10GSSManagerC1Ev,-L..,-lgcj-noncore-dummy'
365 libgcj_sublib_core_extra_deps=libgcj-noncore-dummy.dll.a
371 descriptor_h=sysdep/descriptor-y.h
375 descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
379 descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
383 descriptor_h=sysdep/pa/descriptor.h
386 rs6000-* | powerpc*-*)
387 descriptor_h=sysdep/powerpc/descriptor.h
391 descriptor_h=sysdep/descriptor-n.h
396 *linux*|*-kfreebsd*-gnu|*-gnu*)
404 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
405 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
406 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"