[PATCH v2] configure.ac: use AC_HEADER_MAJOR to detect major()/minor()
Pekka Paalanen
ppaalanen at gmail.com
Wed Dec 13 07:58:29 UTC 2017
On Tue, 12 Dec 2017 15:41:52 +0000
Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On 12 December 2017 at 08:28, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> > On Mon, 11 Dec 2017 16:16:47 +0200
> > Pekka Paalanen <ppaalanen at gmail.com> wrote:
> >
> >> On Wed, 31 May 2017 22:17:50 +0100
> >> Sergei Trofimovich <slyfox at gentoo.org> wrote:
> >>
> >> > This change slightly updates c4d7f66c12853b9575366dd9f4a7960ec5694934
> >> > which added <sys/sysmacros.h> inclusion.
> >> >
> >> > Autoconf has AC_HEADER_MAJOR to find out which header defines
> >> > reqiured macros:
> >> > https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Headers.html
> >> >
> >> > This change should increase portability across other libcs.
> >> >
> >> > Bug: https://bugs.gentoo.org/610652
> >> > Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
> >> > ---
> >> > Change since v1:
> >> > - rebased on top of current master
> >> > - dedented nested '# include'
> >> > configure.ac | 1 +
> >> > libweston/launcher-direct.c | 9 ++++++++-
> >> > libweston/launcher-logind.c | 9 ++++++++-
> >> > libweston/launcher-weston-launch.c | 8 +++++++-
> >> > libweston/weston-launch.c | 9 ++++++++-
> >> > 5 files changed, 32 insertions(+), 4 deletions(-)
> >>
> >> Hi,
> >>
> >> I'm on Gentoo with sys-libs/glibc-2.25-r9:2.2 and I am now getting a
> >> bunch of warnings like this:
> >>
> >> /home/pq/git/weston/libweston/weston-launch.c: In function ‘handle_open’:
> >> /home/pq/git/weston/libweston/weston-launch.c:333:13: warning: In the GNU C Library, "major" is defined
> >> by <sys/sysmacros.h>. For historical compatibility, it is
> >> currently defined by <sys/types.h> as well, but we plan to
> >> remove this soon. To use "major", include <sys/sysmacros.h>
> >> directly. If you did not intend to use a system-defined macro
> >> "major", you should undefine it after including <sys/types.h>.
> >> if (major(s.st_rdev) != INPUT_MAJOR &&
> >>
> >>
> >> Reverting this patch makes the warnings go away.
> >>
> >> What's the right fix here?
> >>
> >> In config.h I have:
> >>
> >> /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
> >> */
> >> /* #undef MAJOR_IN_MKDEV */
> >>
> >> /* Define to 1 if `major', `minor', and `makedev' are declared in
> >> <sysmacros.h>. */
> >> /* #undef MAJOR_IN_SYSMACROS */
> >>
> >> I'm not sure what I needed to do get even that far, maybe wipe my
> >> out-of-tree build dir. Even then, I cannot find any evidence of
> >> configure actually running the tests. I always start a new build dir by
> >> running autogen.sh.
> >
> > Hi,
> >
> > there is an email thread of the problem from a slightly different point
> > of view:
> > https://lists.gnu.org/archive/html/autoconf/2016-09/msg00000.html
> >
> > If we keep the code as is, the warning will not go away until glibc
> > actually drops the things from sys/types.h and distros ship it.
> > Apparently there is a workaround one could make with config.site:
> > https://lists.gnu.org/archive/html/autoconf/2016-09/msg00013.html
> >
> > Or we could wait for a new autoconf release and require it, but the
> > discussion happened in 2016 and at least Gentoo does not have a
> > autoconf 2.70 yet. Or we could ship a fixed AC_HEADER_MAJOR.
> >
> > Or we could just revert this patch until something in the above changes
> > or we have migrated to Meson.
> >
> I wish the glibc people were a bit more diligent about the deprecation :-(
> Haven't looked at how Meson does it, but I would suspect it has a
> workaround similar to this [1].
>
> -Emil
> [1] https://cgit.freedesktop.org/mesa/drm/commit/?id=7040fea0280bad527ed4b3d5eee7d7bfbf303efc
Hi Emil,
the workaround taken in libdrm was discussed in that 2016 email thread,
concluding it is not a good idea, because autoconf compiler tests have
horrible code quality: they often provoke warnings anyway, which means
-Werror would cause false negatives in tests.
Maybe it's fine for AC_HEADER_MAJOR alone?
Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20171213/c9ad5eee/attachment.sig>
More information about the wayland-devel
mailing list