> That gets us closer. Once I actually tested on a Fedora machine, I needed
> to do this (ignoring other platforms for a moment)
>
> // #cgo llua LDFLAGS: -llua
> // #cgo linux,!llua LDFLAGS: -llua5.1
>
> That is, the section on +build directives is applicable to cgo directives.
>
> (So a 'go get' should work fine, if the person adds -tags 'llua')
>
> But I cannot see any way to make these fine distinctions between variants of
> a single platform without actively probing the environment in some way.
I think you will not be able to do that, without user intervention.
I don't know pkg-config a lot, but if you request a library and that
library isn't installed in the system, it should return an empty
string.
So, maybe, you could just use pkg-config and request both libs (llua
and lua5.1) and let pkg-config find the right one to use.