Issue #5309: distutils' build and build_ext commands now accept a ``-j``
option to enable parallel building of extension modules.
diff --git a/Lib/distutils/command/build.py b/Lib/distutils/command/build.py
index cfc15cf..337dd0b 100644
--- a/Lib/distutils/command/build.py
+++ b/Lib/distutils/command/build.py
@@ -36,6 +36,8 @@
          "(default: %s)" % get_platform()),
         ('compiler=', 'c',
          "specify the compiler type"),
+        ('parallel=', 'j',
+         "number of parallel build jobs"),
         ('debug', 'g',
          "compile extensions and libraries with debugging information"),
         ('force', 'f',
@@ -65,6 +67,7 @@
         self.debug = None
         self.force = 0
         self.executable = None
+        self.parallel = None
 
     def finalize_options(self):
         if self.plat_name is None:
@@ -116,6 +119,12 @@
         if self.executable is None:
             self.executable = os.path.normpath(sys.executable)
 
+        if isinstance(self.parallel, str):
+            try:
+                self.parallel = int(self.parallel)
+            except ValueError:
+                raise DistutilsOptionError("parallel should be an integer")
+
     def run(self):
         # Run all relevant sub-commands.  This will be some subset of:
         #  - build_py      - pure Python modules