[VM] Linking and external libs

Ian Piumarta ian.piumarta at inria.fr
Fri May 31 00:17:28 UTC 2002


On Thu, 30 May 2002, Stephen Pair wrote:

> No, no, don't go out of your way on my account...it's no problem.

It has to be done.  (And I think it really is a problem, as plugins are
getting ever more complex/ambitious.)

> I was just curious if there is a way of making a plugin find specific
> headers/libs without twiddling the makefile.

Exactly!

> Maybe the configure script that makes the Makefile could detect special
> files (like SomePlugin.cfg or something)

Precisely!

> add to LIBS or INCLUDES as appropriate.

I think that much is actually possible right now.  (I've no idea if the
current VMM build stuff supports makefile/configure extensions in both
cross and platdep dirs though.  If not, it should.)

> The contents of SomePlugin.cfg might look something like:
> 
> LIBS = -L/some/path/lib -lsomelib
> INCLUDES = -I/some/path/include

More or less.  ;-)

To do it right you'd want (at least) two files: the first tells
`configure' how to check if the lib is actually available (this wouldn't
necessarily be as horrendous as the stuff in acinclude.m4 but something
equivalent to a "build-time" AC_TRY_COMPILE/AC_TRY_LINK is what we're
after here) and the second tells `make' how to include extra definitions
and/or extra compile/link/whatever steps that it might need.  If you just
need to link against a lib (or `-rpath' it) in the final VM then only the
`configure' part is actually needed (the lib just has itself added to the
main list of LIBS/INCLUDES/... inside `configure').  If you need the lib
to be sucked into the plugin then the `Makefile' part is needed too.

Doing it like this gives `configure' the chance to just supress the plugin
(and maybe bitch and moan a little about the missing lib in the process ;)
before continuing to build a VM without it.  (If at all possible: there
might be complications with named prims and the like if the plugin is
being built internally.)  OTOH, missing external libraries for entirely
optional pieces of VM shouldn't (IMO) be a reason to refuse point-blank to
build *some* kind of VM.

> or even better, make them specific to a LIBS or INCLUDES
> variable for just the plugin in question.

Watch this space.

;)

Ian




More information about the Squeak-dev mailing list