Merge "Add path for libraries lookup during perl build."
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"