meson options vs AC options:

tlaronde at kergis.com tlaronde at kergis.com
Sun Mar 3 21:03:09 UTC 2024


On Sun, Mar 03, 2024 at 12:39:12PM -0800, Alan Coopersmith wrote:
> On 3/3/24 12:06, tlaronde at kergis.com wrote:
> > [I'm back to working on Xorg stuff].
> > 
> > When writing a meson.build, I realize that all the options settable
> > with GNU AC are not available in meson built-ins. This does mean
> > that one has to add a meson_options.txt for everything used that is
> > not a built-in options in meson?
> > 
> > I take the example of xorg-sgml-doctools. I think there are two bugs:
> > 
> > 1) meson.build defines:
> > 
> > datarootdir = get_option('prefix') / get_option('datadir')
> > sgmlrootdir = datarootdir / 'sgml'
> > 
> > and generates the pkgconfig file from the template with:
> > 
> > pc_conf = configuration_data({
> >      'prefix': get_option('prefix'),
> >      'datarootdir': '${prefix}/share',
> >      'sgmlrootdir': '${datarootdir}/sgml',
> >      'PACKAGE_VERSION': meson.project_version()
> > })
> > configure_file(input: 'xorg-sgml-doctools.pc.in',
> >                 output: 'xorg-sgml-doctools.pc',
> >                 install_dir: get_option('datadir') / 'pkgconfig',
> >                 configuration: pc_conf)
> > 
> > Above, for the pkgconfig file, datarootdir is reset with something
> > that can be different from the first definition if 'datadir' (a meson
> > built-in option) is something else than the default 'share'.
> 
> That seems like a mistake - I don't remember any reason that the datadir &
> sgmlrootdir variables weren't used for the values in pc_conf.
> 
> > 2) In the pkgconfig template, there are:
> > 
> > prefix=@prefix@
> > datarootdir=@datarootdir@
> > sgmlrootdir=@sgmlrootdir@
> > 
> > These can all be set, if I'm not mistaken, with AC, independantly. But
> > with the meson file, since there are no meson_options.txt, not exactly
> > the same thing can be achieved (for example, sgmlrootdir can not be
> > set independantly).
> 
> I don't see any way in the autoconf to set sgmlrootdir - it appears to be
> hardcoded in configure.ac to:
> 
> AC_SUBST([sgmlrootdir],['${datarootdir}/sgml'])
> 
> and there's no flag to set it listed by configure --help nor do I see any flags
> defined in that configure.ac to check with AC_ARG_WITH or similar.

They are so many things "implied" by AC, with a mix of
lowercase/uppercase, and no trace in configure.ac, that I had taken it
for granted that all the '@string@' were converted automatically to
configurable options...

Since I'm on writing meson stuff for xcb-proto (I'm neither using
meson nor python myself, but meson.build is far more readable for
me than the AC stuff), I will fix xorg-sgml-doctools also by the
way, adding as meson options whatever is settable by the AC stuff
(configuring the AC stuff and simply looking at the options; better
than guessing ;-)
-- 
        Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


More information about the xorg-devel mailing list