meson: Fix sys/mkdev.h detection on Solaris
PATCH 1/1 meson: Fix sys/mkdev.h detection on Solaris
On Solaris, sys/sysmacros.h has long-deprecated copies of major() & minor() but not makedev(). sys/mkdev.h has all three and is the preferred choice.
So we check for sys/mkdev.h first, as autoconf's AC_HEADER_MAJOR does.
Fixes build failure with error:../xf86drm.c: In function ‘drmOpenMinor’:../xf86drm.c:454:30: error: implicit declaration of function ‘makedev’ [-Werror=implicit-function-declaration]
454 | return drmOpenDevice(makedev(DRM_MAJOR, minor), minor, type);
| ^~~~~~~
--- meson.build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
meson.build +3 -3
@@ -183,10 +183,10 @@ foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h'] config.set('HAVE_' + header.underscorify().to_upper(), cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header))) endforeach -if cc.has_header_symbol('sys/sysmacros.h', 'major') - config.set10('MAJOR_IN_SYSMACROS', true) -elif cc.has_header_symbol('sys/mkdev.h', 'major') +if cc.has_header_symbol('sys/mkdev.h', 'major') config.set10('MAJOR_IN_MKDEV', true) +elif cc.has_header_symbol('sys/sysmacros.h', 'major') + config.set10('MAJOR_IN_SYSMACROS', true) endif config.set10('HAVE_OPEN_MEMSTREAM', cc.has_function('open_memstream'))
Signature · 6 lines
2.15.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · Alan Coopersmith
On Solaris,
sys/sysmacros.hhas long-deprecated copies ofmajor()&minor()but notmakedev().sys/mkdev.hhas all three and is the preferred choice.So we check for
sys/mkdev.hfirst, as autoconf'sAC_HEADER_MAJORdoes.
Alternatively, how about this?
---8<---
meson.build +7 -2
@@ -183,9 +183,14 @@ foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h'] config.set('HAVE_' + header.underscorify().to_upper(), cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header))) endforeach -if cc.has_header_symbol('sys/sysmacros.h', 'major') +if (cc.has_header_symbol('sys/sysmacros.h', 'major') and + cc.has_header_symbol('sys/sysmacros.h', 'minor') and + cc.has_header_symbol('sys/sysmacros.h', 'makedev')) config.set10('MAJOR_IN_SYSMACROS', true) -elif cc.has_header_symbol('sys/mkdev.h', 'major') +endif +if (cc.has_header_symbol('sys/mkdev.h', 'major') and + cc.has_header_symbol('sys/mkdev.h', 'minor') and + cc.has_header_symbol('sys/mkdev.h', 'makedev')) config.set10('MAJOR_IN_MKDEV', true) endif config.set10('HAVE_OPEN_MEMSTREAM', cc.has_function('open_memstream'))
--->8---
Makes both checks independent and represent the reality of what's wanted more accurately (despite the historical name of the macro).
Quoted 33 lines
Fixes build failure with error:
../xf86drm.c: In function ‘drmOpenMinor’:../xf86drm.c:454:30: error: implicit declaration of function ‘makedev’ [-Werror=implicit-function-declaration]
454 | returndrmOpenDevice(makedev(DRM_MAJOR, minor), minor, type);
| ^~~~~~~Signed-off-by Alan Coopersmith <[email protected]>--- meson.build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)meson.build +3
-3@@ -183,10 +183,10 @@ foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h'] config.set('HAVE_' + header.underscorify().to_upper(), cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header))) endforeach -if cc.has_header_symbol('sys/sysmacros.h', 'major') - config.set10('MAJOR_IN_SYSMACROS', true) -elif cc.has_header_symbol('sys/mkdev.h', 'major') +if cc.has_header_symbol('sys/mkdev.h', 'major') config.set10('MAJOR_IN_MKDEV', true) +elif cc.has_header_symbol('sys/sysmacros.h', 'major') + config.set10('MAJOR_IN_SYSMACROS', true) endif config.set10('HAVE_OPEN_MEMSTREAM', cc.has_function('open_memstream'))Signature · 1 line
2.15.2
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 33 lines · Eric Engestrom
Quoted 4 lines · Alan Coopersmith
On Solaris,
sys/sysmacros.hhas long-deprecated copies ofmajor()&minor()but notmakedev().sys/mkdev.hhas all three and is the preferred choice.So we check for
sys/mkdev.hfirst, as autoconf'sAC_HEADER_MAJORdoes.Reviewed-by Eric Engestrom <[email protected]>Alternatively, how about this?
---8<---meson.build +7
-3@@ -183,9 +183,14 @@ foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h'] config.set('HAVE_' + header.underscorify().to_upper(), cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header))) endforeach -if cc.has_header_symbol('sys/sysmacros.h', 'major') +if (cc.has_header_symbol('sys/sysmacros.h', 'major') and + cc.has_header_symbol('sys/sysmacros.h', 'minor') and + cc.has_header_symbol('sys/sysmacros.h', 'makedev')) config.set10('MAJOR_IN_SYSMACROS', true) -elif cc.has_header_symbol('sys/mkdev.h', 'major') +endif +if (cc.has_header_symbol('sys/mkdev.h', 'major') and + cc.has_header_symbol('sys/mkdev.h', 'minor') and + cc.has_header_symbol('sys/mkdev.h', 'makedev')) config.set10('MAJOR_IN_MKDEV', true) endif config.set10('HAVE_OPEN_MEMSTREAM', cc.has_function('open_memstream')) --->8---
Quoted 2 lines
Makes both checks independent and represent the reality of what's wanted more accurately (despite the historical name of the macro).
That works:
Header <sys/sysmacros.h> has symbol "major" : YES (cached) Header <sys/sysmacros.h> has symbol "minor" : YES Header <sys/sysmacros.h> has symbol "makedev" : NO Header <sys/mkdev.h> has symbol "major" : YES Header <sys/mkdev.h> has symbol "minor" : YES Header <sys/mkdev.h> has symbol "makedev" : YES
Would you like me to resubmit with that, or do you want to submit it?
If you want to go ahead, then:
Signature · 6 lines
-Alan Coopersmith- [email protected] Oracle Solaris Engineering - https://blogs.oracle.com/alanc _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 46 lines · Alan Coopersmith
Quoted 33 lines · Eric Engestrom
Quoted 4 lines · Alan Coopersmith
On Solaris,
sys/sysmacros.hhas long-deprecated copies ofmajor()&minor()but notmakedev().sys/mkdev.hhas all three and is the preferred choice.So we check for
sys/mkdev.hfirst, as autoconf'sAC_HEADER_MAJORdoes.Reviewed-by Eric Engestrom <[email protected]>Alternatively, how about this?
---8<---meson.build +7
-3@@ -183,9 +183,14 @@ foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h'] config.set('HAVE_' + header.underscorify().to_upper(), cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header))) endforeach -if cc.has_header_symbol('sys/sysmacros.h', 'major') +if (cc.has_header_symbol('sys/sysmacros.h', 'major') and + cc.has_header_symbol('sys/sysmacros.h', 'minor') and + cc.has_header_symbol('sys/sysmacros.h', 'makedev')) config.set10('MAJOR_IN_SYSMACROS', true) -elif cc.has_header_symbol('sys/mkdev.h', 'major') +endif +if (cc.has_header_symbol('sys/mkdev.h', 'major') and + cc.has_header_symbol('sys/mkdev.h', 'minor') and + cc.has_header_symbol('sys/mkdev.h', 'makedev')) config.set10('MAJOR_IN_MKDEV', true) endif config.set10('HAVE_OPEN_MEMSTREAM', cc.has_function('open_memstream')) --->8---Quoted 2 lines
Makes both checks independent and represent the reality of what's wanted more accurately (despite the historical name of the macro).
That works:
Header <
sys/sysmacros.h> has symbol "major" : YES (cached) Header <sys/sysmacros.h> has symbol "minor" : YES Header <sys/sysmacros.h> has symbol "makedev" : NO Header <sys/mkdev.h> has symbol "major" : YES Header <sys/mkdev.h> has symbol "minor" : YES Header <sys/mkdev.h> has symbol "makedev" : YES
Quoted 6 lines
Would you like me to resubmit with that, or do you want to submit it?
If you want to go ahead, then:
Reviewed-by Alan Coopersmith <[email protected]>Tested-by Alan Coopersmith <[email protected]>
Just pushed it as 827a2a2042359ac93a9b082ee9584b43baa1a3f7; thanks for testing it!
I've also tagged you on a Mesa MR to the same effect, in case you want to give it a go :)
Quoted 8 lines
Signature · 7 lines
-- -Alan Coopersmith- [email protected] Oracle Solaris Engineering - https://blogs.oracle.com/alanc _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel