Issue #9437: Fix building C extensions with non-default LDFLAGS.
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index 730718a..19847c9 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -296,6 +296,11 @@
                 # bogus variable reference; just drop it since we can't deal
                 variables.remove(name)
 
+    # strip spurious spaces
+    for k, v in done.items():
+        if isinstance(v, str):
+            done[k] = v.strip()
+
     # save the results in the global dictionary
     vars.update(done)
     return vars