Branch: master

3dbad980 2014-09-23 17:37:54 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 c11e626..4af4e9b 100644
--- a/configure.py
+++ b/configure.py
@@ -231,6 +231,7 @@
     print "    -h      displays this help message"
     print "    -c      concatenates each module's C/C++ source files [default]"
     print "    -d dir  where the PyKDE modules will be installed [default %s]" % opt_pytdemoddir
+    print "    -e lib  explicitly specify the python library"
     print "    -g      always release the GIL (SIP v3.x behaviour)"
     print "    -i      no concatenation of each module's C/C++ source files"
     print "    -j #    splits the concatenated C++ source files into # pieces [default 1]"
@@ -557,7 +558,7 @@
     kde_sip_flags.append(sipconfig.version_to_sip_tag(kde_version, kdetags, "KDE"))
 
 
-def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, extra_define=None, extra_include_dir=None, extra_lflags=None, extra_lib_dir=None, extra_lib=None, opengl=0, sip_flags=None):
+def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, extra_define=None, extra_include_dir=None, extra_lflags=None, extra_lib_dir=None, extra_lib=None, extra_libs=None, opengl=0, sip_flags=None):
     """Generate the code for a module.
 
     mname is the name of the module.
@@ -766,6 +767,9 @@
         makefile.extra_cflags.append ("-fno-rtti")
         makefile.extra_cxxflags.append ("-fno-rtti")
 
+    if extra_libs:
+        makefile.extra_libs.extend(extra_libs)
+
     if sipcfg.sip_version < 0x040000 and imports:
         # Inter-module links.
         for im in imports:
@@ -819,7 +823,7 @@
     argv is the list of command line arguments.
     """
     try:
-        optlist, args = getopt.getopt(argv[1:], "hcd:gij:k:L:l:n:o:ruv:wz:")
+        optlist, args = getopt.getopt(argv[1:], "hcd:e:gij:k:L:l:n:o:ruv:wz:")
     except getopt.GetoptError:
         usage()
 
@@ -830,6 +834,7 @@
     global opt_tdebasedir, opt_kdelibdir, opt_kdeincdir, opt_libdir
     global pytde_modules, opt_dep_warnings, opt_dist_name
     global pytde_imports, kde_includes
+    global opt_libpython
 
     # Look for '-z' first and process that switch
     # (command line switches override file switches)
@@ -845,6 +850,9 @@
     for opt, arg in optlist:
         if opt == "-h":
             usage(0)
+
+        elif opt == "-e":
+            opt_libpython = arg
 
         # turns on concatentation (on by default, here for consistency)
         elif opt == "-c":
@@ -923,7 +931,10 @@
     set_sip_flags()
 
     for module in pytde_modules [opt_startmod:opt_endmod]:
-        generate_code (module, pytde_imports [module], extra_lib = module)
+        extra_libs = []
+        if opt_libpython:
+            extra_libs.append(opt_libpython)
+        generate_code (module, pytde_imports [module], extra_lib = module, extra_libs = extra_libs)
 
     # Create the additional Makefiles.
     create_makefiles()