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