[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Setting autotools for static compilation
From: |
Ralf Wildenhues |
Subject: |
Re: Setting autotools for static compilation |
Date: |
Sat, 29 Apr 2006 18:10:01 +0200 |
User-agent: |
Mutt/1.5.11+cvs20060403 |
Hi Paulo,
* Paulo J. Matos wrote on Sat, Apr 29, 2006 at 01:15:47PM CEST:
> ATT: Cross-sent to automake and autoconf MLs since problem spans both
> worlds, I think!
Do you use Libtool? Then it would probably a Libtool question.
But anyway.
> I'm currently using autoconf for the for my libraries with
> AC_CHECK_LIB, and to generate static binaries I do everytime I
> configure:
> ./configure LDFLAGS="-static"
OK. Why do you want static linking?
> However, in google groups:
> http://groups.google.com/group/gnu.g++.help/browse_frm/thread/2144e5bd146e9cfe
> Paul Pluzhnikov told that it was not the best way to do this. Instead
> of using -static I should do:
> -Wl,-Bstatic -llog4cpp -lglpk -Wl,-Bdynamic
> (because I was using log4cpp and glpk at the time)
Is he the author of those libraries, or may otherwise happen to know
that those libraries can't keep their interface clean?
Ah, I guess rather than special-casing those two libraries, you would
like to link all non-Glibc (and maybe non-GCC) libraries statically,
right? (The rest of my mail assumes this somewhat.)
> So in general I should do:
> -Wl,-Bstatic <LIBS> -Wl,-Bdynamic
Hmm. I did a small survey about this a little while ago, as a first
step to implement per-deplib static/shared switches in Libtool[1].
Above settings are fairly portable, but there are important exceptions.
> My question is, Is there a way to configure this efficiently in
> autotools, so that whenever I add a check for a LIB it is also added
> to that line for static linking?
Hmm. Libtool-1.5.24 will have -static-libtool-libs, which will allow
you this functionality portably, but only for libraries created with
libtool. Eventually, the per-deplib flags feature[2] will appear in
mainline libtool in some way or other, which will allow this for all
kinds of libraries.
Cheers,
Ralf
[1] http://wiki.azazil.net/GnuLibtoolProject/FeatureRequests/PerDeplibFlags
[2] http://lists.gnu.org/archive/html/libtool-patches/2006-01/msg00064.html