re PR c++/24780 (ICE set_mem_attributes_minus_bitpos)
[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_interpreter If the bytecode interpreter supports this platform.
22 # enable_java_net_default If java.net native code should be enabled by
23 # default.
24 # enable_hash_synchronization_default If hash synchronization should be
25 # enabled by default.
26 # sysdeps_dir Directory containing system-dependent headers
27 # slow_pthread_self The synchronization code should try to avoid
28 # pthread_self calls by caching thread IDs in a hashtable
29 # can_unwind_signal Set to "yes" if the EH unwinder supports throwing
30 # from a signal handler.
31 # disable_dladdr Set to "yes" if dladdr should not be used
32 # (i.e it is broken).
33 # fallback_backtrace_h Header to use for fallback backtrace implementation
34 # (only for targets that don't support DWARF2 unwind)
35 # descriptor_h Header to use for looking past function descriptors
36
37 libgcj_flags=
38 libgcj_cflags=
39 libgcj_cxxflags=
40 libgcj_javaflags=
41 libgcj_interpreter=
42 enable_java_net_default=yes
43 enable_hash_synchronization_default=no
44 sysdeps_dir=generic
45 slow_pthread_self=
46 can_unwind_signal=no
47 disable_dladdr=
48 fallback_backtrace_h=sysdep/generic/backtrace.h
49
50 case "${target_optspace}:${host}" in
51 yes:*)
52 libgcj_flags="${libgcj_flags} -Os"
53 ;;
54 :m32r-* | :d10v-* | :d30v-*)
55 libgcj_flags="${libgcj_flags} -Os"
56 ;;
57 no:* | :*)
58 # Nothing.
59 ;;
60 esac
61
62 AM_RUNTESTFLAGS=
63
64 # Set any host dependent compiler flags.
65 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
66
67 echo "$target"
68
69 DIVIDESPEC=-fuse-divide-subroutine
70 EXCEPTIONSPEC=-fnon-call-exceptions
71 CHECKREFSPEC=
72 BACKTRACESPEC=
73
74 # This case statement supports per-CPU defaults.
75 case "${host}" in
76 arm*-elf | strongarm*-elf | xscale*-elf)
77 with_libffi_default=no
78 PROCESS=Ecos
79 FILE=Posix
80 CHECKREFSPEC=-fcheck-references
81 EXCEPTIONSPEC=
82 enable_java_net_default=no
83 enable_getenv_properties_default=no
84 enable_main_args_default=no
85 ;;
86 mips-tx39-*|mipstx39-unknown-*)
87 libgcj_flags="${libgcj_flags} -G 0"
88 LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
89 AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
90 # Use "Ecos" processes since they are a no-op.
91 PROCESS=Ecos
92 FILE=Posix
93 enable_java_net_default=no
94 enable_getenv_properties_default=no
95 ;;
96 i686-*|i586-*|i486-*|i386-*)
97 sysdeps_dir=i386
98 # With -fomit-frame-pointer -maccumulate-outgoing-args (implied),
99 # the .text section of libgcj.so is 30k larger, and the .eh_frame
100 # section is 1.4M smaller.
101 libgcj_flags="${libgcj_flags} -ffloat-store -fomit-frame-pointer"
102 libgcj_interpreter=yes
103 libgcj_cxxflags=
104 libgcj_cflags=
105 DIVIDESPEC=-fno-use-divide-subroutine
106 enable_hash_synchronization_default=yes
107 slow_pthread_self=yes
108 ;;
109 x86_64-*)
110 sysdeps_dir=x86-64
111 # For 64-bit we always use SSE registers for arithmetic,
112 # which doesn't have the extra precision problems of the fpu.
113 # But be careful about 32-bit multilibs.
114 case " $CC " in
115 *" -m32 "*)
116 libgcj_flags="${libgcj_flags} -ffloat-store" ;;
117 esac
118 libgcj_flags="${libgcj_flags} -fomit-frame-pointer"
119 libgcj_cxxflags=
120 libgcj_cflags=
121 DIVIDESPEC=-f%{m32:no-}use-divide-subroutine
122 enable_hash_synchronization_default=yes
123 slow_pthread_self=yes
124 libgcj_interpreter=yes
125 ;;
126 alpha*-*)
127 sysdeps_dir=alpha
128 libgcj_flags="${libgcj_flags} -mieee"
129 libgcj_interpreter=yes
130 enable_hash_synchronization_default=yes
131 IEEESPEC=-mieee
132 ;;
133 hppa-*)
134 sysdeps_dir=pa
135 libgcj_interpreter=yes
136 enable_hash_synchronization_default=yes
137 ;;
138 powerpc64*-*)
139 sysdeps_dir=powerpc
140 libgcj_interpreter=yes
141 if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
142 libgcj_flags="${libgcj_flags} -mminimal-toc"
143 fi
144 enable_hash_synchronization_default=yes
145 slow_pthread_self=yes
146 ;;
147 powerpc*-*)
148 sysdeps_dir=powerpc
149 libgcj_interpreter=yes
150 enable_hash_synchronization_default=yes
151 slow_pthread_self=yes
152 ;;
153 s390*-*)
154 sysdeps_dir=s390
155 libgcj_interpreter=yes
156 DIVIDESPEC=-fno-use-divide-subroutine
157 enable_hash_synchronization_default=yes
158 ;;
159 sparc*-*)
160 libgcj_interpreter=yes
161 ;;
162 ia64-*)
163 sysdeps_dir=ia64
164 libgcj_flags="${libgcj_flags} -funwind-tables"
165 libgcj_interpreter=yes
166 enable_hash_synchronization_default=yes
167 ;;
168 sh-* | sh[34]*-*)
169 sysdeps_dir=sh
170 libgcj_flags="${libgcj_flags} -mieee"
171 libgcj_interpreter=yes
172 enable_hash_synchronization_default=yes
173 IEEESPEC=-mieee
174 ;;
175 esac
176
177 # This case statement supports generic port properties and may refine
178 # the above per-CPU defaults. Note: If your OS implements
179 # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
180 # here.
181 case "${host}" in
182 i[34567]86*-linux* | \
183 powerpc*-linux* | \
184 alpha*-linux* | \
185 s390*-linux* | \
186 sparc*-linux* | \
187 ia64-* | \
188 x86_64*-linux* | \
189 hppa*-linux* | \
190 sh-linux* | sh[34]*-linux*)
191 can_unwind_signal=yes
192 libgcj_ld_symbolic='-Wl,-Bsymbolic'
193 if test x$slow_pthread_self = xyes \
194 && test x$cross_compiling != xyes; then
195 cat > conftest.c <<EOF
196 #define _GNU_SOURCE 1
197 #include <pthread.h>
198 #include <stdlib.h>
199 #include <sys/resource.h>
200 #include <limits.h>
201
202 void *
203 tf (void *arg __attribute__ ((unused)))
204 {
205 pthread_attr_t a;
206 size_t s;
207
208 if (pthread_getattr_np (pthread_self (), &a)
209 || pthread_attr_getstacksize (&a, &s)
210 || s > 2 * PTHREAD_STACK_MIN)
211 exit (1);
212 exit (0);
213 }
214
215 int
216 main (int argc, char **argv)
217 {
218 pthread_t p;
219 void *ret;
220 struct rlimit r;
221
222 if (argc == 2)
223 {
224 r.rlim_cur = 2 * PTHREAD_STACK_MIN;
225 r.rlim_max = 2 * PTHREAD_STACK_MIN;
226 if (setrlimit (RLIMIT_STACK, &r))
227 exit (1);
228 execl (argv[1], argv[0], NULL);
229 exit (1);
230 }
231
232 if (pthread_create (&p, NULL, tf, NULL)
233 || pthread_join (p, &ret))
234 exit (1);
235 exit (1);
236 }
237 EOF
238 $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
239 ./conftest ./conftest && slow_pthread_self=
240 rm -f conftest conftest.c
241 fi
242 ;;
243 i[34567]86-*-solaris2.1[0-9]* )
244 sysdeps_dir=x86-64
245 DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
246 ;;
247 mips*-*-linux* )
248 sysdeps_dir=mips
249 can_unwind_signal=yes
250 DIVIDESPEC=-fno-use-divide-subroutine
251 case "${host}" in
252 mipsel*-linux* | mipsisa32el*-linux*)
253 enable_hash_synchronization_default=yes
254 disable_dladdr=yes
255 ;;
256 esac
257 ;;
258 powerpc*-*-darwin*)
259 enable_hash_synchronization_default=yes
260 slow_pthread_self=
261 can_unwind_signal=yes
262 ;;
263 *-*-freebsd*)
264 slow_pthread_self=
265 ;;
266 *-mingw*)
267 # FIXME: win32_exception_handler( ) in win32.cc does not do the
268 # right stuff yet w.r.t. SEH. Live with the following for now.
269 can_unwind_signal=no
270 CHECKREFSPEC=-fcheck-references
271 DIVIDESPEC=-fuse-divide-subroutine
272 ;;
273 *-cygwin*)
274 # The cygwin linker doesn't do 8-byte alignment by default, so
275 # disable hash synchronization for now.
276 enable_hash_synchronization_default=no
277 slow_pthread_self=
278 ;;
279 esac
280
281 case "${host}" in
282 *-cygwin* | *-mingw*)
283 fallback_backtrace_h=sysdep/i386/backtrace.h
284 # We need a frame pointer on Windows, so override BACKTRACESPEC
285 BACKTRACESPEC=
286 ;;
287 esac
288
289 case "${host}" in
290 ia64-*)
291 descriptor_h=sysdep/descriptor-y.h
292 ;;
293
294 hppa*-*)
295 descriptor_h=sysdep/pa/descriptor.h
296 ;;
297
298 rs6000-* | powerpc*-*)
299 descriptor_h=sysdep/powerpc/descriptor.h
300 ;;
301
302 *)
303 descriptor_h=sysdep/descriptor-n.h
304 ;;
305 esac
306
307 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
308 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
309 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"