[Top][All Lists]

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

Re: Setting autotools for static compilation

From: Paulo J. Matos
Subject: Re: Setting autotools for static compilation
Date: Sat, 29 Apr 2006 23:01:56 +0100

On 29/04/06, Ralf Wildenhues <address@hidden> wrote:
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.

No, as far as I know, libtool is for me to create my own libraries and
link them with my program. I cannot use libtool to link others
libraries, mainly if I do not know how they were created, right?

> 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?

Yes, it's wierd I know!
This binary is for a competition. It'll have to run on system without
the libraries I use installed out of the box, except of course, gcc
and glib which are standard in Linux systems.

> However, in google groups:
> 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?

Don't really know about that... :) Seems it just knows more than I do
on these matters!

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.

Still, I don't understand how to use them with automake and autoconf!

I don't think I can use libtool since these are not my libraries and
furthermore, I do not have the slightest idea on how they were

> 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.



Paulo Jorge Matos - pocm at sat inesc-id pt
Computer and Software Engineering

reply via email to

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