]>
Commit | Line | Data |
---|---|---|
ee9dd372 TT |
1 | dnl Process this with autoconf to create configure |
2 | AC_INIT(java/lang/System.java) | |
3 | ||
0d16618c | 4 | dnl Can't be done in LIBGCJ_CONFIGURE because that confuses automake. |
ee9dd372 TT |
5 | AC_CONFIG_AUX_DIR(..) |
6 | ||
7 | AC_CANONICAL_SYSTEM | |
8 | ||
9 | dnl We use these options to decide which functions to include. | |
10 | AC_ARG_WITH(target-subdir, | |
7941ceab AG |
11 | [ --with-target-subdir=SUBDIR |
12 | configuring in a subdirectory]) | |
ee9dd372 | 13 | AC_ARG_WITH(cross-host, |
7941ceab | 14 | [ --with-cross-host=HOST configuring with a cross compiler]) |
ee9dd372 TT |
15 | |
16 | LIBGCJ_CONFIGURE(.) | |
17 | ||
18 | AM_CONFIG_HEADER(include/config.h) | |
19 | ||
a3ffcff3 TT |
20 | AM_PROG_LIBTOOL |
21 | ||
ee9dd372 TT |
22 | if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then |
23 | COMPPATH=. | |
24 | else | |
25 | COMPPATH=.. | |
26 | fi | |
27 | AC_SUBST(COMPPATH) | |
28 | ||
29 | dnl The -no-testsuite modules omit the test subdir. | |
30 | AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite) | |
31 | ||
32 | dnl See whether the user prefers size or speed for Character. | |
33 | dnl The default is size. | |
34 | AC_ARG_ENABLE(fast-character, | |
7941ceab | 35 | [ --enable-fast-character prefer speed over size for Character], |
ee9dd372 TT |
36 | # Nothing |
37 | , AC_DEFINE(COMPACT_CHARACTER)) | |
38 | ||
39 | dnl See if the user has requested runtime debugging. | |
40 | AC_ARG_ENABLE(libgcj-debug, | |
7941ceab | 41 | [ --enable-libgcj-debug enable runtime debugging code], |
ee9dd372 TT |
42 | if test "$enable_libgcj_debug" = yes; then |
43 | AC_DEFINE(DEBUG) | |
44 | fi) | |
45 | ||
58eb6e7c AG |
46 | dnl See if the user has the enterpreter included. |
47 | AC_ARG_ENABLE(interpreter, | |
7941ceab | 48 | [ --enable-interpreter enable interpreter], |
58eb6e7c AG |
49 | if test "$enable_interpreter" = yes; then |
50 | AC_DEFINE(INTERPRETER) | |
51 | fi) | |
52 | ||
efc3b511 | 53 | dnl This becomes -lffi if the interpreter is enabled. |
58eb6e7c AG |
54 | INTERPSPEC= |
55 | AC_SUBST(INTERPSPEC) | |
56 | ||
ee9dd372 TT |
57 | dnl If the target is an eCos system, use the appropriate eCos |
58 | dnl I/O routines. | |
59 | dnl FIXME: this should not be a local option but a global target | |
60 | dnl system; at present there is no eCos target. | |
61 | TARGET_ECOS="no" | |
62 | AC_ARG_WITH(ecos, | |
7941ceab | 63 | [ --with-ecos enable runtime eCos target support], |
ee9dd372 TT |
64 | TARGET_ECOS="$with_ecos" |
65 | ) | |
66 | ||
67 | case "$TARGET_ECOS" in | |
68 | no) | |
69 | FILE_DESCRIPTOR=natFileDescriptorPosix.cc | |
42962a48 | 70 | PROCESS=Posix |
ee9dd372 TT |
71 | ;; |
72 | *) | |
73 | FILE_DESCRIPTOR=natFileDescriptorEcos.cc | |
42962a48 | 74 | PROCESS=Ecos |
ee9dd372 TT |
75 | AC_DEFINE(ECOS) |
76 | ;; | |
77 | esac | |
78 | ||
0d16618c TT |
79 | AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED)) |
80 | AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED)) | |
81 | AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED)) | |
82 | AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED)) | |
83 | ||
ee9dd372 TT |
84 | |
85 | dnl These may not be defined in a non-ANS conformant embedded system. | |
86 | dnl FIXME: Should these case a runtime exception in that case? | |
87 | AC_EGREP_HEADER(mktime, time.h, AC_DEFINE(HAVE_MKTIME)) | |
88 | AC_EGREP_HEADER(localtime, time.h, AC_DEFINE(HAVE_LOCALTIME)) | |
89 | ||
90 | dnl Create the subdirectory for natFileDescriptor.cc, or the attempt | |
91 | dnl to create the link will fail. | |
92 | test -d java || mkdir java | |
93 | test -d java/io || mkdir java/io | |
94 | AC_LINK_FILES(java/io/$FILE_DESCRIPTOR, java/io/natFileDescriptor.cc) | |
95 | ||
42962a48 TT |
96 | dnl Likewise for ConcreteProcess.java and natConcreteProcess.cc. |
97 | test -d java/lang || mkdir java/lang | |
98 | AC_LINK_FILES(java/lang/${PROCESS}Process.java, java/lang/ConcreteProcess.java) | |
99 | AC_LINK_FILES(java/lang/nat${PROCESS}Process.cc, java/lang/natConcreteProcess.cc) | |
100 | ||
f994389b TT |
101 | SYSTEMSPEC= |
102 | AC_SUBST(SYSTEMSPEC) | |
103 | ||
104 | AC_ARG_WITH(system-zlib, | |
7941ceab | 105 | [ --with-system-zlib use installed libz]) |
f994389b TT |
106 | ZLIBSPEC= |
107 | AC_SUBST(ZLIBSPEC) | |
108 | ||
109 | dnl FIXME: this should be _libs on some hosts. | |
110 | libsubdir=.libs | |
111 | ||
ee9dd372 TT |
112 | dnl Allow the GC to be disabled. Can be useful when debugging. |
113 | AC_MSG_CHECKING([for garbage collector to use]) | |
114 | AC_ARG_ENABLE(java-gc, | |
115 | changequote(<<,>>)dnl | |
7941ceab | 116 | << --enable-java-gc=TYPE choose garbage collector [boehm]>>, |
ee9dd372 TT |
117 | changequote([,]) |
118 | GC=$enableval, | |
119 | GC=boehm) | |
120 | GCLIBS= | |
121 | GCINCS= | |
122 | GCDEPS= | |
123 | GCOBJS= | |
f994389b | 124 | GCSPEC= |
ee9dd372 TT |
125 | case "$GC" in |
126 | boehm) | |
127 | AC_MSG_RESULT(boehm) | |
a3ffcff3 | 128 | GCDEPS='$(top_builddir)/../boehm-gc/libgcjgc.la' |
f994389b TT |
129 | # We include the path to the boehm-gc build directory. |
130 | # See Makefile.am to understand why. | |
131 | GCLIBS="$GCDEPS -L\$(here)/../boehm-gc/$libsubdir" | |
ee9dd372 | 132 | GCINCS='-I$(top_srcdir)/../boehm-gc -I$(top_builddir)/../boehm-gc' |
f994389b | 133 | GCSPEC='-lgcjgc' |
ee9dd372 TT |
134 | dnl We also want to pick up some cpp flags required when including |
135 | dnl boehm-config.h. Yuck. | |
136 | GCINCS="$GCINCS `cat ../boehm-gc/boehm-cflags`" | |
a3ffcff3 | 137 | GCOBJS=boehm.lo |
ee9dd372 TT |
138 | GCHDR=boehm-gc.h |
139 | dnl The POSIX thread support needs to know this. | |
140 | AC_DEFINE(HAVE_BOEHM_GC) | |
141 | ;; | |
142 | no) | |
143 | AC_MSG_RESULT(none) | |
a3ffcff3 | 144 | GCOBJS=nogc.lo |
ee9dd372 TT |
145 | GCHDR=no-gc.h |
146 | ;; | |
147 | *) | |
148 | AC_MSG_ERROR(unrecognized collector \"$GC\") | |
149 | ;; | |
150 | esac | |
151 | AC_SUBST(GCLIBS) | |
152 | AC_SUBST(GCINCS) | |
153 | AC_SUBST(GCDEPS) | |
154 | AC_SUBST(GCOBJS) | |
f994389b | 155 | AC_SUBST(GCSPEC) |
ee9dd372 TT |
156 | AC_LINK_FILES(include/$GCHDR, include/java-gc.h) |
157 | ||
158 | ||
159 | dnl Note that this code is kept in sync with similar code in gcc/configure.in. | |
160 | dnl In particular both packages must make the same decision about which | |
161 | dnl thread package to use. | |
162 | AC_MSG_CHECKING([for threads package to use]) | |
7941ceab | 163 | AC_ARG_ENABLE(threads, [ --enable-threads=TYPE choose threading package], |
ee9dd372 TT |
164 | THREADS=$enableval, |
165 | dnl FIXME: figure out native threads to use here. | |
166 | THREADS=no) | |
167 | ||
168 | if test "$THREADS" = yes; then | |
169 | case "$host" in | |
170 | *-*-vxworks*) | |
171 | THREADS=vxworks | |
172 | ;; | |
173 | *-*-linux*) | |
174 | # FIXME: this isn't correct in all cases. | |
175 | THREADS=posix | |
176 | ;; | |
177 | *-*-win*) | |
178 | THREADS=win32 | |
179 | ;; | |
180 | *-*-irix*) | |
395e3bf9 GZ |
181 | # FIXME: for now, choose POSIX, because we implement that. |
182 | # Later, choose irix threads. | |
183 | THREADS=posix | |
ee9dd372 TT |
184 | ;; |
185 | *-*-solaris*) | |
186 | # FIXME: for now, choose POSIX, because we implement that. | |
187 | # Later, choose solaris threads. | |
188 | THREADS=posix | |
189 | ;; | |
190 | *) | |
191 | # For now. | |
192 | THREADS=none | |
193 | ;; | |
194 | esac | |
195 | fi | |
196 | ||
197 | case "$THREADS" in | |
198 | no | none | single) | |
199 | THREADS=none | |
200 | ;; | |
201 | posix | pthreads) | |
202 | THREADS=posix | |
203 | case "$host" in | |
204 | *-*-linux*) | |
205 | AC_DEFINE(LINUX_THREADS) | |
206 | ;; | |
207 | esac | |
208 | ;; | |
209 | qt) | |
210 | ;; | |
211 | decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks) | |
212 | AC_MSG_ERROR(thread package $THREADS not yet supported) | |
213 | ;; | |
214 | *) | |
215 | AC_MSG_ERROR($THREADS is an unknown thread package) | |
216 | ;; | |
217 | esac | |
218 | AC_MSG_RESULT($THREADS) | |
219 | ||
220 | THREADLIBS= | |
221 | THREADINCS= | |
222 | THREADDEPS= | |
223 | THREADOBJS= | |
224 | THREADH= | |
f994389b | 225 | THREADSPEC= |
ee9dd372 TT |
226 | case "$THREADS" in |
227 | posix) | |
228 | THREADLIBS=-lpthread | |
f994389b | 229 | THREADSPEC=-lpthread |
a3ffcff3 | 230 | THREADOBJS=posix-threads.lo |
ee9dd372 TT |
231 | THREADH=posix-threads.h |
232 | # MIT pthreads doesn't seem to have the mutexattr functions. | |
233 | # But for now we don't check for it. We just assume you aren't | |
234 | # using MIT pthreads. | |
235 | AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT) | |
236 | ;; | |
237 | ||
238 | qt) | |
a3ffcff3 | 239 | THREADDEPS='$(top_builddir)/../qthreads/libgcjcoop.la' |
f994389b TT |
240 | # We include the path to the qthreads build directory. |
241 | # See Makefile.am to understand why. | |
242 | THREADLIBS="$THREADDEPS -L\$(here)/../qthreads/$libsubdir" | |
243 | THREADSPEC='-lgcjcoop' | |
a3ffcff3 | 244 | THREADOBJS=quick-threads.lo |
ee9dd372 TT |
245 | THREADINCS='-I$(top_srcdir)/../qthreads' |
246 | THREADH=quick-threads.h | |
ee9dd372 TT |
247 | ;; |
248 | ||
249 | none) | |
a3ffcff3 | 250 | THREADOBJS=no-threads.lo |
ee9dd372 TT |
251 | THREADH=no-threads.h |
252 | ;; | |
253 | esac | |
254 | AC_LINK_FILES(include/$THREADH, include/java-threads.h) | |
255 | AC_SUBST(THREADLIBS) | |
256 | AC_SUBST(THREADINCS) | |
257 | AC_SUBST(THREADDEPS) | |
258 | AC_SUBST(THREADOBJS) | |
f994389b | 259 | AC_SUBST(THREADSPEC) |
ee9dd372 TT |
260 | |
261 | AM_CONDITIONAL(USING_GCC, test "$GCC" = yes) | |
262 | ||
263 | CANADIAN=no | |
264 | NULL_TARGET=no | |
265 | ||
266 | # Find eh-common.h and support headers. If we're in the tree with | |
267 | # gcc, then look there. Otherwise look in compat-include. If all else | |
268 | # fails, just hope the user has set things up somehow. | |
269 | if test -r $srcdir/../gcc/eh-common.h; then | |
270 | EH_COMMON_INCLUDE='-I$(top_srcdir)/../gcc -I$(top_srcdir)/../include' | |
271 | else | |
272 | if test -d $srcdir/../compat-include; then | |
273 | EH_COMMON_INCLUDE='-I$(top_srcdir)/../compat-include' | |
274 | else | |
275 | EH_COMMON_INCLUDE= | |
276 | fi | |
277 | fi | |
278 | ||
279 | if test -n "${with_cross_host}"; then | |
280 | # We are being configured with a cross compiler. AC_REPLACE_FUNCS | |
281 | # may not work correctly, because the compiler may not be able to | |
282 | # link executables. | |
283 | ||
284 | # We assume newlib. This lets us hard-code the functions we know | |
285 | # we'll have. | |
286 | AC_DEFINE(HAVE_MEMMOVE) | |
287 | AC_DEFINE(HAVE_MEMCPY) | |
288 | AC_DEFINE(HAVE_STRERROR) | |
289 | AC_DEFINE(HAVE_CTIME_R) | |
290 | AC_DEFINE(HAVE_GMTIME_R) | |
291 | AC_DEFINE(HAVE_LOCALTIME_R) | |
292 | dnl This is only for POSIX threads. | |
293 | AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT) | |
294 | dnl We also assume we are using gcc, which provides alloca. | |
295 | AC_DEFINE(HAVE_ALLOCA) | |
296 | ||
f994389b TT |
297 | ZLIBSPEC=-lgcj |
298 | ||
ee9dd372 TT |
299 | # If Canadian cross, then don't pick up tools from the build |
300 | # directory. | |
301 | if test "$build" != "$with_cross_host"; then | |
302 | CANADIAN=yes | |
303 | EH_COMMON_INCLUDE= | |
01b02b11 TT |
304 | GCJ="${target_alias}/gcj" |
305 | else | |
306 | GCJ= | |
ee9dd372 TT |
307 | fi |
308 | else | |
309 | # Some POSIX thread systems don't have pthread_mutexattr_settype. | |
310 | # E.g., Solaris. | |
311 | AC_CHECK_FUNCS(strerror ioctl select open fsync sleep) | |
312 | AC_CHECK_FUNCS(ctime_r ctime, break) | |
313 | AC_CHECK_FUNCS(gmtime_r localtime_r readdir_r getpwuid_r) | |
314 | AC_CHECK_FUNCS(access stat mkdir rename rmdir unlink realpath) | |
315 | AC_CHECK_FUNCS(inet_aton inet_addr, break) | |
6130b0af | 316 | AC_CHECK_FUNCS(inet_pton uname inet_ntoa) |
ee9dd372 TT |
317 | |
318 | AC_CHECK_FUNCS(gethostbyname_r, [ | |
319 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) | |
320 | # There are two different kinds of gethostbyname_r. | |
321 | # We look for the one that returns `int'. | |
322 | # Hopefully this check is robust enough. | |
323 | AC_EGREP_HEADER(int.*gethostbyname_r, netdb.h, [ | |
34c5c0e1 AO |
324 | AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT)]) |
325 | ||
326 | case " $GCINCS " in | |
327 | *" -D_REENTRANT "*) ;; | |
328 | *) | |
329 | dnl On DU4.0, gethostbyname_r is only declared with -D_REENTRANT | |
330 | AC_CACHE_CHECK([whether gethostbyname_r declaration requires -D_REENTRANT], | |
331 | [libjava_cv_gethostbyname_r_needs_reentrant], | |
332 | [ AC_LANG_SAVE | |
333 | AC_LANG_CPLUSPLUS | |
334 | AC_TRY_COMPILE([#include <netdb.h>], | |
335 | [gethostbyname_r("", 0, 0);], | |
336 | [libjava_cv_gethostbyname_r_needs_reentrant=no], [dnl | |
337 | CPPFLAGS_SAVE="$CPPFLAGS" | |
338 | CPPFLAGS="$CPPFLAGS -D_REENTRANT" | |
339 | AC_TRY_COMPILE([#include <netdb.h>], [gethostbyname_r("", 0, 0);], | |
340 | [libjava_cv_gethostbyname_r_needs_reentrant=yes], | |
341 | [libjava_cv_gethostbyname_r_needs_reentrant=fail]) | |
342 | CPPFLAGS="$CPPFLAGS_SAVE" | |
343 | ]) | |
344 | AC_LANG_RESTORE | |
345 | ]) | |
346 | if test "x$libjava_cv_gethostbyname_r_needs_reentrant" = xyes; then | |
347 | AC_DEFINE(GETHOSTBYNAME_R_NEEDS_REENTRANT, 1, [Define if gethostbyname_r is only declared if _REENTRANT is defined]) | |
348 | fi | |
349 | ;; | |
350 | esac | |
351 | ||
352 | AC_CACHE_CHECK([for struct hostent_data], | |
353 | [libjava_cv_struct_hostent_data], [dnl | |
354 | AC_TRY_COMPILE([ | |
355 | #if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT) | |
356 | # define _REENTRANT 1 | |
357 | #endif | |
358 | #include <netdb.h>], [struct hostent_data data;], | |
359 | [libjava_cv_struct_hostent_data=yes], | |
360 | [libjava_cv_struct_hostent_data=no])]) | |
361 | if test "x$libjava_cv_struct_hostent_data" = xyes; then | |
362 | AC_DEFINE(HAVE_STRUCT_HOSTENT_DATA, 1, | |
363 | [Define if struct hostent_data is defined in netdb.h]) | |
364 | fi | |
365 | ]) | |
ee9dd372 TT |
366 | |
367 | AC_CHECK_FUNCS(gethostbyaddr_r, [ | |
368 | AC_DEFINE(HAVE_GETHOSTBYADDR_R) | |
369 | # There are two different kinds of gethostbyaddr_r. | |
370 | # We look for the one that returns `int'. | |
371 | # Hopefully this check is robust enough. | |
372 | AC_EGREP_HEADER(int.*gethostbyaddr_r, netdb.h, [ | |
373 | AC_DEFINE(GETHOSTBYADDR_R_RETURNS_INT)])]) | |
374 | ||
375 | AC_CHECK_FUNCS(gethostname, [ | |
376 | AC_DEFINE(HAVE_GETHOSTNAME) | |
377 | AC_EGREP_HEADER(gethostname, unistd.h, [ | |
378 | AC_DEFINE(HAVE_GETHOSTNAME_DECL)])]) | |
379 | ||
380 | # Look for these functions in the thread library. | |
381 | save_LIBS="$LIBS" | |
382 | LIBS="$LIBS $THREADLIBS" | |
7339705d TT |
383 | AC_CHECK_FUNCS(pthread_mutexattr_settype pthread_mutexattr_setkind_np) |
384 | ||
05ca950a RO |
385 | # Look for sched_yield. Up to Solaris 2.6, it is in libposix4, since |
386 | # Solaris 7 the name librt is preferred. | |
4b7f154f | 387 | AC_CHECK_FUNCS(sched_yield, , [ |
05ca950a | 388 | AC_CHECK_LIB(rt, sched_yield, [ |
4b7f154f | 389 | AC_DEFINE(HAVE_SCHED_YIELD) |
05ca950a RO |
390 | THREADLIBS="$THREADLIBS -lrt" |
391 | THREADSPECS="$THREADSPECS -lrt"], [ | |
392 | AC_CHECK_LIB(posix4, sched_yield, [ | |
7339705d | 393 | AC_DEFINE(HAVE_SCHED_YIELD) |
05ca950a RO |
394 | THREADLIBS="$THREADLIBS -lposix4" |
395 | THREADSPECS="$THREADSPECS -lposix4"])])]) | |
ee9dd372 TT |
396 | LIBS="$save_LIBS" |
397 | ||
398 | # We require a way to get the time. | |
399 | time_found=no | |
400 | AC_CHECK_FUNCS(gettimeofday time ftime, time_found=yes) | |
401 | if test "$time_found" = no; then | |
402 | AC_MSG_ERROR([no function found to get the time]) | |
403 | fi | |
404 | ||
138607df | 405 | AC_CHECK_FUNCS(memmove) |
ee9dd372 TT |
406 | |
407 | # We require memcpy. | |
408 | memcpy_found=no | |
409 | AC_CHECK_FUNCS(memcpy, memcpy_found=yes) | |
410 | if test "$memcpy_found" = no; then | |
411 | AC_MSG_ERROR([memcpy is required]) | |
412 | fi | |
413 | ||
f994389b TT |
414 | # Some library-finding code we stole from Tcl. |
415 | #-------------------------------------------------------------------- | |
416 | # Check for the existence of the -lsocket and -lnsl libraries. | |
417 | # The order here is important, so that they end up in the right | |
418 | # order in the command line generated by make. Here are some | |
419 | # special considerations: | |
420 | # 1. Use "connect" and "accept" to check for -lsocket, and | |
421 | # "gethostbyname" to check for -lnsl. | |
422 | # 2. Use each function name only once: can't redo a check because | |
423 | # autoconf caches the results of the last check and won't redo it. | |
424 | # 3. Use -lnsl and -lsocket only if they supply procedures that | |
425 | # aren't already present in the normal libraries. This is because | |
426 | # IRIX 5.2 has libraries, but they aren't needed and they're | |
427 | # bogus: they goof up name resolution if used. | |
428 | # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. | |
429 | # To get around this problem, check for both libraries together | |
430 | # if -lsocket doesn't work by itself. | |
431 | #-------------------------------------------------------------------- | |
432 | ||
433 | AC_CACHE_CHECK([for socket libraries], gcj_cv_lib_sockets, | |
434 | [gcj_cv_lib_sockets= | |
435 | gcj_checkBoth=0 | |
436 | unset ac_cv_func_connect | |
437 | AC_CHECK_FUNC(connect, gcj_checkSocket=0, gcj_checkSocket=1) | |
438 | if test "$gcj_checkSocket" = 1; then | |
439 | unset ac_cv_func_connect | |
440 | AC_CHECK_LIB(socket, main, gcj_cv_lib_sockets="-lsocket", | |
441 | gcj_checkBoth=1) | |
442 | fi | |
443 | if test "$gcj_checkBoth" = 1; then | |
444 | gcj_oldLibs=$LIBS | |
445 | LIBS="$LIBS -lsocket -lnsl" | |
446 | unset ac_cv_func_accept | |
447 | AC_CHECK_FUNC(accept, | |
448 | [gcj_checkNsl=0 | |
449 | gcj_cv_lib_sockets="-lsocket -lnsl"]) | |
450 | unset ac_cv_func_accept | |
451 | LIBS=$gcj_oldLibs | |
452 | fi | |
453 | unset ac_cv_func_gethostbyname | |
454 | gcj_oldLibs=$LIBS | |
455 | LIBS="$LIBS $gcj_cv_lib_sockets" | |
456 | AC_CHECK_FUNC(gethostbyname, , | |
457 | [AC_CHECK_LIB(nsl, main, | |
458 | [gcj_cv_lib_sockets="$gcj_cv_lib_sockets -lnsl"])]) | |
459 | unset ac_cv_func_gethostbyname | |
460 | LIBS=$gcj_oldLIBS | |
461 | ]) | |
462 | SYSTEMSPEC="$SYSTEMSPEC $gcj_cv_lib_sockets" | |
463 | ||
58eb6e7c AG |
464 | if test "$enable_interpreter" = yes; then |
465 | INTERPSPEC= | |
466 | fi | |
467 | ||
f994389b TT |
468 | if test "$with_system_zlib" = yes; then |
469 | AC_CHECK_LIB(z, deflate, ZLIBSPEC=-lz, ZLIBSPEC=-lzgcj) | |
470 | else | |
471 | ZLIBSPEC=-lzgcj | |
472 | fi | |
473 | ||
4b7f154f TT |
474 | # On Solaris, and maybe other architectures, the Boehm collector |
475 | # requires -ldl. | |
476 | if test "$GC" = boehm; then | |
477 | AC_CHECK_LIB(dl, main, SYSTEMSPEC="$SYSTEMSPEC -ldl") | |
478 | fi | |
479 | ||
01b02b11 TT |
480 | if test -d "$libgcj_basedir/../gcc/java"; then |
481 | GCJ= | |
482 | else | |
ee9dd372 TT |
483 | CANADIAN=yes |
484 | NULL_TARGET=yes | |
01b02b11 TT |
485 | GCJ=gcj |
486 | fi | |
ee9dd372 TT |
487 | fi |
488 | ||
f994389b TT |
489 | ZLIBS= |
490 | ZDEPS= | |
41e0e0cd | 491 | ZINCS= |
f994389b TT |
492 | if test "x$ZLIBSPEC" = "x-lzgcj"; then |
493 | # We include the path to the zlib build directory. | |
494 | # See Makefile.am to understand why. | |
495 | ZDEPS='$(top_builddir)/../zlib/libzgcj.la' | |
496 | ZLIBS="$ZDEPS -L\$(here)/../zlib/$libsubdir" | |
41e0e0cd | 497 | ZINCS='-I$(top_srcdir)/../zlib' |
f994389b TT |
498 | else |
499 | ZLIBS="$ZLIBSPEC" | |
500 | fi | |
501 | AC_SUBST(ZLIBS) | |
502 | AC_SUBST(ZDEPS) | |
41e0e0cd | 503 | AC_SUBST(ZINCS) |
67a60018 | 504 | AC_SUBST(DIVIDESPEC) |
f994389b | 505 | |
ee9dd372 TT |
506 | AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes) |
507 | AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes) | |
508 | AM_CONDITIONAL(NATIVE, test "$CANADIAN" = no || test "$NULL_TARGET" = yes) | |
b48ed568 | 509 | AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host") |
ee9dd372 TT |
510 | AC_SUBST(EH_COMMON_INCLUDE) |
511 | ||
01b02b11 TT |
512 | # Determine gcj version number. |
513 | if test "$GCJ" = ""; then | |
514 | if test -z "${with_multisubdir}"; then | |
515 | builddotdot=. | |
516 | else | |
517 | builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'` | |
518 | fi | |
519 | dir="`cd ${builddotdot}/../../gcc && pwd`" | |
520 | GCJ="$dir/gcj -B$dir/" | |
521 | fi | |
522 | changequote(<<,>>) | |
523 | gcjvers="`$GCJ -v 2>&1 | sed -n 's/^.*version \([^ ]*\).*$/\1/p'`" | |
524 | changequote([,]) | |
525 | AC_DEFINE_UNQUOTED(GCJVERSION, "$gcjvers") | |
526 | ||
086920c3 TT |
527 | # See if gcj supports -fuse-divide-subroutine. gcc 2.95 does not, and |
528 | # we want to continue to support that version. | |
529 | cat > conftest.java << 'END' | |
530 | public class conftest { } | |
531 | END | |
532 | use_fuse=yes | |
533 | $GCJ -fuse-divide-subroutine -fsyntax-only conftest.java || use_fuse=no | |
534 | rm -f conftest.java | |
535 | if test "$use_fuse" = no; then | |
536 | DIVIDESPEC= | |
537 | fi | |
538 | ||
ee9dd372 TT |
539 | AC_SUBST(AM_RUNTESTFLAGS) |
540 | ||
541 | dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there. | |
542 | dnl On that system, sys/ioctl.h will not include sys/filio.h unless | |
543 | dnl BSD_COMP is defined; just including sys/filio.h is simpler. | |
130e63de | 544 | 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) |
ee9dd372 TT |
545 | dnl We avoid AC_HEADER_DIRENT since we really only care about dirent.h |
546 | dnl for now. If you change this, you also must update natFile.cc. | |
547 | AC_CHECK_HEADERS(dirent.h) | |
548 | ||
a3e174ea | 549 | AC_CHECK_TYPE([ssize_t], [int]) |
ccfe7e46 AO |
550 | |
551 | AC_MSG_CHECKING([for in_addr_t]) | |
552 | AC_TRY_COMPILE([#include <sys/types.h> | |
553 | #if STDC_HEADERS | |
554 | #include <stdlib.h> | |
555 | #include <stddef.h> | |
556 | #endif | |
557 | #if HAVE_NETINET_IN_H | |
558 | #include <netinet/in.h> | |
559 | #endif], [in_addr_t foo;], | |
560 | [AC_DEFINE([HAVE_IN_ADDR_T]) | |
561 | AC_MSG_RESULT(yes)], | |
562 | [AC_MSG_RESULT(no)]) | |
563 | ||
564 | AC_MSG_CHECKING([whether struct ip_mreq is in netinet/in.h]) | |
565 | AC_TRY_COMPILE([#include <netinet/in.h>], [struct ip_mreq mreq;], | |
566 | [AC_DEFINE(HAVE_STRUCT_IP_MREQ) | |
567 | AC_MSG_RESULT(yes)], | |
568 | [AC_MSG_RESULT(no)]) | |
a3e174ea | 569 | |
ee9dd372 TT |
570 | AC_MSG_CHECKING([whether struct sockaddr_in6 is in netinet/in.h]) |
571 | AC_TRY_COMPILE([#include <netinet/in.h>], [struct sockaddr_in6 addr6;], | |
572 | [AC_DEFINE(HAVE_INET6) | |
573 | AC_MSG_RESULT(yes)], | |
574 | [AC_MSG_RESULT(no)]) | |
575 | ||
576 | AC_MSG_CHECKING([for socklen_t in sys/socket.h]) | |
577 | AC_TRY_COMPILE([#include <sys/socket.h>], [socklen_t x = 5;], | |
578 | [AC_DEFINE(HAVE_SOCKLEN_T) | |
579 | AC_MSG_RESULT(yes)], | |
580 | [AC_MSG_RESULT(no)]) | |
581 | ||
582 | AC_MSG_CHECKING([for tm_gmtoff in struct tm]) | |
583 | AC_TRY_COMPILE([#include <time.h>], [struct tm tim; tim.tm_gmtoff = 0;], | |
584 | [AC_DEFINE(STRUCT_TM_HAS_GMTOFF) | |
585 | AC_MSG_RESULT(yes)], | |
586 | [AC_MSG_RESULT(no) | |
587 | AC_MSG_CHECKING([for global timezone variable]) | |
588 | dnl FIXME: we don't want a link check here because that won't work | |
589 | dnl when cross-compiling. So instead we make an assumption that | |
590 | dnl the header file will mention timezone if it exists. | |
591 | AC_TRY_COMPILE([#include <time.h>], [long z2 = timezone;], | |
592 | [AC_DEFINE(HAVE_TIMEZONE) | |
593 | AC_MSG_RESULT(yes)], | |
594 | [AC_MSG_RESULT(no)])]) | |
595 | ||
596 | AC_FUNC_ALLOCA | |
597 | ||
598 | AC_CHECK_PROGS(PERL, perl, false) | |
599 | ||
a4e44caa AH |
600 | case "${host}" in |
601 | i?86-*-linux*) | |
602 | SIGNAL_HANDLER=include/i386-signal.h | |
603 | ;; | |
01f78a02 AH |
604 | sparc-sun-solaris*) |
605 | SIGNAL_HANDLER=include/sparc-signal.h | |
606 | ;; | |
a4e44caa AH |
607 | *) |
608 | SIGNAL_HANDLER=include/default-signal.h | |
609 | ;; | |
610 | esac | |
611 | ||
612 | AC_LINK_FILES($SIGNAL_HANDLER, include/java-signal.h) | |
613 | ||
ee9dd372 TT |
614 | if test "${multilib}" = "yes"; then |
615 | multilib_arg="--enable-multilib" | |
616 | else | |
617 | multilib_arg= | |
618 | fi | |
619 | ||
620 | here=`pwd` | |
621 | AC_SUBST(here) | |
622 | ||
f994389b | 623 | AC_OUTPUT(Makefile libgcj.spec testsuite/Makefile, |
ee9dd372 TT |
624 | [if test -n "$CONFIG_FILES"; then |
625 | ac_file=Makefile . ${libgcj_basedir}/../config-ml.in | |
626 | fi], | |
627 | srcdir=${srcdir} | |
628 | host=${host} | |
629 | target=${target} | |
630 | with_multisubdir=${with_multisubdir} | |
631 | ac_configure_args="${multilib_arg} ${ac_configure_args}" | |
632 | CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} | |
633 | libgcj_basedir=${libgcj_basedir} | |
634 | CC="${CC}" | |
635 | CXX="${CXX}" | |
636 | ) |