I have a shared object library (a python extension in C++) which includes several other archives, from a shared code base, which were wrapped in -Wl,whole-archive arhive1.a archive2.a ... -Wl,no-whole-archive in our former home-baked version of makefiles. Each archive was contained in its own subdirectory and was built as part of the ultimate goal of this python extension. I'm porting our build environment to using autoconf and automake.
In the Makefile.am relevant to the python extension, I have this (with extraneous stuff cut away):
pyexc_LTLIBRARIES = pyextension.la
ARCHIVE1_PATH = ../Path/to/.libs/ # built from another Makefile.am
ARCHIVE2_PATH = ../Path2/to/.libs/
pyextension_la_SOURCES = ...
pyextension_la_LDFLAGS = -lz -lrt -module ...
pyextension_la_LIBADD = $(ARCHIVE1_PATH)/archive1.a $(ARCHIVE2_PATH)/archive2.a
pyextension_la_CXXFLAGS = -std=c++0x -fPIC
All of this stuff comes out on the command line but it's not being packed correctly because when I import my pyextension module, I get undefined symbol errors from the archives that it's looking for. Originally, I had something like this for pyextension_LDFLAGS:
pyextension_la_LDFLAGS = -Wl,whole-archive $(ARCHIVE1_PATH)/archive1.a $(ARCHIVE2_PATH)/archive2.a -Wl,no-whole-archive -lz -lrt -module
However, much to my surprise, when the final Makefile is processed by make, after running ./configure the options -Wl,whole-archive and -Wl,no-whole-archive appear in the command line but with nothing in between them(??) and the archive files listed elsewhere. So, I thought I should try the route of pyextension_la_LIBADD with the archives and the magic would work.
I'm not sure where to go from here. By the way, these other archive libraries will be installed with the rest as part of our deployment, but during build, they obviously aren't installed yet. So, any pointers on how to make this happen are much appreciated. I'm still an automake and autoconf neophyte.