Add path for libraries lookup during perl build.

Perl Configure is doing its own lookup for libraries by scanning some
standard paths like /lib, etc. When we are building perl with host gcc
from prebuilts/tools/gcc-sdk/gcc which is configured to use it's own
sysroot it may lead to conflict between libraries gcc is using and
libraries Perl Configure found. This change force Perl Configure to scan
the same lib dirs gcc is using on libraries search.

Change-Id: Ic5e6e60a47560da6b97b51bbe4ba58f80116b209
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
diff --git a/build/tools/build-host-perl.sh b/build/tools/build-host-perl.sh
index 9a7e5c0..27fefa4 100755
--- a/build/tools/build-host-perl.sh
+++ b/build/tools/build-host-perl.sh
@@ -91,6 +91,8 @@
 run copy_directory "$SRC_DIR/perl/perl-$PERL_VERSION" "$BUILD_OUT"
 fail_panic "Could not copy perl source $SRC_DIR/perl/perl-$PERL_VERSION to build directory $BUILD_OUT"
 
+LIBS_SEARCH=`$CC -print-search-dirs | grep libraries | sed ' s/^.*=// ' | sed ' s/:/ /g '`
+
 cd $BUILD_OUT &&
 CFLAGS=$HOST_CFLAGS" -O2 -s" &&
 run ./Configure \
@@ -99,6 +101,7 @@
     -Dcc="$CC" \
     -Dcc_as_ld \
     -Dccflags="$CFLAGS" \
+    -A prepend:libpth="$LIBS_SEARCH" \
 fail_panic "Failed to configure the perl-$PERL_VERSION build!"
 
 log "Building perl"