title: How to link to FORTRAN library via numpy distutils
body: <p>I'm having trouble getting my setup.py script to work properly when linking to FORTRAN libraries. </p>
  
  <p>I have almost no experience with libraries, so I may use the incorrect terminology. I have a fortran module which uses the FMLIB fortran package. The FMLIB package contains three f95 files which I have compiled to .o files. This module is in turn used by a python module. In the setup.py file, I use Extension:</p>
  
  <pre><code>shapelets = Extension('PyCosmology.shapelets.fort.shapelets', 
                       ['PyCosmology/shapelets/fort/find_coeffs.f90'],
                         libraries = [&lt;DIRECTORY&gt;./FM.o'
                         '&lt;DIRECTORY&gt;/FMSAVE.f95',
                         '&lt;DIRECTORY&gt;/FMZM90.f95'],
                         extra_f90_compile_args=['-Wtabs'],
                         f2py_options=['--quiet'])
  </code></pre>
  
  <p>However, when I try installing it says that it can't use FMZM because no .mod file can be found. Am I supposed to use a different keyword in Extension to link to the libraries, or link to the mod files instead? Or is there something else I should be doing? The documentation for distutils is relatively sparse.</p>