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

How to use --as-needed

How should one add --as-needed linker flags to an autotools-based
package? I ended up adding CFLAGS=-Wl,--as-needed to my
dh_auto_configure parameters but is it OK to just overwrite CFLAGS like
that, or should I add it to any existing CFLAGS?

BTW, at first I tried LDFLAGS=--as-needed but automake/libtools passed
it to gcc without -Wl, which I thought wasn't very clever. I then used
CFLAGS because the -Wl makes it a gcc option, but OTOH it is explicitly
a linker option (according to the man page) so perhaps I should stick
with LDFLAGS after all?

Reply to: