source: trunk/third/gcc/libjava/configure.in @ 16960

Revision 16960, 25.4 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r16959, which included commits to RCS files with non-trunk default branches.
Line 
1dnl Process this with autoconf to create configure
2AC_INIT(java/lang/System.java)
3
4AC_PROG_LN_S
5
6dnl We use these options to decide which functions to include.
7AC_ARG_WITH(target-subdir,
8[  --with-target-subdir=SUBDIR
9                           configuring in a subdirectory])
10AC_ARG_WITH(cross-host,
11[  --with-cross-host=HOST  configuring with a cross compiler])
12
13LIBGCJ_CONFIGURE(.)
14
15AM_CONFIG_HEADER(include/config.h)
16
17# Only use libltdl for native builds.
18if 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"
28fi
29AC_SUBST(INCLTDL)
30AC_SUBST(LIBLTDL)
31AC_SUBST(DIRLTDL)
32AM_PROG_LIBTOOL
33AC_CONFIG_SUBDIRS($DIRLTDL)
34
35if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then
36   COMPPATH=.
37else
38   COMPPATH=..
39fi
40AC_SUBST(COMPPATH)
41
42dnl The -no-testsuite modules omit the test subdir.
43AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
44
45dnl See whether the user prefers size or speed for Character.
46dnl The default is size.
47AC_ARG_ENABLE(fast-character,
48[  --enable-fast-character prefer speed over size for Character],
49# Nothing
50, AC_DEFINE(COMPACT_CHARACTER))
51
52dnl Should the runtime set system properties by examining the
53dnl environment variable GCJ_PROPERTIES?
54AC_ARG_ENABLE(getenv-properties,
55[  --disable-getenv-properties
56                          don't set system properties from GCJ_PROPERTIES])
57
58dnl Whether GCJ_PROPERTIES is used depends on the target.
59if test -n "$enable_getenv_properties"; then
60   enable_getenv_properties=${enable_getenv_properties_default-yes}
61fi
62if test "$enable_getenv_properties" = no; then
63   AC_DEFINE(DISABLE_GETENV_PROPERTIES)
64fi
65
66dnl See if the user has requested runtime debugging.
67LIBGCJDEBUG="false"
68AC_SUBST(LIBGCJDEBUG)
69AC_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
76dnl See if the user has the interpreter included.
77AC_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
86if test "$libgcj_interpreter" = yes; then
87   AC_DEFINE(INTERPRETER)
88fi
89
90AC_MSG_CHECKING([for exception model to use])
91AC_LANG_SAVE
92AC_LANG_CPLUSPLUS
93AC_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.
97dnl Link tests against libgcc.a are problematic since -- at least
98dnl as of this writing -- we've not been given proper -L bits for
99dnl single-tree newlib and libgloss.
100dnl
101dnl This is what AC_TRY_COMPILE would do if it didn't delete the
102dnl conftest files before we got a change to grep them first.
103cat > conftest.$ac_ext << EOF
104[#]line __oline__ "configure"
105struct S { ~S(); };
106void bar();
107void foo()
108{
109  S s;
110  bar();
111}
112EOF
113old_CXXFLAGS="$CXXFLAGS" 
114CXXFLAGS=-S
115if 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
121fi
122CXXFLAGS="$old_CXXFLAGS"
123rm -f conftest*])
124if 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
128elif test x$enable_sjlj_exceptions = xno; then
129  ac_exception_model_name="call frame"
130else
131  AC_MSG_ERROR([unable to detect exception model])
132fi
133AC_LANG_RESTORE
134AC_MSG_RESULT($ac_exception_model_name)
135
136AC_MSG_CHECKING([for data_start])
137LIBDATASTARTSPEC=
138NEEDS_DATA_START=
139AC_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)])
144AC_SUBST(LIBDATASTARTSPEC)
145
146dnl See if the user wants to disable java.net.  This is the mildly
147dnl ugly way that we admit that target-side configuration sucks.
148AC_ARG_ENABLE(java-net,
149[  --disable-java-net      disable java.net])
150
151dnl Whether java.net is built by default can depend on the target.
152if test -n "$enable_java_net"; then
153   enable_java_net=${enable_java_net_default-yes}
154fi
155if test "$enable_java_net" = no; then
156   AC_DEFINE(DISABLE_JAVA_NET)
157fi
158
159dnl See if the user wants to disable JVMPI support.
160AC_ARG_ENABLE(jvmpi,
161[  --disable-jvmpi         disable JVMPI support])
162
163if test "$enable_jvmpi" != no; then
164    AC_DEFINE(ENABLE_JVMPI)
165fi
166
167dnl If the target is an eCos system, use the appropriate eCos
168dnl I/O routines.
169dnl FIXME: this should not be a local option but a global target
170dnl system; at present there is no eCos target.
171TARGET_ECOS="no"
172AC_ARG_WITH(ecos,
173[  --with-ecos             enable runtime eCos target support],
174TARGET_ECOS="$with_ecos"
175)
176
177case "$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      ;;
187esac
188
189AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED))
190AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED))
191AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED))
192AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED))
193
194
195dnl These may not be defined in a non-ANS conformant embedded system.
196dnl FIXME: Should these case a runtime exception in that case?
197AC_EGREP_HEADER(mktime, time.h, AC_DEFINE(HAVE_MKTIME))
198AC_EGREP_HEADER(localtime, time.h, AC_DEFINE(HAVE_LOCALTIME))
199
200dnl Create the subdirectory for natFileDescriptor.cc, or the attempt
201dnl to create the link will fail.
202test -d java || mkdir java
203test -d java/io || mkdir java/io
204test -d gnu || mkdir gnu
205AC_LINK_FILES(java/io/$FILE_DESCRIPTOR, java/io/natFileDescriptor.cc)
206
207dnl Likewise for ConcreteProcess.java and natConcreteProcess.cc.
208test -d java/lang || mkdir java/lang
209AC_LINK_FILES(java/lang/${PROCESS}Process.java, java/lang/ConcreteProcess.java)
210AC_LINK_FILES(java/lang/nat${PROCESS}Process.cc, java/lang/natConcreteProcess.cc)
211
212SYSTEMSPEC=
213AC_SUBST(SYSTEMSPEC)
214
215LIBGCJTESTSPEC="-L`pwd`/.libs -rpath `pwd`/.libs"
216AC_SUBST(LIBGCJTESTSPEC)
217
218AC_ARG_WITH(system-zlib,
219[  --with-system-zlib      use installed libz])
220ZLIBSPEC=
221AC_SUBST(ZLIBSPEC)
222ZLIBTESTSPEC=
223AC_SUBST(ZLIBTESTSPEC)
224
225dnl FIXME: this should be _libs on some hosts.
226libsubdir=.libs
227
228dnl Allow the GC to be disabled.  Can be useful when debugging.
229AC_MSG_CHECKING([for garbage collector to use])
230AC_ARG_ENABLE(java-gc,
231changequote(<<,>>)dnl
232<<  --enable-java-gc=TYPE   choose garbage collector [boehm]>>,
233changequote([,])
234  GC=$enableval,
235  GC=boehm)
236GCLIBS=
237GCINCS=
238GCDEPS=
239GCOBJS=
240GCSPEC=
241JC1GCSPEC=
242GCTESTSPEC=
243case "$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    ;;
270esac
271AC_SUBST(GCLIBS)
272AC_SUBST(GCINCS)
273AC_SUBST(GCDEPS)
274AC_SUBST(GCOBJS)
275AC_SUBST(GCSPEC)
276AC_SUBST(JC1GCSPEC)
277AC_SUBST(GCTESTSPEC)
278AC_LINK_FILES(include/$GCHDR, include/java-gc.h)
279
280
281AC_MSG_CHECKING([for thread model used by GCC])
282THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
283AC_MSG_RESULT([$THREADS])
284
285case "$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    ;;
303esac
304
305THREADLIBS=
306THREADINCS=
307THREADDEPS=
308THREADOBJS=
309THREADH=
310THREADSPEC=
311case "$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    ;;
334esac
335AC_LINK_FILES(include/$THREADH, include/java-threads.h)
336AC_SUBST(THREADLIBS)
337AC_SUBST(THREADINCS)
338AC_SUBST(THREADDEPS)
339AC_SUBST(THREADOBJS)
340AC_SUBST(THREADSPEC)
341
342AM_CONDITIONAL(USING_GCC, test "$GCC" = yes)
343
344CANADIAN=no
345NULL_TARGET=no
346NATIVE=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.
351echo "probing $srcdir/../gcc/unwind.h"
352if test -r $libgcj_basedir/../gcc/unwind.h; then
353   GCC_UNWIND_INCLUDE='-I$(libgcj_basedir)/../gcc'
354else
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
360fi
361
362if 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
393else
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
585changequote(<<,>>)
586      builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`
587changequote([,])
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
597fi
598
599# Create it, so that compile/link tests don't fail
600test -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
604GCJ_SAVE_CPPFLAGS=$CPPFLAGS
605CPPFLAGS="$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 :-(
609if 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
621fi
622
623LT_AC_PROG_GCJ
624
625CPPFLAGS=$GCJ_SAVE_CPPFLAGS
626
627dnl FIXME: cross compilation
628AC_CHECK_SIZEOF(void *)
629
630ZLIBS=
631ZDEPS=
632ZINCS=
633if 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'
639else
640   ZLIBS="$ZLIBSPEC"
641fi
642AC_SUBST(ZLIBS)
643AC_SUBST(ZDEPS)
644AC_SUBST(ZINCS)
645AC_SUBST(DIVIDESPEC)
646AC_SUBST(EXCEPTIONSPEC)
647
648AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
649AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes)
650AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes || test "$NULL_TARGET" = yes)
651AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
652AM_CONDITIONAL(NEEDS_DATA_START, test "$NEEDS_DATA_START" = yes && test "$NATIVE" = yes)
653AC_SUBST(GCC_UNWIND_INCLUDE)
654
655# Determine gcj version number.
656changequote(<<,>>)
657gcjvers="`$GCJ -v 2>&1 | sed -n 's/^.*version \([^ ]*\).*$/\1/p'`"
658changequote([,])
659AC_DEFINE_UNQUOTED(GCJVERSION, "$gcjvers")
660AC_SUBST(GCJVERSION)
661
662AC_SUBST(AM_RUNTESTFLAGS)
663
664dnl Work around a g++ bug.  Reported to gcc-bugs@gcc.gnu.org on Jan 22, 2000.
665AC_MSG_CHECKING([for g++ -ffloat-store bug])
666save_CFLAGS="$CFLAGS"
667CFLAGS="-x c++ -O2 -ffloat-store"
668AC_TRY_COMPILE([#include <math.h>], ,
669  [AC_MSG_RESULT(no)],
670  [AC_DEFINE(__NO_MATH_INLINES)
671   AC_MSG_RESULT(yes)])
672CFLAGS="$save_CFLAGS"
673
674dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
675dnl On that system, sys/ioctl.h will not include sys/filio.h unless
676dnl BSD_COMP is defined; just including sys/filio.h is simpler.
677AC_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)
678dnl We avoid AC_HEADER_DIRENT since we really only care about dirent.h
679dnl for now.  If you change this, you also must update natFile.cc.
680AC_CHECK_HEADERS(dirent.h)
681
682AC_CHECK_TYPE([ssize_t], [int])
683
684AC_MSG_CHECKING([for in_addr_t])
685AC_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
697AC_MSG_CHECKING([whether struct ip_mreq is in netinet/in.h])
698AC_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
703AC_MSG_CHECKING([whether struct ipv6_mreq is in netinet/in.h])
704AC_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
709AC_MSG_CHECKING([whether struct sockaddr_in6 is in netinet/in.h])
710AC_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
715AC_MSG_CHECKING([for socklen_t in sys/socket.h])
716AC_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
723AC_MSG_CHECKING([for tm_gmtoff in struct tm])
724AC_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
737AC_FUNC_ALLOCA
738
739AC_CHECK_PROGS(PERL, perl, false)
740
741SYSDEP_SOURCES=
742
743case "${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    ;;
763esac
764
765# If we're using sjlj exceptions, forget what we just learned.
766if test "$enable_sjlj_exceptions" = yes; then
767   SIGNAL_HANDLER=include/default-signal.h
768fi
769
770AC_SUBST(SYSDEP_SOURCES)
771
772AC_LINK_FILES($SIGNAL_HANDLER, include/java-signal.h)
773
774if test "${multilib}" = "yes"; then
775  multilib_arg="--enable-multilib"
776else
777  multilib_arg=
778fi
779
780AC_PATH_XTRA
781
782dnl Determine which AWT peer libraries to build
783AC_ARG_ENABLE(java-awt,
784[  --enable-java-awt       list of AWT peer implementations to be built])
785
786peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
787use_xlib_awt=""
788use_gtk_awt=""
789
790for 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
807done
808
809AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes)
810AM_CONDITIONAL(GTK_AWT, test "$use_gtk_awt" = yes)
811
812
813here=`pwd`
814AC_SUBST(here)
815
816# We get this from the environment.
817AC_SUBST(GCJFLAGS)
818
819AC_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
822fi
823
824# Make subdirectories and `.d' files.  Look in both srcdir and
825# builddir for the .java files.
826h=`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 || {
835changequote(<<,>>)
836         d=`echo $f | sed -e 's,/[^/]*$,,'`
837changequote([,])
838         $libgcj_basedir/../mkinstalldirs $d
839         echo > $f
840      }
841   done
842],
843srcdir=${srcdir}
844host=${host}
845target=${target}
846with_multisubdir=${with_multisubdir}
847ac_configure_args="${multilib_arg} ${ac_configure_args}"
848CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
849libgcj_basedir=${libgcj_basedir}
850CC="${CC}"
851CXX="${CXX}"
852)
Note: See TracBrowser for help on using the repository browser.