title: libtool and Windows DLLs
body: <p>I have an difficult relationship with the GNU autotools, especially libtool. But because they kick ass when it comes to portability and cross compilation I started using them again. </p>
  
  <p>Unfortunately I can't get libtool to build proper windows DLLs. Yet with vanilla make gcc 
  will happily build the DLL for me. </p>
  
  <p>For example:</p>
  
  <pre><code>LIBEXT = .dll
  
  pkzo$(LIBEXT): $(patsubst %.cpp, %.o, $(pkzo_SOURCES)) resources.o
      $(CXX) -shared -fPIC $(CXXFLAGS) $^ $(LDFLAGS) -Wl,--out-implib=libpkzo.lib -o $@   
  </code></pre>
  
  <p>Will haily build a DLL and import library. (Even without any annoying decelspec).</p>
  
  <p>Yet if I use libtool like so:</p>
  
  <pre><code>lib_LTLIBRARIES = libpkzo.la
  
  libpkzo_la_CXXFALGS = ...
  libpkzo_la_LDADD    = ...
  libpkzo_la_SOURCES  = ...
  </code></pre>
  
  <p>Libtool comes complaining: </p>
  
  <pre><code>*** Warning: linker path does not have real file for library -lSDL2main.
  *** I have the capability to make that library automatically link in when
  *** you link to this library.  But I can only do this if you have a
  *** shared version of the library, which you do not appear to have
  *** because I did check the linker path looking for a file starting
  *** with libSDL2main and none of the candidates passed a file format test
  *** using a file magic. Last file checked: /usr/local/lib/libSDL2main.a
  
  *** Since this library must not contain undefined symbols,
  *** because either the platform does not support them or
  *** it was explicitly requested with -no-undefined,
  *** libtool will only create a static version of it.
  </code></pre>
  
  <p>Well guess what libSDL2main.a is a static library and has no DLL. </p>
  
  <p>It there a way to build a DLL with automake not using libtool or telling libtool to stop making a fuss about nothing? </p>
  
  <p>PS: Before anyone mentions it, I am configuring libtool with <code>LT_INIT([shared static win32-dll])</code></p>