3
votes

I work on a project written in C, using the autotools, that produces a static library. Am also providing a Python interface to the C API in the context of the same project. I did not have permission until recently to introduce libtool in the project, in order to be able to provide both static and dynamic libraries in a portable fashion. So far, I'd produce the Python shared module using the distutils, and link the python module to the project's C static library. Again, that's because I was not allowed to introduce libtool/shared libraries into the ecuation. Now that I want to put libtool in, I am facing the following two problematic scenarios:

  1. If I keep producing the Python shared module using the distutils, since the distutils and the autotools do not talk to eachother, I need to tell the distutils what C library to link to. So far, I cannot think of any way of doing that but parsing the .la file to get the name and path of the library libtool was able to produce. Does libtool provide any information with regards to what type of library it was able to produce on a system ?

  2. If I move the Python module production to automake, that's fine, until I reach the installation process. I have not idea how to tell libtool I want my Python module somewhere else but the lib folder, i.e. 'lib/python2.5/site-packages/myproject'. I tried to just copy the library in the Makefile however that did not work properly as the library had the wrong rpath (that of the build and not that of the install). Why do I want it there ? Because there I also have the .py wrappers. So, is there any way to tell libtool to install my module somewhere else and properly set the rpath ?

I guess I'm just looking for an elegant solution, or maybe the solution is there and it's simple but I can't see it as I'm not experienced enough. Any help ?

P.S. Would prefer option 2, if I could make it work, since that way I would not have to pass information from the autotools to the distutils.

1

1 Answers

3
votes

Have you read http://www.gnu.org/software/hello/manual/automake/Python.html ? I can't tell if you want to use pyexecdir as the location to install your modules. If so, add AM_PATH_PYTHON to configure.ac.

Anyway, in automake, the name before the _PRIMARY specifies where something is to be installed: lib_LTLIBRARIES will install the library in $(libdir), pyexec_LTLIBRARIES will install to $(pyexecdir), bin_PROGRAMS will install to $(bindir), and so on.