1 | dnl Process this with autoconf to create configure |
---|
2 | AC_INIT(java/lang/System.java) |
---|
3 | |
---|
4 | AC_PROG_LN_S |
---|
5 | |
---|
6 | dnl We use these options to decide which functions to include. |
---|
7 | AC_ARG_WITH(target-subdir, |
---|
8 | [ --with-target-subdir=SUBDIR |
---|
9 | configuring in a subdirectory]) |
---|
10 | AC_ARG_WITH(cross-host, |
---|
11 | [ --with-cross-host=HOST configuring with a cross compiler]) |
---|
12 | |
---|
13 | LIBGCJ_CONFIGURE(.) |
---|
14 | |
---|
15 | AM_CONFIG_HEADER(include/config.h) |
---|
16 | |
---|
17 | # Only use libltdl for native builds. |
---|
18 | if test -z "${with_cross_host}"; then |
---|
19 | AC_LIBLTDL_CONVENIENCE |
---|
20 | AC_LIBTOOL_DLOPEN |
---|
21 | DIRLTDL=libltdl |
---|
22 | AC_DEFINE(USE_LTDL) |
---|
23 | # Sigh. Libtool's macro doesn't do the right thing. |
---|
24 | INCLTDL="-I\$(top_srcdir)/libltdl $INCLTDL" |
---|
25 | # FIXME: this is a hack. |
---|
26 | sub_auxdir="`cd $ac_aux_dir && pwd`" |
---|
27 | ac_configure_args="$ac_configure_args --with-auxdir=$sub_auxdir" |
---|
28 | fi |
---|
29 | AC_SUBST(INCLTDL) |
---|
30 | AC_SUBST(LIBLTDL) |
---|
31 | AC_SUBST(DIRLTDL) |
---|
32 | AM_PROG_LIBTOOL |
---|
33 | AC_CONFIG_SUBDIRS($DIRLTDL) |
---|
34 | |
---|
35 | if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then |
---|
36 | COMPPATH=. |
---|
37 | else |
---|
38 | COMPPATH=.. |
---|
39 | fi |
---|
40 | AC_SUBST(COMPPATH) |
---|
41 | |
---|
42 | dnl The -no-testsuite modules omit the test subdir. |
---|
43 | AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite) |
---|
44 | |
---|
45 | dnl See whether the user prefers size or speed for Character. |
---|
46 | dnl The default is size. |
---|
47 | AC_ARG_ENABLE(fast-character, |
---|
48 | [ --enable-fast-character prefer speed over size for Character], |
---|
49 | # Nothing |
---|
50 | , AC_DEFINE(COMPACT_CHARACTER)) |
---|
51 | |
---|
52 | dnl Should the runtime set system properties by examining the |
---|
53 | dnl environment variable GCJ_PROPERTIES? |
---|
54 | AC_ARG_ENABLE(getenv-properties, |
---|
55 | [ --disable-getenv-properties |
---|
56 | don't set system properties from GCJ_PROPERTIES]) |
---|
57 | |
---|
58 | dnl Whether GCJ_PROPERTIES is used depends on the target. |
---|
59 | if test -n "$enable_getenv_properties"; then |
---|
60 | enable_getenv_properties=${enable_getenv_properties_default-yes} |
---|
61 | fi |
---|
62 | if test "$enable_getenv_properties" = no; then |
---|
63 | AC_DEFINE(DISABLE_GETENV_PROPERTIES) |
---|
64 | fi |
---|
65 | |
---|
66 | dnl See if the user has requested runtime debugging. |
---|
67 | LIBGCJDEBUG="false" |
---|
68 | AC_SUBST(LIBGCJDEBUG) |
---|
69 | AC_ARG_ENABLE(libgcj-debug, |
---|
70 | [ --enable-libgcj-debug enable runtime debugging code], |
---|
71 | if test "$enable_libgcj_debug" = yes; then |
---|
72 | AC_DEFINE(DEBUG) |
---|
73 | LIBGCJDEBUG="true" |
---|
74 | fi) |
---|
75 | |
---|
76 | dnl See if the user has the interpreter included. |
---|
77 | AC_ARG_ENABLE(interpreter, |
---|
78 | [ --enable-interpreter enable interpreter], |
---|
79 | if test "$enable_interpreter" = yes; then |
---|
80 | # This can also be set in configure.host. |
---|
81 | libgcj_interpreter=yes |
---|
82 | elif test "$enable_interpreter" = no; then |
---|
83 | libgcj_interpreter=no |
---|
84 | fi) |
---|
85 | |
---|
86 | if test "$libgcj_interpreter" = yes; then |
---|
87 | AC_DEFINE(INTERPRETER) |
---|
88 | fi |
---|
89 | |
---|
90 | AC_MSG_CHECKING([for exception model to use]) |
---|
91 | AC_LANG_SAVE |
---|
92 | AC_LANG_CPLUSPLUS |
---|
93 | AC_ARG_ENABLE(sjlj-exceptions, |
---|
94 | [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions], |
---|
95 | [:], |
---|
96 | [dnl Botheration. Now we've got to detect the exception model. |
---|
97 | dnl Link tests against libgcc.a are problematic since -- at least |
---|
98 | dnl as of this writing -- we've not been given proper -L bits for |
---|
99 | dnl single-tree newlib and libgloss. |
---|
100 | dnl |
---|
101 | dnl This is what AC_TRY_COMPILE would do if it didn't delete the |
---|
102 | dnl conftest files before we got a change to grep them first. |
---|
103 | cat > conftest.$ac_ext << EOF |
---|
104 | [#]line __oline__ "configure" |
---|
105 | struct S { ~S(); }; |
---|
106 | void bar(); |
---|
107 | void foo() |
---|
108 | { |
---|
109 | S s; |
---|
110 | bar(); |
---|
111 | } |
---|
112 | EOF |
---|
113 | old_CXXFLAGS="$CXXFLAGS" |
---|
114 | CXXFLAGS=-S |
---|
115 | if AC_TRY_EVAL(ac_compile); then |
---|
116 | if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then |
---|
117 | enable_sjlj_exceptions=yes |
---|
118 | elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then |
---|
119 | enable_sjlj_exceptions=no |
---|
120 | fi |
---|
121 | fi |
---|
122 | CXXFLAGS="$old_CXXFLAGS" |
---|
123 | rm -f conftest*]) |
---|
124 | if test x$enable_sjlj_exceptions = xyes; then |
---|
125 | AC_DEFINE(SJLJ_EXCEPTIONS, 1, |
---|
126 | [Define if the compiler is configured for setjmp/longjmp exceptions.]) |
---|
127 | ac_exception_model_name=sjlj |
---|
128 | elif test x$enable_sjlj_exceptions = xno; then |
---|
129 | ac_exception_model_name="call frame" |
---|
130 | else |
---|
131 | AC_MSG_ERROR([unable to detect exception model]) |
---|
132 | fi |
---|
133 | AC_LANG_RESTORE |
---|
134 | AC_MSG_RESULT($ac_exception_model_name) |
---|
135 | |
---|
136 | AC_MSG_CHECKING([for data_start]) |
---|
137 | LIBDATASTARTSPEC= |
---|
138 | NEEDS_DATA_START= |
---|
139 | AC_TRY_LINK([extern int data_start;], [return ((int) &data_start);], |
---|
140 | [AC_MSG_RESULT(found it)], |
---|
141 | [LIBDATASTARTSPEC="-u data_start libgcjdata.a%s" |
---|
142 | NEEDS_DATA_START=yes |
---|
143 | AC_MSG_RESULT(missing)]) |
---|
144 | AC_SUBST(LIBDATASTARTSPEC) |
---|
145 | |
---|
146 | dnl See if the user wants to disable java.net. This is the mildly |
---|
147 | dnl ugly way that we admit that target-side configuration sucks. |
---|
148 | AC_ARG_ENABLE(java-net, |
---|
149 | [ --disable-java-net disable java.net]) |
---|
150 | |
---|
151 | dnl Whether java.net is built by default can depend on the target. |
---|
152 | if test -n "$enable_java_net"; then |
---|
153 | enable_java_net=${enable_java_net_default-yes} |
---|
154 | fi |
---|
155 | if test "$enable_java_net" = no; then |
---|
156 | AC_DEFINE(DISABLE_JAVA_NET) |
---|
157 | fi |
---|
158 | |
---|
159 | dnl See if the user wants to disable JVMPI support. |
---|
160 | AC_ARG_ENABLE(jvmpi, |
---|
161 | [ --disable-jvmpi disable JVMPI support]) |
---|
162 | |
---|
163 | if test "$enable_jvmpi" != no; then |
---|
164 | AC_DEFINE(ENABLE_JVMPI) |
---|
165 | fi |
---|
166 | |
---|
167 | dnl If the target is an eCos system, use the appropriate eCos |
---|
168 | dnl I/O routines. |
---|
169 | dnl FIXME: this should not be a local option but a global target |
---|
170 | dnl system; at present there is no eCos target. |
---|
171 | TARGET_ECOS="no" |
---|
172 | AC_ARG_WITH(ecos, |
---|
173 | [ --with-ecos enable runtime eCos target support], |
---|
174 | TARGET_ECOS="$with_ecos" |
---|
175 | ) |
---|
176 | |
---|
177 | case "$TARGET_ECOS" in |
---|
178 | no) |
---|
179 | FILE_DESCRIPTOR=natFileDescriptorPosix.cc |
---|
180 | PROCESS=${PROCESS-Posix} |
---|
181 | ;; |
---|
182 | *) |
---|
183 | FILE_DESCRIPTOR=natFileDescriptorEcos.cc |
---|
184 | PROCESS=Ecos |
---|
185 | AC_DEFINE(ECOS) |
---|
186 | ;; |
---|
187 | esac |
---|
188 | |
---|
189 | AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED)) |
---|
190 | AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED)) |
---|
191 | AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED)) |
---|
192 | AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED)) |
---|
193 | |
---|
194 | |
---|
195 | dnl These may not be defined in a non-ANS conformant embedded system. |
---|
196 | dnl FIXME: Should these case a runtime exception in that case? |
---|
197 | AC_EGREP_HEADER(mktime, time.h, AC_DEFINE(HAVE_MKTIME)) |
---|
198 | AC_EGREP_HEADER(localtime, time.h, AC_DEFINE(HAVE_LOCALTIME)) |
---|
199 | |
---|
200 | dnl Create the subdirectory for natFileDescriptor.cc, or the attempt |
---|
201 | dnl to create the link will fail. |
---|
202 | test -d java || mkdir java |
---|
203 | test -d java/io || mkdir java/io |
---|
204 | test -d gnu || mkdir gnu |
---|
205 | AC_LINK_FILES(java/io/$FILE_DESCRIPTOR, java/io/natFileDescriptor.cc) |
---|
206 | |
---|
207 | dnl Likewise for ConcreteProcess.java and natConcreteProcess.cc. |
---|
208 | test -d java/lang || mkdir java/lang |
---|
209 | AC_LINK_FILES(java/lang/${PROCESS}Process.java, java/lang/ConcreteProcess.java) |
---|
210 | AC_LINK_FILES(java/lang/nat${PROCESS}Process.cc, java/lang/natConcreteProcess.cc) |
---|
211 | |
---|
212 | SYSTEMSPEC= |
---|
213 | AC_SUBST(SYSTEMSPEC) |
---|
214 | |
---|
215 | LIBGCJTESTSPEC="-L`pwd`/.libs -rpath `pwd`/.libs" |
---|
216 | AC_SUBST(LIBGCJTESTSPEC) |
---|
217 | |
---|
218 | AC_ARG_WITH(system-zlib, |
---|
219 | [ --with-system-zlib use installed libz]) |
---|
220 | ZLIBSPEC= |
---|
221 | AC_SUBST(ZLIBSPEC) |
---|
222 | ZLIBTESTSPEC= |
---|
223 | AC_SUBST(ZLIBTESTSPEC) |
---|
224 | |
---|
225 | dnl FIXME: this should be _libs on some hosts. |
---|
226 | libsubdir=.libs |
---|
227 | |
---|
228 | dnl Allow the GC to be disabled. Can be useful when debugging. |
---|
229 | AC_MSG_CHECKING([for garbage collector to use]) |
---|
230 | AC_ARG_ENABLE(java-gc, |
---|
231 | changequote(<<,>>)dnl |
---|
232 | << --enable-java-gc=TYPE choose garbage collector [boehm]>>, |
---|
233 | changequote([,]) |
---|
234 | GC=$enableval, |
---|
235 | GC=boehm) |
---|
236 | GCLIBS= |
---|
237 | GCINCS= |
---|
238 | GCDEPS= |
---|
239 | GCOBJS= |
---|
240 | GCSPEC= |
---|
241 | JC1GCSPEC= |
---|
242 | GCTESTSPEC= |
---|
243 | case "$GC" in |
---|
244 | boehm) |
---|
245 | AC_MSG_RESULT(boehm) |
---|
246 | GCDEPS='$(top_builddir)/../boehm-gc/libgcjgc.la' |
---|
247 | # We include the path to the boehm-gc build directory. |
---|
248 | # See Makefile.am to understand why. |
---|
249 | GCLIBS="$GCDEPS -L\$(here)/../boehm-gc/$libsubdir" |
---|
250 | GCINCS='-I$(top_srcdir)/../boehm-gc -I$(top_builddir)/../boehm-gc' |
---|
251 | GCSPEC='-lgcjgc' |
---|
252 | JC1GCSPEC='-fuse-boehm-gc' |
---|
253 | GCTESTSPEC="-L`pwd`/../boehm-gc/.libs -rpath `pwd`/../boehm-gc/.libs" |
---|
254 | dnl We also want to pick up some cpp flags required when including |
---|
255 | dnl boehm-config.h. Yuck. |
---|
256 | GCINCS="$GCINCS `cat ../boehm-gc/boehm-cflags`" |
---|
257 | GCOBJS=boehm.lo |
---|
258 | GCHDR=boehm-gc.h |
---|
259 | dnl The POSIX thread support needs to know this. |
---|
260 | AC_DEFINE(HAVE_BOEHM_GC) |
---|
261 | ;; |
---|
262 | no) |
---|
263 | AC_MSG_RESULT(none) |
---|
264 | GCOBJS=nogc.lo |
---|
265 | GCHDR=no-gc.h |
---|
266 | ;; |
---|
267 | *) |
---|
268 | AC_MSG_ERROR(unrecognized collector \"$GC\") |
---|
269 | ;; |
---|
270 | esac |
---|
271 | AC_SUBST(GCLIBS) |
---|
272 | AC_SUBST(GCINCS) |
---|
273 | AC_SUBST(GCDEPS) |
---|
274 | AC_SUBST(GCOBJS) |
---|
275 | AC_SUBST(GCSPEC) |
---|
276 | AC_SUBST(JC1GCSPEC) |
---|
277 | AC_SUBST(GCTESTSPEC) |
---|
278 | AC_LINK_FILES(include/$GCHDR, include/java-gc.h) |
---|
279 | |
---|
280 | |
---|
281 | AC_MSG_CHECKING([for thread model used by GCC]) |
---|
282 | THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` |
---|
283 | AC_MSG_RESULT([$THREADS]) |
---|
284 | |
---|
285 | case "$THREADS" in |
---|
286 | no | none | single) |
---|
287 | THREADS=none |
---|
288 | ;; |
---|
289 | posix | pthreads) |
---|
290 | THREADS=posix |
---|
291 | case "$host" in |
---|
292 | *-*-linux*) |
---|
293 | AC_DEFINE(LINUX_THREADS) |
---|
294 | ;; |
---|
295 | esac |
---|
296 | ;; |
---|
297 | decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks) |
---|
298 | AC_MSG_ERROR(thread package $THREADS not yet supported) |
---|
299 | ;; |
---|
300 | *) |
---|
301 | AC_MSG_ERROR($THREADS is an unknown thread package) |
---|
302 | ;; |
---|
303 | esac |
---|
304 | |
---|
305 | THREADLIBS= |
---|
306 | THREADINCS= |
---|
307 | THREADDEPS= |
---|
308 | THREADOBJS= |
---|
309 | THREADH= |
---|
310 | THREADSPEC= |
---|
311 | case "$THREADS" in |
---|
312 | posix) |
---|
313 | THREADLIBS=-lpthread |
---|
314 | THREADSPEC=-lpthread |
---|
315 | THREADOBJS=posix-threads.lo |
---|
316 | THREADH=posix-threads.h |
---|
317 | # MIT pthreads doesn't seem to have the mutexattr functions. |
---|
318 | # But for now we don't check for it. We just assume you aren't |
---|
319 | # using MIT pthreads. |
---|
320 | AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT) |
---|
321 | |
---|
322 | # If we're using the Boehm GC, then we happen to know that it |
---|
323 | # defines _REENTRANT, so we don't bother. Eww. |
---|
324 | if test "$GC" != boehm; then |
---|
325 | AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads]) |
---|
326 | fi |
---|
327 | AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Required define if using POSIX threads]) |
---|
328 | ;; |
---|
329 | |
---|
330 | none) |
---|
331 | THREADOBJS=no-threads.lo |
---|
332 | THREADH=no-threads.h |
---|
333 | ;; |
---|
334 | esac |
---|
335 | AC_LINK_FILES(include/$THREADH, include/java-threads.h) |
---|
336 | AC_SUBST(THREADLIBS) |
---|
337 | AC_SUBST(THREADINCS) |
---|
338 | AC_SUBST(THREADDEPS) |
---|
339 | AC_SUBST(THREADOBJS) |
---|
340 | AC_SUBST(THREADSPEC) |
---|
341 | |
---|
342 | AM_CONDITIONAL(USING_GCC, test "$GCC" = yes) |
---|
343 | |
---|
344 | CANADIAN=no |
---|
345 | NULL_TARGET=no |
---|
346 | NATIVE=yes |
---|
347 | |
---|
348 | # Find unwind.h and support headers. If we're in the tree with |
---|
349 | # gcc, then look there. Otherwise look in compat-include. If all else |
---|
350 | # fails, just hope the user has set things up somehow. |
---|
351 | echo "probing $srcdir/../gcc/unwind.h" |
---|
352 | if test -r $libgcj_basedir/../gcc/unwind.h; then |
---|
353 | GCC_UNWIND_INCLUDE='-I$(libgcj_basedir)/../gcc' |
---|
354 | else |
---|
355 | if test -d $srcdir/../compat-include; then |
---|
356 | GCC_UNWIND_INCLUDE='-I$(top_srcdir)/../compat-include' |
---|
357 | else |
---|
358 | GCC_UNWIND_INCLUDE= |
---|
359 | fi |
---|
360 | fi |
---|
361 | |
---|
362 | if test -n "${with_cross_host}"; then |
---|
363 | # We are being configured with a cross compiler. AC_REPLACE_FUNCS |
---|
364 | # may not work correctly, because the compiler may not be able to |
---|
365 | # link executables. |
---|
366 | |
---|
367 | # We assume newlib. This lets us hard-code the functions we know |
---|
368 | # we'll have. |
---|
369 | AC_DEFINE(HAVE_MEMMOVE) |
---|
370 | AC_DEFINE(HAVE_MEMCPY) |
---|
371 | AC_DEFINE(HAVE_STRERROR) |
---|
372 | AC_DEFINE(HAVE_GMTIME_R) |
---|
373 | AC_DEFINE(HAVE_LOCALTIME_R) |
---|
374 | dnl This is only for POSIX threads. |
---|
375 | AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT) |
---|
376 | dnl We also assume we are using gcc, which provides alloca. |
---|
377 | AC_DEFINE(HAVE_ALLOCA) |
---|
378 | |
---|
379 | dnl Assume we do not have getuid and friends. |
---|
380 | AC_DEFINE(NO_GETUID) |
---|
381 | |
---|
382 | ZLIBSPEC=-lzgcj |
---|
383 | ZLIBTESTSPEC="-L`pwd`/../zlib/.libs -rpath `pwd`/../zlib/.libs" |
---|
384 | |
---|
385 | # If Canadian cross, then don't pick up tools from the build |
---|
386 | # directory. |
---|
387 | if test x"$build" != x"$with_cross_host" && x"$build" != x"$target"; then |
---|
388 | CANADIAN=yes |
---|
389 | GCC_UNWIND_INCLUDE= |
---|
390 | GCJ="${target_alias}-gcj" |
---|
391 | fi |
---|
392 | NATIVE=no |
---|
393 | else |
---|
394 | AC_CHECK_FUNCS(strerror ioctl select fstat open fsync sleep) |
---|
395 | AC_CHECK_FUNCS(gmtime_r localtime_r readdir_r getpwuid_r getcwd) |
---|
396 | AC_CHECK_FUNCS(access stat mkdir rename rmdir unlink realpath utime chmod) |
---|
397 | AC_CHECK_FUNCS(nl_langinfo setlocale) |
---|
398 | AC_CHECK_FUNCS(inet_aton inet_addr, break) |
---|
399 | AC_CHECK_FUNCS(inet_pton uname inet_ntoa) |
---|
400 | AC_CHECK_FUNCS(backtrace fork execvp pipe) |
---|
401 | AC_CHECK_HEADERS(execinfo.h unistd.h dlfcn.h) |
---|
402 | AC_CHECK_LIB(dl, dladdr, [ |
---|
403 | AC_DEFINE(HAVE_DLADDR)]) |
---|
404 | AC_CHECK_FILES(/proc/self/exe, [ |
---|
405 | AC_DEFINE(HAVE_PROC_SELF_EXE)]) |
---|
406 | |
---|
407 | AM_ICONV |
---|
408 | |
---|
409 | AC_CHECK_FUNCS(gethostbyname_r, [ |
---|
410 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
---|
411 | # There are two different kinds of gethostbyname_r. |
---|
412 | # We look for the one that returns `int'. |
---|
413 | # Hopefully this check is robust enough. |
---|
414 | AC_EGREP_HEADER(int.*gethostbyname_r, netdb.h, [ |
---|
415 | AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT)]) |
---|
416 | |
---|
417 | case " $GCINCS " in |
---|
418 | *" -D_REENTRANT "*) ;; |
---|
419 | *) |
---|
420 | dnl On DU4.0, gethostbyname_r is only declared with -D_REENTRANT |
---|
421 | AC_CACHE_CHECK([whether gethostbyname_r declaration requires -D_REENTRANT], |
---|
422 | [libjava_cv_gethostbyname_r_needs_reentrant], |
---|
423 | [ AC_LANG_SAVE |
---|
424 | AC_LANG_CPLUSPLUS |
---|
425 | AC_TRY_COMPILE([#include <netdb.h>], |
---|
426 | [gethostbyname_r("", 0, 0);], |
---|
427 | [libjava_cv_gethostbyname_r_needs_reentrant=no], [dnl |
---|
428 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
429 | CPPFLAGS="$CPPFLAGS -D_REENTRANT" |
---|
430 | AC_TRY_COMPILE([#include <netdb.h>], [gethostbyname_r("", 0, 0);], |
---|
431 | [libjava_cv_gethostbyname_r_needs_reentrant=yes], |
---|
432 | [libjava_cv_gethostbyname_r_needs_reentrant=fail]) |
---|
433 | CPPFLAGS="$CPPFLAGS_SAVE" |
---|
434 | ]) |
---|
435 | AC_LANG_RESTORE |
---|
436 | ]) |
---|
437 | if test "x$libjava_cv_gethostbyname_r_needs_reentrant" = xyes; then |
---|
438 | AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads]) |
---|
439 | fi |
---|
440 | ;; |
---|
441 | esac |
---|
442 | |
---|
443 | AC_CACHE_CHECK([for struct hostent_data], |
---|
444 | [libjava_cv_struct_hostent_data], [dnl |
---|
445 | AC_TRY_COMPILE([ |
---|
446 | #if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT) |
---|
447 | # define _REENTRANT 1 |
---|
448 | #endif |
---|
449 | #include <netdb.h>], [struct hostent_data data;], |
---|
450 | [libjava_cv_struct_hostent_data=yes], |
---|
451 | [libjava_cv_struct_hostent_data=no])]) |
---|
452 | if test "x$libjava_cv_struct_hostent_data" = xyes; then |
---|
453 | AC_DEFINE(HAVE_STRUCT_HOSTENT_DATA, 1, |
---|
454 | [Define if struct hostent_data is defined in netdb.h]) |
---|
455 | fi |
---|
456 | ]) |
---|
457 | |
---|
458 | AC_CHECK_FUNCS(gethostbyaddr_r, [ |
---|
459 | AC_DEFINE(HAVE_GETHOSTBYADDR_R) |
---|
460 | # There are two different kinds of gethostbyaddr_r. |
---|
461 | # We look for the one that returns `int'. |
---|
462 | # Hopefully this check is robust enough. |
---|
463 | AC_EGREP_HEADER(int.*gethostbyaddr_r, netdb.h, [ |
---|
464 | AC_DEFINE(GETHOSTBYADDR_R_RETURNS_INT)])]) |
---|
465 | |
---|
466 | AC_CHECK_FUNCS(gethostname, [ |
---|
467 | AC_DEFINE(HAVE_GETHOSTNAME) |
---|
468 | AC_EGREP_HEADER(gethostname, unistd.h, [ |
---|
469 | AC_DEFINE(HAVE_GETHOSTNAME_DECL)])]) |
---|
470 | |
---|
471 | # Look for these functions in the thread library, but only bother |
---|
472 | # if using POSIX threads. |
---|
473 | if test "$THREADS" = posix; then |
---|
474 | save_LIBS="$LIBS" |
---|
475 | LIBS="$LIBS $THREADLIBS" |
---|
476 | # Some POSIX thread systems don't have pthread_mutexattr_settype. |
---|
477 | # E.g., Solaris. |
---|
478 | AC_CHECK_FUNCS(pthread_mutexattr_settype pthread_mutexattr_setkind_np) |
---|
479 | |
---|
480 | # Look for sched_yield. Up to Solaris 2.6, it is in libposix4, since |
---|
481 | # Solaris 7 the name librt is preferred. |
---|
482 | AC_CHECK_FUNCS(sched_yield, , [ |
---|
483 | AC_CHECK_LIB(rt, sched_yield, [ |
---|
484 | AC_DEFINE(HAVE_SCHED_YIELD) |
---|
485 | THREADLIBS="$THREADLIBS -lrt" |
---|
486 | THREADSPEC="$THREADSPEC -lrt"], [ |
---|
487 | AC_CHECK_LIB(posix4, sched_yield, [ |
---|
488 | AC_DEFINE(HAVE_SCHED_YIELD) |
---|
489 | THREADLIBS="$THREADLIBS -lposix4" |
---|
490 | THREADSPEC="$THREADSPEC -lposix4"])])]) |
---|
491 | LIBS="$save_LIBS" |
---|
492 | |
---|
493 | # We can save a little space at runtime if the mutex has m_count |
---|
494 | # or __m_count. This is a nice hack for Linux. |
---|
495 | AC_TRY_COMPILE([#include <pthread.h>], [ |
---|
496 | extern pthread_mutex_t *mutex; int q = mutex->m_count; |
---|
497 | ], AC_DEFINE(PTHREAD_MUTEX_HAVE_M_COUNT), [ |
---|
498 | AC_TRY_COMPILE([#include <pthread.h>], [ |
---|
499 | extern pthread_mutex_t *mutex; int q = mutex->__m_count; |
---|
500 | ], AC_DEFINE(PTHREAD_MUTEX_HAVE___M_COUNT))]) |
---|
501 | fi |
---|
502 | |
---|
503 | # We require a way to get the time. |
---|
504 | time_found=no |
---|
505 | AC_CHECK_FUNCS(gettimeofday time ftime, time_found=yes) |
---|
506 | if test "$time_found" = no; then |
---|
507 | AC_MSG_ERROR([no function found to get the time]) |
---|
508 | fi |
---|
509 | |
---|
510 | AC_CHECK_FUNCS(memmove) |
---|
511 | |
---|
512 | # We require memcpy. |
---|
513 | memcpy_found=no |
---|
514 | AC_CHECK_FUNCS(memcpy, memcpy_found=yes) |
---|
515 | if test "$memcpy_found" = no; then |
---|
516 | AC_MSG_ERROR([memcpy is required]) |
---|
517 | fi |
---|
518 | |
---|
519 | # Some library-finding code we stole from Tcl. |
---|
520 | #-------------------------------------------------------------------- |
---|
521 | # Check for the existence of the -lsocket and -lnsl libraries. |
---|
522 | # The order here is important, so that they end up in the right |
---|
523 | # order in the command line generated by make. Here are some |
---|
524 | # special considerations: |
---|
525 | # 1. Use "connect" and "accept" to check for -lsocket, and |
---|
526 | # "gethostbyname" to check for -lnsl. |
---|
527 | # 2. Use each function name only once: can't redo a check because |
---|
528 | # autoconf caches the results of the last check and won't redo it. |
---|
529 | # 3. Use -lnsl and -lsocket only if they supply procedures that |
---|
530 | # aren't already present in the normal libraries. This is because |
---|
531 | # IRIX 5.2 has libraries, but they aren't needed and they're |
---|
532 | # bogus: they goof up name resolution if used. |
---|
533 | # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. |
---|
534 | # To get around this problem, check for both libraries together |
---|
535 | # if -lsocket doesn't work by itself. |
---|
536 | #-------------------------------------------------------------------- |
---|
537 | |
---|
538 | AC_CACHE_CHECK([for socket libraries], gcj_cv_lib_sockets, |
---|
539 | [gcj_cv_lib_sockets= |
---|
540 | gcj_checkBoth=0 |
---|
541 | unset ac_cv_func_connect |
---|
542 | AC_CHECK_FUNC(connect, gcj_checkSocket=0, gcj_checkSocket=1) |
---|
543 | if test "$gcj_checkSocket" = 1; then |
---|
544 | unset ac_cv_func_connect |
---|
545 | AC_CHECK_LIB(socket, main, gcj_cv_lib_sockets="-lsocket", |
---|
546 | gcj_checkBoth=1) |
---|
547 | fi |
---|
548 | if test "$gcj_checkBoth" = 1; then |
---|
549 | gcj_oldLibs=$LIBS |
---|
550 | LIBS="$LIBS -lsocket -lnsl" |
---|
551 | unset ac_cv_func_accept |
---|
552 | AC_CHECK_FUNC(accept, |
---|
553 | [gcj_checkNsl=0 |
---|
554 | gcj_cv_lib_sockets="-lsocket -lnsl"]) |
---|
555 | unset ac_cv_func_accept |
---|
556 | LIBS=$gcj_oldLibs |
---|
557 | fi |
---|
558 | unset ac_cv_func_gethostbyname |
---|
559 | gcj_oldLibs=$LIBS |
---|
560 | LIBS="$LIBS $gcj_cv_lib_sockets" |
---|
561 | AC_CHECK_FUNC(gethostbyname, , |
---|
562 | [AC_CHECK_LIB(nsl, main, |
---|
563 | [gcj_cv_lib_sockets="$gcj_cv_lib_sockets -lnsl"])]) |
---|
564 | unset ac_cv_func_gethostbyname |
---|
565 | LIBS=$gcj_oldLIBS |
---|
566 | ]) |
---|
567 | SYSTEMSPEC="$SYSTEMSPEC $gcj_cv_lib_sockets" |
---|
568 | |
---|
569 | if test "$with_system_zlib" = yes; then |
---|
570 | AC_CHECK_LIB(z, deflate, ZLIBSPEC=-lz, ZLIBSPEC=-lzgcj) |
---|
571 | else |
---|
572 | ZLIBSPEC=-lzgcj |
---|
573 | ZLIBTESTSPEC="-L`pwd`/../zlib/.libs -rpath `pwd`/../zlib/.libs" |
---|
574 | fi |
---|
575 | |
---|
576 | # On Solaris, and maybe other architectures, the Boehm collector |
---|
577 | # requires -ldl. |
---|
578 | if test "$GC" = boehm; then |
---|
579 | AC_CHECK_LIB(dl, main, SYSTEMSPEC="$SYSTEMSPEC -ldl") |
---|
580 | fi |
---|
581 | |
---|
582 | if test -z "${with_multisubdir}"; then |
---|
583 | builddotdot=. |
---|
584 | else |
---|
585 | changequote(<<,>>) |
---|
586 | builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'` |
---|
587 | changequote([,]) |
---|
588 | fi |
---|
589 | if test -x "${builddotdot}/../../gcc/gcj"; then |
---|
590 | dir="`cd ${builddotdot}/../../gcc && pwd`" |
---|
591 | GCJ="$dir/gcj -B`pwd`/ -B$dir/" |
---|
592 | else |
---|
593 | CANADIAN=yes |
---|
594 | NULL_TARGET=yes |
---|
595 | GCJ="gcj -B`pwd`/" |
---|
596 | fi |
---|
597 | fi |
---|
598 | |
---|
599 | # Create it, so that compile/link tests don't fail |
---|
600 | test -f libgcj.spec || touch libgcj.spec |
---|
601 | |
---|
602 | # We must search the source tree for java.lang, since we still don't |
---|
603 | # have libgcj.jar nor java/lang/*.class |
---|
604 | GCJ_SAVE_CPPFLAGS=$CPPFLAGS |
---|
605 | CPPFLAGS="$CPPFLAGS -I`pwd` -I`cd $srcdir && pwd`" |
---|
606 | |
---|
607 | # Since some classes depend on this one, we need its source available |
---|
608 | # before we can do any GCJ compilation test :-( |
---|
609 | if test ! -f gnu/classpath/Configuration.java; then |
---|
610 | test -d gnu || mkdir gnu |
---|
611 | test -d gnu/classpath || mkdir gnu/classpath |
---|
612 | sed 's,@LIBGCJDEBUG@,$LIBGCJDEBUG,' \ |
---|
613 | < $srcdir/gnu/classpath/Configuration.java.in \ |
---|
614 | > gnu/classpath/Configuration.java |
---|
615 | # We do not want to redirect the output of the grep below to /dev/null, |
---|
616 | # but we add /dev/null to the input list so that grep will print the |
---|
617 | # filename of Configuration.java in case it finds any matches. |
---|
618 | if grep @ gnu/classpath/Configuration.java /dev/null; then |
---|
619 | AC_MSG_ERROR([configure.in is missing the substitutions above]) |
---|
620 | fi |
---|
621 | fi |
---|
622 | |
---|
623 | LT_AC_PROG_GCJ |
---|
624 | |
---|
625 | CPPFLAGS=$GCJ_SAVE_CPPFLAGS |
---|
626 | |
---|
627 | dnl FIXME: cross compilation |
---|
628 | AC_CHECK_SIZEOF(void *) |
---|
629 | |
---|
630 | ZLIBS= |
---|
631 | ZDEPS= |
---|
632 | ZINCS= |
---|
633 | if test "x$ZLIBSPEC" = "x-lzgcj"; then |
---|
634 | # We include the path to the zlib build directory. |
---|
635 | # See Makefile.am to understand why. |
---|
636 | ZDEPS='$(top_builddir)/../zlib/libzgcj.la' |
---|
637 | ZLIBS="$ZDEPS -L\$(here)/../zlib/$libsubdir" |
---|
638 | ZINCS='-I$(top_srcdir)/../zlib' |
---|
639 | else |
---|
640 | ZLIBS="$ZLIBSPEC" |
---|
641 | fi |
---|
642 | AC_SUBST(ZLIBS) |
---|
643 | AC_SUBST(ZDEPS) |
---|
644 | AC_SUBST(ZINCS) |
---|
645 | AC_SUBST(DIVIDESPEC) |
---|
646 | AC_SUBST(EXCEPTIONSPEC) |
---|
647 | |
---|
648 | AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes) |
---|
649 | AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes) |
---|
650 | AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes || test "$NULL_TARGET" = yes) |
---|
651 | AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host") |
---|
652 | AM_CONDITIONAL(NEEDS_DATA_START, test "$NEEDS_DATA_START" = yes && test "$NATIVE" = yes) |
---|
653 | AC_SUBST(GCC_UNWIND_INCLUDE) |
---|
654 | |
---|
655 | # Determine gcj version number. |
---|
656 | changequote(<<,>>) |
---|
657 | gcjvers="`$GCJ -v 2>&1 | sed -n 's/^.*version \([^ ]*\).*$/\1/p'`" |
---|
658 | changequote([,]) |
---|
659 | AC_DEFINE_UNQUOTED(GCJVERSION, "$gcjvers") |
---|
660 | AC_SUBST(GCJVERSION) |
---|
661 | |
---|
662 | AC_SUBST(AM_RUNTESTFLAGS) |
---|
663 | |
---|
664 | dnl Work around a g++ bug. Reported to gcc-bugs@gcc.gnu.org on Jan 22, 2000. |
---|
665 | AC_MSG_CHECKING([for g++ -ffloat-store bug]) |
---|
666 | save_CFLAGS="$CFLAGS" |
---|
667 | CFLAGS="-x c++ -O2 -ffloat-store" |
---|
668 | AC_TRY_COMPILE([#include <math.h>], , |
---|
669 | [AC_MSG_RESULT(no)], |
---|
670 | [AC_DEFINE(__NO_MATH_INLINES) |
---|
671 | AC_MSG_RESULT(yes)]) |
---|
672 | CFLAGS="$save_CFLAGS" |
---|
673 | |
---|
674 | dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there. |
---|
675 | dnl On that system, sys/ioctl.h will not include sys/filio.h unless |
---|
676 | dnl BSD_COMP is defined; just including sys/filio.h is simpler. |
---|
677 | AC_CHECK_HEADERS(unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pwd.h sys/config.h inttypes.h stdint.h langinfo.h locale.h) |
---|
678 | dnl We avoid AC_HEADER_DIRENT since we really only care about dirent.h |
---|
679 | dnl for now. If you change this, you also must update natFile.cc. |
---|
680 | AC_CHECK_HEADERS(dirent.h) |
---|
681 | |
---|
682 | AC_CHECK_TYPE([ssize_t], [int]) |
---|
683 | |
---|
684 | AC_MSG_CHECKING([for in_addr_t]) |
---|
685 | AC_TRY_COMPILE([#include <sys/types.h> |
---|
686 | #if STDC_HEADERS |
---|
687 | #include <stdlib.h> |
---|
688 | #include <stddef.h> |
---|
689 | #endif |
---|
690 | #if HAVE_NETINET_IN_H |
---|
691 | #include <netinet/in.h> |
---|
692 | #endif], [in_addr_t foo;], |
---|
693 | [AC_DEFINE([HAVE_IN_ADDR_T]) |
---|
694 | AC_MSG_RESULT(yes)], |
---|
695 | [AC_MSG_RESULT(no)]) |
---|
696 | |
---|
697 | AC_MSG_CHECKING([whether struct ip_mreq is in netinet/in.h]) |
---|
698 | AC_TRY_COMPILE([#include <netinet/in.h>], [struct ip_mreq mreq;], |
---|
699 | [AC_DEFINE(HAVE_STRUCT_IP_MREQ) |
---|
700 | AC_MSG_RESULT(yes)], |
---|
701 | [AC_MSG_RESULT(no)]) |
---|
702 | |
---|
703 | AC_MSG_CHECKING([whether struct ipv6_mreq is in netinet/in.h]) |
---|
704 | AC_TRY_COMPILE([#include <netinet/in.h>], [struct ipv6_mreq mreq6;], |
---|
705 | [AC_DEFINE(HAVE_STRUCT_IPV6_MREQ) |
---|
706 | AC_MSG_RESULT(yes)], |
---|
707 | [AC_MSG_RESULT(no)]) |
---|
708 | |
---|
709 | AC_MSG_CHECKING([whether struct sockaddr_in6 is in netinet/in.h]) |
---|
710 | AC_TRY_COMPILE([#include <netinet/in.h>], [struct sockaddr_in6 addr6;], |
---|
711 | [AC_DEFINE(HAVE_INET6) |
---|
712 | AC_MSG_RESULT(yes)], |
---|
713 | [AC_MSG_RESULT(no)]) |
---|
714 | |
---|
715 | AC_MSG_CHECKING([for socklen_t in sys/socket.h]) |
---|
716 | AC_TRY_COMPILE([#define _POSIX_PII_SOCKET |
---|
717 | #include <sys/types.h> |
---|
718 | #include <sys/socket.h>], [socklen_t x = 5;], |
---|
719 | [AC_DEFINE(HAVE_SOCKLEN_T) |
---|
720 | AC_MSG_RESULT(yes)], |
---|
721 | [AC_MSG_RESULT(no)]) |
---|
722 | |
---|
723 | AC_MSG_CHECKING([for tm_gmtoff in struct tm]) |
---|
724 | AC_TRY_COMPILE([#include <time.h>], [struct tm tim; tim.tm_gmtoff = 0;], |
---|
725 | [AC_DEFINE(STRUCT_TM_HAS_GMTOFF) |
---|
726 | AC_MSG_RESULT(yes)], |
---|
727 | [AC_MSG_RESULT(no) |
---|
728 | AC_MSG_CHECKING([for global timezone variable]) |
---|
729 | dnl FIXME: we don't want a link check here because that won't work |
---|
730 | dnl when cross-compiling. So instead we make an assumption that |
---|
731 | dnl the header file will mention timezone if it exists. |
---|
732 | AC_TRY_COMPILE([#include <time.h>], [long z2 = timezone;], |
---|
733 | [AC_DEFINE(HAVE_TIMEZONE) |
---|
734 | AC_MSG_RESULT(yes)], |
---|
735 | [AC_MSG_RESULT(no)])]) |
---|
736 | |
---|
737 | AC_FUNC_ALLOCA |
---|
738 | |
---|
739 | AC_CHECK_PROGS(PERL, perl, false) |
---|
740 | |
---|
741 | SYSDEP_SOURCES= |
---|
742 | |
---|
743 | case "${host}" in |
---|
744 | i?86-*-linux*) |
---|
745 | SIGNAL_HANDLER=include/i386-signal.h |
---|
746 | ;; |
---|
747 | sparc-sun-solaris*) |
---|
748 | SIGNAL_HANDLER=include/sparc-signal.h |
---|
749 | ;; |
---|
750 | # ia64-*) |
---|
751 | # SYSDEP_SOURCES=sysdep/ia64.c |
---|
752 | # test -d sysdep || mkdir sysdep |
---|
753 | # ;; |
---|
754 | powerpc-*-linux*) |
---|
755 | SIGNAL_HANDLER=include/dwarf2-signal.h |
---|
756 | ;; |
---|
757 | alpha*-*-linux*) |
---|
758 | SIGNAL_HANDLER=include/dwarf2-signal.h |
---|
759 | ;; |
---|
760 | *) |
---|
761 | SIGNAL_HANDLER=include/default-signal.h |
---|
762 | ;; |
---|
763 | esac |
---|
764 | |
---|
765 | # If we're using sjlj exceptions, forget what we just learned. |
---|
766 | if test "$enable_sjlj_exceptions" = yes; then |
---|
767 | SIGNAL_HANDLER=include/default-signal.h |
---|
768 | fi |
---|
769 | |
---|
770 | AC_SUBST(SYSDEP_SOURCES) |
---|
771 | |
---|
772 | AC_LINK_FILES($SIGNAL_HANDLER, include/java-signal.h) |
---|
773 | |
---|
774 | if test "${multilib}" = "yes"; then |
---|
775 | multilib_arg="--enable-multilib" |
---|
776 | else |
---|
777 | multilib_arg= |
---|
778 | fi |
---|
779 | |
---|
780 | AC_PATH_XTRA |
---|
781 | |
---|
782 | dnl Determine which AWT peer libraries to build |
---|
783 | AC_ARG_ENABLE(java-awt, |
---|
784 | [ --enable-java-awt list of AWT peer implementations to be built]) |
---|
785 | |
---|
786 | peerlibs="`echo ${enable_java_awt} | tr ',' ' '`" |
---|
787 | use_xlib_awt="" |
---|
788 | use_gtk_awt="" |
---|
789 | |
---|
790 | for peer in $peerlibs ; do |
---|
791 | case $peer in |
---|
792 | xlib) |
---|
793 | if [test "$no_x" = yes]; then |
---|
794 | echo "*** xlib peers requested but no X library available" 1>&2 |
---|
795 | exit 1 |
---|
796 | else |
---|
797 | use_xlib_awt="yes" |
---|
798 | fi |
---|
799 | ;; |
---|
800 | gtk) |
---|
801 | # Nothing, yet... |
---|
802 | ;; |
---|
803 | *) |
---|
804 | echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2 |
---|
805 | exit 1 |
---|
806 | esac |
---|
807 | done |
---|
808 | |
---|
809 | AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes) |
---|
810 | AM_CONDITIONAL(GTK_AWT, test "$use_gtk_awt" = yes) |
---|
811 | |
---|
812 | |
---|
813 | here=`pwd` |
---|
814 | AC_SUBST(here) |
---|
815 | |
---|
816 | # We get this from the environment. |
---|
817 | AC_SUBST(GCJFLAGS) |
---|
818 | |
---|
819 | AC_OUTPUT(Makefile libgcj.spec libgcj-test.spec gnu/classpath/Configuration.java gcj/Makefile include/Makefile testsuite/Makefile, |
---|
820 | [if test -n "$CONFIG_FILES"; then |
---|
821 | ac_file=Makefile . ${libgcj_basedir}/../config-ml.in |
---|
822 | fi |
---|
823 | |
---|
824 | # Make subdirectories and `.d' files. Look in both srcdir and |
---|
825 | # builddir for the .java files. |
---|
826 | h=`pwd` |
---|
827 | : > deps.mk |
---|
828 | ( (cd $srcdir && find . -name '*.java' -print) ; |
---|
829 | find . -name '*.java' -print) | \ |
---|
830 | fgrep -v testsuite | \ |
---|
831 | sed -e 's/\.java/.d/' | \ |
---|
832 | while read f; do |
---|
833 | echo "include $f" >> deps.mk |
---|
834 | test -f $f || { |
---|
835 | changequote(<<,>>) |
---|
836 | d=`echo $f | sed -e 's,/[^/]*$,,'` |
---|
837 | changequote([,]) |
---|
838 | $libgcj_basedir/../mkinstalldirs $d |
---|
839 | echo > $f |
---|
840 | } |
---|
841 | done |
---|
842 | ], |
---|
843 | srcdir=${srcdir} |
---|
844 | host=${host} |
---|
845 | target=${target} |
---|
846 | with_multisubdir=${with_multisubdir} |
---|
847 | ac_configure_args="${multilib_arg} ${ac_configure_args}" |
---|
848 | CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} |
---|
849 | libgcj_basedir=${libgcj_basedir} |
---|
850 | CC="${CC}" |
---|
851 | CXX="${CXX}" |
---|
852 | ) |
---|