automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use ld options correctly for --whole-archive in automake and


From: Gavin Smith
Subject: Re: How to use ld options correctly for --whole-archive in automake and libtool
Date: Thu, 5 Mar 2015 18:28:47 +0000

On 4 March 2015 at 19:05, Andy Falanga (afalanga) <address@hidden> wrote:
> I'm trying to reproduce this using the automake tools.  I have this in the 
> Makefile.am located in sata:
>
> lib_LTLIBRARIES = satacpp.la
> satacpp_la_SOURCES = ...
>
> pyexec_LTLIBRAIRES = sata.la
> sata_la_LDFLAGS = -module
> sata_la_LIBADD = -Wl,--whole-archive ../Shared/HwMgmt/.libs/libhwmgmt.a 
> ../Shared/Misc/.libs/libmisc.a .libs/libsata.a -Wl,--no-whole-archive -lz -lrt
>
> As I'm sure no one here will be surprised, this causes automake to fail 
> because, "linker flags such as '-Wl,--whole-archive' belong in 
> sata_la_LDFLAGS."  However, when I place this there, I find that Makefile.in 
> and the final Makefile have things where I expect them, but when make runs, 
> the libraries I've specified to be included as "whole-archive" are not listed 
> between this option.  Instead, they are listed earlier and *nothing is 
> listed* between -Wl,--whole-archive -Wl,--no-whole-archive.  I assume that 
> libtool is doing this for me.
>

I don't know if will work in your case, but I managed to work around
automake's policing of one of its variables in a similar situation by
hiding the value in a variable set by the configure script, e.g. do

my_libadd=-Wl,--whole-archive ../Shared/HwMgmt/.libs/libhwmgmt.a
../Shared/Misc/.libs/libmisc.a .libs/libsata.a -Wl,--no-whole-archive
-lz -lrt
AC_SUBST([my_libadd])

in configure.ac, and

sata_la_LIBADD=$(my_libadd)

in Makefile.am.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]