Fix year.
[deliverable/binutils-gdb.git] / config / acx.m4
index 9f0dd1e00be5fc152cb1c9791976347372fdde23..826f6ba3ccc9588e0550b3c31748bf2ba2acc54e 100644 (file)
@@ -74,8 +74,22 @@ dnl # amount to a lot more with autoconf 2.5x.
 AC_DEFUN([GCC_TOPLEV_SUBDIRS],
 [AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []dnl
 AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl
+
+# post-stage1 host modules use a different CC_FOR_BUILD so, in order to
+# have matching libraries, they should use host libraries: Makefile.tpl
+# arranges to pass --with-build-libsubdir=$(HOST_SUBDIR).
+# However, they still use the build modules, because the corresponding
+# host modules (e.g. bison) are only built for the host when bootstrap
+# finishes. So:
+# - build_subdir is where we find build modules, and never changes.
+# - build_libsubdir is where we find build libraries, and can be overridden.
+
 # Prefix 'build-' so this never conflicts with target_subdir.
 build_subdir="build-${build_noncanonical}"
+AC_ARG_WITH(build-libsubdir,
+[  --with-build-libsubdir=[DIR]  Directory where to find libraries for build system],
+build_libsubdir="$withval",
+build_libsubdir="$build_subdir")
 # --srcdir=. covers the toplevel, while "test -d" covers the subdirectories
 if ( test $srcdir = . && test -d gcc ) \
    || test -d $srcdir/../host-${host_noncanonical}; then
@@ -85,6 +99,7 @@ else
 fi
 # No prefix.
 target_subdir=${target_noncanonical}
+AC_SUBST([build_libsubdir]) []dnl
 AC_SUBST([build_subdir]) []dnl
 AC_SUBST([host_subdir]) []dnl
 AC_SUBST([target_subdir]) []dnl
@@ -138,8 +153,8 @@ AC_DEFUN([NCN_STRICT_CHECK_TARGET_TOOLS],
 if test -n "$with_build_time_tools"; then
   for ncn_progname in $2; do
     AC_MSG_CHECKING([for ${ncn_progname} in $with_build_time_tools])
-    if test -x $with_build_time_tools/$1; then
-      ac_cv_prog_$1=$with_build_time_tools/$1
+    if test -x $with_build_time_tools/${ncn_progname}; then
+      ac_cv_prog_$1=$with_build_time_tools/${ncn_progname}
       AC_MSG_RESULT(yes)
       break
     else
@@ -271,10 +286,14 @@ AC_REQUIRE([ACX_TOOL_DIRS])
 AC_REQUIRE([ACX_HAVE_GCC_FOR_TARGET])
 if test -z "$ac_cv_path_$1" ; then
   if test -n "$with_build_time_tools"; then
-    AC_MSG_CHECKING([for ${ncn_target_tool_prefix}${ncn_progname} in $with_build_time_tools])
-    $1=`cd $with_build_time_tools && pwd`/$1
-    ac_cv_path_$1=[$]$1
-    AC_MSG_RESULT([$ac_cv_path_$1])
+    AC_MSG_CHECKING([for $2 in $with_build_time_tools])
+    if test -x $with_build_time_tools/$2; then
+      $1=`cd $with_build_time_tools && pwd`/$2
+      ac_cv_path_$1=[$]$1
+      AC_MSG_RESULT([$ac_cv_path_$1])
+    else
+      AC_MSG_RESULT(no)
+    fi
   elif test $build != $host && test $have_gcc_for_target = yes; then
     $1=`$GCC_FOR_TARGET --print-prog-name=$2`
     test [$]$1=$2 && $1=
@@ -286,6 +305,8 @@ if test -z "$ac_cv_path_$1" ; then
 fi
 if test -z "$ac_cv_path_$1" ; then
   NCN_STRICT_CHECK_TARGET_TOOLS([$1], [$2])
+else
+  $1=$ac_cv_path_$1
 fi
 ]) []dnl # ACX_CHECK_INSTALLED_TARGET_TOOL
 
@@ -467,4 +488,5 @@ else
     # We need a cross tool
     AC_MSG_RESULT(pre-installed)
   fi
-fi])
+fi
+AC_SUBST($2)])
This page took 0.023383 seconds and 4 git commands to generate.