I have a very complicated connection with GNU autotools, especially with libtool. But because they kick ass when it comes to portability and cross-compilation, I started using them again.
Unfortunately, I cannot get libtool to create the correct Windows DLLs. But with vanilla, gcc will happily build a DLL for me.
For example:
LIBEXT = .dll
pkzo$(LIBEXT): $(patsubst %.cpp, %.o, $(pkzo_SOURCES)) resources.o
$(CXX) -shared -fPIC $(CXXFLAGS) $^ $(LDFLAGS) -Wl,--out-implib=libpkzo.lib -o $@
Will build a DLL and import. (Even without annoying decelspec).
But if I use libtool like this:
lib_LTLIBRARIES = libpkzo.la
libpkzo_la_CXXFALGS = ...
libpkzo_la_LDADD = ...
libpkzo_la_SOURCES = ...
Libtool complains:
*** 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.
Guess libSDL2main.a is a static library and does not have a DLL.
Is there a way to build a DLL with automake without using libtool or telling libtool to stop fussing about anything?
PS: Before anyone mentions this, I configure libtool with LT_INIT([shared static win32-dll])