automake
[Top][All Lists]
Advanced

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

Re: What does --with-pic really mean?


From: Ralf Wildenhues
Subject: Re: What does --with-pic really mean?
Date: Mon, 29 Oct 2007 07:17:17 +0100
User-agent: Mutt/1.5.16 (2007-10-15)

Hello Kent,

* Kent Boortz wrote on Sun, Oct 28, 2007 at 11:34:13PM CET:
> 
> I use --with-pic for builds created with autoconf/automake assuming
> that everything in the build will be compiled with the PIC flag. But
> examining the logs some compile lines lacks the PIC flag. The configure
> flag seems not to mean what it says when you do "./configure --help"
> 
>   --with-pic  try to use only PIC/non-PIC objects [default=use both]
> 
> >From reading the generated configure script, it seems to me that the
> flag --with-pic only affects libraries under "libtool control",

Yes, that is true.  This switch is provided by Libtool.

> i.e.  the help text is a bit misleading.

Can you suggest a better text that is less misleading and not too long,
either?

BTW, --with-pic is regarded as rather useless, as libtool will choose
the right objects when creating shared libraries anyway.  Why do you
want all objects to be PIC?  Just in case: if you're out for PIE
executables, then really with GCC you should specify -pie in CFLAGS.

> The flag is in fact originating
> from "libtool.m4". So unless your libraries are "libtool convenience
> libraries", the compile lines will not have any PIC flags at all.

Yes.  And real shared libraries created by libtool will have PIC
objects.

> Reading the generated make files the reason seems to be that "normal"
> libraries are built from "*.o" files where the "*.o" files are the
> intermediate targets, not using libtool at all. But libtool
> convenience libraries are built from ".libs/*.o" files created where
> "*.lo" are the intermediate targets, and libtool was used. And no
> libtool usage, no reaction on the --with-pic.

Correct.

If I knew more about why you want PIC objects, then I could say which of
the two (convert all libraries to libtool-controlled ones, or just put
the pic flag in CFLAGS) would be more appropriate.  Note that libtool
convenience archives are not intended to be installed, for consistency
reasons.

Hope that helps.

Cheers,
Ralf




reply via email to

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