[PATCH] src/meson: add module name_suffix as 'so'
Daniel P. Berrangé
berrange at redhat.com
Tue Aug 25 09:36:23 UTC 2020
On Tue, Aug 25, 2020 at 11:29:21AM +0200, Pavel Hrdina wrote:
> On Tue, Aug 25, 2020 at 09:44:41AM +0100, Daniel P. Berrangé wrote:
> > On Mon, Aug 24, 2020 at 06:15:57PM -0700, Scott Shambarger wrote:
> > > On 2020-08-24 02:34, Daniel P. Berrangé wrote:
> > > > I don't think we want to keep compatibility with any libtool quirks. We
> > > > should do the right thing for the platform, and I think that means using
> > > > the platform native suffix for shared library modles correctly.
> > > >
> > >
> > > Of course... we'd still have to deal with meson quirks (it suffixes modules
> > > with .dylib instead of .bundle on MacOS).
> > >
> > > I'm happy to take a crack at a patch using the platform suffix in the
> > > code... any idea how to configure meson to put the module suffix into
> > > config.h? (I'm kinda new to meson - would be easy in autoconf :)
> >
> > I wouldn't bother - just #ifdef __APPLE__ in the source code
>
> Meson doesn't export any function to get the default suffix but they
> have clear definition of the default suffixes:
>
> 'By default, for shared libraries this is dylib on macOS, dll on
> Windows, and so everywhere else.'
>
> As we don't care about Windows in this case we can hard-code .dylib in
> meson or in source code. With meson you would do something like this in
> meson.build:
>
> if host_machine.system() == 'darwin'
> conf.set('MODULE_SUFFIX', '.dylib')
> else
> conf.set('MODULE_SUFFIX', '.so')
> endif
>
> The conf variable is then used to generate meson-config.h which is
> included in config.h
I don't think that adds any value over just using an #ifdef in the
source. Arguably it makes it worse, as you can't see what's happening
in the source without serching for the definition of MODULE_SUFFIX
in meson.
Autoconf skewed our POV towards using defining config.h variables
for everything, because when you have a big hammer, everything
looks like a nail. We should resist the urge to just blindly follow
the same approach we did with autoconf.
Use meson generated config.h variables only where truly adding
value. ie things that are a response to user config params to
meson, or things that we needed to auto-detect from host OS.
...
> Or as Dan suggested you can do #ifdef somewhere in source code.
...If it can just be a siple #ifdef in the source though, just
do that and skip meson-confg.h
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
More information about the libvir-list
mailing list