Added an emerge of libtool in cros_gcc_config.

libtool is dependent on the installed version of gcc in the board.

BUG=none
TEST=cros_gcc_config $ctarget-4.4.3 and manually inspect the output.

Change-Id: I31d52b05c815c6aefee1ae1ded0b6f076de22707
Reviewed-on: http://gerrit.chromium.org/gerrit/3968
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: asharif <asharif@chromium.org>
Tested-by: asharif <asharif@chromium.org>
diff --git a/toolchain_utils.sh b/toolchain_utils.sh
index a8a620c..2fce66b 100755
--- a/toolchain_utils.sh
+++ b/toolchain_utils.sh
@@ -129,6 +129,8 @@
   return $emerge_retval
 }
 
+# This function should only be called when testing experimental toolchain
+# compilers. Please don't call this from any other script.
 cros_gcc_config()
 {
   # Return if we're not switching profiles.
@@ -152,11 +154,16 @@
 
   sudo gcc-config "$1" || die "Could not switch to $1"
 
-  cros_install_libs_for_config "$1"
+  local boards=$(get_boards_from_config "$1")
+  local board
+  for board in $boards
+  do
+    cros_install_libs_for_config "$board" "$atom"
+    emerge-"$board" --oneshot sys-devel/libtool
+  done
 }
 
-
-cros_install_libs_for_config()
+get_boards_from_config()
 {
   local atom=$(get_installed_atom_from_config "$1")
   if [[ $atom != cross* ]]
@@ -174,7 +181,14 @@
     local board_tc="$(get_ctarget_from_board $board)"
     if [[ "${board_tc}" == "${ctarget}" ]]
     then
-      copy_gcc_libs "$board_root" "$atom"
+      echo "$board"
     fi
   done
 }
+
+cros_install_libs_for_config()
+{
+  local board="$1"
+  local atom=$(get_installed_atom_from_config "$2")
+  copy_gcc_libs /build/"$board" "$atom"
+}