OSDN Git Service

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