diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 6846f9b2af7aa4c6fccbb1c2eedc97773d198465..c0c18ea08141a730181669f476d815ae9284e5fd 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,8 @@
+2007-09-04  Matthias Klose  <doko@ubuntu.com>
+
+	* configure.ac: Do not pass --with-native-libdir to classpath.
+	* configure: Regenerate.
+
 2007-09-04  Matthias Klose  <doko@ubuntu.com>
 
 	PR libgcj/33278
diff --git a/libjava/classpath/ChangeLog.gcj b/libjava/classpath/ChangeLog.gcj
index ff019d023680205b6d92a2fb3e3647781e49e9e2..b5de4d8086e5d3702c01e937d1132d286e0b2763 100644
--- a/libjava/classpath/ChangeLog.gcj
+++ b/libjava/classpath/ChangeLog.gcj
@@ -1,3 +1,8 @@
+2007-09-04  Matthias Klose  <doko@ubuntu.com>
+
+	* configure.ac: Append libgcj soversion to nativeexeclibdir.
+	* configure: Regenerate.
+
 2007-08-04  Matthias Klose  <doko@ubuntu.com>
 
 	* java/util/EnumMap.java (clone): Add cast.
diff --git a/libjava/classpath/configure b/libjava/classpath/configure
index 3e8b19dda8d635e456252089a724399560aa5215..7d283ed19a38f4c5fe39c81266c56df760386c98 100755
--- a/libjava/classpath/configure
+++ b/libjava/classpath/configure
@@ -4771,7 +4771,7 @@ if test "${with_native_libdir+set}" = set; then
 
 else
 
-	     nativeexeclibdir='${toolexeclibdir}/gcj-'`cat ${srcdir}/../../gcc/BASE-VER`
+	     nativeexeclibdir='${toolexeclibdir}/gcj-'`cat ${srcdir}/../../gcc/BASE-VER`-`awk -F: '/^[^#].*:/ { print $1 }' ${srcdir}/../libtool-version`
 
 fi;
 
diff --git a/libjava/classpath/configure.ac b/libjava/classpath/configure.ac
index b6feecf5b68069a20584317c5788a720625da9e6..0a017d19e9d64cbaae8198a408178909256b54aa 100644
--- a/libjava/classpath/configure.ac
+++ b/libjava/classpath/configure.ac
@@ -294,14 +294,14 @@ CLASSPATH_TOOLEXECLIBDIR
 dnl -----------------------------------------------------------
 dnl Sets the native libraries installation dir
 dnl -----------------------------------------------------------
-dnl GCJ LOCAL: default to ${toolexeclibdir}/gcj-${gcc_version}
+dnl GCJ LOCAL: default to ${toolexeclibdir}/gcj-${gcc_version}-${libgcj_soversion}
 AC_ARG_WITH([native-libdir],
 	    [AS_HELP_STRING(--with-native-libdir,sets the installation directory for native libraries [default='${libdir}/${PACKAGE}'])],
 	    [
 	     nativeexeclibdir=${withval}
 	    ],
 	    [
-	     nativeexeclibdir='${toolexeclibdir}/gcj-'`cat ${srcdir}/../../gcc/BASE-VER`
+	     nativeexeclibdir='${toolexeclibdir}/gcj-'`cat ${srcdir}/../../gcc/BASE-VER`-`awk -F: '/^[[^#]].*:/ { print $1 }' ${srcdir}/../libtool-version`
 	    ])
 
 AC_SUBST(nativeexeclibdir)
diff --git a/libjava/configure b/libjava/configure
index 89e5fff58df2ab900bf43072288c6396b092ce97..f2192058781821fe64d121fa750077fd6ae662fe 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -26200,17 +26200,17 @@ _ACEOF
 
 # Determine where the standard .db file and GNU Classpath JNI
 # libraries are found.
+gcjsubdir=gcj-$gcjversion-$libgcj_soversion
 multi_os_directory=`$CC -print-multi-os-directory`
 case $multi_os_directory in
   .)
-   dbexecdir='$(libdir)/gcj-$(gcc_version)'-$libgcj_soversion # Avoid /.
+   dbexecdir='$(libdir)/'$gcjsubdir # Avoid /.
    ;;
   *)
-   dbexecdir='$(libdir)/'$multi_os_directory'/gcj-$(gcc_version)'-$libgcj_soversion
+   dbexecdir='$(libdir)/'$multi_os_directory/$gcjsubdir
    ;;
 esac
 
-ac_configure_args="$ac_configure_args --with-native-libdir=\$\(toolexeclibdir\)/gcj-$gcjversion-$libgcj_soversion"
 
 
 cat >>confdefs.h <<\_ACEOF
diff --git a/libjava/configure.ac b/libjava/configure.ac
index e1fada2eddfddf8531e1019a072674acc2ea1b0b..c99a882784316245dc6b1bfc93ea02b86239d093 100644
--- a/libjava/configure.ac
+++ b/libjava/configure.ac
@@ -1389,17 +1389,17 @@ AC_DEFINE_UNQUOTED(GCJVERSION, "$GCJVERSION", [Short GCJ version ID])
 
 # Determine where the standard .db file and GNU Classpath JNI
 # libraries are found.
+gcjsubdir=gcj-$gcjversion-$libgcj_soversion
 multi_os_directory=`$CC -print-multi-os-directory`
 case $multi_os_directory in
   .)
-   dbexecdir='$(libdir)/gcj-$(gcc_version)'-$libgcj_soversion # Avoid /.
+   dbexecdir='$(libdir)/'$gcjsubdir # Avoid /.
    ;;
   *)
-   dbexecdir='$(libdir)/'$multi_os_directory'/gcj-$(gcc_version)'-$libgcj_soversion
+   dbexecdir='$(libdir)/'$multi_os_directory/$gcjsubdir
    ;;
 esac
 AC_SUBST(dbexecdir)
-ac_configure_args="$ac_configure_args --with-native-libdir=\$\(toolexeclibdir\)/gcj-$gcjversion-$libgcj_soversion"
 
 AC_DEFINE(JV_VERSION, "1.5.0", [Compatibility version string])
 AC_DEFINE(JV_API_VERSION, "1.5", [API compatibility version string])