OSDN Git Service

* configure.host: Set IEEESPEC to -mieee for sh*-*-*.
[pf3gnuchains/gcc-fork.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
36 libgcj_flags=
37 libgcj_cflags=
38 libgcj_cxxflags=
39 libgcj_javaflags=
40 libgcj_interpreter=
41 enable_java_net_default=yes
42 enable_hash_synchronization_default=no
43 sysdeps_dir=generic
44 slow_pthread_self=
45 can_unwind_signal=no
46 disable_dladdr=
47 fallback_backtrace_h=sysdep/generic/backtrace.h
48
49 case "${target_optspace}:${host}" in
50   yes:*)
51     libgcj_flags="${libgcj_flags} -Os"
52     ;;
53   :m32r-* | :d10v-* | :d30v-*)
54     libgcj_flags="${libgcj_flags} -Os"
55     ;;
56   no:* | :*)
57     # Nothing.
58     ;;
59 esac
60
61 AM_RUNTESTFLAGS= 
62
63 # Set any host dependent compiler flags.
64 # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
65
66 echo "$target"
67
68 DIVIDESPEC=-fuse-divide-subroutine
69 EXCEPTIONSPEC=-fnon-call-exceptions
70 CHECKREFSPEC=
71
72 # This case statement supports per-CPU defaults.
73 case "${host}" in
74   arm*-elf | strongarm*-elf | xscale*-elf)
75         with_libffi_default=no
76         PROCESS=Ecos
77         FILE=Posix
78         CHECKREFSPEC=-fcheck-references
79         EXCEPTIONSPEC=
80         enable_java_net_default=no
81         enable_getenv_properties_default=no
82         enable_main_args_default=no
83         ;;
84   mips-tx39-*|mipstx39-unknown-*)
85         libgcj_flags="${libgcj_flags} -G 0"
86         LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
87         AM_RUNTESTFLAGS="--target_board=jmr3904-sim"    
88         # Use "Ecos" processes since they are a no-op.
89         PROCESS=Ecos
90         FILE=Posix
91         enable_java_net_default=no
92         enable_getenv_properties_default=no
93         ;;
94   i686-*|i586-*|i486-*|i386-*)
95         sysdeps_dir=i386
96         libgcj_flags="${libgcj_flags} -ffloat-store -fno-omit-frame-pointer"
97         libgcj_interpreter=yes
98         libgcj_cxxflags=
99         libgcj_cflags=
100         DIVIDESPEC=-fno-use-divide-subroutine
101         enable_hash_synchronization_default=yes
102         slow_pthread_self=yes
103         ;;
104   x86_64-*)
105         sysdeps_dir=x86-64
106         libgcj_flags="${libgcj_flags} -ffloat-store -fno-omit-frame-pointer"
107         libgcj_cxxflags=
108         libgcj_cflags=
109         DIVIDESPEC=-f%{m32:no-}use-divide-subroutine
110         enable_hash_synchronization_default=yes
111         slow_pthread_self=yes
112         libgcj_interpreter=yes
113         ;;
114   alpha*-*)
115         sysdeps_dir=alpha
116         libgcj_flags="${libgcj_flags} -mieee"
117         libgcj_interpreter=yes
118         enable_hash_synchronization_default=yes
119         IEEESPEC=-mieee
120         ;;
121   hppa-*)
122         sysdeps_dir=pa
123         libgcj_interpreter=yes
124         enable_hash_synchronization_default=yes
125         ;;
126   powerpc64*-*)
127         sysdeps_dir=powerpc
128         libgcj_interpreter=yes
129         if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
130             libgcj_flags="${libgcj_flags} -mminimal-toc"
131         fi
132         enable_hash_synchronization_default=yes
133         slow_pthread_self=yes
134         ;;
135   powerpc*-*)
136         sysdeps_dir=powerpc
137         libgcj_interpreter=yes
138         enable_hash_synchronization_default=yes
139         slow_pthread_self=yes
140         ;;
141   s390*-*)
142         sysdeps_dir=s390
143         libgcj_interpreter=yes
144         DIVIDESPEC=-fno-use-divide-subroutine
145         enable_hash_synchronization_default=yes
146         ;;
147   sparc*-*)
148         libgcj_interpreter=yes
149         ;;
150   ia64-*)
151         sysdeps_dir=ia64
152         libgcj_flags="${libgcj_flags} -funwind-tables"
153         libgcj_interpreter=yes
154         enable_hash_synchronization_default=yes
155         ;;
156   sh-* | sh[34]*-*)
157         sysdeps_dir=sh
158         libgcj_flags="${libgcj_flags} -mieee"
159         libgcj_interpreter=yes
160         enable_hash_synchronization_default=yes
161         IEEESPEC=-mieee
162         ;;
163 esac
164
165 # This case statement supports generic port properties and may refine
166 # the above per-CPU defaults.  Note: If your OS implements
167 # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
168 # here.
169 case "${host}" in
170   i[34567]86*-linux* | \
171   powerpc*-linux* | \
172   alpha*-linux* | \
173   s390*-linux* | \
174   sparc*-linux* | \
175   ia64-* | \
176   x86_64*-linux* | \
177   hppa*-linux* | \
178   sh-linux* | sh[34]*-linux*)
179         can_unwind_signal=yes
180         libgcj_ld_symbolic='-Wl,-Bsymbolic'
181         if test x$slow_pthread_self = xyes \
182            && test x$cross_compiling != xyes; then
183           cat > conftest.c <<EOF
184 #define _GNU_SOURCE 1
185 #include <pthread.h>
186 #include <stdlib.h>
187 #include <sys/resource.h>
188 #include <limits.h>
189
190 void *
191 tf (void *arg __attribute__ ((unused)))
192 {
193   pthread_attr_t a;
194   size_t s;
195
196   if (pthread_getattr_np (pthread_self (), &a)
197       || pthread_attr_getstacksize (&a, &s)
198       || s > 2 * PTHREAD_STACK_MIN)
199     exit (1);
200   exit (0);
201 }
202
203 int
204 main (int argc, char **argv)
205 {
206   pthread_t p;
207   void *ret;
208   struct rlimit r;
209
210   if (argc == 2)
211     {
212       r.rlim_cur = 2 * PTHREAD_STACK_MIN;
213       r.rlim_max = 2 * PTHREAD_STACK_MIN;
214       if (setrlimit (RLIMIT_STACK, &r))
215         exit (1);
216       execl (argv[1], argv[0], NULL);
217       exit (1);
218     }
219
220   if (pthread_create (&p, NULL, tf, NULL)
221       || pthread_join (p, &ret))
222     exit (1);
223   exit (1);
224 }
225 EOF
226           $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
227           ./conftest ./conftest && slow_pthread_self=
228           rm -f conftest conftest.c
229         fi
230         ;;
231   mips*-*-linux* )
232         sysdeps_dir=mips
233         can_unwind_signal=yes
234         DIVIDESPEC=-fno-use-divide-subroutine
235         case "${host}" in
236             mipsel*-linux* | mipsisa32el*-linux*)
237                 enable_hash_synchronization_default=yes
238                 disable_dladdr=yes
239             ;;
240         esac
241         ;;
242   powerpc*-*-darwin*)
243         enable_hash_synchronization_default=yes
244         slow_pthread_self=
245         can_unwind_signal=yes
246         ;;
247   *-*-freebsd*)
248         slow_pthread_self=
249         ;;
250   *-mingw*)
251         # FIXME: win32_exception_handler( ) in win32.cc does not do the
252         # right stuff yet w.r.t. SEH. Live with the following for now.
253         can_unwind_signal=no
254         CHECKREFSPEC=-fcheck-references
255         DIVIDESPEC=-fuse-divide-subroutine
256         ;;
257   *-cygwin*)
258         # The cygwin linker doesn't do 8-byte alignment by default, so
259         # disable hash synchronization for now.
260         enable_hash_synchronization_default=no
261         slow_pthread_self=
262         ;;
263 esac
264
265 case "${host}" in
266   *-cygwin* | *-mingw*)
267         fallback_backtrace_h=sysdep/i386/backtrace.h  
268   ;;
269 esac
270
271
272 libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
273 libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
274 libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"