Add C++11 header <cuchar>.
[official-gcc.git] / libjava / configure.ac
blob656384be1fae685f880fa3f5ef19b2f195b195d0
1 dnl # Process this with autoconf to create configure
3 sinclude(../config/sjlj.m4)
5 AC_PREREQ(2.64)
6 # Still use "libjava" here to placate dejagnu.
7 AC_INIT([libjava], [version-unused],, [libjava])
9 AC_CONFIG_SRCDIR(java/lang/System.java)
11 GCC_TOPLEV_SUBDIRS
13 # We use these options to decide which functions to include.
14 AC_ARG_WITH(target-subdir,
15   AS_HELP_STRING([--with-target-subdir=SUBDIR],
16                  [configure in a subdirectory]))
18 # We may get other options which we don't document:
19 # --with-target-subdir, --with-multisrctop, --with-multisubdir
21 # Find the rest of the source tree framework.
22 AM_ENABLE_MULTILIB(, ..)
24 AC_CANONICAL_SYSTEM
25 _GCC_TOPLEV_NONCANONICAL_BUILD
26 _GCC_TOPLEV_NONCANONICAL_TARGET
28 AC_SUBST(target_noncanonical)
30 GCC_LIBSTDCXX_RAW_CXX_FLAGS
32 # This works around the fact that libtool configuration may change LD
33 # for this particular configuration, but some shells, instead of
34 # keeping the changes in LD private, export them just because LD is
35 # exported.
36 ORIGINAL_LD_FOR_MULTILIBS=$LD
38 AC_PROG_LN_S
40 # This works around an automake problem.
41 mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
42 AC_SUBST(mkinstalldirs)
44 AC_ARG_WITH(cross-host,
45   AS_HELP_STRING([--with-cross-host=HOST],
46                  [configure with a cross compiler from HOST]))
48 AC_ARG_WITH(newlib,
49   AS_HELP_STRING([--with-newlib],
50                  [configure with newlib]))
52 AC_ARG_ENABLE(version-specific-runtime-libs,
53   AS_HELP_STRING([--enable-version-specific-runtime-libs],    
54                  [specify that runtime libraries should be installed in a compiler-specific directory]),
55     [case "$enableval" in
56       yes) version_specific_libs=yes ;;
57       no)  version_specific_libs=no ;;
58       *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
59      esac],
60     [version_specific_libs=no]
63 AC_ARG_ENABLE(browser-plugin,
64   AS_HELP_STRING([--enable-browser-plugin],
65                  [build gcjwebplugin web browser plugin]),
66     [case "$enableval" in
67       yes) browser_plugin_enabled=yes ;;
68       no)  browser_plugin_enabled=no ;;
69       *)   AC_MSG_ERROR([Unknown argument to enable/disable browser plugin]);;
70      esac],
71     [browser_plugin_enabled=no]
74 AC_ARG_ENABLE(gconf-peer,
75   AS_HELP_STRING([--enable-gconf-peer],
76                  [compile GConf native peers for util.preferences]),
77     [case "$enableval" in
78       yes) gconf_enabled=yes ;;
79       no)  gconf_enabled=no ;;
80       *)   AC_MSG_ERROR([Unknown argument to enable/disable gconf-peer]);;
81      esac],
82     [gconf_enabled=no]
85 AC_ARG_WITH([antlr-jar],
86             [AS_HELP_STRING([--with-antlr-jar=file],[Use ANTLR from the specified jar file])],
87             [
88              ANTLR_JAR=$withval
89             ],
90             [
91              ANTLR_JAR=
92             ])
94 AC_MSG_CHECKING([for antlr.jar])
95 if test "x$ANTLR_JAR" = x; then
96     for antlr_lib_home in `ls -d /usr/local/share/antlr* 2> /dev/null` \
97         /usr/share/antlr/lib /usr/share/java /usr/lib;
98     do
99         if test -f "$antlr_lib_home/antlr.jar"; then
100             # FIXME: version check for antlr needed without using a VM
101             ANTLR_JAR="$antlr_lib_home/antlr.jar"
102             break
103         fi
104     done
105     if test "x$ANTLR_JAR" = x; then
106         AC_MSG_RESULT([not found])
107     else
108         AC_MSG_RESULT($ANTLR_JAR)
109     fi
110 else
111     if test -f "${ANTLR_JAR}"; then
112         AC_MSG_RESULT($ANTLR_JAR)
113     else
114         AC_MSG_ERROR([antlr jar file not found: $ANTLR_JAR])
115     fi
117 AC_SUBST(ANTLR_JAR)
119 AC_ARG_ENABLE([gjdoc],
120               [AS_HELP_STRING(--disable-gjdoc,compile GJDoc (disabled by --disable-gjdoc) [default=yes])],
121               [case "${enableval}" in
122                 yes) BUILD_GJDOC=yes ;;
123                 no) BUILD_GJDOC=no ;;
124                 *) BUILD_GJDOC=yes ;;
125               esac],
126               [BUILD_GJDOC=maybe])
128 AC_MSG_CHECKING([whether to build gjdoc])
129 if test "x$BUILD_GJDOC" = xmaybe; then
130     if test -f "${ANTLR_JAR}"; then
131         BUILD_GJDOC=yes
132         AC_MSG_RESULT(yes)
133     else
134         BUILD_GJDOC=no
135         AC_MSG_RESULT([no, antlr.jar not found])
136     fi
137 else
138     AC_MSG_RESULT($BUILD_GJDOC)
140 AM_CONDITIONAL(CREATE_GJDOC, test "x${BUILD_GJDOC}" = xyes)
142 AC_ARG_ENABLE(java-maintainer-mode,
143         AS_HELP_STRING([--enable-java-maintainer-mode],
144         [allow rebuilding of .class and .h files]))
145 AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes)
147 # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.
148 GCC_NO_EXECUTABLES
150 # For libstdc++-v3, -fno-builtin must be present here so that a
151 # non-conflicting form of std::exit can be guessed by AC_PROG_CXX, and
152 # used in later tests.  This may not be necessary in libjava; I don't know.
153 save_CXXFLAGS="$CXXFLAGS"
154 CXXFLAGS="$CXXFLAGS -fno-builtin"
155 AC_PROG_CC
156 AC_PROG_CXX
157 CXXFLAGS="$save_CXXFLAGS"
159 AM_INIT_AUTOMAKE([no-dist 1.9.0])
161 AC_CHECK_TOOL(AS, as)
162 AC_CHECK_TOOL(LD, ld)
163 AC_CHECK_TOOL(AR, ar)
164 AC_CHECK_TOOL(RANLIB, ranlib, :)
165 AC_CHECK_TOOL(DLLTOOL, dlltool, :)
166 AC_PROG_AWK
167 AC_CHECK_PROGS([JAR], [jar fastjar gjar], no)
168 AC_PATH_PROG([ZIP], [zip], no)
169 AC_PATH_PROG([UNZIP], [unzip], unzip)
171 # We need a jar that supports -@.  This is a GNU extension.
172 if test "$JAR" != no; then
173    rm -f config-test.jar
174    echo $srcdir/configure.ac | $JAR -cf@ config-test.jar >/dev/null 2>&1
175    if test -f config-test.jar; then
176      rm -f config-test.jar
177    else
178      JAR=no
179    fi
182 # Prefer the jar we found, but fall back to our jar script.
183 if test "$JAR" = no; then
184   if test "$ZIP" = no; then
185     AC_MSG_ERROR([cannot find neither zip nor jar, cannot continue])
186   else
187     # InfoZIP available, use the 'guaranteed' Bourne-shell JAR to build libjava
188     JAR=`pwd`/scripts/jar
189   fi
192 AC_PROG_INSTALL
194 AM_MAINTAINER_MODE
196 AC_EXEEXT
198 # configure.host sets the following important variables
199 #       libgcj_cflags    - host specific C compiler flags
200 #       libgcj_cxxflags  - host specific C++ compiler flags
201 #       libgcj_javaflags - host specific Java compiler flags
202 #       libgcj_sublib_ltflags - host specific Libtool flags 
203 #       libgcj_sublib_core_extra_deps - host specific extra 
204 #                          dependencies for core sublib
205 #       (these last two only used when building sublibs)
206 # and a number of others; see the list at the start of the file.
208 libgcj_cflags=
209 libgcj_cxxflags=
210 libgcj_javaflags=
211 libgcj_sublib_ltflags=
212 libgcj_sublib_core_extra_deps=
214 . ${srcdir}/configure.host
216 ACX_PROG_LD_GNU_SYMBOLIC
217 libgcj_ld_symbolic_functions=$SYMBOLIC_LDFLAGS
218 if test -z "$libgcj_ld_symbolic"; then
219   libgcj_ld_symbolic=$SYMBOLIC_LDFLAGS
222 # for windows native targets enforce export of all symbols for shared libgcj.
223 libgcj_ld_export_all=
224 case "$host" in
225       *mingw*)
226         libgcj_ld_export_all=-Wl,--export-all-symbols
227         ;;
228       *)
229         ;;
230 esac
232 LIBGCJ_CFLAGS="${libgcj_cflags}"
233 LIBGCJ_CXXFLAGS="${libgcj_cxxflags}"
234 LIBGCJ_JAVAFLAGS="${libgcj_javaflags}"
235 LIBGCJ_SUBLIB_LTFLAGS="${libgcj_sublib_ltflags}"
236 LIBGCJ_SUBLIB_CORE_EXTRA_DEPS="${libgcj_sublib_core_extra_deps}"
237 LIBGCJ_LD_SYMBOLIC="${libgcj_ld_symbolic}"
238 LIBGCJ_LD_SYMBOLIC_FUNCTIONS="${libgcj_ld_symbolic_functions}"
239 LIBGCJ_LD_EXPORT_ALL="${libgcj_ld_export_all}"
240 AC_SUBST(LIBGCJ_CFLAGS)
241 AC_SUBST(LIBGCJ_CXXFLAGS)
242 AC_SUBST(LIBGCJ_JAVAFLAGS)
243 AC_SUBST(LIBGCJ_SUBLIB_LTFLAGS)
244 AC_SUBST(LIBGCJ_SUBLIB_CORE_EXTRA_DEPS)
245 AC_SUBST(LIBGCJ_LD_SYMBOLIC)
246 AC_SUBST(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
247 AC_SUBST(LIBGCJ_LD_EXPORT_ALL)
249 # Only use libltdl for non-newlib builds.
250 if test "x${with_newlib}" = "x" || test "x${with_newlib}" = "xno"; then
251    AC_LTDL_SHLIBPATH
254 AC_CONFIG_HEADERS([include/config.h gcj/libgcj-config.h])
256 # Possibly build libgcj as many sub-libraries.
257 AC_ARG_ENABLE(libgcj-sublibs,
258   AS_HELP_STRING([--enable-libgcj-sublibs],
259                  [build libgcj as many sub-libraries]))
261 if test -z "$enable_libgcj_sublibs"; then
262    enable_libgcj_sublibs=$enable_libgcj_sublibs_default
264 AM_CONDITIONAL(BUILD_SUBLIBS, test "$enable_libgcj_sublibs" = yes)
265 if test "$enable_libgcj_sublibs" = yes ; then
266   # In theory we could make do with only one override and simply
267   # tag "_bc" onto the end of it when we use it to generate the
268   # spec, but that's an ugly thing to do when there are multiple
269   # words in the string and you're relying on the ordering to
270   # append the correct one.
271   libgcj_spec_lgcj_override="-lgcj-noncore -lgcj"
272   libgcj_spec_lgcj_bc_override="-lgcj-noncore -lgcj_bc"
276 # See if the user has requested runtime debugging.
277 LIBGCJDEBUG="disable"
278 AC_SUBST(LIBGCJDEBUG)
279 AC_ARG_ENABLE(libgcj-debug,
280   AS_HELP_STRING([--enable-libgcj-debug],
281                  [enable runtime debugging code]),
282   [if test "$enable_libgcj_debug" = yes; then
283     AC_DEFINE(__GCJ_DEBUG, 1, [Define this if you want runtime debugging enabled.])
284     LIBGCJDEBUG="enable"
285   fi])
287 AC_ARG_WITH([escher],
288          AS_HELP_STRING([--with-escher=ABS.PATH],
289                         [specify path to escher dir or JAR for X peers]))
290 case "$with_escher" in
292         use_escher=false
293         ;;
294 "no")
295         use_escher=false
296         ;;
297 "yes")
298         AC_MSG_ERROR([Please supply an absolute path to Escher library])
299         ;;
301         use_escher=true
302         ;;
303 esac
305 # Determine which AWT peer libraries to build
306 AC_ARG_ENABLE(java-awt,
307   AS_HELP_STRING([--enable-java-awt],
308                  [list of AWT peer implementations to be built]))
310 peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
311 use_xlib_awt=""
312 use_gtk_awt=""
313 use_qt_awt=""
314 use_x_awt=""
315 # The default toolkit to use is the first one specified.
316 TOOLKIT=
317 AC_SUBST(TOOLKIT)
319 for peer in $peerlibs ; do
320   case $peer in
321     xlib)
322       if test "$no_x" = yes; then
323         echo "*** xlib peers requested but no X library available" 1>&2
324         exit 1
325       else
326         use_xlib_awt="yes"
327         if test -z "$TOOLKIT"; then
328            TOOLKIT=gnu.awt.xlib.XToolkit
329         fi
330       fi
331       ;;
332     gtk)
333       if test "$no_x" = yes; then
334          echo "*** gtk peers requested but no X library available" 1>&2
335          exit 1
336       else
337          use_gtk_awt=yes
338          if test -z "$TOOLKIT"; then
339             TOOLKIT=gnu.java.awt.peer.gtk.GtkToolkit
340          fi
341       fi
342       ;;
343     qt)
344       if test "$no_x" = yes; then
345          # Perhaps we should admit the possibility of embedded Qt.
346          echo "*** Qt peers requested but no X library available" 1>&2
347          exit 1
348       else
349          use_qt_awt=yes
350          if test -z "$TOOLKIT"; then
351             TOOLKIT=gnu.java.awt.peer.qt.QtToolkit
352          fi
353       fi
354       ;;
355     x)
356       use_x_awt=yes
357       if test -z "$TOOLKIT"; then
358          TOOLKIT=gnu.java.awt.peer.x.XToolkit
359       fi
360       ;;
361     no)
362       use_xlib_awt=
363       use_gtk_awt=
364       use_qt_awt=
365       use_x_awt=
366       break
367       ;;
368     *)
369       echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
370       exit 1
371   esac
372 done
374 AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes)
375 AM_CONDITIONAL(X_AWT, test "$use_x_awt" = yes)
377 AC_DEFINE_UNQUOTED(AWT_TOOLKIT, "$TOOLKIT", [Name of default AWT toolkit])
379 expanded_prefix=$prefix
380 if test "X$prefix" = XNONE; then
381   expanded_prefix=${ac_default_prefix}
384 AC_DEFINE_UNQUOTED(LIBGCJ_PREFIX, "$expanded_prefix", [Installation prefix])
386 # Create standard.omit based on decisions we just made.
387 cp $srcdir/standard.omit.in standard.omit
388 if test "$use_xlib_awt" != yes; then
389    echo gnu/awt/xlib >> standard.omit
390    echo gnu/gcj/xlib >> standard.omit
392 if test "$use_x_awt" != yes; then
393    echo gnu/java/awt/peer/x >> standard.omit
396 # Tools that need to be compiled against classpath's tools classes
397 : > vm-tools-packages
398 for package in gnu/gcj/tools/gc_analyze ; do
399     echo $package >> standard.omit
400     echo $package >> vm-tools-packages
401 done
403 if test -z "${with_multisubdir}"; then
404    builddotdot=.
405 else
406    builddotdot=`echo ${with_multisubdir} | sed -e 's:[[^/]][[^/]]*:..:g'`
409 NATIVE=yes
411 # Which gcj and host gcj (for ecjx) do we use?
412 which_gcj=default
413 host_exeext=${ac_exeext}
414 GCJ_FOR_ECJX='$(GCJ)'
415 GCC_FOR_ECJX='$(CXX)'
416 built_gcc_dir="`cd ${builddotdot}/../../${host_subdir}/gcc && ${PWDCMD-pwd}`"
417 if test -n "${with_cross_host}"; then
418   # We are being configured with a cross compiler. We can't
419   # use ac_exeext, because that is for the target platform.
420   NATIVE=no
421   cross_host_exeext=
422   GCJ_FOR_ECJX="${with_cross_host}-gcj"
423   GCC_FOR_ECJX="${with_cross_host}-gcc"
424   case "${with_cross_host}" in
425      *mingw* | *cygwin*)
426          cross_host_exeext=.exe
427      ;;
428   esac
429   host_exeext=${cross_host_exeext}
430   if test -x "${built_gcc_dir}/gcj${cross_host_exeext}"; then
431      if test x"$build_noncanonical" = x"$with_cross_host"; then
432         # Ordinary cross (host!=target and host=build)
433         which_gcj=built
434      else
435         # Canadian cross (host!=target and host!=build)
436         which_gcj=cross
437      fi
438   else
439      which_gcj=cross
440   fi
441 else
442   # We are being configured with a native or crossed-native compiler
443   if test -x "${built_gcc_dir}/gcj${ac_exeext}"; then
444      if test x"$build" = x"$host"; then
445         # True native build (host=target and host=build)
446         which_gcj=built
447      else
448         # Crossed-native build (host=target and host!=build)
449         which_gcj=cross
450      fi
451   else
452      which_gcj=path
453   fi
455 libgcjdir=`${PWDCMD-pwd}`
456 case $GCJ in
457 *" -B"*)
458   # Just in case there is a comma in the build dir, quote it for the
459   # sed command below.
460   case $libgcjdir in
461   *[[,\\]]*) qlibgcjdir=`echo "$libgcjdir" | sed 's:[[,\\]]:\\&:g'`;;
462   *) qlibgcjdir=$libgcjdir;;
463   esac
464   GCJ=`echo "$GCJ" | sed "s, -B, -B$qlibgcjdir/&,"`
465   ;;
467   GCJ=$GCJ" -B$libgcjdir/"
468   ;;
469 esac
470 case "${which_gcj}" in
471    built)
472       GCJH='$(top_builddir)/$(MULTIBUILDTOP)../../$(host_subdir)/gcc/gcjh'
473    ;;
474    cross)
475       if test "x${with_newlib}" = "xyes"; then
476          # FIXME (comment): Why is this needed?
477          LIBGCC_UNWIND_INCLUDE=
478       fi
479       GCJH='$(target_noncanonical)-gcjh'
480    ;;
481    path)
482       GCJH=gcjh
483    ;;
484 esac
485 JAVAC="$GCJ -C"
486 export JAVAC
488 AC_SUBST(GCJ_FOR_ECJX)
489 AC_SUBST(GCC_FOR_ECJX)
490 AC_SUBST(GCJH)
491 AC_SUBST(host_exeext)
493 # Create it, so that compile/link tests don't fail
494 test -f libgcj.spec || touch libgcj.spec
498 # Set up to configure Classpath.
499 # FIXME: no supported way to pass args in autoconf.
500 # Disable tool wrappers to avoid ltdl.h configure check.
501 ac_configure_args="$ac_configure_args --disable-tool-wrappers"
502 ac_configure_args="$ac_configure_args --disable-load-library"
503 ac_configure_args="$ac_configure_args --${LIBGCJDEBUG}-debug"
504 ac_configure_args="$ac_configure_args --enable-default-toolkit=$TOOLKIT"
505 dir1=`cd $srcdir && pwd`
506 dir2=`pwd`
507 ac_configure_args="$ac_configure_args --with-vm-classes=$dir1:$dir2"
508 ac_configure_args="$ac_configure_args --disable-core-jni"
509 dnl FIXME?
510 ac_configure_args="$ac_configure_args --disable-examples"
511 ac_configure_args="$ac_configure_args --with-glibj=build"
512 if test "$browser_plugin_enabled" != yes; then
513   ac_configure_args="$ac_configure_args --disable-plugin"
514 else
515   ac_configure_args="$ac_configure_args --enable-plugin"
517 if test "$gconf_enabled" != yes; then
518   ac_configure_args="$ac_configure_args --disable-gconf-peer"
519   ac_configure_args="$ac_configure_args --enable-default-preferences-peer=gnu.java.util.prefs.FileBasedFactory"
521 if test "$use_gtk_awt" != yes; then
522   ac_configure_args="$ac_configure_args --disable-gtk-peer --disable-plugin"
524 if test "$use_qt_awt" != yes; then
525   ac_configure_args="$ac_configure_args --disable-qt-peer"
526 else
527   # We need this as qt is disabled by default in classpath.
528   ac_configure_args="$ac_configure_args --enable-qt-peer"
530 if test "$use_x_awt" != yes; then
531   ac_configure_args="$ac_configure_args --without-escher"
532 else
533   # We need this as escher is disabled by default in classpath.
534   if test "$use_escher" != true; then
535     AC_MSG_ERROR([Please supply an absolute path to the Escher library])
536   else
537     ac_configure_args="$ac_configure_args --with-escher=$with_escher"
538   fi
540 if test "x$BUILD_GJDOC" = xno; then
541   ac_configure_args="$ac_configure_args --disable-gjdoc"
543 # -Werror causes unavoidable problems in code using alsa.
544 ac_configure_args="$ac_configure_args --disable-regen-headers"
545 ac_configure_args="$ac_configure_args --disable-Werror"
546 dnl --with-gcj=$GCJ
547 dnl --with-javah=$GCJH
548 dnl gtk-cairo -- just export here...
549 dnl --enable-regen-headers?
551 # Only use libltdl for non-newlib builds.
552 if test "x${with_newlib}" = "x" || test "x${with_newlib}" = "xno"; then
553    AC_LIBLTDL_CONVENIENCE
554    AC_LIBTOOL_DLOPEN
555    DIRLTDL=libltdl
556    AC_DEFINE(USE_LTDL, 1, [Define if libltdl is in use.])
557    # Sigh.  Libtool's macro doesn't do the right thing.
558    INCLTDL="-I\$(top_srcdir)/libltdl $INCLTDL"
559    # FIXME: this is a hack.
560    sub_auxdir="`cd $ac_aux_dir && ${PWDCMD-pwd}`"
561    ac_configure_args="$ac_configure_args --with-auxdir=$sub_auxdir"
563 AC_SUBST(INCLTDL)
564 AC_SUBST(LIBLTDL)
565 AC_SUBST(DIRLTDL)
566 AC_PROG_LIBTOOL
567 ACX_LT_HOST_FLAGS
568 AM_PROG_GCJ
569 AM_PROG_CC_C_O
571 AC_CONFIG_SUBDIRS(classpath libltdl)
573 # The -no-testsuite modules omit the test subdir.
574 AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
576 # Should the runtime set system properties by examining the 
577 # environment variable GCJ_PROPERTIES?
578 AC_ARG_ENABLE(getenv-properties,
579   AS_HELP_STRING([--disable-getenv-properties],
580                  [don't set system properties from GCJ_PROPERTIES]))
582 # Whether GCJ_PROPERTIES is used depends on the target.
583 if test -z "$enable_getenv_properties"; then
584    enable_getenv_properties=${enable_getenv_properties_default-yes}
586 if test "$enable_getenv_properties" = no; then
587    AC_DEFINE(DISABLE_GETENV_PROPERTIES, 1,
588      [Define if system properties shouldn't be read from getenv("GCJ_PROPERTIES").])
591 # Whether we should use arguments to main()
592 if test -z "$enable_main_args"; then
593    enable_main_args=${enable_main_args_default-yes}
595 if test "$enable_main_args" = no; then
596    AC_DEFINE(DISABLE_MAIN_ARGS, 1, [Define if we should ignore arguments to main().])
600 # Should we use hashtable-based synchronization?
601 # Currently works only for Linux X86/ia64
602 # Typically faster and more space-efficient
603 AC_ARG_ENABLE(hash-synchronization,
604   AS_HELP_STRING([--enable-hash-synchronization],
605                  [use global hash table for monitor locks]))
607 if test -z "$enable_hash_synchronization"; then
608    enable_hash_synchronization=$enable_hash_synchronization_default
612 install_ecj_jar=no
613 ECJ_BUILD_JAR=
614 ECJ_JAR=
615 AC_ARG_WITH(ecj-jar,
616         AS_HELP_STRING([--with-ecj-jar=FILE], [use preinstalled ecj jar]),
617         [ECJ_JAR=$withval],
618         [if test -f $multi_basedir/ecj.jar; then
619            ECJ_BUILD_JAR=$multi_basedir/ecj.jar
620            ECJ_JAR='$(jardir)/ecj.jar'
621            install_ecj_jar=yes
622          fi])
623 AC_SUBST(ECJ_BUILD_JAR)
624 AC_SUBST(ECJ_JAR)
625 AM_CONDITIONAL(BUILD_ECJ1, test "$ECJ_JAR" != "")
626 AM_CONDITIONAL(INSTALL_ECJ_JAR, test $install_ecj_jar = yes)
628 AC_ARG_WITH(java-home,
629   AS_HELP_STRING([--with-java-home=DIRECTORY],
630                  [value of java.home system property]),
631                  [JAVA_HOME="${withval}"], [JAVA_HOME=""])
632 AM_CONDITIONAL(JAVA_HOME_SET, test ! -z "$JAVA_HOME")
633 AC_SUBST(JAVA_HOME)
635 suppress_libgcj_bc=no
636 AC_ARG_ENABLE(libgcj-bc,
637   AS_HELP_STRING([--enable-libgcj-bc],
638                  [enable(default) or disable BC ABI for portions of libgcj]),
639   [if test "$enable_libgcj_bc" = "no"; then
640      suppress_libgcj_bc=yes
641    fi])
642 AM_CONDITIONAL(SUPPRESS_LIBGCJ_BC, test "$suppress_libgcj_bc" = "yes")
644 build_libgcj_reduced_reflection=no
645 AC_ARG_ENABLE(reduced-reflection,
646   AS_HELP_STRING([--enable-reduced-reflection],
647                  [enable or disable(default) -freduced-reflection when building portions of libgcj]),
648   [if test "$enable_reduced_reflection" = "yes"; then
649      build_libgcj_reduced_reflection=yes
650    fi])
651 AM_CONDITIONAL(BUILD_LIBGCJ_REDUCED_REFLECTION, test "$build_libgcj_reduced_reflection" = "yes")
653 # What is the native OS API for MinGW?
654 AC_ARG_WITH(win32-nlsapi,
655   AS_HELP_STRING([--with-win32-nlsapi=ansi or unicows or unicode],
656                  [native MinGW libgcj Win32 OS API (default is ansi)]),
657 [case "${withval}" in
658   ansi) with_win32_nlsapi=ansi ;;
659   unicows) with_win32_nlsapi=unicows ;;
660   unicode) with_win32_nlsapi=unicode ;;
661   *) AC_MSG_ERROR(Bad value ${withval} for --with-win32-nlsapi.) ;;
662 esac],[with_win32_nlsapi=ansi])
664 case "${with_win32_nlsapi}" in
665   unicows | unicode) 
666     AC_DEFINE(MINGW_LIBGCJ_UNICODE, 1,
667       [Define if MinGW libgcj uses the Windows UNICODE OS API.])
668     ;;
669 esac
671 # configure.host sets slow_pthread_self if the synchronization code should 
672 # try to avoid pthread_self calls by caching thread IDs in a hashtable.
673 if test "${slow_pthread_self}" = "yes"; then
674   AC_DEFINE(SLOW_PTHREAD_SELF, 1,
675     [Define if if the synchronization code should try to avoid pthread_self calls by caching thread IDs in a hashtable.])
678 # Check for gc debugging.  This option is handled both here and in the GC.
679 AC_ARG_ENABLE(gc-debug,
680    AS_HELP_STRING([--enable-gc-debug],
681                   [include full support for pointer backtracing etc.]),
682 [ if test "$enable_gc_debug" = "yes"; then
683     AC_DEFINE(LIBGCJ_GC_DEBUG, 1, 
684               [Define if we want to use debug calls into the garbage collector.])
685   fi])
687 # See if the user has the interpreter included.
688 AC_ARG_ENABLE(interpreter,
689   AS_HELP_STRING([--enable-interpreter],
690                  [enable interpreter]),
691   [if test "$enable_interpreter" = yes; then
692     # This can also be set in configure.host.
693     libgcj_interpreter=yes
694   elif test "$enable_interpreter" = no; then
695     libgcj_interpreter=no
696   fi])
698 if test "$libgcj_interpreter" = yes; then
699    AC_DEFINE(INTERPRETER, 1, [Define if you want a bytecode interpreter.])
701 INTERPRETER="$libgcj_interpreter"
702 AC_SUBST(INTERPRETER)
703 AM_CONDITIONAL(INTERPRETER, test "$libgcj_interpreter" = yes)
705 # If we are not using SJLJ exceptions, and this host does not have support 
706 # for unwinding from a signal handler, enable checked dereferences and divides.
707 GCC_CHECK_SJLJ_EXCEPTIONS
708 if test $ac_cv_sjlj_exceptions = no && test $can_unwind_signal = no; then
709   CHECKREFSPEC=-fcheck-references
710   DIVIDESPEC=-fuse-divide-subroutine
711   EXCEPTIONSPEC=
714 # See if the user wants to disable java.net.  This is the mildly
715 # ugly way that we admit that target-side configuration sucks.
716 AC_ARG_ENABLE(java-net,
717   AS_HELP_STRING([--disable-java-net],
718                  [disable java.net]))
720 # Whether java.net is built by default can depend on the target.
721 if test -z "$enable_java_net"; then
722    enable_java_net=${enable_java_net_default-yes}
724 if test "$enable_java_net" = no; then
725    AC_DEFINE(DISABLE_JAVA_NET, 1, [Define if java.net native functions should be stubbed out.])
728 # See if the user wants to configure without libffi.  Some
729 # architectures don't support it, and default values are set in 
730 # configure.host.
731 AC_ARG_WITH(libffi,
732   AS_HELP_STRING([--without-libffi],
733                  [don't use libffi]),
734   [:],
735   [with_libffi=${with_libffi_default-yes}])
737 LIBFFI=
738 LIBFFIINCS=
739 if test "$with_libffi" != no; then
740    AC_DEFINE(USE_LIBFFI, 1, [Define if we're to use libffi.])
741    LIBFFI=../libffi/libffi_convenience.la
742    LIBFFIINCS='-I$(top_srcdir)/../libffi/include -I../libffi/include'
744 AC_SUBST(LIBFFI)
745 AC_SUBST(LIBFFIINCS)
747 # See if the user wants to disable JVMPI support.
748 AC_ARG_ENABLE(jvmpi,
749   AS_HELP_STRING([--disable-jvmpi],
750                  [disable JVMPI support]))
752 if test "$enable_jvmpi" != no; then
753     AC_DEFINE(ENABLE_JVMPI, 1, [Define if you are using JVMPI.])
756 # If the target is an eCos system, use the appropriate eCos
757 # I/O routines.
758 # FIXME: this should not be a local option but a global target
759 # system; at present there is no eCos target.
760 TARGET_ECOS=${PROCESS-"no"}
761 AC_ARG_WITH(ecos,
762 [  --with-ecos             enable runtime eCos target support],
763 TARGET_ECOS="$with_ecos"
766 case "$TARGET_ECOS" in
767    no) case "$host" in
768       *mingw*)
769             PLATFORM=Win32
770             PLATFORMNET=Win32
771             PLATFORMH=win32.h
772         CHECK_FOR_BROKEN_MINGW_LD
773       ;;
774       *)
775             PLATFORM=Posix
776             PLATFORMNET=Posix
777             PLATFORMH=posix.h
778       ;;
779       esac
780       ;;
781    *)
782       PLATFORM=Ecos
783       PLATFORMNET=NoNet
784       AC_DEFINE(ECOS, 1, [Define if you're running eCos.])
785       PLATFORMH=posix.h
786       ;;
787 esac
788 AC_SUBST(PLATFORM)
789 AC_CONFIG_LINKS(include/platform.h:include/$PLATFORMH)
791 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1,
792                                       [Define if you have int32_t and uint32_t.]))
793 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1,
794                                         [Define if you have int32_t and uint32_t.]))
795 AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1,
796                                           [Define if you have u_int32_t]))
797 AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1,
798                                            [Define if you have u_int32_t]))
800 AM_CONDITIONAL(USING_WIN32_PLATFORM, test "$PLATFORM" = Win32)
801 AM_CONDITIONAL(USING_POSIX_PLATFORM, test "$PLATFORM" = Posix || test "$PLATFORM" = Ecos)
803 case "$host" in
804   *-darwin*) DARWIN_CRT=true ;;
805   *) DARWIN_CRT=false ;;
806 esac
807 AM_CONDITIONAL(USING_DARWIN_CRT, $DARWIN_CRT)
809 # This may not be defined in a non-ANS conformant embedded system.
810 # FIXME: Should these case a runtime exception in that case?
811 AC_EGREP_HEADER(localtime, time.h, AC_DEFINE(HAVE_LOCALTIME, 1,
812                                   [Define is you have 'localtime' in <time.h>]))
814 # Create the subdirectory for natFile.cc, or the attempt
815 # to create the link will fail.
816 test -d java || mkdir java
817 test -d java/io || mkdir java/io
818 test -d gnu || mkdir gnu
819 AC_CONFIG_LINKS(java/io/natFile.cc:java/io/natFile${FILE-${PLATFORM}}.cc)
821 # Likewise for natConcreteProcess.cc.
822 test -d java/lang || mkdir java/lang
823 AC_CONFIG_LINKS(java/lang/natConcreteProcess.cc:java/lang/nat${PLATFORM}Process.cc)
825 # Likewise for natVMInetAddress.cc and natVMNetworkInterface.cc.
826 test -d java/net || mkdir java/net
827 AC_CONFIG_LINKS(java/net/natVMInetAddress.cc:java/net/natVMInetAddress${PLATFORMNET}.cc)
828 AC_CONFIG_LINKS(java/net/natVMNetworkInterface.cc:java/net/natVMNetworkInterface${PLATFORMNET}.cc)
830 # Likewise for natPlainSocketImpl.cc and natPlainDatagramSocketImpl.cc.
831 test -d gnu/java || mkdir gnu/java
832 test -d gnu/java/net || mkdir gnu/java/net
833 AC_CONFIG_LINKS(gnu/java/net/natPlainSocketImpl.cc:gnu/java/net/natPlainSocketImpl${PLATFORMNET}.cc)
834 AC_CONFIG_LINKS(gnu/java/net/natPlainDatagramSocketImpl.cc:gnu/java/net/natPlainDatagramSocketImpl${PLATFORMNET}.cc)
836 # Likewise for natVMPipe.cc and natVMSelector.cc.
837 test -d gnu/java/nio || mkdir gnu/java/nio
838 AC_CONFIG_LINKS(gnu/java/nio/natVMPipe.cc:gnu/java/nio/natVMPipe${PLATFORM}.cc)
839 AC_CONFIG_LINKS(gnu/java/nio/natVMSelector.cc:gnu/java/nio/natVMSelector${PLATFORM}.cc)
841 # Likewise for natFileChannelImpl.cc
842 test -d gnu/java/nio/channels || mkdir gnu/java/nio/channels
843 AC_CONFIG_LINKS(gnu/java/nio/channels/natFileChannelImpl.cc:gnu/java/nio/channels/natFileChannel${FILE-${PLATFORM}}.cc)
845 # Likewise for natVMSecureRandom.cc
846 test -d gnu/java/security || mkdir gnu/java/security
847 test -d gnu/java/security/jce || mkdir gnu/java/security/jce
848 test -d gnu/java/security/jce/prng || mkdir gnu/java/security/jce/prng
849 AC_CONFIG_LINKS(gnu/java/security/jce/prng/natVMSecureRandom.cc:gnu/java/security/jce/prng/natVMSecureRandom${FILE-${PLATFORM}}.cc)
851 case "${host}" in
852     *mingw*)
853       SYSTEMSPEC="-lgdi32 -lws2_32"
854       if test "${with_win32_nlsapi}" = "unicows"; then
855         SYSTEMSPEC="-lunicows $SYSTEMSPEC"
856       fi
857     ;;
858     *-*-darwin[[912]]*)
859       SYSTEMSPEC="%{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}"
860     ;;
861     *)
862       SYSTEMSPEC=
863     ;;
864 esac
865 AC_SUBST(SYSTEMSPEC)
867 AC_ARG_WITH(system-zlib,
868   AS_HELP_STRING([--with-system-zlib],
869                  [use installed libz]))
870 ZLIBSPEC=
871 AC_SUBST(ZLIBSPEC)
872 ZLIBTESTSPEC=
873 AC_SUBST(ZLIBTESTSPEC)
875 AC_PATH_XTRA
877 # FIXME: this should be _libs on some hosts.
878 libsubdir=.libs
880 LIBGCJTESTSPEC="-L`${PWDCMD-pwd}`/.libs -rpath `${PWDCMD-pwd}`/.libs"
882 LIBSTDCXXSPEC=
883 # extra LD Flags which are required for targets
884 case "${host}" in
885 *-*-darwin[[0-7]].*)
886     # For now we have to disable it on darwin[8-9] because it slows down
887     # the linking phase. A possible bug in ld?
888     # on Darwin -single_module speeds up loading of the dynamic libraries.
889     extra_ldflags_libjava=-Wl,-single_module
890     ;;
891 arm*-*-linux-*)
892     # Some of the ARM unwinder code is actually in libstdc++.  We
893     # could in principle replicate it in libgcj, but it's better to
894     # have a dependency on libstdc++.
895     extra_ldflags='-L$(here)/../libstdc++-v3/src/.libs -lstdc++'
896     LIBSTDCXXSPEC=-lstdc++
897     LIBGCJTESTSPEC="-L`${PWDCMD-pwd}`/.libs -L`${PWDCMD-pwd}`/../libstdc++-v3/src/.libs -rpath `${PWDCMD-pwd}`/.libs:`${PWDCMD-pwd}`/../libstdc++-v3/src/.libs -lstdc++"
898     ;;
899 *-*-cygwin)
900     extra_ldflags_libjava=-liconv
901     ;;
902 *-*-mingw*)
903     extra_ldflags_libjava=-lws2_32
904     ;;
905 esac
907 LIBMATHSPEC=
908 # extra LD Flags which are required for targets
909 case "${host}" in
910 *-*-darwin*)
911      ;;
913      LIBMATHSPEC=-lm
914      ;;
915 esac
917 # Check for --no-merge-exidx-entries, an ARM-specific linker option.
918 AC_CACHE_CHECK([for --no-merge-exidx-entries], [libgcj_cv_exidx],
919   [saved_ldflags="$LDFLAGS"
920    LDFLAGS="${LDFLAGS} -Wl,--no-merge-exidx-entries"
921    AC_LINK_IFELSE([int main(void){ return 0;} ],
922                       [eval "libgcj_cv_exidx=yes"],
923                       [eval "libgcj_cv_exidx=no"])
924    LDFLAGS="${saved_ldflags}"]
926 if test "${libgcj_cv_exidx}" = "yes"; then
927   SYSTEMSPEC="${SYSTEMSPEC} --no-merge-exidx-entries"
928   extra_ldflags="${extra_ldflags} -Wl,--no-merge-exidx-entries"
929 fi   
931 AC_SUBST(extra_ldflags_libjava)
932 AC_SUBST(extra_ldflags)
933 AC_SUBST(LIBSTDCXXSPEC)
934 AC_SUBST(LIBMATHSPEC)
936 AC_SUBST(LIBGCJTESTSPEC)
938 # Allow the GC to be disabled.  Can be useful when debugging.
939 AC_MSG_CHECKING([for garbage collector to use])
940 AC_ARG_ENABLE(java-gc,
941   AS_HELP_STRING([--enable-java-gc=TYPE],
942                  [choose garbage collector (default is boehm)]),
943   [GC=$enableval],
944   [GC=boehm])
945 GCLIBS=
946 GCINCS=
947 GCDEPS=
948 GCSPEC=
949 JC1GCSPEC=
950 GCTESTSPEC=
951 case "$GC" in
952  boehm)
953     AC_MSG_RESULT(boehm)
954     GCLIBS=../boehm-gc/libgcjgc_convenience.la
955     JC1GCSPEC='-fuse-boehm-gc'
956     GCTESTSPEC="-L`${PWDCMD-pwd}`/../boehm-gc/.libs -rpath `${PWDCMD-pwd}`/../boehm-gc/.libs"
957     GCINCS='-I$(top_srcdir)/../boehm-gc/include -I../boehm-gc/include'
958     GCOBJS=boehm.lo    
959     GCHDR=boehm-gc.h
960     # The POSIX thread support needs to know this.
961     AC_DEFINE(HAVE_BOEHM_GC, 1, [Define if Boehm GC in use.])
962     ;;
963  no)
964     AC_MSG_RESULT(none)
965     GCHDR=no-gc.h
966     ;;
967  *)
968     AC_MSG_ERROR([unrecognized collector "$GC"])
969     ;;
970 esac
971 AC_SUBST(GCLIBS)
972 AC_SUBST(GCINCS)
973 AC_SUBST(GCDEPS)
974 AC_SUBST(GCSPEC)
975 AC_SUBST(JC1GCSPEC)
976 AC_SUBST(GCTESTSPEC)
977 AC_CONFIG_LINKS(include/java-gc.h:include/$GCHDR)
978 AM_CONDITIONAL(USING_BOEHMGC, test "$GC" = boehm)
979 AM_CONDITIONAL(USING_NOGC, test "$GC" = no)
982 AC_MSG_CHECKING([for thread model used by GCC])
983 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
984 AC_MSG_RESULT([$THREADS])
986 case "$THREADS" in
987  no | none | single)
988     THREADS=none
989     ;;
990  aix | posix | pthreads)
991     THREADS=posix
992     case "$host" in
993      *-*-linux*)
994         AC_DEFINE(LINUX_THREADS, 1, [Define if using POSIX threads on Linux.])
995         ;;
996     esac
997     ;;
998  win32)
999     ;;
1000  dce | vxworks)
1001     AC_MSG_ERROR(thread package $THREADS not yet supported)
1002     ;;
1003  *)
1004     AC_MSG_ERROR($THREADS is an unknown thread package)
1005     ;;
1006 esac
1008 THREADCXXFLAGS=
1009 THREADLDFLAGS=
1010 THREADLIBS=
1011 THREADINCS=
1012 THREADDEPS=
1013 THREADH=
1014 THREADSPEC=
1015 THREADSTARTFILESPEC=
1016 case "$THREADS" in
1017  posix)
1018     case "$host" in
1019      *-*-cygwin*)
1020         # Don't set THREADLIBS here.  Cygwin doesn't have -lpthread.
1021         ;;
1022      *-*-freebsd[[34]].*)
1023         # Before FreeBSD 5, it didn't have -lpthread (or any library which
1024         # merely adds pthread_* functions) but it does have a -pthread switch
1025         # which is required at link-time to select -lc_r *instead* of -lc.
1026         THREADLDFLAGS=-pthread
1027         # Don't set THREADSPEC here as might be expected since -pthread is
1028         # not processed when found within a spec file, it must come from
1029         # the command line.  For now, the user must provide the -pthread
1030         # switch to link code compiled with gcj.  In future, consider adding
1031         # support for weak references to pthread_* functions ala gthr.h API.
1032         THREADSPEC='%{!pthread: %{!shared: %eUnder this configuration, the user must provide -pthread when linking.}}'
1033         ;;
1034      *-*-freebsd*)
1035         # FreeBSD >=5.3 implements a model much closer to other modern UNIX
1036         # systems which support threads and -lpthread.
1037         THREADLDFLAGS=-pthread
1038         THREADSPEC=-lpthread
1039         ;;
1040      hppa*-hp-hpux*)
1041         THREADCXXFLAGS=-pthread
1042         # boehm-gc needs some functions from librt, so link that too.
1043         THREADLIBS='-lpthread -lrt'
1044         THREADSPEC='-lpthread -lrt'
1045         ;;
1046      *-*-darwin*)
1047         # Don't set THREADLIBS or THREADSPEC as Darwin already
1048         # provides pthread via libSystem.
1049         ;;
1050      *)
1051         THREADLIBS=-lpthread
1052         THREADSPEC=-lpthread
1053         ;;
1054     esac
1055     THREADH=posix-threads.h
1056     # MIT pthreads doesn't seem to have the mutexattr functions.
1057     # But for now we don't check for it.  We just assume you aren't
1058     # using MIT pthreads.
1059     AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT, 1, [Define if using POSIX threads that have the mutexattr functions.])
1061     # If we're using the Boehm GC, then we happen to know that it
1062     # defines _REENTRANT, so we don't bother.  Eww.
1063     if test "$GC" != boehm; then
1064        AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
1065     fi
1066     AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Required define if using POSIX threads])
1067     ;;
1069  win32)
1070     THREADH=win32-threads.h
1071     THREADCXXFLAGS=-mthreads
1072     # We need thread-safe exception handling so _CRT_MT should be set to 1.
1073     # But we do not want the executables created to be dependent on
1074     # mingwm10.dll which provides a __mingwthr_key_dtor() that cleans up
1075     # exception handling contexts.  The following kludge achieves this effect
1076     # and causes a dummy __mingwthr_key_dtor() to be linked in from
1077     # libmingw32.a.  This causes a memory leak of about 24 bytes per thread.
1078     # A workaround is to explicitly use -mthreads while linking Java programs.
1079     # See PR libgcj/28263.
1080     #
1081     # FIXME: In Java we are able to detect thread death at the end of
1082     # Thread.run() so we should be able to clean up the exception handling
1083     # contexts ourselves.
1084     case "$host" in
1085     *-w64-mingw*)
1086       ;;
1087     *)
1088       THREADSTARTFILESPEC='crtmt%O%s'
1089       ;;
1090     esac
1091     ;;
1092  none)
1093     THREADH=no-threads.h
1094     ;;
1095 esac
1096 AC_CONFIG_LINKS(include/java-threads.h:include/$THREADH)
1097 AC_SUBST(THREADLIBS)
1098 AC_SUBST(THREADINCS)
1099 AC_SUBST(THREADDEPS)
1100 AC_SUBST(THREADSPEC)
1101 AC_SUBST(THREADSTARTFILESPEC)
1102 AC_SUBST(THREADLDFLAGS)
1103 AC_SUBST(THREADCXXFLAGS)
1104 AM_CONDITIONAL(USING_POSIX_THREADS, test "$THREADS" = posix)
1105 AM_CONDITIONAL(USING_WIN32_THREADS, test "$THREADS" = win32)
1106 AM_CONDITIONAL(USING_NO_THREADS, test "$THREADS" = none)
1107 if test "$enable_shared" != yes; then
1108   use_libgcj_bc=no
1110 AM_CONDITIONAL(USE_LIBGCJ_BC, test "$use_libgcj_bc" = yes)
1112 if test -d sysdep; then true; else mkdir sysdep; fi
1113 AC_CONFIG_LINKS(sysdep/locks.h:sysdep/$sysdeps_dir/locks.h)
1114 AC_CONFIG_LINKS(sysdep/backtrace.h:$fallback_backtrace_h)
1115 AC_CONFIG_LINKS(sysdep/descriptor.h:$descriptor_h)
1117 LIBGCJ_SPEC_LGCJ=-lgcj
1118 LIBGCJ_SPEC_LGCJ_BC=-lgcj_bc
1119 if test x"$libgcj_spec_lgcj_override" != x ; then
1120   LIBGCJ_SPEC_LGCJ=$libgcj_spec_lgcj_override
1122 if test x"$libgcj_spec_lgcj_bc_override" != x ; then
1123   LIBGCJ_SPEC_LGCJ_BC=$libgcj_spec_lgcj_bc_override
1125 LIBGCJ_SPEC="%{s-bc-abi:} $LIBGCJ_SPEC_LGCJ"
1126 if test "$use_libgcj_bc" = yes; then
1127   LIBGCJ_SPEC="%{static|static-libgcj|!s-bc-abi:$LIBGCJ_SPEC_LGCJ;:$LIBGCJ_SPEC_LGCJ_BC}"
1128   LIBGCJ_BC_SPEC="%{findirect-dispatch:-fPIC}"
1130 AC_SUBST(LIBGCJ_SPEC)
1131 AC_SUBST(LIBGCJ_BC_SPEC)
1133 HASH_SYNC_SPEC=
1134 # Hash synchronization is only useful with posix threads right now.
1135 if test "$enable_hash_synchronization" = yes && test "$THREADS" != "none"; then
1136    HASH_SYNC_SPEC=-fhash-synchronization
1137    AC_DEFINE(JV_HASH_SYNCHRONIZATION, 1, [Define if hash synchronization is in use])
1139 AC_SUBST(HASH_SYNC_SPEC)
1141 AM_CONDITIONAL(USING_GCC, test "$GCC" = yes)
1143 # We're in the tree with libgcc, and need to include some of its headers.
1144 LIBGCC_UNWIND_INCLUDE='-I$(multi_basedir)/./libjava/../libgcc'
1146 if test "x${with_newlib}" = "xyes"; then
1147    # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
1148    # may not work correctly, because the compiler may not be able to
1149    # link executables.
1151    # We assume newlib.  This lets us hard-code the functions we know
1152    # we'll have.
1153    AC_DEFINE(HAVE_MEMMOVE, 1, [Define if you have memmove.])
1154    AC_DEFINE(HAVE_MEMCPY, 1, [Define if you have memcpy.])
1155    AC_DEFINE(HAVE_TIME, 1, [Define if you have time.])
1156    AC_DEFINE(HAVE_GMTIME_R, 1, [Define if you have the 'gmtime_r' function])
1157    AC_DEFINE(HAVE_LOCALTIME_R, 1, [Define if you have the 'localtime_r' function.])
1158    AC_DEFINE(HAVE_USLEEP_DECL, 1, [Define if usleep is declared in <unistd.h>.])
1159    # This is only for POSIX threads.
1160    AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT, 1, [Define if using POSIX threads that have the mutexattr functions.])
1162    # Assume we do not have getuid and friends.
1163    AC_DEFINE(NO_GETUID, 1, [Define if getuid() and friends are missing.])
1164    PLATFORMNET=NoNet
1165 else
1166    AC_CHECK_FUNCS([strerror_r select fstat open fsync sleep opendir \
1167                    localtime_r getpwuid_r getcwd \
1168                    access stat lstat mkdir rename rmdir unlink utime chmod readlink \
1169                    nl_langinfo setlocale \
1170                    inet_pton uname inet_ntoa \
1171                    getrlimit sigaction ftruncate mmap \
1172                    getifaddrs])
1173    AC_CHECK_FUNCS(inet_aton inet_addr, break)
1174    AC_CHECK_HEADERS(unistd.h dlfcn.h sys/resource.h)
1175    # Do an additional check on dld, HP-UX for example has dladdr in libdld.sl
1176    AC_CHECK_LIB(dl, dladdr, [
1177        AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()])], [
1178        AC_CHECK_LIB(dld, dladdr, [
1179        AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()])])])
1181    if test x"$cross_compiling" = x"no"; then
1182      AC_CHECK_FILES(/proc/self/exe, [
1183        AC_DEFINE(HAVE_PROC_SELF_EXE, 1, [Define if you have /proc/self/exe])])
1184      AC_CHECK_FILES(/proc/self/maps, [
1185        AC_DEFINE(HAVE_PROC_SELF_MAPS, 1,
1186          [Define if you have /proc/self/maps])])
1187    else
1188      case $host in
1189      *-linux*)
1190        AC_DEFINE(HAVE_PROC_SELF_EXE, 1, [Define if you have /proc/self/exe])
1191        AC_DEFINE(HAVE_PROC_SELF_MAPS, 1, [Define if you have /proc/self/maps])
1192        ;;
1193      esac
1194    fi
1196    AM_ICONV
1197    AM_LC_MESSAGES
1198    AC_STRUCT_TIMEZONE
1199    LDLIBICONV=`echo " $LIBICONV " | sed "s/${acl_cv_wl--Wl,}/ /g; s/,/ /g"`
1200    AC_SUBST([LDLIBICONV])
1202    AC_CHECK_FUNCS(gethostbyname_r, [
1203      AC_DEFINE(HAVE_GETHOSTBYNAME_R, 1,
1204        [Define if you have the 'gethostbyname_r' function.])
1205      # There are two different kinds of gethostbyname_r.
1206      # We look for the one that returns `int'.
1207      # Hopefully this check is robust enough.
1208      AC_EGREP_HEADER(int.*gethostbyname_r, netdb.h, [
1209        AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT, 1, [Define if gethostbyname_r returns 'int'.])])
1211      case " $GCINCS " in
1212      *" -D_REENTRANT "*) ;;
1213      *)
1214         dnl On DU4.0, gethostbyname_r is only declared with -D_REENTRANT
1215         AC_CACHE_CHECK([whether gethostbyname_r declaration requires -D_REENTRANT],
1216         [libjava_cv_gethostbyname_r_needs_reentrant],
1217         [ AC_LANG_PUSH(C++)
1218           AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
1219             [[gethostbyname_r("", 0, 0);]])],
1220             [libjava_cv_gethostbyname_r_needs_reentrant=no], [dnl
1221                 CPPFLAGS_SAVE="$CPPFLAGS"
1222                 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
1223                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[gethostbyname_r("", 0, 0);]])],
1224                     [libjava_cv_gethostbyname_r_needs_reentrant=yes],
1225                     [libjava_cv_gethostbyname_r_needs_reentrant=fail])
1226                 CPPFLAGS="$CPPFLAGS_SAVE"
1227           ])
1228           AC_LANG_POP(C++)
1229         ])
1230         if test "x$libjava_cv_gethostbyname_r_needs_reentrant" = xyes; then
1231           AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
1232         fi
1233      ;;
1234      esac
1236      AC_CACHE_CHECK([for struct hostent_data],
1237         [libjava_cv_struct_hostent_data], [dnl
1238         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1239 #if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
1240 # define _REENTRANT 1
1241 #endif
1242 #include <netdb.h>]], [[struct hostent_data data;]])],
1243           [libjava_cv_struct_hostent_data=yes],
1244           [libjava_cv_struct_hostent_data=no])])
1245      if test "x$libjava_cv_struct_hostent_data" = xyes; then
1246        AC_DEFINE(HAVE_STRUCT_HOSTENT_DATA, 1,
1247          [Define if struct hostent_data is defined in netdb.h])
1248      fi
1249    ])
1251    # FIXME: libjava source code expects to find a prototype for
1252    # gethostbyaddr_r in netdb.h.  The outer check ensures that
1253    # HAVE_GETHOSTBYADDR_R will not be defined if the prototype fails
1254    # to exist where expected.  (The root issue: AC_CHECK_FUNCS assumes C
1255    # linkage check is enough, yet C++ code requires proper prototypes.)
1256    AC_EGREP_HEADER(gethostbyaddr_r, netdb.h, [
1257    AC_CHECK_FUNCS(gethostbyaddr_r, [
1258      AC_DEFINE(HAVE_GETHOSTBYADDR_R, 1,
1259        [Define if you have the 'gethostbyaddr_r' function.])
1260      # There are two different kinds of gethostbyaddr_r.
1261      # We look for the one that returns `int'.
1262      # Hopefully this check is robust enough.
1263      AC_EGREP_HEADER(int.*gethostbyaddr_r, netdb.h, [
1264        AC_DEFINE(GETHOSTBYADDR_R_RETURNS_INT, 1,
1265          [Define if gethostbyaddr_r returns 'int'.])])])])
1267    AC_CHECK_FUNCS(gethostname, [
1268      AC_DEFINE(HAVE_GETHOSTNAME, 1,
1269        [Define if you have the 'gethostname' function.])
1270      AC_EGREP_HEADER(gethostname, unistd.h, [
1271        AC_DEFINE(HAVE_GETHOSTNAME_DECL, 1,
1272          [Define if gethostname is declared in <unistd.h>.])])])
1274    AC_CHECK_FUNCS(usleep, [
1275      AC_EGREP_HEADER(usleep, unistd.h, [
1276        AC_DEFINE(HAVE_USLEEP_DECL, 1,
1277           [Define if usleep is declared in <unistd.h>.])])])
1279    # Look for these functions in the thread library, but only bother
1280    # if using POSIX threads.
1281    if test "$THREADS" = posix; then
1282       save_LIBS="$LIBS"
1283       LIBS="$LIBS $THREADLIBS"
1285       # Look for sched_yield.  Up to Solaris 2.6, it is in libposix4, since
1286       # Solaris 7 the name librt is preferred.
1287       AC_CHECK_FUNCS(sched_yield, , [
1288         AC_CHECK_LIB(rt, sched_yield, [
1289           AC_DEFINE(HAVE_SCHED_YIELD)
1290           THREADLIBS="$THREADLIBS -lrt"
1291           THREADSPEC="$THREADSPEC -lrt"], [
1292           AC_CHECK_LIB(posix4, sched_yield, [
1293             AC_DEFINE(HAVE_SCHED_YIELD)
1294             THREADLIBS="$THREADLIBS -lposix4"
1295             THREADSPEC="$THREADSPEC -lposix4"])])])
1297       AC_CHECK_LIB(rt, clock_gettime, [
1298          AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])
1299          case "$THREADSPEC" in
1300            *-lrt*) ;;
1301            *)
1302              THREADSPEC="$THREADSPEC -lrt"
1303              THREADLIBS="$THREADLIBS -lrt"
1304              ;;
1305          esac])
1307       LIBS="$save_LIBS"
1309       # We can save a little space at runtime if the mutex has m_count
1310       # or __m_count.  This is a nice hack for Linux.
1311       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[
1312           extern pthread_mutex_t *mutex; int q = mutex->m_count;
1313         ]])], AC_DEFINE(PTHREAD_MUTEX_HAVE_M_COUNT, 1,
1314              [Define if pthread_mutex_t has m_count member.]), [
1315         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[
1316             extern pthread_mutex_t *mutex; int q = mutex->__m_count;
1317           ]])], AC_DEFINE(PTHREAD_MUTEX_HAVE___M_COUNT, 1,
1318             [Define if pthread_mutex_t has __m_count member.]))])
1319    fi
1321    # We require a way to get the time.
1322    time_found=no
1323    AC_CHECK_FUNCS(gettimeofday time ftime, time_found=yes)
1324    if test "$time_found" = no; then
1325       AC_MSG_ERROR([no function found to get the time])
1326    fi
1328    AC_CHECK_FUNCS(memmove)
1330    # We require memcpy.
1331    memcpy_found=no
1332    AC_CHECK_FUNCS(memcpy, memcpy_found=yes)
1333    if test "$memcpy_found" = no; then
1334       AC_MSG_ERROR([memcpy is required])
1335    fi
1336    # Do an additional check on dld, HP-UX for example has dlopen in libdld.sl
1337    AC_CHECK_LIB(dl, dlopen, [
1338        AC_DEFINE(HAVE_DLOPEN, 1, [Define if dlopen is available])], [
1339        AC_CHECK_LIB(dld, dlopen, [
1340        AC_DEFINE(HAVE_DLOPEN, 1, [Define if dlopen is available])])])
1342    # Some library-finding code we stole from Tcl.
1343    #--------------------------------------------------------------------
1344    #    Check for the existence of the -lsocket and -lnsl libraries.
1345    #    The order here is important, so that they end up in the right
1346    #    order in the command line generated by make.  Here are some
1347    #    special considerations:
1348    #    1. Use "connect" and "accept" to check for -lsocket, and
1349    #       "gethostbyname" to check for -lnsl.
1350    #    2. Use each function name only once:  can't redo a check because
1351    #       autoconf caches the results of the last check and won't redo it.
1352    #    3. Use -lnsl and -lsocket only if they supply procedures that
1353    #       aren't already present in the normal libraries.  This is because
1354    #       IRIX 5.2 has libraries, but they aren't needed and they're
1355    #       bogus:  they goof up name resolution if used.
1356    #    4. On some SVR4 systems, can't use -lsocket without -lnsl too.
1357    #       To get around this problem, check for both libraries together
1358    #       if -lsocket doesn't work by itself.
1359    #--------------------------------------------------------------------
1361    AC_CACHE_CHECK([for socket libraries], gcj_cv_lib_sockets,
1362     [gcj_cv_lib_sockets=
1363      gcj_checkBoth=0
1364      unset ac_cv_func_connect
1365      AC_CHECK_FUNC(connect, gcj_checkSocket=0, gcj_checkSocket=1)
1366      if test "$gcj_checkSocket" = 1; then
1367          unset ac_cv_func_connect
1368          AC_CHECK_LIB(socket, main, gcj_cv_lib_sockets="-lsocket",
1369                       gcj_checkBoth=1)
1370      fi
1371      if test "$gcj_checkBoth" = 1; then
1372          gcj_oldLibs=$LIBS
1373          LIBS="$LIBS -lsocket -lnsl"
1374          unset ac_cv_func_accept
1375          AC_CHECK_FUNC(accept,
1376                        [gcj_checkNsl=0
1377                         gcj_cv_lib_sockets="-lsocket -lnsl"])
1378          unset ac_cv_func_accept
1379          LIBS=$gcj_oldLibs
1380      fi
1381      unset ac_cv_func_gethostbyname
1382      gcj_oldLibs=$LIBS
1383      LIBS="$LIBS $gcj_cv_lib_sockets"
1384      AC_CHECK_FUNC(gethostbyname, ,
1385                    [AC_CHECK_LIB(nsl, main,
1386                                  [gcj_cv_lib_sockets="$gcj_cv_lib_sockets -lnsl"])])
1387      unset ac_cv_func_gethostbyname
1388      LIBS=$gcj_oldLIBS
1389    ])
1390    SYSTEMSPEC="$SYSTEMSPEC $gcj_cv_lib_sockets"
1392    if test "$with_system_zlib" = yes; then
1393       AC_CHECK_LIB(z, deflate, ZLIBSPEC=-lz, ZLIBSPEC=)
1394    fi
1396    # Test for Gtk stuff, if asked for.
1397    if test "$use_gtk_awt" = yes; then
1398       PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4)
1399       AC_SUBST(GTK_CFLAGS)
1400       AC_SUBST(GTK_LIBS)
1402       PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.4 gthread-2.0 >= 2.4)
1403       AC_SUBST(GLIB_CFLAGS)
1404       AC_SUBST(GLIB_LIBS)
1406       PKG_CHECK_MODULES(LIBART, libart-2.0 >= 2.1)
1407       AC_SUBST(LIBART_CFLAGS)
1408       AC_SUBST(LIBART_LIBS)
1410       # We require the XTest Extension to support java.awt.Robot.
1411       AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
1412                    [AC_MSG_ERROR([libXtst not found, required by java.awt.Robot])],
1413                    [${X_LIBS}])
1414    fi
1416    # On Solaris, and maybe other architectures, the Boehm collector
1417    # requires -ldl.
1418    if test "$GC" = boehm; then
1419       case "${host}" in
1420           *-*-darwin*)
1421             ;;
1422           *)
1423             AC_CHECK_LIB(dl, main, SYSTEMSPEC="$SYSTEMSPEC -ldl")
1424             ;;
1425       esac
1426    fi
1429 # Use a semicolon as CLASSPATH separator for MinGW, otherwise a colon.
1430 case $build in
1431     *-mingw32) CLASSPATH_SEPARATOR=';' ;;
1432     *)         CLASSPATH_SEPARATOR=':' ;;
1433 esac
1434 AC_SUBST(CLASSPATH_SEPARATOR)
1436 # We must search the source tree for java.lang, since we still don't
1437 # have libgcj.jar nor java/lang/*.class
1438 GCJ_SAVE_CPPFLAGS=$CPPFLAGS
1439 CPPFLAGS="$CPPFLAGS -I`${PWDCMD-pwd}` -I`cd $srcdir && ${PWDCMD-pwd}`"
1441 # Since some classes depend on this one, we need its source available
1442 # before we can do any GCJ compilation test :-(
1443 if test ! -f gnu/classpath/Configuration.java; then
1444   test -d gnu || mkdir gnu
1445   test -d gnu/classpath || mkdir gnu/classpath
1446   # Note that it is not crucial that all the values here be correct.
1447   sed -e "s,@prefix@,$expanded_prefix," \
1448       -e "s,@VERSION@,$VERSION," \
1449       -e "s,@LIBDEBUG@,false," \
1450       -e "s,@INIT_LOAD_LIBRARY@,false," \
1451       -e "s,@@,$LIBGCJDEBUG," \
1452       -e "s,@default_toolkit@,$TOOLKIT," \
1453       -e "s,@JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@,false," \
1454       -e "s,@GTK_CAIRO_ENABLED@,false," \
1455       -e "s,@ECJ_JAR@,," \
1456       -e "s,@WANT_NATIVE_BIG_INTEGER@,false," \
1457         < $srcdir/classpath/gnu/classpath/Configuration.java.in \
1458         > gnu/classpath/Configuration.java
1459   # We do not want to redirect the output of the grep below to /dev/null,
1460   # but we add /dev/null to the input list so that grep will print the
1461   # filename of Configuration.java in case it finds any matches.
1462   if grep '@.*@' gnu/classpath/Configuration.java /dev/null; then
1463     AC_MSG_ERROR([configure.ac is missing the substitutions above])
1464   fi
1467 LT_AC_PROG_GCJ
1469 # Now remove it.
1470 rm -f gnu/classpath/Configuration.java
1472 CPPFLAGS=$GCJ_SAVE_CPPFLAGS
1474 AC_CHECK_SIZEOF(void *)
1476 AC_C_BIGENDIAN
1478 ZLIBS=
1479 SYS_ZLIBS=
1480 ZINCS=
1482 if test -z "$ZLIBSPEC"; then
1483    # Use zlib from the GCC tree.
1484    ZINCS='-I$(top_srcdir)/../zlib'
1485    ZLIBS=../zlib/libzgcj_convenience.la
1486 else
1487    # System's zlib.
1488    SYS_ZLIBS="$ZLIBSPEC"
1490 AC_SUBST(ZLIBS)
1491 AC_SUBST(SYS_ZLIBS)
1492 AC_SUBST(ZINCS)
1493 AC_SUBST(DIVIDESPEC)
1494 AC_SUBST(CHECKREFSPEC)
1495 AC_SUBST(EXCEPTIONSPEC)
1496 AC_SUBST(BACKTRACESPEC)
1497 AC_SUBST(IEEESPEC)
1498 AC_SUBST(ATOMICSPEC)
1500 AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes)
1501 AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = yes)
1502 AM_CONDITIONAL(NEEDS_DATA_START, test "$NEEDS_DATA_START" = yes && test "$NATIVE" = yes)
1503 AM_CONDITIONAL(INSTALL_BINARIES, test -z "${with_multisubdir}")
1504 AC_SUBST(LIBGCC_UNWIND_INCLUDE)
1506 # Process the option "--enable-version-specific-runtime-libs"
1507 # Calculate toolexeclibdir
1508 case ${version_specific_libs} in
1509   yes)
1510     # Need the gcc compiler version to know where to install libraries
1511     # and header files if --enable-version-specific-runtime-libs option
1512     # is selected.
1513     includedir='$(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include/'
1514     toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
1515     toolexecmainlibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
1516     toolexeclibdir=$toolexecmainlibdir
1517     ;;
1518   no)
1519     if test -n "$with_cross_host" &&
1520        test x"$with_cross_host" != x"no"; then
1521       # Install a library built with a cross compiler in tooldir, not libdir.
1522       toolexecdir='$(exec_prefix)/$(target_noncanonical)'
1523       toolexecmainlibdir='$(toolexecdir)/lib'
1524     else
1525       toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
1526       toolexecmainlibdir='$(libdir)'
1527     fi
1528     multi_os_directory=`$CC -print-multi-os-directory`
1529     case $multi_os_directory in
1530       .) toolexeclibdir=$toolexecmainlibdir ;; # Avoid trailing /.
1531       *) toolexeclibdir=$toolexecmainlibdir/$multi_os_directory ;;
1532     esac
1533     ;;
1534 esac
1535 AC_SUBST(toolexecdir)
1536 AC_SUBST(toolexecmainlibdir)
1537 AC_SUBST(toolexeclibdir)
1539 # Determine gcj and libgcj version number.
1540 gcjversion=`cat "$srcdir/../gcc/BASE-VER"`
1541 libgcj_soversion=`awk -F: '/^[[^#]].*:/ { print $1 }' $srcdir/libtool-version`
1542 GCJVERSION=$gcjversion
1543 AC_SUBST(GCJVERSION)
1544 AC_DEFINE_UNQUOTED(GCJVERSION, "$GCJVERSION", [Short GCJ version ID])
1546 # Determine where the standard .db file and GNU Classpath JNI
1547 # libraries are found.
1548 gcjsubdir=gcj-$gcjversion-$libgcj_soversion
1549 dbexecdir='$(toolexeclibdir)/'$gcjsubdir
1550 AC_SUBST(dbexecdir)
1551 AC_SUBST(gcjsubdir)
1553 AC_DEFINE(JV_VERSION, "1.5.0", [Compatibility version string])
1554 AC_DEFINE(JV_API_VERSION, "1.5", [API compatibility version string])
1556 TL_AC_GXX_INCLUDE_DIR
1558 # We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
1559 # On that system, sys/ioctl.h will not include sys/filio.h unless
1560 # BSD_COMP is defined; just including sys/filio.h is simpler.
1561 # We avoid AC_HEADER_DIRENT since we really only care about dirent.h
1562 # for now.  If you change this, you also must update natFile.cc.
1563 AC_CHECK_HEADERS([unistd.h sys/time.h sys/types.h fcntl.h \
1564                   sys/ioctl.h sys/filio.h sys/stat.h sys/select.h \
1565                   sys/socket.h netinet/in.h arpa/inet.h netdb.h \
1566                   pwd.h sys/config.h stdint.h langinfo.h locale.h \
1567                   dirent.h sys/rw_lock.h magic.h ifaddrs.h])
1569 # sys/socket.h is a prerequisite for net/if.h on Solaris.
1570 AC_CHECK_HEADERS(net/if.h, [], [], [
1571 #ifdef HAVE_SYS_SOCKET_H
1572 #include <sys/socket.h>
1573 #endif
1576 AC_CHECK_HEADERS(inttypes.h, [
1577     AC_DEFINE(HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
1578     AC_DEFINE(JV_HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
1581 AC_CHECK_TYPE([ssize_t], [int])
1582 AC_CHECK_TYPE([magic_t], [
1583     AC_DEFINE(HAVE_MAGIC_T, 1, [Define if magic.h declares magic_t])], [], [
1584 #ifdef HAVE_MAGIC_H
1585 #include <magic.h>
1586 #endif])
1588 AC_MSG_CHECKING([for in_addr_t])
1589 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1590 #if STDC_HEADERS
1591 #include <stdlib.h>
1592 #include <stddef.h>
1593 #endif
1594 #if HAVE_NETINET_IN_H
1595 #include <netinet/in.h>
1596 #endif]], [[in_addr_t foo;]])],
1597   [AC_DEFINE(HAVE_IN_ADDR_T, 1,
1598      [Define to 1 if 'in_addr_t' is defined in sys/types.h or netinet/in.h.])
1599    AC_MSG_RESULT(yes)],
1600   [AC_MSG_RESULT(no)])
1602 AC_MSG_CHECKING([whether struct ip_mreq is in netinet/in.h])
1603 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[struct ip_mreq mreq;]])],
1604   [AC_DEFINE(HAVE_STRUCT_IP_MREQ, 1,
1605      [Define if struct ip_mreq is defined in netinet/in.h.])
1606    AC_MSG_RESULT(yes)],
1607   [AC_MSG_RESULT(no)])
1609 AC_MSG_CHECKING([whether struct ipv6_mreq is in netinet/in.h])
1610 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[struct ipv6_mreq mreq6;]])],
1611   [AC_DEFINE(HAVE_STRUCT_IPV6_MREQ, 1,
1612      [Define if struct ipv6_mreq is defined in netinet/in.h.])
1613    AC_MSG_RESULT(yes)],
1614   [AC_MSG_RESULT(no)])
1616 AC_MSG_CHECKING([whether struct sockaddr_in6 is in netinet/in.h])
1617 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[struct sockaddr_in6 addr6;]])],
1618   [AC_DEFINE(HAVE_INET6, 1,
1619      [Define if inet6 structures are defined in netinet/in.h.])
1620    AC_MSG_RESULT(yes)],
1621   [AC_MSG_RESULT(no)])
1623 AC_MSG_CHECKING([for socklen_t in sys/socket.h])
1624 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_PII_SOCKET
1625 #include <sys/types.h>
1626 #include <sys/socket.h>]], [[socklen_t x = 5;]])],
1627   [AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define it socklen_t typedef is in sys/socket.h.])
1628    AC_MSG_RESULT(yes)],
1629   [AC_MSG_RESULT(no)])
1631 AC_MSG_CHECKING([for tm_gmtoff in struct tm])
1632 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tim; tim.tm_gmtoff = 0;]])],
1633   [AC_DEFINE(STRUCT_TM_HAS_GMTOFF, 1, [Define if struct tm has tm_gmtoff field.])
1634    AC_MSG_RESULT(yes)],
1635   [AC_MSG_RESULT(no)
1636    AC_MSG_CHECKING([for global timezone variable])
1637    dnl FIXME: we don't want a link check here because that won't work
1638    dnl when cross-compiling.  So instead we make an assumption that
1639    dnl the header file will mention timezone if it exists.
1640    dnl Don't find the win32 function timezone
1641    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[void i(){long z2 = 2*timezone;}]])],
1642      [AC_DEFINE(HAVE_TIMEZONE, 1, [Define if global 'timezone' exists.])
1643       AC_MSG_RESULT(yes)],
1644      [AC_MSG_RESULT(no)
1645        AC_MSG_CHECKING([for global _timezone variable])
1646        dnl FIXME: As above, don't want link check
1647        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[long z2 = _timezone;]])],
1648          [AC_DEFINE(HAVE_UNDERSCORE_TIMEZONE, 1,
1649             [Define if your platform has the global _timezone variable.])
1650           AC_MSG_RESULT(yes)],
1651           [AC_MSG_RESULT(no)])])])
1653 AC_CHECK_PROGS(PERL, perl, false)
1655 SYSDEP_SOURCES=
1656 SIGNAL_HANDLER_AUX=
1658 case "${host}" in
1659  *-*-solaris2*)
1660     SIGNAL_HANDLER=include/posix-signal.h
1661     ;;
1662  i?86-*-linux*)
1663     SIGNAL_HANDLER=include/i386-signal.h
1664     SIGNAL_HANDLER_AUX=include/x86_64-signal.h
1665     ;;
1666 # ia64-*)
1667 #    SYSDEP_SOURCES=sysdep/ia64.c
1668 #    test -d sysdep || mkdir sysdep
1669 #    ;;
1670  hppa*-*-linux*)
1671     SIGNAL_HANDLER=include/pa-signal.h
1672     ;;
1673  hppa*-hp-hpux*)
1674     SIGNAL_HANDLER=include/hppa-signal.h
1675     ;;
1676  ia64-*-linux*)
1677     SIGNAL_HANDLER=include/dwarf2-signal.h
1678     ;;
1679  powerpc*-*-linux*)
1680     SIGNAL_HANDLER=include/powerpc-signal.h
1681     ;;
1682  alpha*-*-linux*)
1683     SIGNAL_HANDLER=include/dwarf2-signal.h
1684     ;;
1685  s390*-*-linux*)
1686     SIGNAL_HANDLER=include/s390-signal.h
1687     ;;
1688  x86_64*-*-linux*)
1689     SIGNAL_HANDLER=include/x86_64-signal.h
1690     SIGNAL_HANDLER_AUX=include/i386-signal.h
1691     ;;
1692  sparc*-*-linux*)
1693     SIGNAL_HANDLER=include/dwarf2-signal.h
1694     ;;
1695  sh*-*-linux*)
1696     SIGNAL_HANDLER=include/sh-signal.h
1697     ;;
1698  *mingw*)
1699     SIGNAL_HANDLER=include/win32-signal.h
1700     ;;
1701  mips*-*-linux*)
1702     SIGNAL_HANDLER=include/mips-signal.h
1703     ;;
1704  m68*-*-linux*)
1705     SIGNAL_HANDLER=include/dwarf2-signal.h
1706     ;;
1707  powerpc*-*-darwin* | i?86-*-darwin[[912]]* | x86_64-*-darwin[[912]]*)
1708     SIGNAL_HANDLER=include/darwin-signal.h
1709     ;;
1710  powerpc*-*-aix*)
1711     SIGNAL_HANDLER=include/aix-signal.h
1712     ;;
1713  i?86-*-freebsd* | x86_64-*-freebsd*)
1714     SIGNAL_HANDLER=include/freebsd-signal.h
1715     ;;
1716  *)
1717     SIGNAL_HANDLER=include/default-signal.h
1718     ;;
1719 esac
1721 # If we're using sjlj exceptions, forget what we just learned.
1722 if test "$ac_cv_sjlj_exceptions" = yes; then
1723    SIGNAL_HANDLER=include/default-signal.h
1724    SIGNAL_HANDLER_AUX=
1727 AC_SUBST(SYSDEP_SOURCES)
1729 if test -z "$SIGNAL_HANDLER_AUX"; then
1730   SIGNAL_HANDLER_AUX=$SIGNAL_HANDLER
1733 AC_CONFIG_LINKS(include/java-signal.h:$SIGNAL_HANDLER
1734                 include/java-signal-aux.h:$SIGNAL_HANDLER_AUX)
1736 if test "${multilib}" = "yes"; then
1737   multilib_arg="--enable-multilib"
1738 else
1739   multilib_arg=
1742 # See if we support thread-local storage.
1743 GCC_CHECK_TLS
1745 # For _Unwind_GetIPInfo.
1746 GCC_CHECK_UNWIND_GETIPINFO
1748 # See if linker supports anonymous version scripts.
1749 AC_CACHE_CHECK([whether ld supports anonymous version scripts],
1750   [libjava_cv_anon_version_script],
1751   [AC_ARG_ENABLE(symvers,
1752      AS_HELP_STRING([--disable-symvers],
1753                     [disable symbol versioning for libjava]),
1754        [case "$enableval" in
1755          yes|gnu*) libjava_cv_anon_version_script=yes ;;
1756          no)  libjava_cv_anon_version_script=no ;;
1757          *)   AC_MSG_ERROR([Unknown argument to enable/disable symvers]);;
1758         esac],
1759        [libjava_cv_anon_version_script=yes]
1760    )
1761    if test x$libjava_cv_anon_version_script = xyes; then
1762      save_CFLAGS="$CFLAGS"; save_LDFLAGS="$LDFLAGS"
1763      CFLAGS="$CFLAGS -fPIC";
1764      LDFLAGS="$LDFLAGS -shared -Wl,--version-script,conftest.map"
1765      echo '{ global: globalsymb*; local: *; };' > conftest.map
1766      AC_TRY_LINK(void globalsymbol (void) {} void localsymbol (void) {},,
1767                  [libjava_cv_anon_version_script=gnu],
1768                  [libjava_cv_anon_version_script=no])
1769      if test x$libjava_cv_anon_version_script = xno; then
1770        case "$target_os" in
1771          solaris2*)
1772            LDFLAGS="$save_LDFLAGS"
1773            LDFLAGS="$LDFLAGS -shared -Wl,-M,conftest.map"
1774            # Sun ld doesn't understand wildcards here.
1775            echo '{ global: globalsymbol; local: *; };' > conftest.map
1776            AC_TRY_LINK(void globalsymbol (void) {} void localsymbol (void) {},,
1777                        [libjava_cv_anon_version_script=sun], [])
1778            ;;
1779        esac
1780      fi
1781      CFLAGS="$save_CFLAGS"; LDFLAGS="$save_LDFLAGS"
1782    fi
1783   ])
1784 AM_CONDITIONAL(ANONVERSCRIPT, test "$libjava_cv_anon_version_script" != no)
1785 AM_CONDITIONAL(ANONVERSCRIPT_GNU, test "$libjava_cv_anon_version_script" = gnu)
1786 AM_CONDITIONAL(ANONVERSCRIPT_SUN, test "$libjava_cv_anon_version_script" = sun)
1788 # Check if linker supports static linking on a per library basis
1789 LD_START_STATIC_SPEC=
1790 LD_FINISH_STATIC_SPEC=
1791 if $LD --help 2>&1 | grep -- -call_shared >/dev/null 2>&1; then
1792   if $LD --help 2>&1 | grep -- -non_shared >/dev/null 2>&1; then
1793     LD_START_STATIC_SPEC='%{static-libgcj:-non_shared}'
1794     LD_FINISH_STATIC_SPEC='%{static-libgcj:-call_shared}'
1795   fi
1797 AC_SUBST(LD_START_STATIC_SPEC)
1798 AC_SUBST(LD_FINISH_STATIC_SPEC)
1800 here=`${PWDCMD-pwd}`
1801 AC_SUBST(here)
1803 # We get this from the environment.
1804 AC_SUBST(GCJFLAGS)
1806 default_python_dir="/share/gcc-`cat ${srcdir}/../gcc/BASE-VER`/python/libjava"
1807 AC_ARG_WITH([python-dir],
1808             AS_HELP_STRING([--with-python-dir],
1809                            [the location to install Python modules. This path should NOT include the prefix.]),
1810             [with_python_dir=$withval], [with_python_dir="${default_python_dir}"])
1812 # Needed for installing Python modules during make install.
1813 python_mod_dir="\${prefix}${with_python_dir}"
1815 # Needed for substituting into aot-compile*
1816 python_mod_dir_expanded="${expanded_prefix}${with_python_dir}"
1818 AC_MSG_RESULT(Python modules dir: ${python_mod_dir_expanded});
1819 AC_SUBST(python_mod_dir)
1820 AC_SUBST(python_mod_dir_expanded)
1822 # needed for aot-compile-rpm
1823 MAKE=`which make`
1824 AC_SUBST(MAKE)
1826 AC_ARG_ENABLE([aot-compile-rpm],
1827   [AS_HELP_STRING([--enable-aot-compile-rpm],
1828                  [enable installation of aot-compile-rpm [default=no]])],
1829   [case "${enableval}" in
1830     yes) AOT_RPM_ENABLED=yes ;;
1831     no)  AOT_RPM_ENABLED=no ;;
1832     *)   AC_MSG_ERROR([Unknown argument to enable/disable aot-compile-rpm]) ;;
1833   esac],
1834   [AOT_RPM_ENABLED=no]
1836 AM_CONDITIONAL(INSTALL_AOT_RPM, test "x${AOT_RPM_ENABLED}" = xyes)
1838 AC_ARG_ENABLE([java-home],
1839   [AS_HELP_STRING([--enable-java-home],
1840                  [create a standard JDK-style directory layout in the install tree [default=no]])],
1841   [case "${enableval}" in
1842     yes) JAVA_HOME_ENABLED=yes ;;
1843     no)  JAVA_HOME_ENABLED=no ;;
1844     *)   AC_MSG_ERROR([Unknown argument to enable/disable java-home]) ;;
1845   esac],
1846   [JAVA_HOME_ENABLED=no]
1848 AM_CONDITIONAL(CREATE_JAVA_HOME, test "x${JAVA_HOME_ENABLED}" = xyes)
1850 # Only do these checks if java-home above is enabled.
1851 if test "x${JAVA_HOME_ENABLED}" = xyes
1852 then
1854   AC_ARG_WITH([gcc-suffix],
1855               AS_HELP_STRING([--with-gcc-suffix],
1856                              [the GCC tool suffix (defaults to empty string)]),
1857               [gcc_suffix=$withval], [gcc_suffix=""])
1858   AC_MSG_RESULT(GCC suffix: ${gcc_suffix})
1859   AC_SUBST(gcc_suffix)
1861   AC_ARG_WITH([arch-directory],
1862               AS_HELP_STRING([--with-arch-directory],
1863                              [the arch directory under jre/lib (defaults to auto-detect)]),
1864               [host_cpu=$withval], [host_cpu=""])
1866   AC_ARG_WITH([os-directory],
1867               AS_HELP_STRING([--with-os-directory],
1868                              [the os directory under include (defaults to auto-detect)]),
1869               [host_os=$withval], [host_os=""])
1871   AC_ARG_WITH([origin-name],
1872               AS_HELP_STRING([--with-origin-name],
1873                              [the JPackage origin name of this package (default is gcj${gcc_suffix}]),
1874               [origin_name=$withval], [origin_name=gcj${gcc_suffix}])
1875   AC_MSG_RESULT(JPackage origin name: ${origin_name})
1877   AC_ARG_WITH([arch-suffix],
1878               AS_HELP_STRING([--with-arch-suffix],
1879                              [the arch directory suffix (default is the empty string]),
1880               [arch_suffix=$withval], [arch_suffix=""])
1881   AC_MSG_RESULT(arch suffix: ${arch_suffix})
1883   AC_ARG_WITH([jvm-root-dir],
1884               AS_HELP_STRING([--with-jvm-root-dir],
1885                              [where to install SDK (default is ${prefix}/lib/jvm)]),
1886               [jvm_root_dir=$withval], [jvm_root_dir="\${prefix}/lib/jvm"])
1887   AC_MSG_RESULT(JVM root installation directory: ${jvm_root_dir})
1889   AC_ARG_WITH([jvm-jar-dir],
1890               AS_HELP_STRING([--with-jvm-jar-dir],
1891                                          [where to install jars (default is ${prefix}/lib/jvm-exports)]),
1892               [jvm_jar_dir=$withval], [jvm_jar_dir=\${prefix}/lib/jvm-exports])
1893   AC_MSG_RESULT(JAR root installation directory: ${jvm_jar_dir})
1895   JAVA_VERSION=1.5.0
1896   BUILD_VERSION=0
1897   AC_SUBST(JAVA_VERSION)
1898   AC_SUBST(BUILD_VERSION)
1899   AC_MSG_RESULT(Java version: ${JAVA_VERSION})
1901   jre_dir=jre
1902   jre_lnk=jre-${JAVA_VERSION}-${origin_name}
1903   sdk_lnk=java-${JAVA_VERSION}-${origin_name}
1905   JVM_ROOT_DIR=${jvm_root_dir}
1906   AC_SUBST(JVM_ROOT_DIR)
1907   AC_MSG_RESULT(JVM ROOT directory: ${JVM_ROOT_DIR})
1909   JVM_JAR_ROOT_DIR=${jvm_jar_dir}
1910   AC_SUBST(JVM_JAR_ROOT_DIR)
1911   AC_MSG_RESULT(JVM JAR ROOT directory: ${JVM_JAR_ROOT_DIR})
1913   JVM_JAR_DIR=${jvm_jar_dir}
1914   AC_SUBST(JVM_JAR_DIR)
1915   AC_MSG_RESULT(JVM JAR directory: ${JVM_JAR_DIR})
1917   JRE_DIR=${jre_dir}
1918   AC_SUBST(JRE_DIR)
1920   JRE_LNK=${jre_lnk}
1921   AC_SUBST(JRE_LNK)
1923   SDK_LNK=${sdk_lnk}
1924   AC_SUBST(SDK_LNK)
1926   SDK_BIN_DIR=${jvm_root_dir}/bin
1927   AC_SUBST(SDK_BIN_DIR)
1928   AC_MSG_RESULT(SDK tools directory: ${SDK_BIN_DIR})
1930   SDK_LIB_DIR=${jvm_root_dir}/lib
1931   AC_SUBST(SDK_LIB_DIR)
1932   AC_MSG_RESULT(SDK jar directory: ${SDK_LIB_DIR})
1934   SDK_INCLUDE_DIR=${jvm_root_dir}/include
1935   AC_SUBST(SDK_INCLUDE_DIR)
1936   AC_MSG_RESULT(SDK include directory: ${SDK_INCLUDE_DIR})
1938   JRE_BIN_DIR=${jvm_root_dir}/${jre_dir}/bin
1939   AC_SUBST(JRE_BIN_DIR)
1940   AC_MSG_RESULT(JRE tools directory: ${JRE_BIN_DIR})
1942   JRE_LIB_DIR=${jvm_root_dir}/${jre_dir}/lib
1943   AC_SUBST(JRE_LIB_DIR)
1944   AC_MSG_RESULT(JRE lib directory: ${JRE_LIB_DIR})
1946   # Find gcj prefix using gcj found in PATH.
1947   gcj_prefix=`which gcj${gcc_suffix} | sed "s%/bin/gcj${gcc_suffix}%%"`
1949   # Where do the gcj binaries live?
1950   # For jhbuild based builds, they all live in a sibling of bin called
1951   # gcj-bin.  Check for gcj-bin first, and use bin otherwise.
1952   GCJ_BIN_DIR=`if test -d ${gcj_prefix}/gcj-bin; then echo ${gcj_prefix}/gcj-bin; else echo ${gcj_prefix}/bin; fi`
1953   AC_SUBST(GCJ_BIN_DIR)
1954   AC_MSG_RESULT(GCJ tools directory: ${GCJ_BIN_DIR})
1956   AC_MSG_RESULT(host is ${host})
1957   if test "x${host_cpu}" = "x"
1958   then
1959     case ${host} in
1960       *-mingw* | *-cygwin*)
1961         host_cpu=x86;;
1962       i486-* | i586-* | i686-*)
1963         host_cpu=i386;;
1964       x86_64-*)
1965         host_cpu=amd64;;
1966       *)
1967         host_cpu=${host_cpu};;
1968     esac
1969   fi
1970   AC_MSG_RESULT(arch directory: ${host_cpu})
1971   CPU=${host_cpu}
1972   AC_SUBST(CPU)
1974   if test "x${host_os}" = "x"
1975   then
1976     case ${host} in
1977       *-mingw* | *-cygwin*)
1978         host_os=win32;;
1979       *-linux*)
1980         host_os=linux;;
1981       *)
1982         host_os=${host_os};;
1983     esac
1984   fi
1985   echo os directory: ${host_os}
1986   OS=${host_os}
1987   AC_SUBST(OS)
1989   # make an expanded $libdir, for substituting into
1990   # scripts (and other non-Makefile things).
1991   LIBDIR=$libdir
1992   if test "x${exec_prefix}" = "xNONE"
1993   then
1994       lib_exec_prefix=$expanded_prefix
1995   else
1996       lib_exec_prefix=$exec_prefix
1997   fi
1998   LIBDIR=`echo $libdir | sed "s:\\\${exec_prefix}:$lib_exec_prefix:g"`
1999   AC_SUBST(LIBDIR)
2002 AC_CONFIG_FILES([
2003 Makefile
2004 libgcj.pc
2005 libgcj.spec
2006 libgcj-test.spec
2007 gcj/Makefile
2008 include/Makefile
2009 testsuite/Makefile
2010 contrib/aotcompile.py
2011 contrib/aot-compile
2012 contrib/aot-compile-rpm
2013 contrib/generate-cacerts.pl
2014 contrib/rebuild-gcj-db
2017 if test ${multilib} = yes; then
2018   multilib_arg="--enable-multilib"
2019 else
2020   multilib_arg=
2023 AC_CONFIG_FILES([scripts/jar], [chmod +x scripts/jar])
2024 AC_OUTPUT