Add a flag to enable the fix for r1717

It seems like Chrome (and potentially other projects using gyp) depend on the
bug that was fixed in r1717.  So for now, only enable the fix if the target has
'allow_sharedlib_linksettings_propagation' explicitly set to False (by default,
it is True).

This will allow Chrome and other projects to continue building until they are
fixed to not depend on this bug, at which point, we could remove the flag.

BUG=
R=mark@chromium.org

Review URL: https://codereview.chromium.org/23557010

git-svn-id: http://gyp.googlecode.com/svn/trunk@1722 78cadc50-ecff-11dd-a971-7dbc132099af
diff --git a/pylib/gyp/input.py b/pylib/gyp/input.py
index 2b2ca89..8abfa3d 100644
--- a/pylib/gyp/input.py
+++ b/pylib/gyp/input.py
@@ -1671,7 +1671,14 @@
     Returns a list of dependency targets whose link_settings should be merged
     into this target.
     """
-    return self._LinkDependenciesInternal(targets, False)
+
+    # TODO(sbaig) Currently, chrome depends on the bug that shared libraries'
+    # link_settings are propagated.  So for now, we will allow it, unless the
+    # 'allow_sharedlib_linksettings_propagation' flag is explicitly set to
+    # False.  Once chrome is fixed, we can remove this flag.
+    include_shared_libraries = \
+        targets[self.ref].get('allow_sharedlib_linksettings_propagation', True)
+    return self._LinkDependenciesInternal(targets, include_shared_libraries)
 
   def DependenciesToLinkAgainst(self, targets):
     """
diff --git a/test/dependencies/sharedlib-linksettings/test.gyp b/test/dependencies/sharedlib-linksettings/test.gyp
index 59a4774..830ce32 100644
--- a/test/dependencies/sharedlib-linksettings/test.gyp
+++ b/test/dependencies/sharedlib-linksettings/test.gyp
@@ -3,6 +3,9 @@
 # found in the LICENSE file.
 
 {
+  'target_defaults': {
+    'allow_sharedlib_linksettings_propagation': 0,
+  },
   'targets': [
     {
       'target_name': 'sharedlib',