OSDN Git Service

* configure.in: Check for in_addr_t in netinet/in.h too. Check
[pf3gnuchains/gcc-fork.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
9 dnl We use these options to decide which functions to include.
10 AC_ARG_WITH(target-subdir,
11 [  --with-target-subdir=SUBDIR
12                           configuring in a subdirectory])
13 AC_ARG_WITH(cross-host,
14 [  --with-cross-host=HOST  configuring with a cross compiler])
15
16 LIBGCJ_CONFIGURE(.)
17
18 AM_CONFIG_HEADER(include/config.h)
19
20 AM_PROG_LIBTOOL
21
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,
35 [  --enable-fast-character prefer speed over size for Character],
36 # Nothing
37 , AC_DEFINE(COMPACT_CHARACTER))
38
39 dnl See if the user has requested runtime debugging.
40 AC_ARG_ENABLE(libgcj-debug,
41 [  --enable-libgcj-debug   enable runtime debugging code],
42   if test "$enable_libgcj_debug" = yes; then
43      AC_DEFINE(DEBUG)
44   fi)
45
46 dnl See if the user has the enterpreter included.
47 AC_ARG_ENABLE(interpreter,
48 [  --enable-interpreter    enable interpreter],
49   if test "$enable_interpreter" = yes; then
50      AC_DEFINE(INTERPRETER)
51   fi)
52
53 dnl This becomes -lffi if the interpreter is enabled.
54 INTERPSPEC=
55 AC_SUBST(INTERPSPEC)
56
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,
63 [  --with-ecos             enable runtime eCos target support],
64 TARGET_ECOS="$with_ecos"
65 )
66
67 case "$TARGET_ECOS" in
68    no)
69       FILE_DESCRIPTOR=natFileDescriptorPosix.cc
70       PROCESS=Posix
71       ;;
72    *)
73       FILE_DESCRIPTOR=natFileDescriptorEcos.cc
74       PROCESS=Ecos
75       AC_DEFINE(ECOS)
76       ;;
77 esac
78
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
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
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
101 SYSTEMSPEC=
102 AC_SUBST(SYSTEMSPEC)
103
104 AC_ARG_WITH(system-zlib,
105 [  --with-system-zlib      use installed libz])
106 ZLIBSPEC=
107 AC_SUBST(ZLIBSPEC)
108
109 dnl FIXME: this should be _libs on some hosts.
110 libsubdir=.libs
111
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
116 <<  --enable-java-gc=TYPE   choose garbage collector [boehm]>>,
117 changequote([,])
118   GC=$enableval,
119   GC=boehm)
120 GCLIBS=
121 GCINCS=
122 GCDEPS=
123 GCOBJS=
124 GCSPEC=
125 case "$GC" in
126  boehm)
127     AC_MSG_RESULT(boehm)
128     GCDEPS='$(top_builddir)/../boehm-gc/libgcjgc.la'
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"
132     GCINCS='-I$(top_srcdir)/../boehm-gc -I$(top_builddir)/../boehm-gc'
133     GCSPEC='-lgcjgc'
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`"
137     GCOBJS=boehm.lo
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)
144     GCOBJS=nogc.lo
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)
155 AC_SUBST(GCSPEC)
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])
163 AC_ARG_ENABLE(threads, [  --enable-threads=TYPE   choose threading package],
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*)
181        # FIXME: for now, choose POSIX, because we implement that.
182        # Later, choose irix threads.
183        THREADS=posix
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=
225 THREADSPEC=
226 case "$THREADS" in
227  posix)
228     THREADLIBS=-lpthread
229     THREADSPEC=-lpthread
230     THREADOBJS=posix-threads.lo
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)
239     THREADDEPS='$(top_builddir)/../qthreads/libgcjcoop.la'
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'
244     THREADOBJS=quick-threads.lo
245     THREADINCS='-I$(top_srcdir)/../qthreads'
246     THREADH=quick-threads.h
247     ;;
248
249  none)
250     THREADOBJS=no-threads.lo
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)
259 AC_SUBST(THREADSPEC)
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
297    ZLIBSPEC=-lgcj
298
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=
304       GCJ="${target_alias}/gcj"
305    else
306       GCJ=
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)
316    AC_CHECK_FUNCS(inet_pton uname inet_ntoa)
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, [
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    ])
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"
383    AC_CHECK_FUNCS(pthread_mutexattr_settype pthread_mutexattr_setkind_np)
384
385    # Look for sched_yield.  Up to Solaris 2.6, it is in libposix4, since
386    # Solaris 7 the name librt is preferred.
387    AC_CHECK_FUNCS(sched_yield, , [
388      AC_CHECK_LIB(rt, sched_yield, [
389        AC_DEFINE(HAVE_SCHED_YIELD)
390        THREADLIBS="$THREADLIBS -lrt"
391        THREADSPECS="$THREADSPECS -lrt"], [
392        AC_CHECK_LIB(posix4, sched_yield, [
393          AC_DEFINE(HAVE_SCHED_YIELD)
394          THREADLIBS="$THREADLIBS -lposix4"
395          THREADSPECS="$THREADSPECS -lposix4"])])])
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
405    AC_CHECK_FUNCS(memmove)
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
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
464    if test "$enable_interpreter" = yes; then
465       INTERPSPEC=
466    fi
467
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
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
480    if test -d "$libgcj_basedir/../gcc/java"; then
481       GCJ=
482    else
483       CANADIAN=yes
484       NULL_TARGET=yes
485       GCJ=gcj
486    fi
487 fi
488
489 ZLIBS=
490 ZDEPS=
491 ZINCS=
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"
497    ZINCS='-I$(top_srcdir)/../zlib'
498 else
499    ZLIBS="$ZLIBSPEC"
500 fi
501 AC_SUBST(ZLIBS)
502 AC_SUBST(ZDEPS)
503 AC_SUBST(ZINCS)
504 AC_SUBST(DIVIDESPEC)
505
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)
509 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
510 AC_SUBST(EH_COMMON_INCLUDE)
511
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
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
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.
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)
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
549 AC_CHECK_TYPE([ssize_t], [int])
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)])
569
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
600 case "${host}" in
601   i?86-*-linux*)
602     SIGNAL_HANDLER=include/i386-signal.h
603         ;;
604   sparc-sun-solaris*)
605     SIGNAL_HANDLER=include/sparc-signal.h
606         ;;
607   *)
608     SIGNAL_HANDLER=include/default-signal.h
609         ;;
610 esac
611
612 AC_LINK_FILES($SIGNAL_HANDLER, include/java-signal.h)
613
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
623 AC_OUTPUT(Makefile libgcj.spec testsuite/Makefile,
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 )