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