Bug #1765375: fix stripping of unwanted LDFLAGS.
 (backport from rev. 57389)
diff --git a/setup.py b/setup.py
index a983b3b..65b32ea 100644
--- a/setup.py
+++ b/setup.py
@@ -267,7 +267,8 @@
                 # strip out double-dashes first so that we don't end up with
                 # substituting "--Long" to "-Long" and thus lead to "ong" being
                 # used for a library directory.
-                env_val = re.sub(r'(^|\s+)-(-|(?!%s))' % arg_name[1], '', env_val)
+                env_val = re.sub(r'(^|\s+)-(-|(?!%s))' % arg_name[1],
+                                 ' ', env_val)
                 parser = optparse.OptionParser()
                 # Make sure that allowing args interspersed with options is
                 # allowed