* Norman Gray wrote on Fri, Oct 15, 2004 at 11:19:21PM CEST: > > Is there any way of indicating to automake which language to use when > linking a library? > > I'm assembling a (shared) library using convenience libraries: > > lib_LTLIBRARIES = libfoo.la > libfoo_la_SOURCES = > libfoo_la_LIBADD = stuff/libconvenience.la > > Now, libconvenience.la is a convenience library of objects built from > _Fortran_ sources. This means that the libfoo shared library should be > assembled using the F77 or FC languages (this matters on OSX: this > situation requires libtool's Fortran magic, since the OSX linker has a > big downer on common blocks, and needs to be told to chill out a bit). > > However automake doesn't know this, so it tries to use gcc to link the > library, which fails. Is there any way of giving it a hint, here?
Well. Imagine the following: Your libconvenience.la is not built by you, it's rather the implementation of a published interface, so in general you cannot know which language it actually consists of. Neither can Automake. Libtool, however, could (and should, IMHO) store such information in the installed .la file. But it does not do that right now, AFAICS. And it's not as simple as it seems in the first place: The compiler set you use could be different from the one with which the dso was compiled. Obviously, this argument does not hold for convenience libraries. But then again, I'd suggest you drop your convenience library and use subdir-objects (with a recent Automake). Problem solved (apart from any subdir-object related Libtool bugs). *snip* > I've managed to get this to work by setting > > libfoo_la_SOURCES = dummy.f > > where dummy.f is a trivial Fortran routine. That tells automake that > Fortran is involved somewhere, and it consequently does The Right > Thing. But this seems like a bit of a hack. I think that is by far the easiest way to achieve what you want. Regards, Ralf