Hi Braden, * Braden McDaniel wrote on Wed, Mar 29, 2006 at 06:18:02PM CEST: > On Wed, 2006-03-29 at 10:41 +0200, Ralf Wildenhues wrote: > > * Braden McDaniel wrote on Wed, Mar 29, 2006 at 10:32:37AM CEST: > > > [ -l* in *_LDFLAGS ] > > That's very likely because you rarely do static linking. > > While as a matter of convenience during development I build dynamic > libraries much more often than static ones, I do ensure my package works > in the static case. I do use libtool, so perhaps it is insulating me > from problems. Nope, libtool leaves you out in the cold there. But it's really Automake that dictates the order of the Makefile macros in the link command line. > You seem to be saying "make sure all your -l flags are in the right > order", which is a concept (I think) I understand. But I believe I've > been doing that while putting the -l flags in *_LDFLAGS just fine. So you have the order inside your library flags under control. That is one important part for static linking. > Are you saying that use of *_LDFLAGS is somehow fundamentally > incompatible with this goal? Well, Automake generates something similar to this (abridged): LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ [...] prog$(EXEEXT): $(prog_OBJECTS) $(prog_DEPENDENCIES) @rm -f prog$(EXEEXT) $(LINK) $(prog_OBJECTS) $(prog_LDADD) $(LIBS) Now look at this example: cat >m.c <<\EOF #include <stdio.h> #include <math.h> int main() { double x = 0.; printf("%g\n", sin(x)); return 0; } EOF gcc -c m.c gcc -static -lm -o m m.o | m.o(.text+0x1f): In function `main': | : undefined reference to `sin' | collect2: ld returned 1 exit status gcc -static -o m m.o -lm; echo $? | 0 So it's a good idea to put the library flags after all the objects. (BTW, the variable keeps gcc from optimizing the sin call away.) Cheers, Ralf _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf