title: How to build *.so module in Automake and a libtool-using project?
body: <p>I have the same problem as <a href="https://stackoverflow.com/questions/8916425/how-to-create-a-shared-library-so-in-an-automake-script">others</a> have:</p>
  
  <ul>
  <li>I have a <code>*.la</code> file generated by <strong>libtool</strong> in an <strong>Automake</strong> project (e.g. <code>module.la</code>),</li>
  <li>but I <strong>need the <code>*.so</code></strong> of it to use it for <code>dlopen()</code> (eg. <code>module.so</code>).</li>
  </ul>
  
  <p>But: project is configured and built with <code>--disable-shared</code> to make sure the created main binary is one big statically linked program, e.g. <code>main.x</code> (easier for deployment and debugging). Thus <code>*.so</code> files are not created.</p>
  
  <p>The program <code>main.x</code> is a huge framework-like application which is capable of loading extensions (modules) via <code>dlopen()</code> -- despite it being linked statically.</p>
  
  <p>This works fine when I build <code>module.so</code> by hand. But putting this to work in <code>Makefile.am</code> seems impossible to me. Yes, I can write <code>lib_LTLIBRARIES</code>, but with my standard <code>--disable-shared</code> I do not get a <code>*.so</code> file.</p>
  
  <pre><code>lib_LTLIBRARIES = module.la
  module_so_SOURCES = module.cpp
  </code></pre>
  
  <p>The file <code>module.la</code> is created, which <code>dlopen()</code> refuses to load (of course).</p>
  
  <p>I tried to put rules into <code>Makefile.am</code> building it manually and that works:</p>
  
  <pre><code># Makefile.am (yes, .am)
  all: mm_cpp_logger.so
  
  SUFFIXES = .so
  
  %.so: %.cpp
      $(CXX) $(CXXFLAGS) -fPIC -fpic -c -I $(top_srcdir)/include -o $@  $&lt;
  
  %.so: %.o
      $(CXX) $(LDFLAGS) -shared -fPIC -fpic -o $@  $&lt;
  </code></pre>
  
  <p>But this can only be a workaround. I do not get all the nice auto-features like dependency-checking and installation.</p>
  
  <p>How can I build <code>module.so</code> with still building the main program with <code>--disable-shared</code> (or with the same effect) in the <code>Makefile.am</code>-way?</p>
  
  <ul>
  <li>can I postprocess <code>*.la</code> files to <code>*.so</code> files with a special automake rule?</li>
  <li>can I tweak the <code>lib_LTLIBRARIES</code> process to create <code>*.so</code> files in any case?</li>
  </ul>