1 dnl # Process this with autoconf to create configure
3 # Still use "libjava" here to placate dejagnu.
4 AC_INIT([libjava], [version-unused],, [libjava])
6 AC_CONFIG_SRCDIR(java/lang/System.java)
10 # We use these options to decide which functions to include.
11 AC_ARG_WITH(target-subdir,
12 AS_HELP_STRING([--with-target-subdir=SUBDIR],
13 [configure in a subdirectory]))
15 # We may get other options which we don't document:
16 # --with-target-subdir, --with-multisrctop, --with-multisubdir
18 # When building with srcdir == objdir, links to the source files will
19 # be created in directories within the target_subdir. We have to
20 # adjust toplevel_srcdir accordingly, so that configure finds
21 # install-sh and other auxiliary files that live in the top-level
23 if test "${srcdir}" = "."; then
24 if test -z "${with_target_subdir}"; then
27 if test "${with_target_subdir}" != "."; then
28 toprel="${with_multisrctop}../.."
30 toprel="${with_multisrctop}.."
37 libgcj_basedir=$srcdir/$toprel/./libjava
38 AC_SUBST(libgcj_basedir)
41 _GCC_TOPLEV_NONCANONICAL_BUILD
42 _GCC_TOPLEV_NONCANONICAL_TARGET
44 AC_SUBST(target_noncanonical)
46 # This works around the fact that libtool configuration may change LD
47 # for this particular configuration, but some shells, instead of
48 # keeping the changes in LD private, export them just because LD is
50 ORIGINAL_LD_FOR_MULTILIBS=$LD
54 # This works around an automake problem.
55 mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
56 AC_SUBST(mkinstalldirs)
58 AC_ARG_WITH(cross-host,
59 AS_HELP_STRING([--with-cross-host=HOST],
60 [configure with a cross compiler from HOST]))
63 AS_HELP_STRING([--with-newlib],
64 [configure with newlib]))
66 AC_ARG_ENABLE(version-specific-runtime-libs,
67 AS_HELP_STRING([--enable-version-specific-runtime-libs],
68 [specify that runtime libraries should be installed in a compiler-specific directory]),
70 yes) version_specific_libs=yes ;;
71 no) version_specific_libs=no ;;
72 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
74 [version_specific_libs=no]
77 # Default to --enable-multilib
78 AC_ARG_ENABLE(multilib,
79 AS_HELP_STRING([--enable-multilib],
80 [build many library versions (default)]),
81 [case "${enableval}" in
84 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
85 esac], [multilib=yes])dnl
88 AS_HELP_STRING([--enable-plugin],
89 [build gcjwebplugin web browser plugin]),
91 yes) plugin_enabled=yes ;;
92 no) plugin_enabled=no ;;
93 *) AC_MSG_ERROR([Unknown argument to enable/disable plugin]);;
98 AC_ARG_ENABLE(gconf-peer,
99 AS_HELP_STRING([--enable-gconf-peer],
100 [compile GConf native peers for util.preferences]),
101 [case "$enableval" in
102 yes) gconf_enabled=yes ;;
103 no) gconf_enabled=no ;;
104 *) AC_MSG_ERROR([Unknown argument to enable/disable gconf-peer]);;
109 # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.
112 # (1) We use an abnormal CXX (without library references), so we
113 # must cache it under a different name.
114 # (2) CC, CFLAGS, CXX, CXXFLAGS, LDFLAGS must not be 'precious', or
115 # the non-multilib-adjusted value will be used in multilibs.
116 # (3) As a side effect, we must SUBST CXXFLAGS, CFLAGS, and LDFLAGS ourselves.
117 # (4) As another side effect, automake doesn't automatically include them
119 # (5) For libstdc++-v3, -fno-builtin must be present here so that a
120 # non-conflicting form of std::exit can be guessed by AC_PROG_CXX, and
121 # used in later tests. This may not be necessary in libjava; I don't know.
122 m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX])
123 m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS])
124 m4_define([_AC_ARG_VAR_PRECIOUS],[])
125 save_CXXFLAGS="$CXXFLAGS"
126 CXXFLAGS="$CXXFLAGS -fno-builtin"
129 CXXFLAGS="$save_CXXFLAGS"
130 m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
135 AM_INIT_AUTOMAKE([1.9.0])
137 AC_CHECK_TOOL(AS, as)
138 AC_CHECK_TOOL(LD, ld)
139 AC_CHECK_TOOL(AR, ar)
140 AC_CHECK_TOOL(RANLIB, ranlib, :)
142 AC_CHECK_PROGS([JAR], [jar fastjar], no)
143 AC_PATH_PROG([ZIP], [zip], no)
144 AC_PATH_PROG([UNZIP], [unzip], unzip)
145 AM_CONDITIONAL(BASH_JAR, test "$JAR" = no)
146 if test "$ZIP" = no; then
147 if test "$JAR" = no; then
148 AC_MSG_ERROR([cannot find neither zip nor jar, cannot continue])
151 # InfoZIP available, use the 'guaranteed' Bourne-shell JAR to build libjava
152 JAR=`pwd`/scripts/jar
161 # configure.host sets the following important variables
162 # libgcj_cflags - host specific C compiler flags
163 # libgcj_cxxflags - host specific C++ compiler flags
164 # libgcj_javaflags - host specific Java compiler flags
170 . ${srcdir}/configure.host
172 LIBGCJ_CFLAGS="${libgcj_cflags}"
173 LIBGCJ_CXXFLAGS="${libgcj_cxxflags}"
174 LIBGCJ_JAVAFLAGS="${libgcj_javaflags}"
175 LIBGCJ_LD_SYMBOLIC="${libgcj_ld_symbolic}"
176 AC_SUBST(LIBGCJ_CFLAGS)
177 AC_SUBST(LIBGCJ_CXXFLAGS)
178 AC_SUBST(LIBGCJ_JAVAFLAGS)
179 AC_SUBST(LIBGCJ_LD_SYMBOLIC)
181 # Only use libltdl for non-newlib builds.
182 if test "x${with_newlib}" = "x" || test "x${with_newlib}" = "xno"; then
186 AC_CONFIG_HEADERS([include/config.h gcj/libgcj-config.h])
188 # See if the user has requested runtime debugging.
189 LIBGCJDEBUG="disable"
190 AC_SUBST(LIBGCJDEBUG)
191 AC_ARG_ENABLE(libgcj-debug,
192 AS_HELP_STRING([--enable-libgcj-debug],
193 [enable runtime debugging code]),
194 [if test "$enable_libgcj_debug" = yes; then
195 AC_DEFINE(DEBUG, 1, [Define this if you want runtime debugging enabled.])
199 # Determine which AWT peer libraries to build
200 AC_ARG_ENABLE(java-awt,
201 AS_HELP_STRING([--enable-java-awt],
202 [list of AWT peer implementations to be built]))
204 peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
208 # The default toolkit to use is the first one specified.
212 for peer in $peerlibs ; do
215 if test "$no_x" = yes; then
216 echo "*** xlib peers requested but no X library available" 1>&2
220 if test -z "$TOOLKIT"; then
221 TOOLKIT=gnu.awt.xlib.XToolkit
226 if test "$no_x" = yes; then
227 echo "*** gtk peers requested but no X library available" 1>&2
231 if test -z "$TOOLKIT"; then
232 TOOLKIT=gnu.java.awt.peer.gtk.GtkToolkit
237 if test "$no_x" = yes; then
238 # Perhaps we should admit the possibility of embedded Qt.
239 echo "*** Qt peers requested but no X library available" 1>&2
243 if test -z "$TOOLKIT"; then
244 TOOLKIT=gnu.java.awt.peer.qt.QtToolkit
255 echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
260 AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes)
262 # Create standard.omit based on decisions we just made.
263 cp $srcdir/standard.omit.in standard.omit
264 if test "$use_xlib_awt" != yes; then
265 echo gnu/awt/xlib >> standard.omit
266 echo gnu/gcj/xlib >> standard.omit
269 if test -z "${with_multisubdir}"; then
272 builddotdot=`echo ${with_multisubdir} | sed -e 's:[[^/]][[^/]]*:..:g'`
277 # Which gcj do we use?
279 built_gcc_dir="`cd ${builddotdot}/../../${host_subdir}/gcc && ${PWDCMD-pwd}`"
280 if test -n "${with_cross_host}"; then
281 # We are being configured with a cross compiler. We can't
282 # use ac_exeext, because that is for the target platform.
285 case "${with_cross_host}" in
287 cross_host_exeext=.exe
290 if test -x "${built_gcc_dir}/gcj${cross_host_exeext}"; then
291 if test x"$build_noncanonical" = x"$with_cross_host"; then
292 # Ordinary cross (host!=target and host=build)
295 # Canadian cross (host!=target and host!=build)
302 # We are being configured with a native or crossed-native compiler
303 if test -x "${built_gcc_dir}/gcj${ac_exeext}"; then
304 if test x"$build" = x"$host"; then
305 # True native build (host=target and host=build)
308 # Crossed-native build (host=target and host!=build)
315 case "${which_gcj}" in
317 GCJ="$built_gcc_dir/gcj -B`${PWDCMD-pwd}`/ -B$built_gcc_dir/"
318 GCJH='$(top_builddir)/$(MULTIBUILDTOP)../../$(host_subdir)/gcc/gcjh'
321 if test "x${with_newlib}" = "xyes"; then
322 # FIXME (comment): Why is this needed?
324 GCJ="${target_noncanonical}-gcj"
326 GCJ="$built_gcc_dir/gcj -B$built_gcc_dir/"
328 GCJH="$built_gcc_dir/gcjh"
331 GCJ="gcj -B`${PWDCMD-pwd}`/"
338 # Create it, so that compile/link tests don't fail
339 test -f libgcj.spec || touch libgcj.spec
343 # Set up to configure Classpath.
344 # FIXME: no supported way to pass args in autoconf.
345 ac_configure_args="$ac_configure_args --with-fastjar=$JAR"
346 ac_configure_args="$ac_configure_args --enable-tool-wrappers"
347 ac_configure_args="$ac_configure_args --disable-load-library"
348 ac_configure_args="$ac_configure_args --${LIBGCJDEBUG}-debug"
349 ac_configure_args="$ac_configure_args --enable-default-toolkit=$TOOLKIT"
350 dir1=`cd $srcdir && pwd`
352 ac_configure_args="$ac_configure_args --with-vm-classes=$dir1:$dir2"
353 ac_configure_args="$ac_configure_args --disable-core-jni"
355 ac_configure_args="$ac_configure_args --disable-examples"
356 ac_configure_args="$ac_configure_args --with-glibj=build"
357 if test "$plugin_enabled" != yes; then
358 ac_configure_args="$ac_configure_args --disable-plugin"
360 if test "$gconf_enabled" != yes; then
361 ac_configure_args="$ac_configure_args --disable-gconf-peer"
362 ac_configure_args="$ac_configure_args --enable-default-preferences-peer=gnu.java.util.prefs.FileBasedFactory"
364 if test "$use_gtk_awt" != yes; then
365 ac_configure_args="$ac_configure_args --disable-gtk-peer"
367 if test "$use_qt_awt" != yes; then
368 ac_configure_args="$ac_configure_args --disable-qt-peer"
370 # We need this as qt is disabled by default in classpath.
371 ac_configure_args="$ac_configure_args --enable-qt-peer"
374 dnl --with-javah=$GCJH
376 dnl gtk-cairo -- just export here...
377 dnl --enable-regen-headers?
379 # Only use libltdl for non-newlib builds.
380 if test "x${with_newlib}" = "x" || test "x${with_newlib}" = "xno"; then
381 AC_LIBLTDL_CONVENIENCE
384 AC_DEFINE(USE_LTDL, 1, [Define if libltdl is in use.])
385 # Sigh. Libtool's macro doesn't do the right thing.
386 INCLTDL="-I\$(top_srcdir)/libltdl $INCLTDL"
387 # FIXME: this is a hack.
388 sub_auxdir="`cd $ac_aux_dir && ${PWDCMD-pwd}`"
389 ac_configure_args="$ac_configure_args --with-auxdir=$sub_auxdir"
398 AC_CONFIG_SUBDIRS(classpath libltdl)
400 # The -no-testsuite modules omit the test subdir.
401 AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
403 # Should the runtime set system properties by examining the
404 # environment variable GCJ_PROPERTIES?
405 AC_ARG_ENABLE(getenv-properties,
406 AS_HELP_STRING([--disable-getenv-properties],
407 [don't set system properties from GCJ_PROPERTIES]))
409 # Whether GCJ_PROPERTIES is used depends on the target.
410 if test -z "$enable_getenv_properties"; then
411 enable_getenv_properties=${enable_getenv_properties_default-yes}
413 if test "$enable_getenv_properties" = no; then
414 AC_DEFINE(DISABLE_GETENV_PROPERTIES, 1,
415 [Define if system properties shouldn't be read from getenv("GCJ_PROPERTIES").])
418 # Whether we should use arguments to main()
419 if test -z "$enable_main_args"; then
420 enable_main_args=${enable_main_args_default-yes}
422 if test "$enable_main_args" = no; then
423 AC_DEFINE(DISABLE_MAIN_ARGS, 1, [Define if we should ignore arguments to main().])
427 # Should we use hashtable-based synchronization?
428 # Currently works only for Linux X86/ia64
429 # Typically faster and more space-efficient
430 AC_ARG_ENABLE(hash-synchronization,
431 AS_HELP_STRING([--enable-hash-synchronization],
432 [use global hash table for monitor locks]))
434 if test -z "$enable_hash_synchronization"; then
435 enable_hash_synchronization=$enable_hash_synchronization_default
438 AC_ARG_WITH(java-home,
439 AS_HELP_STRING([--with-java-home=DIRECTORY],
440 [value of java.home system property]),
441 [JAVA_HOME="${withval}"], [JAVA_HOME=""])
442 AM_CONDITIONAL(JAVA_HOME_SET, test ! -z "$JAVA_HOME")
445 # What is the native OS API for MinGW?
446 AC_ARG_WITH(win32-nlsapi,
447 AS_HELP_STRING([--with-win32-nlsapi=ansi or unicows or unicode],
448 [native MinGW libgcj Win32 OS API (default is ansi)]),
449 [case "${withval}" in
450 ansi) with_win32_nlsapi=ansi ;;
451 unicows) with_win32_nlsapi=unicows ;;
452 unicode) with_win32_nlsapi=unicode ;;
453 *) AC_MSG_ERROR(Bad value ${withval} for --with-win32-nlsapi.) ;;
454 esac],[with_win32_nlsapi=ansi])
456 case "${with_win32_nlsapi}" in
458 AC_DEFINE(MINGW_LIBGCJ_UNICODE, 1,
459 [Define if MinGW libgcj uses the Windows UNICODE OS API.])
463 # configure.host sets slow_pthread_self if the synchronization code should
464 # try to avoid pthread_self calls by caching thread IDs in a hashtable.
465 if test "${slow_pthread_self}" = "yes"; then
466 AC_DEFINE(SLOW_PTHREAD_SELF, 1,
467 [Define if if the synchronization code should try to avoid pthread_self calls by caching thread IDs in a hashtable.])
470 # Check for gc debugging. This option is handled both here and in the GC.
471 AC_ARG_ENABLE(gc-debug,
472 AS_HELP_STRING([--enable-gc-debug],
473 [include full support for pointer backtracing etc.]),
474 [ if test "$enable_gc_debug" = "yes"; then
475 AC_DEFINE(LIBGCJ_GC_DEBUG, 1,
476 [Define if we want to use debug calls into the garbage collector.])
479 # See if the user has the interpreter included.
480 AC_ARG_ENABLE(interpreter,
481 AS_HELP_STRING([--enable-interpreter],
482 [enable interpreter]),
483 [if test "$enable_interpreter" = yes; then
484 # This can also be set in configure.host.
485 libgcj_interpreter=yes
486 elif test "$enable_interpreter" = no; then
487 libgcj_interpreter=no
490 if test "$libgcj_interpreter" = yes; then
491 AC_DEFINE(INTERPRETER, 1, [Define if you want a bytecode interpreter.])
493 INTERPRETER="$libgcj_interpreter"
494 AC_SUBST(INTERPRETER)
496 AC_MSG_CHECKING([for exception model to use])
498 AC_ARG_ENABLE(sjlj-exceptions,
499 AS_HELP_STRING([--enable-sjlj-exceptions],
500 [force use of builtin_setjmp for exceptions]),
502 [dnl Botheration. Now we've got to detect the exception model.
503 dnl Link tests against libgcc.a are problematic since -- at least
504 dnl as of this writing -- we've not been given proper -L bits for
505 dnl single-tree newlib and libgloss.
507 dnl This is what AC_TRY_COMPILE would do if it didn't delete the
508 dnl conftest files before we got a change to grep them first.
509 cat > conftest.$ac_ext << EOF
510 [#]line __oline__ "configure"
519 old_CXXFLAGS="$CXXFLAGS"
521 if AC_TRY_EVAL(ac_compile); then
522 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
523 enable_sjlj_exceptions=yes
524 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
525 enable_sjlj_exceptions=no
528 CXXFLAGS="$old_CXXFLAGS"
530 if test x$enable_sjlj_exceptions = xyes; then
531 AC_DEFINE(SJLJ_EXCEPTIONS, 1,
532 [Define if the compiler is configured for setjmp/longjmp exceptions.])
533 ac_exception_model_name=sjlj
534 elif test x$enable_sjlj_exceptions = xno; then
535 ac_exception_model_name="call frame"
537 AC_MSG_ERROR([unable to detect exception model])
540 AC_MSG_RESULT($ac_exception_model_name)
542 # If we are non using SJLJ exceptions, and this host does not have support
543 # for unwinding from a signal handler, enable checked dereferences and divides.
544 if test $can_unwind_signal = no && test $enable_sjlj_exceptions = no; then
545 CHECKREFSPEC=-fcheck-references
546 DIVIDESPEC=-fuse-divide-subroutine
550 # See if the user wants to disable java.net. This is the mildly
551 # ugly way that we admit that target-side configuration sucks.
552 AC_ARG_ENABLE(java-net,
553 AS_HELP_STRING([--disable-java-net],
556 # Whether java.net is built by default can depend on the target.
557 if test -z "$enable_java_net"; then
558 enable_java_net=${enable_java_net_default-yes}
560 if test "$enable_java_net" = no; then
561 AC_DEFINE(DISABLE_JAVA_NET, 1, [Define if java.net native functions should be stubbed out.])
564 # See if the user wants to configure without libffi. Some
565 # architectures don't support it, and default values are set in
568 AS_HELP_STRING([--without-libffi],
571 [with_libffi=${with_libffi_default-yes}])
575 if test "$with_libffi" != no; then
576 AC_DEFINE(USE_LIBFFI, 1, [Define if we're to use libffi.])
577 LIBFFI=../libffi/libffi_convenience.la
578 LIBFFIINCS='-I$(top_srcdir)/../libffi/include -I../libffi/include'
583 # See if the user wants to disable JVMPI support.
585 AS_HELP_STRING([--disable-jvmpi],
586 [disable JVMPI support]))
588 if test "$enable_jvmpi" != no; then
589 AC_DEFINE(ENABLE_JVMPI, 1, [Define if you are using JVMPI.])
592 # If the target is an eCos system, use the appropriate eCos
594 # FIXME: this should not be a local option but a global target
595 # system; at present there is no eCos target.
596 TARGET_ECOS=${PROCESS-"no"}
598 [ --with-ecos enable runtime eCos target support],
599 TARGET_ECOS="$with_ecos"
602 PLATFORM_INNER_NAT_HDRS=
603 case "$TARGET_ECOS" in
609 CHECK_FOR_BROKEN_MINGW_LD
615 PLATFORM_INNER_NAT_HDRS='java/lang/ConcreteProcess$$ProcessManager.h'
622 AC_DEFINE(ECOS, 1, [Define if you're running eCos.])
626 AC_SUBST(PLATFORM_INNER_NAT_HDRS)
627 AC_CONFIG_LINKS(include/platform.h:include/$PLATFORMH)
629 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1,
630 [Define if you have int32_t and uint32_t.]))
631 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1,
632 [Define if you have int32_t and uint32_t.]))
633 AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1,
634 [Define if you have u_int32_t]))
635 AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1,
636 [Define if you have u_int32_t]))
638 AM_CONDITIONAL(USING_WIN32_PLATFORM, test "$PLATFORM" = Win32)
639 AM_CONDITIONAL(USING_POSIX_PLATFORM, test "$PLATFORM" = Posix || test "$PLATFORM" = Ecos)
642 *-darwin*) DARWIN_CRT=true ;;
643 *) DARWIN_CRT=false ;;
645 AM_CONDITIONAL(USING_DARWIN_CRT, $DARWIN_CRT)
647 # These may not be defined in a non-ANS conformant embedded system.
648 # FIXME: Should these case a runtime exception in that case?
649 AC_EGREP_HEADER(mktime, time.h, AC_DEFINE(HAVE_MKTIME, 1,
650 [Define is you have 'mktime' in <time.h>]))
651 AC_EGREP_HEADER(localtime, time.h, AC_DEFINE(HAVE_LOCALTIME, 1,
652 [Define is you have 'localtime' in <time.h>]))
654 # Create the subdirectory for natFile.cc, or the attempt
655 # to create the link will fail.
656 test -d java || mkdir java
657 test -d java/io || mkdir java/io
658 test -d gnu || mkdir gnu
659 AC_CONFIG_LINKS(java/io/natFile.cc:java/io/natFile${FILE-${PLATFORM}}.cc)
661 # Likewise for ConcreteProcess.java and natConcreteProcess.cc.
662 test -d java/lang || mkdir java/lang
663 AC_CONFIG_LINKS(java/lang/ConcreteProcess.java:java/lang/${PLATFORM}Process.java)
664 AC_CONFIG_LINKS(java/lang/natConcreteProcess.cc:java/lang/nat${PLATFORM}Process.cc)
666 # Likewise for natVMInetAddress.cc and natVMNetworkInterface.cc.
667 test -d java/net || mkdir java/net
668 AC_CONFIG_LINKS(java/net/natVMInetAddress.cc:java/net/natVMInetAddress${PLATFORMNET}.cc)
669 AC_CONFIG_LINKS(java/net/natVMNetworkInterface.cc:java/net/natVMNetworkInterface${PLATFORMNET}.cc)
671 # Likewise for natPlainSocketImpl.cc and natPlainDatagramSocketImpl.cc.
672 test -d gnu/java || mkdir gnu/java
673 test -d gnu/java/net || mkdir gnu/java/net
674 AC_CONFIG_LINKS(gnu/java/net/natPlainSocketImpl.cc:gnu/java/net/natPlainSocketImpl${PLATFORMNET}.cc)
675 AC_CONFIG_LINKS(gnu/java/net/natPlainDatagramSocketImpl.cc:gnu/java/net/natPlainDatagramSocketImpl${PLATFORMNET}.cc)
677 # Likewise for natPipeImpl.cc and natSelectorImpl.cc.
678 test -d gnu/java/nio || mkdir gnu/java/nio
679 AC_CONFIG_LINKS(gnu/java/nio/natPipeImpl.cc:gnu/java/nio/natPipeImpl${PLATFORM}.cc)
680 AC_CONFIG_LINKS(gnu/java/nio/natSelectorImpl.cc:gnu/java/nio/natSelectorImpl${PLATFORM}.cc)
681 test -d gnu/java/nio/channels || mkdir gnu/java/nio/channels
682 AC_CONFIG_LINKS(gnu/java/nio/channels/natFileChannelImpl.cc:gnu/java/nio/channels/natFileChannel${FILE-${PLATFORM}}.cc)
686 SYSTEMSPEC="-lgdi32 -lws2_32"
687 if test "${with_win32_nlsapi}" = "unicows"; then
688 SYSTEMSPEC="-lunicows $SYSTEMSPEC"
697 LIBGCJTESTSPEC="-L`${PWDCMD-pwd}`/.libs -rpath `${PWDCMD-pwd}`/.libs"
698 AC_SUBST(LIBGCJTESTSPEC)
700 AC_ARG_WITH(system-zlib,
701 AS_HELP_STRING([--with-system-zlib],
702 [use installed libz]))
706 AC_SUBST(ZLIBTESTSPEC)
710 # FIXME: this should be _libs on some hosts.
713 # extra LD Flags which are required for targets
716 # For now we have to disable it on darwin[8-9] because it slows down
717 # the linking phase. A possible bug in ld?
718 # on Darwin -single_module speeds up loading of the dynamic libraries.
719 extra_ldflags_libjava=-Wl,-single_module
722 AC_SUBST(extra_ldflags_libjava)
724 # Allow the GC to be disabled. Can be useful when debugging.
725 AC_MSG_CHECKING([for garbage collector to use])
726 AC_ARG_ENABLE(java-gc,
727 AS_HELP_STRING([--enable-java-gc=TYPE],
728 [choose garbage collector (default is boehm)]),
740 GCLIBS=../boehm-gc/libgcjgc_convenience.la
741 JC1GCSPEC='-fuse-boehm-gc'
742 GCTESTSPEC="-L`${PWDCMD-pwd}`/../boehm-gc/.libs -rpath `${PWDCMD-pwd}`/../boehm-gc/.libs"
743 GCINCS='-I$(top_srcdir)/../boehm-gc/include -I../boehm-gc/include'
746 # The POSIX thread support needs to know this.
747 AC_DEFINE(HAVE_BOEHM_GC, 1, [Define if Boehm GC in use.])
754 AC_MSG_ERROR([unrecognized collector "$GC"])
763 AC_CONFIG_LINKS(include/java-gc.h:include/$GCHDR)
764 AM_CONDITIONAL(USING_BOEHMGC, test "$GC" = boehm)
765 AM_CONDITIONAL(USING_NOGC, test "$GC" = no)
768 AC_MSG_CHECKING([for thread model used by GCC])
769 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
770 AC_MSG_RESULT([$THREADS])
776 posix | posix95 | pthreads)
780 AC_DEFINE(LINUX_THREADS, 1, [Define if using POSIX threads on Linux.])
786 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
787 AC_MSG_ERROR(thread package $THREADS not yet supported)
790 AC_MSG_ERROR($THREADS is an unknown thread package)
806 # Don't set THREADLIBS here. Cygwin doesn't have -lpthread.
808 *-*-freebsd[[1234]]*)
809 # Before FreeBSD 5, it didn't have -lpthread (or any library which
810 # merely adds pthread_* functions) but it does have a -pthread switch
811 # which is required at link-time to select -lc_r *instead* of -lc.
812 THREADLDFLAGS=-pthread
813 # Don't set THREADSPEC here as might be expected since -pthread is
814 # not processed when found within a spec file, it must come from
815 # the command line. For now, the user must provide the -pthread
816 # switch to link code compiled with gcj. In future, consider adding
817 # support for weak references to pthread_* functions ala gthr.h API.
818 THREADSPEC='%{!pthread: %{!shared: %eUnder this configuration, the user must provide -pthread when linking.}}'
821 # FreeBSD >=5.3 implements a model much closer to other modern UNIX
822 # systems which support threads and -lpthread.
823 THREADLDFLAGS=-pthread
826 alpha*-dec-osf* | hppa*-hp-hpux*)
827 THREADCXXFLAGS=-pthread
828 # boehm-gc needs some functions from librt, so link that too.
829 THREADLIBS='-lpthread -lrt'
830 THREADSPEC='-lpthread -lrt'
837 THREADH=posix-threads.h
838 # MIT pthreads doesn't seem to have the mutexattr functions.
839 # But for now we don't check for it. We just assume you aren't
840 # using MIT pthreads.
841 AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT, 1, [Define if using POSIX threads that have the mutexattr functions.])
843 # If we're using the Boehm GC, then we happen to know that it
844 # defines _REENTRANT, so we don't bother. Eww.
845 if test "$GC" != boehm; then
846 AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
848 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Required define if using POSIX threads])
852 THREADH=win32-threads.h
853 THREADCXXFLAGS=-mthreads
854 # We need thread-safe exception handling so _CRT_MT should be set to 1.
855 # But we do not want the executables created to be dependent on
856 # mingwm10.dll which provides a __mingwthr_key_dtor() that cleans up
857 # exception handling contexts. The following kludge achieves this effect
858 # and causes a dummy __mingwthr_key_dtor() to be linked in from
859 # libmingw32.a. This causes a memory leak of about 24 bytes per thread.
860 # A workaround is to explicitly use -mthreads while linking Java programs.
861 # See PR libgcj/28263.
863 # FIXME: In Java we are able to detect thread death at the end of
864 # Thread.run() so we should be able to clean up the exception handling
865 # contexts ourselves.
866 THREADSTARTFILESPEC='crtmt%O%s'
873 AC_CONFIG_LINKS(include/java-threads.h:include/$THREADH)
878 AC_SUBST(THREADSTARTFILESPEC)
879 AC_SUBST(THREADLDFLAGS)
880 AC_SUBST(THREADCXXFLAGS)
881 AM_CONDITIONAL(USING_POSIX_THREADS, test "$THREADS" = posix)
882 AM_CONDITIONAL(USING_WIN32_THREADS, test "$THREADS" = win32)
883 AM_CONDITIONAL(USING_NO_THREADS, test "$THREADS" = none)
884 AM_CONDITIONAL(USE_LIBGCJ_BC, test "$use_libgcj_bc" = yes)
886 if test -d sysdep; then true; else mkdir sysdep; fi
887 AC_CONFIG_LINKS(sysdep/locks.h:sysdep/$sysdeps_dir/locks.h)
888 AC_CONFIG_LINKS(sysdep/backtrace.h:$fallback_backtrace_h)
889 AC_CONFIG_LINKS(sysdep/descriptor.h:$descriptor_h)
891 LIBGCJ_SPEC="%{s-bc-abi:} -lgcj"
892 if test "$use_libgcj_bc" = yes; then
893 LIBGCJ_SPEC="%{s-bc-abi:-lgcj_bc;:-lgcj}"
895 AC_SUBST(LIBGCJ_SPEC)
898 # Hash synchronization is only useful with posix threads right now.
899 if test "$enable_hash_synchronization" = yes && test "$THREADS" != "none"; then
900 HASH_SYNC_SPEC=-fhash-synchronization
901 AC_DEFINE(JV_HASH_SYNCHRONIZATION, 1, [Define if hash synchronization is in use])
903 AC_SUBST(HASH_SYNC_SPEC)
905 AM_CONDITIONAL(USING_GCC, test "$GCC" = yes)
907 # We're in the tree with gcc, and need to include some of its headers.
908 GCC_UNWIND_INCLUDE='-I$(libgcj_basedir)/../gcc'
910 if test "x${with_newlib}" = "xyes"; then
911 # We are being configured with a cross compiler. AC_REPLACE_FUNCS
912 # may not work correctly, because the compiler may not be able to
915 # We assume newlib. This lets us hard-code the functions we know
917 AC_DEFINE(HAVE_MEMMOVE, 1, [Define if you have memmove.])
918 AC_DEFINE(HAVE_MEMCPY, 1, [Define if you have memcpy.])
919 AC_DEFINE(HAVE_STRERROR, 1, [Define if you have strerror.])
920 AC_DEFINE(HAVE_TIME, 1, [Define if you have time.])
921 AC_DEFINE(HAVE_GMTIME_R, 1, [Define if you have the 'gmtime_r' function])
922 AC_DEFINE(HAVE_LOCALTIME_R, 1, [Define if you have the 'localtime_r' function.])
923 AC_DEFINE(HAVE_USLEEP_DECL, 1, [Define if usleep is declared in <unistd.h>.])
924 # This is only for POSIX threads.
925 AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT, 1, [Define if using POSIX threads that have the mutexattr functions.])
926 # We also assume we are using gcc, which provides alloca.
927 AC_DEFINE(HAVE_ALLOCA)
929 # Assume we do not have getuid and friends.
930 AC_DEFINE(NO_GETUID, 1, [Define if getuid() and friends are missing.])
933 AC_CHECK_FUNCS([strerror ioctl select fstat open fsync sleep opendir \
934 gmtime_r localtime_r readdir_r getpwuid_r getcwd \
935 access stat lstat mkdir rename rmdir unlink utime chmod readlink \
936 nl_langinfo setlocale \
937 inet_pton uname inet_ntoa \
938 fork execvp pipe sigaction ftruncate mmap \
940 AC_CHECK_FUNCS(inet_aton inet_addr, break)
941 AC_CHECK_HEADERS(execinfo.h unistd.h dlfcn.h)
942 # Do an additional check on dld, HP-UX for example has dladdr in libdld.sl
943 AC_CHECK_LIB(dl, dladdr, [
944 AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()])], [
945 AC_CHECK_LIB(dld, dladdr, [
946 AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()])])])
948 if test x"$build" = x"$host"; then
949 AC_CHECK_FILES(/proc/self/exe, [
950 AC_DEFINE(HAVE_PROC_SELF_EXE, 1, [Define if you have /proc/self/exe])])
954 AC_DEFINE(HAVE_PROC_SELF_EXE, 1, [Define if you have /proc/self/exe])
963 AC_CHECK_FUNCS(gethostbyname_r, [
964 AC_DEFINE(HAVE_GETHOSTBYNAME_R, 1,
965 [Define if you have the 'gethostbyname_r' function.])
966 # There are two different kinds of gethostbyname_r.
967 # We look for the one that returns `int'.
968 # Hopefully this check is robust enough.
969 AC_EGREP_HEADER(int.*gethostbyname_r, netdb.h, [
970 AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT, 1, [Define if gethostbyname_r returns 'int'.])])
973 *" -D_REENTRANT "*) ;;
975 dnl On DU4.0, gethostbyname_r is only declared with -D_REENTRANT
976 AC_CACHE_CHECK([whether gethostbyname_r declaration requires -D_REENTRANT],
977 [libjava_cv_gethostbyname_r_needs_reentrant],
979 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
980 [[gethostbyname_r("", 0, 0);]])],
981 [libjava_cv_gethostbyname_r_needs_reentrant=no], [dnl
982 CPPFLAGS_SAVE="$CPPFLAGS"
983 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
984 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[gethostbyname_r("", 0, 0);]])],
985 [libjava_cv_gethostbyname_r_needs_reentrant=yes],
986 [libjava_cv_gethostbyname_r_needs_reentrant=fail])
987 CPPFLAGS="$CPPFLAGS_SAVE"
991 if test "x$libjava_cv_gethostbyname_r_needs_reentrant" = xyes; then
992 AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
997 AC_CACHE_CHECK([for struct hostent_data],
998 [libjava_cv_struct_hostent_data], [dnl
999 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1000 #if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
1001 # define _REENTRANT 1
1003 #include <netdb.h>]], [[struct hostent_data data;]])],
1004 [libjava_cv_struct_hostent_data=yes],
1005 [libjava_cv_struct_hostent_data=no])])
1006 if test "x$libjava_cv_struct_hostent_data" = xyes; then
1007 AC_DEFINE(HAVE_STRUCT_HOSTENT_DATA, 1,
1008 [Define if struct hostent_data is defined in netdb.h])
1012 # FIXME: libjava source code expects to find a prototype for
1013 # gethostbyaddr_r in netdb.h. The outer check ensures that
1014 # HAVE_GETHOSTBYADDR_R will not be defined if the prototype fails
1015 # to exist where expected. (The root issue: AC_CHECK_FUNCS assumes C
1016 # linkage check is enough, yet C++ code requires proper prototypes.)
1017 AC_EGREP_HEADER(gethostbyaddr_r, netdb.h, [
1018 AC_CHECK_FUNCS(gethostbyaddr_r, [
1019 AC_DEFINE(HAVE_GETHOSTBYADDR_R, 1,
1020 [Define if you have the 'gethostbyaddr_r' function.])
1021 # There are two different kinds of gethostbyaddr_r.
1022 # We look for the one that returns `int'.
1023 # Hopefully this check is robust enough.
1024 AC_EGREP_HEADER(int.*gethostbyaddr_r, netdb.h, [
1025 AC_DEFINE(GETHOSTBYADDR_R_RETURNS_INT, 1,
1026 [Define if gethostbyaddr_r returns 'int'.])])])])
1028 AC_CHECK_FUNCS(gethostname, [
1029 AC_DEFINE(HAVE_GETHOSTNAME, 1,
1030 [Define if you have the 'gethostname' function.])
1031 AC_EGREP_HEADER(gethostname, unistd.h, [
1032 AC_DEFINE(HAVE_GETHOSTNAME_DECL, 1,
1033 [Define if gethostname is declared in <unistd.h>.])])])
1035 AC_CHECK_FUNCS(usleep, [
1036 AC_EGREP_HEADER(usleep, unistd.h, [
1037 AC_DEFINE(HAVE_USLEEP_DECL, 1,
1038 [Define if usleep is declared in <unistd.h>.])])])
1040 # Look for these functions in the thread library, but only bother
1041 # if using POSIX threads.
1042 if test "$THREADS" = posix; then
1044 LIBS="$LIBS $THREADLIBS"
1045 # Some POSIX thread systems don't have pthread_mutexattr_settype.
1047 AC_CHECK_FUNCS(pthread_mutexattr_settype pthread_mutexattr_setkind_np)
1049 # Look for sched_yield. Up to Solaris 2.6, it is in libposix4, since
1050 # Solaris 7 the name librt is preferred.
1051 AC_CHECK_FUNCS(sched_yield, , [
1052 AC_CHECK_LIB(rt, sched_yield, [
1053 AC_DEFINE(HAVE_SCHED_YIELD)
1054 THREADLIBS="$THREADLIBS -lrt"
1055 THREADSPEC="$THREADSPEC -lrt"], [
1056 AC_CHECK_LIB(posix4, sched_yield, [
1057 AC_DEFINE(HAVE_SCHED_YIELD)
1058 THREADLIBS="$THREADLIBS -lposix4"
1059 THREADSPEC="$THREADSPEC -lposix4"])])])
1061 AC_CHECK_LIB(rt, clock_gettime, [
1062 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])
1063 case "$THREADSPEC" in
1066 THREADSPEC="$THREADSPEC -lrt"
1067 THREADLIBS="$THREADLIBS -lrt"
1073 # We can save a little space at runtime if the mutex has m_count
1074 # or __m_count. This is a nice hack for Linux.
1075 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[
1076 extern pthread_mutex_t *mutex; int q = mutex->m_count;
1077 ]])], AC_DEFINE(PTHREAD_MUTEX_HAVE_M_COUNT, 1,
1078 [Define if pthread_mutex_t has m_count member.]), [
1079 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[
1080 extern pthread_mutex_t *mutex; int q = mutex->__m_count;
1081 ]])], AC_DEFINE(PTHREAD_MUTEX_HAVE___M_COUNT, 1,
1082 [Define if pthread_mutex_t has __m_count member.]))])
1085 # We require a way to get the time.
1087 AC_CHECK_FUNCS(gettimeofday time ftime, time_found=yes)
1088 if test "$time_found" = no; then
1089 AC_MSG_ERROR([no function found to get the time])
1092 AC_CHECK_FUNCS(memmove)
1094 # We require memcpy.
1096 AC_CHECK_FUNCS(memcpy, memcpy_found=yes)
1097 if test "$memcpy_found" = no; then
1098 AC_MSG_ERROR([memcpy is required])
1100 # Do an additional check on dld, HP-UX for example has dlopen in libdld.sl
1101 AC_CHECK_LIB(dl, dlopen, [
1102 AC_DEFINE(HAVE_DLOPEN, 1, [Define if dlopen is available])], [
1103 AC_CHECK_LIB(dld, dlopen, [
1104 AC_DEFINE(HAVE_DLOPEN, 1, [Define if dlopen is available])])])
1106 # Some library-finding code we stole from Tcl.
1107 #--------------------------------------------------------------------
1108 # Check for the existence of the -lsocket and -lnsl libraries.
1109 # The order here is important, so that they end up in the right
1110 # order in the command line generated by make. Here are some
1111 # special considerations:
1112 # 1. Use "connect" and "accept" to check for -lsocket, and
1113 # "gethostbyname" to check for -lnsl.
1114 # 2. Use each function name only once: can't redo a check because
1115 # autoconf caches the results of the last check and won't redo it.
1116 # 3. Use -lnsl and -lsocket only if they supply procedures that
1117 # aren't already present in the normal libraries. This is because
1118 # IRIX 5.2 has libraries, but they aren't needed and they're
1119 # bogus: they goof up name resolution if used.
1120 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
1121 # To get around this problem, check for both libraries together
1122 # if -lsocket doesn't work by itself.
1123 #--------------------------------------------------------------------
1125 AC_CACHE_CHECK([for socket libraries], gcj_cv_lib_sockets,
1126 [gcj_cv_lib_sockets=
1128 unset ac_cv_func_connect
1129 AC_CHECK_FUNC(connect, gcj_checkSocket=0, gcj_checkSocket=1)
1130 if test "$gcj_checkSocket" = 1; then
1131 unset ac_cv_func_connect
1132 AC_CHECK_LIB(socket, main, gcj_cv_lib_sockets="-lsocket",
1135 if test "$gcj_checkBoth" = 1; then
1137 LIBS="$LIBS -lsocket -lnsl"
1138 unset ac_cv_func_accept
1139 AC_CHECK_FUNC(accept,
1141 gcj_cv_lib_sockets="-lsocket -lnsl"])
1142 unset ac_cv_func_accept
1145 unset ac_cv_func_gethostbyname
1147 LIBS="$LIBS $gcj_cv_lib_sockets"
1148 AC_CHECK_FUNC(gethostbyname, ,
1149 [AC_CHECK_LIB(nsl, main,
1150 [gcj_cv_lib_sockets="$gcj_cv_lib_sockets -lnsl"])])
1151 unset ac_cv_func_gethostbyname
1154 SYSTEMSPEC="$SYSTEMSPEC $gcj_cv_lib_sockets"
1156 if test "$with_system_zlib" = yes; then
1157 AC_CHECK_LIB(z, deflate, ZLIBSPEC=-lz, ZLIBSPEC=)
1160 # Test for Gtk stuff, if asked for.
1161 if test "$use_gtk_awt" = yes; then
1162 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4)
1163 AC_SUBST(GTK_CFLAGS)
1166 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.4 gthread-2.0 >= 2.4)
1167 AC_SUBST(GLIB_CFLAGS)
1170 PKG_CHECK_MODULES(LIBART, libart-2.0 >= 2.1)
1171 AC_SUBST(LIBART_CFLAGS)
1172 AC_SUBST(LIBART_LIBS)
1174 # We require the XTest Extension to support java.awt.Robot.
1175 AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
1176 [AC_MSG_ERROR([libXtst not found, required by java.awt.Robot])],
1180 # On Solaris, and maybe other architectures, the Boehm collector
1182 if test "$GC" = boehm; then
1183 AC_CHECK_LIB(dl, main, SYSTEMSPEC="$SYSTEMSPEC -ldl")
1187 # Use a semicolon as CLASSPATH separator for MinGW, otherwise a colon.
1189 *-mingw32) CLASSPATH_SEPARATOR=';' ;;
1190 *) CLASSPATH_SEPARATOR=':' ;;
1192 AC_SUBST(CLASSPATH_SEPARATOR)
1194 # We must search the source tree for java.lang, since we still don't
1195 # have libgcj.jar nor java/lang/*.class
1196 GCJ_SAVE_CPPFLAGS=$CPPFLAGS
1197 CPPFLAGS="$CPPFLAGS -I`${PWDCMD-pwd}` -I`cd $srcdir && ${PWDCMD-pwd}`"
1199 # Since some classes depend on this one, we need its source available
1200 # before we can do any GCJ compilation test :-(
1201 if test ! -f gnu/classpath/Configuration.java; then
1202 test -d gnu || mkdir gnu
1203 test -d gnu/classpath || mkdir gnu/classpath
1204 # Note that it is not crucial that all the values here be correct.
1205 sed -e "s,@prefix@,$prefix," \
1206 -e "s,@VERSION@,$VERSION," \
1207 -e "s,@LIBDEBUG@,false," \
1208 -e "s,@INIT_LOAD_LIBRARY@,false," \
1209 -e "s,@@,$LIBGCJDEBUG," \
1210 -e "s,@default_toolkit@,$TOOLKIT," \
1211 -e "s,@JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@,false," \
1212 -e "s,@GTK_CAIRO_ENABLED@,false," \
1213 < $srcdir/classpath/gnu/classpath/Configuration.java.in \
1214 > gnu/classpath/Configuration.java
1215 # We do not want to redirect the output of the grep below to /dev/null,
1216 # but we add /dev/null to the input list so that grep will print the
1217 # filename of Configuration.java in case it finds any matches.
1218 if grep '@.*@' gnu/classpath/Configuration.java /dev/null; then
1219 AC_MSG_ERROR([configure.ac is missing the substitutions above])
1226 rm -f gnu/classpath/Configuration.java
1228 CPPFLAGS=$GCJ_SAVE_CPPFLAGS
1230 AC_CHECK_SIZEOF(void *)
1238 if test -z "$ZLIBSPEC"; then
1239 # Use zlib from the GCC tree.
1240 ZINCS='-I$(top_srcdir)/../zlib'
1241 ZLIBS=../zlib/libzgcj_convenience.la
1244 SYS_ZLIBS="$ZLIBSPEC"
1249 AC_SUBST(DIVIDESPEC)
1250 AC_SUBST(CHECKREFSPEC)
1251 AC_SUBST(EXCEPTIONSPEC)
1252 AC_SUBST(BACKTRACESPEC)
1255 AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes)
1256 AM_CONDITIONAL(NEEDS_DATA_START, test "$NEEDS_DATA_START" = yes && test "$NATIVE" = yes)
1257 AC_SUBST(GCC_UNWIND_INCLUDE)
1259 # Process the option "--enable-version-specific-runtime-libs"
1260 # Calculate toolexeclibdir
1261 case ${version_specific_libs} in
1263 # Need the gcc compiler version to know where to install libraries
1264 # and header files if --enable-version-specific-runtime-libs option
1266 includedir='$(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include/'
1267 toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
1268 toolexecmainlibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
1269 toolexeclibdir=$toolexecmainlibdir
1272 if test -n "$with_cross_host" &&
1273 test x"$with_cross_host" != x"no"; then
1274 # Install a library built with a cross compiler in tooldir, not libdir.
1275 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
1276 toolexecmainlibdir='$(toolexecdir)/lib'
1278 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
1279 toolexecmainlibdir='$(libdir)'
1281 multi_os_directory=`$CC -print-multi-os-directory`
1282 case $multi_os_directory in
1283 .) toolexeclibdir=$toolexecmainlibdir ;; # Avoid trailing /.
1284 *) toolexeclibdir=$toolexecmainlibdir/$multi_os_directory ;;
1288 AC_SUBST(toolexecdir)
1289 AC_SUBST(toolexecmainlibdir)
1290 AC_SUBST(toolexeclibdir)
1292 # Determine where the standard .db file and GNU Classpath JNI
1293 # libraries are found.
1294 multi_os_directory=`$CC -print-multi-os-directory`
1295 case $multi_os_directory in
1297 dbexecdir='$(libdir)/gcj-$(gcc_version)' # Avoid /.
1300 dbexecdir='$(libdir)/'$multi_os_directory'/gcj-$(gcc_version)'
1305 # Determine gcj version number.
1306 gcjversion=`$GCJ -v 2>&1 | sed -n 's/^.*version \([[^ ]]*\).*$/\1/p'`
1307 GCJVERSION=$gcjversion
1308 AC_SUBST(GCJVERSION)
1309 AC_DEFINE_UNQUOTED(GCJVERSION, "$GCJVERSION", [Short GCJ version ID])
1311 AC_DEFINE(JV_VERSION, "1.4.2", [Compatibility version string])
1312 AC_DEFINE(JV_API_VERSION, "1.4", [API compatibility version string])
1314 TL_AC_GXX_INCLUDE_DIR
1316 # We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
1317 # On that system, sys/ioctl.h will not include sys/filio.h unless
1318 # BSD_COMP is defined; just including sys/filio.h is simpler.
1319 # We avoid AC_HEADER_DIRENT since we really only care about dirent.h
1320 # for now. If you change this, you also must update natFile.cc.
1321 AC_CHECK_HEADERS([unistd.h bstring.h sys/time.h sys/types.h fcntl.h \
1322 sys/ioctl.h sys/filio.h sys/stat.h sys/select.h \
1323 sys/socket.h netinet/in.h arpa/inet.h netdb.h net/if.h \
1324 pwd.h sys/config.h stdint.h langinfo.h locale.h \
1325 dirent.h sys/rw_lock.h ifaddrs.h])
1326 AC_CHECK_HEADERS(inttypes.h, [
1327 AC_DEFINE(HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
1328 AC_DEFINE(JV_HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
1332 AC_CHECK_TYPE([ssize_t], [int])
1334 AC_MSG_CHECKING([for in_addr_t])
1335 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1340 #if HAVE_NETINET_IN_H
1341 #include <netinet/in.h>
1342 #endif]], [[in_addr_t foo;]])],
1343 [AC_DEFINE(HAVE_IN_ADDR_T, 1,
1344 [Define to 1 if 'in_addr_t' is defined in sys/types.h or netinet/in.h.])
1345 AC_MSG_RESULT(yes)],
1346 [AC_MSG_RESULT(no)])
1348 AC_MSG_CHECKING([whether struct ip_mreq is in netinet/in.h])
1349 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[struct ip_mreq mreq;]])],
1350 [AC_DEFINE(HAVE_STRUCT_IP_MREQ, 1,
1351 [Define if struct ip_mreq is defined in netinet/in.h.])
1352 AC_MSG_RESULT(yes)],
1353 [AC_MSG_RESULT(no)])
1355 AC_MSG_CHECKING([whether struct ipv6_mreq is in netinet/in.h])
1356 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[struct ipv6_mreq mreq6;]])],
1357 [AC_DEFINE(HAVE_STRUCT_IPV6_MREQ, 1,
1358 [Define if struct ipv6_mreq is defined in netinet/in.h.])
1359 AC_MSG_RESULT(yes)],
1360 [AC_MSG_RESULT(no)])
1362 AC_MSG_CHECKING([whether struct sockaddr_in6 is in netinet/in.h])
1363 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[struct sockaddr_in6 addr6;]])],
1364 [AC_DEFINE(HAVE_INET6, 1,
1365 [Define if inet6 structures are defined in netinet/in.h.])
1366 AC_MSG_RESULT(yes)],
1367 [AC_MSG_RESULT(no)])
1369 AC_MSG_CHECKING([for socklen_t in sys/socket.h])
1370 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_PII_SOCKET
1371 #include <sys/types.h>
1372 #include <sys/socket.h>]], [[socklen_t x = 5;]])],
1373 [AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define it socklen_t typedef is in sys/socket.h.])
1374 AC_MSG_RESULT(yes)],
1375 [AC_MSG_RESULT(no)])
1377 AC_MSG_CHECKING([for tm_gmtoff in struct tm])
1378 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tim; tim.tm_gmtoff = 0;]])],
1379 [AC_DEFINE(STRUCT_TM_HAS_GMTOFF, 1, [Define if struct tm has tm_gmtoff field.])
1380 AC_MSG_RESULT(yes)],
1382 AC_MSG_CHECKING([for global timezone variable])
1383 dnl FIXME: we don't want a link check here because that won't work
1384 dnl when cross-compiling. So instead we make an assumption that
1385 dnl the header file will mention timezone if it exists.
1386 dnl Don't find the win32 function timezone
1387 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[void i(){long z2 = 2*timezone;}]])],
1388 [AC_DEFINE(HAVE_TIMEZONE, 1, [Define if global 'timezone' exists.])
1389 AC_MSG_RESULT(yes)],
1391 AC_MSG_CHECKING([for global _timezone variable])
1392 dnl FIXME: As above, don't want link check
1393 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[long z2 = _timezone;]])],
1394 [AC_DEFINE(HAVE_UNDERSCORE_TIMEZONE, 1,
1395 [Define if your platform has the global _timezone variable.])
1396 AC_MSG_RESULT(yes)],
1397 [AC_MSG_RESULT(no)])])])
1401 AC_CHECK_PROGS(PERL, perl, false)
1408 SIGNAL_HANDLER=include/i386-signal.h
1410 sparc*-sun-solaris*)
1411 SIGNAL_HANDLER=include/sparc-signal.h
1414 # SYSDEP_SOURCES=sysdep/ia64.c
1415 # test -d sysdep || mkdir sysdep
1418 SIGNAL_HANDLER=include/pa-signal.h
1421 SIGNAL_HANDLER=include/hppa-signal.h
1424 SIGNAL_HANDLER=include/dwarf2-signal.h
1427 SIGNAL_HANDLER=include/powerpc-signal.h
1430 SIGNAL_HANDLER=include/dwarf2-signal.h
1433 SIGNAL_HANDLER=include/s390-signal.h
1436 SIGNAL_HANDLER=include/x86_64-signal.h
1437 SIGNAL_HANDLER_AUX=include/i386-signal.h
1440 SIGNAL_HANDLER=include/dwarf2-signal.h
1443 SIGNAL_HANDLER=include/sh-signal.h
1446 SIGNAL_HANDLER=include/win32-signal.h
1449 SIGNAL_HANDLER=include/mips-signal.h
1452 SIGNAL_HANDLER=include/darwin-signal.h
1455 SIGNAL_HANDLER=include/default-signal.h
1459 # If we're using sjlj exceptions, forget what we just learned.
1460 if test "$enable_sjlj_exceptions" = yes; then
1461 SIGNAL_HANDLER=include/default-signal.h
1465 AC_SUBST(SYSDEP_SOURCES)
1467 if test -z "$SIGNAL_HANDLER_AUX"; then
1468 SIGNAL_HANDLER_AUX=$SIGNAL_HANDLER
1471 AC_CONFIG_LINKS(include/java-signal.h:$SIGNAL_HANDLER
1472 include/java-signal-aux.h:$SIGNAL_HANDLER_AUX)
1474 if test "${multilib}" = "yes"; then
1475 multilib_arg="--enable-multilib"
1480 # See if we support thread-local storage.
1483 # For _Unwind_GetIPInfo.
1484 GCC_CHECK_UNWIND_GETIPINFO
1486 # Check if linker supports static linking on a per library basis
1487 LD_START_STATIC_SPEC=
1488 LD_FINISH_STATIC_SPEC=
1489 if $LD --help 2>&1 | grep -q -e -call_shared ; then
1490 if $LD --help 2>&1 | grep -q -e -non_shared ; then
1491 LD_START_STATIC_SPEC='%{static-libgcj:-non_shared}'
1492 LD_FINISH_STATIC_SPEC='%{static-libgcj:-call_shared}'
1495 AC_SUBST(LD_START_STATIC_SPEC)
1496 AC_SUBST(LD_FINISH_STATIC_SPEC)
1498 here=`${PWDCMD-pwd}`
1501 # We get this from the environment.
1514 AC_CONFIG_FILES([scripts/jar], [chmod +x scripts/jar])
1516 AC_CONFIG_COMMANDS([default],
1517 [# Only add multilib support code if we just rebuilt top-level Makefile.
1518 case " $CONFIG_FILES " in
1520 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
1521 ac_file=Makefile . ${libgcj_basedir}/../config-ml.in
1524 for ac_multi_file in $CONFIG_FILES; do
1525 case $ac_multi_file in
1527 grep "^MULTI[[^ ]]* =" Makefile >> "$ac_multi_file" ;;
1534 with_multisubdir=${with_multisubdir}
1535 ac_configure_args="${multilib_arg} ${ac_configure_args}"
1536 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
1537 libgcj_basedir=${libgcj_basedir}
1540 ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"