[PATCH] src/meson: add module name_suffix as 'so'

Pavel Hrdina phrdina at redhat.com
Tue Aug 25 09:29:21 UTC 2020


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

Or as Dan suggested you can do #ifdef somewhere in source code.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200825/39bcfaaa/attachment-0001.sig>


More information about the libvir-list mailing list