Branch: master

80c7008c 2014-09-23 16:41:22 Timothy Pearson
Add ability to set libpython library
This relates to Bug 1995
M configure.py
diff --git a/configure.py b/configure.py
index c58fe75..bfdbe2b 100644
--- a/configure.py
+++ b/configure.py
@@ -242,7 +242,7 @@
     siputils.create_config_module(module, template, content, macros)
 
 
-def create_makefiles(macros):
+def create_makefiles(macros, extra_lib_dir=None, extra_libs=None):
     """Create the Makefiles.
 
     macros is the dictionary of platform specific build macros.
@@ -295,6 +295,12 @@
         arch=opts.arch
     )
 
+    if extra_lib_dir:
+        makefile.extra_lib_dirs.append(extra_lib_dir)
+
+    if extra_libs:
+        makefile.extra_libs.extend(extra_libs)
+
     makefile.generate()
 
 
@@ -316,6 +322,10 @@
             "[default: %s]" % default_platform)
     p.add_option("-u", "--debug", action="store_true", default=False,
             help="build with debugging symbols")
+    p.add_option("-g", "--libpython",
+            default=None, type="string", metavar="LIB",
+            dest="libpython", help="python "
+            "library name [default: %s]" % None)
 
     if sys.platform == 'darwin':
         # Get the latest SDK to use as the default.
@@ -384,6 +394,8 @@
     if py_version < 0x020300:
         siputils.error("This version of SIP requires Python v2.3 or later.")
 
+    global extra_lib_dir
+
     # Basic initialisation.
     set_platform_directories()
 
@@ -413,6 +425,12 @@
             show_macros()
 
         sys.exit()
+
+    extra_libs = []
+    extra_lib_dir = None
+
+    if opts.libpython:
+        extra_libs.append(opts.libpython)
 
     # Convert the list 'arch' option to a string.  Multiple architectures
     # imply a universal binary.
@@ -453,7 +471,7 @@
             macros)
 
     # Create the Makefiles.
-    create_makefiles(macros)
+    create_makefiles(macros, extra_lib_dir=extra_lib_dir, extra_libs=extra_libs)
 
 
 ###############################################################################