OSDN Git Service

* configure: Rebuilt.
[pf3gnuchains/gcc-fork.git] / libjava / configure.ac
index 61474b2..113b9ba 100644 (file)
@@ -5,6 +5,8 @@ AC_INIT([libjava], [version-unused],, [libjava])
 
 AC_CONFIG_SRCDIR(java/lang/System.java)
 
+GCC_TOPLEV_SUBDIRS
+
 # We use these options to decide which functions to include.
 AC_ARG_WITH(target-subdir,
   AS_HELP_STRING([--with-target-subdir=SUBDIR],
@@ -111,6 +113,7 @@ AC_SUBST(LDFLAGS)
 AM_INIT_AUTOMAKE([1.9.0])
 
 AC_CHECK_TOOL(AS, as)
+AC_CHECK_TOOL(LD, ld)
 AC_CHECK_TOOL(AR, ar)
 AC_CHECK_TOOL(RANLIB, ranlib, :)
 
@@ -140,8 +143,209 @@ AC_SUBST(LIBGCJ_CXXFLAGS)
 AC_SUBST(LIBGCJ_JAVAFLAGS)
 AC_SUBST(LIBGCJ_LD_SYMBOLIC)
 
+# Only use libltdl for non-newlib builds.
+if test "x${with_newlib}" = "x" || test "x${with_newlib}" = "xno"; then
+   AC_LTDL_SHLIBPATH
+fi
+
 AC_CONFIG_HEADERS([include/config.h gcj/libgcj-config.h])
 
+# See if the user has requested runtime debugging.
+LIBGCJDEBUG="disable"
+AC_SUBST(LIBGCJDEBUG)
+AC_ARG_ENABLE(libgcj-debug,
+  AS_HELP_STRING([--enable-libgcj-debug],
+                 [enable runtime debugging code]),
+  [if test "$enable_libgcj_debug" = yes; then
+    AC_DEFINE(DEBUG, 1, [Define this if you want runtime debugging enabled.])
+    LIBGCJDEBUG="enable"
+  fi])
+
+# Determine which AWT peer libraries to build
+AC_ARG_ENABLE(java-awt,
+  AS_HELP_STRING([--enable-java-awt],
+                 [list of AWT peer implementations to be built]))
+
+peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
+use_xlib_awt=""
+use_gtk_awt=""
+use_qt_awt=""
+# The default toolkit to use is the first one specified.
+TOOLKIT=
+AC_SUBST(TOOLKIT)
+
+for peer in $peerlibs ; do
+  case $peer in
+    xlib)
+      if test "$no_x" = yes; then
+        echo "*** xlib peers requested but no X library available" 1>&2
+        exit 1
+      else
+        use_xlib_awt="yes"
+       if test -z "$TOOLKIT"; then
+          TOOLKIT=gnu.awt.xlib.XToolkit
+       fi
+      fi
+      ;;
+    gtk)
+      if test "$no_x" = yes; then
+        echo "*** gtk peers requested but no X library available" 1>&2
+        exit 1
+      else
+        use_gtk_awt=yes
+        if test -z "$TOOLKIT"; then
+           TOOLKIT=gnu.java.awt.peer.gtk.GtkToolkit
+        fi
+      fi
+      ;;
+    qt)
+      if test "$no_x" = yes; then
+         # Perhaps we should admit the possibility of embedded Qt.
+        echo "*** Qt peers requested but no X library available" 1>&2
+        exit 1
+      else
+        use_qt_awt=yes
+        if test -z "$TOOLKIT"; then
+           TOOLKIT=gnu.java.awt.peer.qt.QtToolkit
+        fi
+      fi
+      ;;
+    no)
+      use_xlib_awt=
+      use_gtk_awt=
+      use_qt_awt=
+      break
+      ;;
+    *)
+      echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
+      exit 1
+  esac
+done
+
+AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes)
+AM_CONDITIONAL(GTK_AWT, test "$use_gtk_awt" = yes)
+AM_CONDITIONAL(QT_AWT, test "$use_qt_awt" = yes)
+
+# Create standard.omit based on decisions we just made.
+cp $srcdir/standard.omit.in standard.omit
+if test "$use_xlib_awt" != yes; then
+   echo gnu/awt/xlib >> standard.omit
+   echo gnu/gcj/xlib >> standard.omit
+fi
+if test "$use_gtk_awt" != yes; then
+   echo gnu/java/awt/peer/gtk >> standard.omit
+fi
+if test "$use_qt_awt" != yes; then
+   echo gnu/java/awt/peer/qt >> standard.omit
+fi
+
+if test -z "${with_multisubdir}"; then
+   builddotdot=.
+else
+   builddotdot=`echo ${with_multisubdir} | sed -e 's:[[^/]][[^/]]*:..:g'`
+fi
+
+NATIVE=yes
+
+# Which gcj do we use?
+which_gcj=default
+built_gcc_dir="`cd ${builddotdot}/../../${host_subdir}/gcc && ${PWDCMD-pwd}`"
+if test -n "${with_cross_host}"; then
+  # We are being configured with a cross compiler. We can't
+  # use ac_exeext, because that is for the target platform.
+  NATIVE=no
+  cross_host_exeext=
+  case "${with_cross_host}" in
+     *mingw* | *cygwin*)
+         cross_host_exeext=.exe
+     ;;
+  esac
+  if test -x "${built_gcc_dir}/gcj${cross_host_exeext}"; then
+     if test x"$build_noncanonical" = x"$with_cross_host"; then
+        # Ordinary cross (host!=target and host=build)
+        which_gcj=built
+     else
+        # Canadian cross (host!=target and host!=build)
+        which_gcj=cross
+     fi
+  else
+     which_gcj=cross
+  fi
+else
+  # We are being configured with a native or crossed-native compiler
+  if test -x "${built_gcc_dir}/gcj${ac_exeext}"; then
+     if test x"$build" = x"$host"; then
+        # True native build (host=target and host=build)
+        which_gcj=built
+     else
+        # Crossed-native build (host=target and host!=build)
+        which_gcj=cross
+     fi
+  else
+     which_gcj=path
+  fi
+fi
+case "${which_gcj}" in
+   built)
+      GCJ="$built_gcc_dir/gcj -B`${PWDCMD-pwd}`/ -B$built_gcc_dir/"
+      GCJH='$(top_builddir)/$(MULTIBUILDTOP)../../$(host_subdir)/gcc/gcjh'
+      ZIP='$(top_builddir)/$(MULTIBUILDTOP)../../$(host_subdir)/fastjar/fastjar'
+   ;;
+   cross)
+      if test "x${with_newlib}" = "xyes"; then
+         # FIXME (comment): Why is this needed?
+         GCC_UNWIND_INCLUDE=
+         GCJ="${target_noncanonical}-gcj"
+      else
+         GCJ="${target_noncanonical}-gcj -B`${PWDCMD-pwd}`/"
+      fi
+      ZIP='$(target_noncanonical)-fastjar'
+      GCJH='$(target_noncanonical)-gcjh'
+   ;;
+   path)
+      GCJ="gcj -B`${PWDCMD-pwd}`/"
+      ## In this case, gcj is found outside the build tree.  However, zip is
+      ## found in the build tree.
+      ZIP='$(top_builddir)/$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/fastjar'
+      GCJH=gcjh
+   ;;
+esac
+
+AC_SUBST(GCJH)
+AC_SUBST(ZIP)
+
+# Create it, so that compile/link tests don't fail
+test -f libgcj.spec || touch libgcj.spec
+
+
+
+# Set up to configure Classpath.
+# FIXME: no supported way to pass args in autoconf.
+ac_configure_args="$ac_configure_args --disable-load-library"
+ac_configure_args="$ac_configure_args --${LIBGCJDEBUG}-debug"
+ac_configure_args="$ac_configure_args --enable-default-toolkit=$TOOLKIT"
+dir1=`cd $srcdir && pwd`
+dir2=`pwd`
+ac_configure_args="$ac_configure_args --with-vm-classes=$dir1:$dir2"
+ac_configure_args="$ac_configure_args --disable-core-jni"
+dnl FIXME?
+ac_configure_args="$ac_configure_args --disable-examples"
+ac_configure_args="$ac_configure_args --with-glibj=build"
+if test "$use_gtk_awt" != yes; then
+  ac_configure_args="$ac_configure_args --disable-gtk-peer"
+fi
+if test "$use_qt_awt" != yes; then
+  ac_configure_args="$ac_configure_args --disable-qt-peer"
+else
+  # We need this as qt is disabled by default in classpath.
+  ac_configure_args="$ac_configure_args --enable-qt-peer"
+fi
+dnl --with-gcj=$GCJ
+dnl --with-javah=$GCJH
+dnl gjdoc?
+dnl gtk-cairo -- just export here...
+dnl --enable-regen-headers?
+
 # Only use libltdl for non-newlib builds.
 if test "x${with_newlib}" = "x" || test "x${with_newlib}" = "xno"; then
    AC_LIBLTDL_CONVENIENCE
@@ -160,14 +364,8 @@ AC_SUBST(DIRLTDL)
 AC_PROG_LIBTOOL
 AM_PROG_GCJ
 AM_PROG_CC_C_O
-AC_CONFIG_SUBDIRS(libltdl)
 
-if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then
-   COMPPATH=.
-else
-   COMPPATH=..
-fi
-AC_SUBST(COMPPATH)
+AC_CONFIG_SUBDIRS(classpath libltdl)
 
 # The -no-testsuite modules omit the test subdir.
 AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
@@ -207,16 +405,12 @@ if test -z "$enable_hash_synchronization"; then
    enable_hash_synchronization=$enable_hash_synchronization_default
 fi
 
-# Do we allow intermodule optimizations (i.e. compiling many files at once)?
-AC_ARG_ENABLE(libgcj-multifile,
-  AS_HELP_STRING([--enable-libgcj-multifile]
-                 [allow compilation of several files at once]),
-[case "${enableval}" in
-  yes) enable_libgcj_multifile=yes ;;
-  no)  enable_libgcj_multifile=no ;;
-  *) AC_MSG_ERROR(bad value ${enableval} for --enable-libgcj-multifile) ;;
-esac],[enable_libgcj_multifile=no])
-AM_CONDITIONAL(ONESTEP, test "$enable_libgcj_multifile" = yes)
+AC_ARG_WITH(java-home,
+  AS_HELP_STRING([--with-java-home=DIRECTORY],
+                 [value of java.home system property]),
+                [JAVA_HOME="${withval}"], [JAVA_HOME=""])
+AM_CONDITIONAL(JAVA_HOME_SET, test ! -z "$JAVA_HOME")
+AC_SUBST(JAVA_HOME)
 
 # What is the native OS API for MinGW?
 AC_ARG_WITH(win32-nlsapi,
@@ -243,18 +437,6 @@ if test "${slow_pthread_self}" = "yes"; then
     [Define if if the synchronization code should try to avoid pthread_self calls by caching thread IDs in a hashtable.])
 fi
 
-
-# See if the user has requested runtime debugging.
-LIBGCJDEBUG="false"
-AC_SUBST(LIBGCJDEBUG)
-AC_ARG_ENABLE(libgcj-debug,
-  AS_HELP_STRING([--enable-libgcj-debug],
-                 [enable runtime debugging code]),
-  [if test "$enable_libgcj_debug" = yes; then
-    AC_DEFINE(DEBUG, 1, [Define this if you want runtime debugging enabled.])
-    LIBGCJDEBUG="true"
-  fi])
-
 # Check for gc debugging.  This option is handled both here and in the GC.
 AC_ARG_ENABLE(gc-debug,
    AS_HELP_STRING([--enable-gc-debug],
@@ -387,8 +569,6 @@ AC_ARG_WITH(ecos,
 TARGET_ECOS="$with_ecos"
 )
 
-supply_backtrace=no
-
 PLATFORM_INNER_NAT_HDRS=
 case "$TARGET_ECOS" in
    no) case "$host" in
@@ -426,8 +606,7 @@ AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1,
                                            [Define if you have u_int32_t]))
 
 AM_CONDITIONAL(USING_WIN32_PLATFORM, test "$PLATFORM" = Win32)
-AM_CONDITIONAL(USING_POSIX_PLATFORM, test "$PLATFORM" = Posix)
-AM_CONDITIONAL(USING_ECOS_PLATFORM, test "$PLATFORM" = Ecos)
+AM_CONDITIONAL(USING_POSIX_PLATFORM, test "$PLATFORM" = Posix || test "$PLATFORM" = Ecos)
 
 case "$host" in
   *-darwin*) DARWIN_CRT=true ;;
@@ -454,10 +633,10 @@ test -d java/lang || mkdir java/lang
 AC_CONFIG_LINKS(java/lang/ConcreteProcess.java:java/lang/${PLATFORM}Process.java)
 AC_CONFIG_LINKS(java/lang/natConcreteProcess.cc:java/lang/nat${PLATFORM}Process.cc)
 
-# Likewise for natInetAddress.cc and natNetworkInterface.cc.
+# Likewise for natInetAddress.cc and natVMNetworkInterface.cc.
 test -d java/net || mkdir java/net
 AC_CONFIG_LINKS(java/net/natInetAddress.cc:java/net/natInetAddress${PLATFORMNET}.cc)
-AC_CONFIG_LINKS(java/net/natNetworkInterface.cc:java/net/natNetworkInterface${PLATFORMNET}.cc)
+AC_CONFIG_LINKS(java/net/natVMNetworkInterface.cc:java/net/natVMNetworkInterface${PLATFORMNET}.cc)
 
 # Likewise for natPlainSocketImpl.cc and natPlainDatagramSocketImpl.cc.
 test -d gnu/java || mkdir gnu/java
@@ -498,57 +677,6 @@ AC_SUBST(ZLIBTESTSPEC)
 
 AC_PATH_XTRA
 
-# Determine which AWT peer libraries to build
-AC_ARG_ENABLE(java-awt,
-  AS_HELP_STRING([--enable-java-awt],
-                 [list of AWT peer implementations to be built]))
-
-peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
-use_xlib_awt=""
-use_gtk_awt=""
-# The default toolkit to use is the first one specified.
-TOOLKIT=
-AC_SUBST(TOOLKIT)
-
-for peer in $peerlibs ; do
-  case $peer in
-    xlib)
-      if test "$no_x" = yes; then
-        echo "*** xlib peers requested but no X library available" 1>&2
-        exit 1
-      else
-        use_xlib_awt="yes"
-       if test -z "$TOOLKIT"; then
-          TOOLKIT=gnu.awt.xlib.XToolkit
-       fi
-      fi
-      ;;
-    gtk)
-      if test "$no_x" = yes; then
-        echo "*** xlib peers requested but no X library available" 1>&2
-        exit 1
-      else
-        use_gtk_awt=yes
-        if test -z "$TOOLKIT"; then
-           TOOLKIT=gnu.java.awt.peer.gtk.GtkToolkit
-        fi
-        test -d jniinclude || mkdir jniinclude
-      fi
-      ;;
-    no)
-      use_xlib_awt=
-      use_gtk_awt=
-      break
-      ;;
-    *)
-      echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
-      exit 1
-  esac
-done
-
-AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes)
-AM_CONDITIONAL(GTK_AWT, test "$use_gtk_awt" = yes)
-
 # determine whether to enable the cairo GTK Graphics2D backend
 AC_ARG_ENABLE(gtk-cairo,
   AS_HELP_STRING([--enable-gtk-cairo],
@@ -567,6 +695,17 @@ AC_SUBST(PANGOFT2_CFLAGS)
 # FIXME: this should be _libs on some hosts.
 libsubdir=.libs
 
+# extra LD Flags which are required for targets
+case "${host}" in
+*-*-darwin[[0-7]].*)
+    # For now we have to disable it on darwin[8-9] because it slows down
+    # the linking phase. A possible bug in ld?
+    # on Darwin -single_module speeds up loading of the dynamic libraries.
+    extra_ldflags_libjava=-Wl,-single_module
+    ;;
+esac
+AC_SUBST(extra_ldflags_libjava)
+
 # Allow the GC to be disabled.  Can be useful when debugging.
 AC_MSG_CHECKING([for garbage collector to use])
 AC_ARG_ENABLE(java-gc,
@@ -715,6 +854,8 @@ AM_CONDITIONAL(USING_NO_THREADS, test "$THREADS" = none)
 
 if test -d sysdep; then true; else mkdir sysdep; fi
 AC_CONFIG_LINKS(sysdep/locks.h:sysdep/$sysdeps_dir/locks.h)
+AC_CONFIG_LINKS(sysdep/backtrace.h:$fallback_backtrace_h)
+AC_CONFIG_LINKS(sysdep/descriptor.h:$descriptor_h)
 
 HASH_SYNC_SPEC=
 # Hash synchronization is only useful with posix threads right now.
@@ -724,18 +865,11 @@ if test "$enable_hash_synchronization" = yes && test "$THREADS" != "none"; then
 fi
 AC_SUBST(HASH_SYNC_SPEC)
 
-
 AM_CONDITIONAL(USING_GCC, test "$GCC" = yes)
 
 # We're in the tree with gcc, and need to include some of its headers.
 GCC_UNWIND_INCLUDE='-I$(libgcj_basedir)/../gcc'
 
-TL_AC_GCC_VERSION([$srcdir/..])
-
-# Figure out where generated headers like libgcj-config.h get installed.
-tool_include_dir='$(libdir)/gcc/$(target_noncanonical)/'${gcc_version}/include
-AC_SUBST(tool_include_dir)
-
 if test "x${with_newlib}" = "xyes"; then
    # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
    # may not work correctly, because the compiler may not be able to
@@ -759,49 +893,17 @@ if test "x${with_newlib}" = "xyes"; then
    AC_DEFINE(NO_GETUID, 1, [Define if getuid() and friends are missing.])
    PLATFORMNET=NoNet
 else
-   AC_CHECK_FUNCS(strerror ioctl select fstat open fsync sleep opendir)
-   AC_CHECK_FUNCS(gmtime_r localtime_r readdir_r getpwuid_r getcwd)
-   AC_CHECK_FUNCS(access stat mkdir rename rmdir unlink realpath utime chmod)
-   AC_CHECK_FUNCS(nl_langinfo setlocale)
+   AC_CHECK_FUNCS([strerror ioctl select fstat open fsync sleep opendir \
+                   gmtime_r localtime_r readdir_r getpwuid_r getcwd \
+                  access stat mkdir rename rmdir unlink realpath utime chmod \
+                  nl_langinfo setlocale \
+                  inet_pton uname inet_ntoa \
+                  fork execvp pipe sigaction ftruncate])
    AC_CHECK_FUNCS(inet_aton inet_addr, break)
-   AC_CHECK_FUNCS(inet_pton uname inet_ntoa)
-   AC_CHECK_FUNCS(fork execvp pipe sigaction ftruncate)
    AC_CHECK_HEADERS(execinfo.h unistd.h dlfcn.h) 
-   AC_CHECK_FUNC(backtrace, [
-     case "$host" in
-       ia64-*-linux*)
-        # Has broken backtrace()
-        ;;
-       mips*-*-linux*)
-         # Has broken backtrace(), but we supply our own.
-         if test -d sysdep; then true; else mkdir -p sysdep; fi
-        supply_backtrace=yes
-         AC_DEFINE(HAVE_BACKTRACE, 1,
-           [Define if your platform has a working backtrace() function.])
-         ;;
-       *)
-         AC_DEFINE(HAVE_BACKTRACE, 1,
-           [Define if your platform has a working backtrace() function.])
-        ;;
-     esac
-   ], [
-     case "$host" in
-       *mingw*)
-         # Has backtrace() defined in libgcj itself
-         AC_DEFINE(HAVE_BACKTRACE, 1,
-           [Define if your platform has a working backtrace() function.])
-         ;;
-     esac
-   ])
-
    AC_CHECK_LIB(dl, dladdr, [
-     if test "x${disable_dladdr}" = "xyes"; then
-       #Broken dladdr().
-       true
-     else
-       AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()])
-     fi
-   ])
+       AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()])])
+
    if test x"$build" = x"$host"; then
      AC_CHECK_FILES(/proc/self/exe, [
        AC_DEFINE(HAVE_PROC_SELF_EXE, 1, [Define if you have /proc/self/exe])])
@@ -914,6 +1016,17 @@ else
            AC_DEFINE(HAVE_SCHED_YIELD)
            THREADLIBS="$THREADLIBS -lposix4"
            THREADSPEC="$THREADSPEC -lposix4"])])])
+
+      AC_CHECK_LIB(rt, clock_gettime, [
+         AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])
+        case "$THREADSPEC" in
+          *-lrt*) ;;
+          *)
+            THREADSPEC="$THREADSPEC -lrt"
+            THREADLIBS="$THREADLIBS -lrt"
+            ;;
+        esac])
+
       LIBS="$save_LIBS"
 
       # We can save a little space at runtime if the mutex has m_count
@@ -1014,6 +1127,11 @@ else
       PKG_CHECK_MODULES(LIBART, libart-2.0 >= 2.1)
       AC_SUBST(LIBART_CFLAGS)
       AC_SUBST(LIBART_LIBS)
+
+      # We require the XTest Extension to support java.awt.Robot.
+      AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
+                  [AC_MSG_ERROR([libXtst not found, required by java.awt.Robot])],
+                  [${X_LIBS}])
    fi
 
    # On Solaris, and maybe other architectures, the Boehm collector
@@ -1022,85 +1140,6 @@ else
       AC_CHECK_LIB(dl, main, SYSTEMSPEC="$SYSTEMSPEC -ldl")
    fi
 fi
-AM_CONDITIONAL(SUPPLY_BACKTRACE, test "$supply_backtrace" = yes)
-
-if test -z "${with_multisubdir}"; then
-   builddotdot=.
-else
-   builddotdot=`echo ${with_multisubdir} | sed -e 's:[[^/]][[^/]]*:..:g'`
-fi
-
-NATIVE=yes
-
-# Which gcj do we use?
-which_gcj=default
-built_gcc_dir="`cd ${builddotdot}/../../gcc && ${PWDCMD-pwd}`"
-if test -n "${with_cross_host}"; then
-  # We are being configured with a cross compiler. We can't
-  # use ac_exeext, because that is for the target platform.
-  NATIVE=no
-  cross_host_exeext=
-  case "${with_cross_host}" in
-     *mingw* | *cygwin*)
-         cross_host_exeext=.exe
-     ;;
-  esac
-  if test -x "${built_gcc_dir}/gcj${cross_host_exeext}"; then
-     if test x"$build_noncanonical" = x"$with_cross_host"; then
-        # Ordinary cross (host!=target and host=build)
-        which_gcj=built
-     else
-        # Canadian cross (host!=target and host!=build)
-        which_gcj=cross
-     fi
-  else
-     which_gcj=cross
-  fi
-else
-  # We are being configured with a native or crossed-native compiler
-  if test -x "${built_gcc_dir}/gcj${ac_exeext}"; then
-     if test x"$build" = x"$host"; then
-        # True native build (host=target and host=build)
-        which_gcj=built
-     else
-        # Crossed-native build (host=target and host!=build)
-        which_gcj=cross
-     fi
-  else
-     which_gcj=path
-  fi
-fi
-case "${which_gcj}" in
-   built)
-      GCJ="$built_gcc_dir/gcj -B`${PWDCMD-pwd}`/ -B$built_gcc_dir/"
-      GCJH='$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh'
-      ZIP='$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/fastjar'
-   ;;
-   cross)
-      if test "x${with_newlib}" = "xyes"; then
-         # FIXME (comment): Why is this needed?
-         GCC_UNWIND_INCLUDE=
-         GCJ="${target_noncanonical}-gcj"
-      else
-         GCJ="${target_noncanonical}-gcj -B`${PWDCMD-pwd}`/"
-      fi
-      ZIP=jar
-      GCJH='$(target_noncanonical)-gcjh'
-   ;;
-   path)
-      GCJ="gcj -B`${PWDCMD-pwd}`/"
-      ## In this case, gcj is found outside the build tree.  However, zip is
-      ## found in the build tree.
-      ZIP='$(MULTIBUILDTOP)../$(COMPPATH)/fastjar/fastjar'
-      GCJH=gcjh
-   ;;
-esac
-
-AC_SUBST(GCJH)
-AC_SUBST(ZIP)
-
-# Create it, so that compile/link tests don't fail
-test -f libgcj.spec || touch libgcj.spec
 
 # Use a semicolon as CLASSPATH separator for MinGW, otherwise a colon.
 case $build in
@@ -1119,25 +1158,35 @@ CPPFLAGS="$CPPFLAGS -I`${PWDCMD-pwd}` -I`cd $srcdir && ${PWDCMD-pwd}`"
 if test ! -f gnu/classpath/Configuration.java; then
   test -d gnu || mkdir gnu
   test -d gnu/classpath || mkdir gnu/classpath
-  sed -e 's,@LIBGCJDEBUG@,$LIBGCJDEBUG,' \
-      -e 's,@TOOLKIT@,$TOOLKIT,' \
-       < $srcdir/gnu/classpath/Configuration.java.in \
+  # Note that it is not crucial that all the values here be correct.
+  sed -e "s,@prefix@,$prefix," \
+      -e "s,@VERSION@,$VERSION," \
+      -e "s,@LIBDEBUG@,false," \
+      -e "s,@INIT_LOAD_LIBRARY@,false," \
+      -e "s,@@,$LIBGCJDEBUG," \
+      -e "s,@default_toolkit@,$TOOLKIT," \
+      -e "s,@JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@,false," \
+      -e "s,@GTK_CAIRO_ENABLED@,false," \
+       < $srcdir/classpath/gnu/classpath/Configuration.java.in \
        > gnu/classpath/Configuration.java
   # We do not want to redirect the output of the grep below to /dev/null,
   # but we add /dev/null to the input list so that grep will print the
   # filename of Configuration.java in case it finds any matches.
-  if grep @ gnu/classpath/Configuration.java /dev/null; then
+  if grep '@.*@' gnu/classpath/Configuration.java /dev/null; then
     AC_MSG_ERROR([configure.ac is missing the substitutions above])
   fi
 fi
 
 LT_AC_PROG_GCJ
 
+# Now remove it.
+rm -f gnu/classpath/Configuration.java
+
 CPPFLAGS=$GCJ_SAVE_CPPFLAGS
 
-AC_COMPILE_CHECK_SIZEOF(void *)
+AC_CHECK_SIZEOF(void *)
 
-AC_C_BIGENDIAN_CROSS
+AC_C_BIGENDIAN
 
 ZLIBS=
 SYS_ZLIBS=
@@ -1157,6 +1206,7 @@ AC_SUBST(ZINCS)
 AC_SUBST(DIVIDESPEC)
 AC_SUBST(CHECKREFSPEC)
 AC_SUBST(EXCEPTIONSPEC)
+AC_SUBST(BACKTRACESPEC)
 AC_SUBST(IEEESPEC)
 
 AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes)
@@ -1170,9 +1220,9 @@ case ${version_specific_libs} in
     # Need the gcc compiler version to know where to install libraries
     # and header files if --enable-version-specific-runtime-libs option
     # is selected.
-    includedir='${libdir}/gcc/${target_noncanonical}/'$gcc_version/include/
+    includedir='$(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include/'
     toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
-    toolexecmainlibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
+    toolexecmainlibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
     toolexeclibdir=$toolexecmainlibdir
     ;;
   no)
@@ -1196,19 +1246,35 @@ AC_SUBST(toolexecdir)
 AC_SUBST(toolexecmainlibdir)
 AC_SUBST(toolexeclibdir)
 
+# Determine where the standard .db file is found.
+multi_os_directory=`$CC -print-multi-os-directory`
+case $multi_os_directory in
+  .) dbexecdir='$(libdir)/gcj-$(gcc_version)' ;; # Avoid /.
+  *) dbexecdir='$(libdir)/'$multi_os_directory'/gcj-$(gcc_version)' ;;
+esac
+AC_SUBST(dbexecdir)
+
 # Determine gcj version number.
 gcjversion=`$GCJ -v 2>&1 | sed -n 's/^.*version \([[^ ]]*\).*$/\1/p'`
 GCJVERSION=$gcjversion
 AC_SUBST(GCJVERSION)
 AC_DEFINE_UNQUOTED(GCJVERSION, "$GCJVERSION", [Short GCJ version ID])
 
+AC_DEFINE(JV_VERSION, "1.4.2", [Compatibility version string])
+AC_DEFINE(JV_API_VERSION, "1.4", [API compatibility version string])
+
+TL_AC_GXX_INCLUDE_DIR
+
 # We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
 # On that system, sys/ioctl.h will not include sys/filio.h unless
 # BSD_COMP is defined; just including sys/filio.h is simpler.
-AC_CHECK_HEADERS(unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h net/if.h pwd.h sys/config.h stdint.h langinfo.h locale.h)
 # We avoid AC_HEADER_DIRENT since we really only care about dirent.h
 # for now.  If you change this, you also must update natFile.cc.
-AC_CHECK_HEADERS(dirent.h)
+AC_CHECK_HEADERS([unistd.h bstring.h sys/time.h sys/types.h fcntl.h \
+                 sys/ioctl.h sys/filio.h sys/stat.h sys/select.h \
+                 sys/socket.h netinet/in.h arpa/inet.h netdb.h net/if.h \
+                 pwd.h sys/config.h stdint.h langinfo.h locale.h \
+                 dirent.h])
 AC_CHECK_HEADERS(inttypes.h, [
     AC_DEFINE(HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
     AC_DEFINE(JV_HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
@@ -1346,15 +1412,6 @@ if test "$enable_sjlj_exceptions" = yes; then
    SIGNAL_HANDLER_AUX=
 fi
 
-# Define here any compiler flags that you need in order to make backtrace() work.
-BACKTRACESPEC=
-case "${host}" in
- x86_64*-*-linux*|i?86-*)
-    BACKTRACESPEC=-fno-omit-frame-pointer
-    ;;
-esac
-AC_SUBST(BACKTRACESPEC)
-
 AC_SUBST(SYSDEP_SOURCES)
 
 if test -z "$SIGNAL_HANDLER_AUX"; then
@@ -1370,7 +1427,20 @@ else
   multilib_arg=
 fi
 
+# See if we support thread-local storage.
+GCC_CHECK_TLS
 
+# Check if linker supports static linking on a per library basis
+LD_START_STATIC_SPEC=
+LD_FINISH_STATIC_SPEC=
+if $LD --help 2>&1 | grep -q -e -call_shared ; then
+  if $LD --help 2>&1 | grep -q -e -non_shared ; then
+    LD_START_STATIC_SPEC='%{static-libgcj:-non_shared}'
+    LD_FINISH_STATIC_SPEC='%{static-libgcj:-call_shared}'
+  fi
+fi
+AC_SUBST(LD_START_STATIC_SPEC)
+AC_SUBST(LD_FINISH_STATIC_SPEC)
 
 here=`${PWDCMD-pwd}`
 AC_SUBST(here)
@@ -1383,7 +1453,6 @@ Makefile
 libgcj.pc
 libgcj.spec
 libgcj-test.spec
-gnu/classpath/Configuration.java
 gcj/Makefile
 include/Makefile
 testsuite/Makefile
@@ -1397,6 +1466,12 @@ case " $CONFIG_FILES " in
    ac_file=Makefile . ${libgcj_basedir}/../config-ml.in
    ;;
 esac
+for ac_multi_file in $CONFIG_FILES; do
+  case $ac_multi_file in
+  */Makefile)
+    grep "^MULTI[[^ ]]* =" Makefile >> "$ac_multi_file" ;;
+  esac
+done
 ],
 srcdir=${srcdir}
 host=${host}