]> git.ipfire.org Git - thirdparty/gcc.git/blob - libjava/configure.host
configure.host (libgcj_sublib_ltflags): New variable.
[thirdparty/gcc.git] / libjava / configure.host
1 # configure.host
2
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.
7
8 # This shell script should be invoked as
9 # . configure.host
10 # If it encounters an error, it will exit with a message.
11
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", "")
16
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
24 # default.
25 # enable_hash_synchronization_default If hash synchronization should be
26 # enabled by default.
27 # enable_libgcj_sublibs_default Whether to build libgcj as a bunch of
28 # separate shared libraries or in one
29 # monolithic 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.
40
41 libgcj_flags=
42 libgcj_cflags=
43 libgcj_cxxflags=
44 libgcj_javaflags=
45 libgcj_sublib_ltflags=
46 libgcj_interpreter=
47 enable_java_net_default=yes
48 enable_hash_synchronization_default=no
49 enable_libgcj_sublibs_default=no
50 sysdeps_dir=generic
51 slow_pthread_self=
52 can_unwind_signal=no
53 fallback_backtrace_h=sysdep/generic/backtrace.h
54
55 case "${target_optspace}:${host}" in
56 yes:*)
57 libgcj_flags="${libgcj_flags} -Os"
58 ;;
59 :m32r-* | :d10v-* | :d30v-*)
60 libgcj_flags="${libgcj_flags} -Os"
61 ;;
62 no:* | :*)
63 # Nothing.
64 ;;
65 esac
66
67 AM_RUNTESTFLAGS=
68
69 # Set any host dependent compiler flags.
70 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
71
72 echo "$target"
73
74 DIVIDESPEC=-fuse-divide-subroutine
75 EXCEPTIONSPEC=-fnon-call-exceptions
76 CHECKREFSPEC=
77 BACKTRACESPEC=
78 ATOMICSPEC=
79
80 # This case statement supports per-CPU defaults.
81 case "${host}" in
82 arm*-elf)
83 with_libffi_default=no
84 PROCESS=Ecos
85 FILE=Posix
86 CHECKREFSPEC=-fcheck-references
87 EXCEPTIONSPEC=
88 enable_java_net_default=no
89 enable_getenv_properties_default=no
90 enable_main_args_default=no
91 sysdeps_dir=arm
92 ;;
93 arm*-linux*)
94 libgcj_interpreter=yes
95 sysdeps_dir=arm
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"
102 ;;
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.
108 PROCESS=Ecos
109 FILE=Posix
110 enable_java_net_default=no
111 enable_getenv_properties_default=no
112 ;;
113 mips*-*)
114 libgcj_interpreter=yes
115 ;;
116 i686-*|i586-*|i486-*|i386-*)
117 sysdeps_dir=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
126 libgcj_cxxflags=
127 libgcj_cflags=
128 DIVIDESPEC=-fno-use-divide-subroutine
129 enable_hash_synchronization_default=yes
130 slow_pthread_self=yes
131 ;;
132 x86_64-*)
133 sysdeps_dir=x86-64
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.
137 case " $CC " in
138 *" -m32 "*)
139 libgcj_flags="${libgcj_flags} -ffloat-store" ;;
140 esac
141 libgcj_flags="${libgcj_flags} -fomit-frame-pointer"
142 libgcj_cxxflags=
143 libgcj_cflags=
144 DIVIDESPEC=-fno-use-divide-subroutine
145 enable_hash_synchronization_default=yes
146 slow_pthread_self=yes
147 libgcj_interpreter=yes
148 ;;
149 alpha*-*)
150 sysdeps_dir=alpha
151 libgcj_flags="${libgcj_flags} -mieee"
152 libgcj_interpreter=yes
153 enable_hash_synchronization_default=yes
154 IEEESPEC=-mieee
155 ;;
156 hppa*-*)
157 sysdeps_dir=pa
158 libgcj_interpreter=yes
159 enable_hash_synchronization_default=no
160 ;;
161 m68k-*)
162 sysdeps_dir=m68k
163 libgcj_interpreter=yes
164 ;;
165 powerpc64*-*)
166 sysdeps_dir=powerpc
167 libgcj_interpreter=yes
168 if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
169 libgcj_flags="${libgcj_flags} -mminimal-toc"
170 fi
171 enable_hash_synchronization_default=yes
172 slow_pthread_self=yes
173 ;;
174 powerpc*-*)
175 sysdeps_dir=powerpc
176 libgcj_interpreter=yes
177 enable_hash_synchronization_default=yes
178 slow_pthread_self=yes
179 ;;
180 s390*-*)
181 sysdeps_dir=s390
182 libgcj_interpreter=yes
183 DIVIDESPEC=-fno-use-divide-subroutine
184 enable_hash_synchronization_default=yes
185 ;;
186 sparc*-*)
187 sysdeps_dir=sparc
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
192 ;;
193 ia64-*)
194 sysdeps_dir=ia64
195 libgcj_flags="${libgcj_flags} -funwind-tables"
196 libgcj_interpreter=yes
197 enable_hash_synchronization_default=yes
198 ;;
199 sh-* | sh[34]*-*)
200 sysdeps_dir=sh
201 libgcj_flags="${libgcj_flags} -mieee"
202 libgcj_interpreter=yes
203 enable_hash_synchronization_default=yes
204 IEEESPEC=-mieee
205 ;;
206 esac
207
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
211 # here.
212 case "${host}" in
213 i[34567]86*-linux* | \
214 powerpc*-linux* | \
215 alpha*-linux* | \
216 s390*-linux* | \
217 sparc*-linux* | \
218 ia64-* | \
219 x86_64*-linux* | \
220 hppa*-linux* | \
221 m68k*-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
229 #include <pthread.h>
230 #include <stdlib.h>
231 #include <sys/resource.h>
232 #include <limits.h>
233
234 void *
235 tf (void *arg __attribute__ ((unused)))
236 {
237 pthread_attr_t a;
238 size_t s;
239
240 if (pthread_getattr_np (pthread_self (), &a)
241 || pthread_attr_getstacksize (&a, &s)
242 || s > 2 * PTHREAD_STACK_MIN)
243 exit (1);
244 exit (0);
245 }
246
247 int
248 main (int argc, char **argv)
249 {
250 pthread_t p;
251 void *ret;
252 struct rlimit r;
253
254 if (argc == 2)
255 {
256 r.rlim_cur = 2 * PTHREAD_STACK_MIN;
257 r.rlim_max = 2 * PTHREAD_STACK_MIN;
258 if (setrlimit (RLIMIT_STACK, &r))
259 exit (1);
260 execl (argv[1], argv[0], NULL);
261 exit (1);
262 }
263
264 if (pthread_create (&p, NULL, tf, NULL)
265 || pthread_join (p, &ret))
266 exit (1);
267 exit (1);
268 }
269 EOF
270 $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
271 ./conftest ./conftest && slow_pthread_self=
272 rm -f conftest conftest.c
273 fi
274 ;;
275 i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
276 libgcj_ld_symbolic='-Wl,-Bsymbolic'
277 slow_pthread_self=
278 ;;
279 i[34567]86-*-solaris2.1[0-9]* )
280 sysdeps_dir=x86-64
281 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
282 ;;
283 mips-sgi-irix6* )
284 sysdeps_dir=mips
285 # disable interpreter, no closure support for N32 and N64 ABIs
286 libgcj_interpreter=no
287 ;;
288 arm*-linux* )
289 slow_pthread_self=no
290 can_unwind_signal=no
291 CHECKREFSPEC=-fcheck-references
292 DIVIDESPEC=-fuse-divide-subroutine
293 ;;
294 mips*-*-linux* )
295 sysdeps_dir=mips
296 can_unwind_signal=yes
297 DIVIDESPEC=-fno-use-divide-subroutine
298 enable_hash_synchronization_default=yes
299 ;;
300 powerpc*-*-darwin*)
301 enable_hash_synchronization_default=yes
302 slow_pthread_self=
303 can_unwind_signal=yes
304 ;;
305 i?86-*-darwin*)
306 enable_hash_synchronization_default=yes
307 slow_pthread_self=
308 can_unwind_signal=no
309 ;;
310 i?86-*-darwin[912]*)
311 can_unwind_signal=yes
312 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
313 ;;
314 x86_64-*-darwin[912]*)
315 enable_hash_synchronization_default=yes
316 slow_pthread_self=
317 can_unwind_signal=yes
318 DIVIDESPEC=-fuse-divide-subroutine
319 CHECKREFSPEC=-fcheck-references
320 ;;
321 *-*-freebsd*)
322 slow_pthread_self=
323 ;;
324 *-mingw*)
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.
328 can_unwind_signal=no
329 CHECKREFSPEC=-fcheck-references
330 DIVIDESPEC=-fuse-divide-subroutine
331 ;;
332 *-cygwin*)
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
336 slow_pthread_self=
337 ;;
338 hppa*-hp-hpux11.*)
339 slow_pthread_self=no
340 can_unwind_signal=yes
341 DIVIDESPEC=-fuse-divide-subroutine
342 ;;
343 esac
344
345 case "${host}" in
346 *-cygwin* | *-mingw*)
347 fallback_backtrace_h=sysdep/i386/backtrace.h
348 # We need a frame pointer on Windows, so override BACKTRACESPEC
349 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)'
353 ;;
354 esac
355
356 case "${host}" in
357 ia64-*)
358 descriptor_h=sysdep/descriptor-y.h
359 ;;
360
361 hppa*64*-*-hpux*)
362 descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
363 ;;
364
365 hppa*-*-hpux*)
366 descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
367 ;;
368
369 hppa*-*)
370 descriptor_h=sysdep/pa/descriptor.h
371 ;;
372
373 rs6000-* | powerpc*-*)
374 descriptor_h=sysdep/powerpc/descriptor.h
375 ;;
376
377 *)
378 descriptor_h=sysdep/descriptor-n.h
379 ;;
380 esac
381
382 case "${host}" in
383 *linux*|*-kfreebsd*-gnu|*-gnu*)
384 use_libgcj_bc=yes
385 ;;
386 *)
387 use_libgcj_bc=no
388 ;;
389 esac
390
391 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
392 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
393 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"