All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm] meson: Fix sys/mkdev.h detection on Solaris
@ 2019-09-09 23:51 Alan Coopersmith
  2019-09-10 12:55 ` Eric Engestrom
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Coopersmith @ 2019-09-09 23:51 UTC (permalink / raw)
  To: dri-devel

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);
      |                              ^~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
---
 meson.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index bc5cfc58..a3363c32 100644
--- a/meson.build
+++ b/meson.build
@@ -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'))
 
-- 
2.15.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH libdrm] meson: Fix sys/mkdev.h detection on Solaris
  2019-09-09 23:51 [PATCH libdrm] meson: Fix sys/mkdev.h detection on Solaris Alan Coopersmith
@ 2019-09-10 12:55 ` Eric Engestrom
  2019-09-13 23:26   ` Alan Coopersmith
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Engestrom @ 2019-09-10 12:55 UTC (permalink / raw)
  To: Alan Coopersmith; +Cc: dri-devel

On Monday, 2019-09-09 16:51:16 -0700, Alan Coopersmith wrote:
> 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.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>

Alternatively, how about this?
---8<---
diff --git a/meson.build b/meson.build
index bc5cfc588d0c621a9725..263f691ab2b9107f5be1 100644
--- a/meson.build
+++ b/meson.build
@@ -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).

> 
> 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);
>       |                              ^~~~~~~
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
> ---
>  meson.build | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index bc5cfc58..a3363c32 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -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'))
>  
> -- 
> 2.15.2
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH libdrm] meson: Fix sys/mkdev.h detection on Solaris
  2019-09-10 12:55 ` Eric Engestrom
@ 2019-09-13 23:26   ` Alan Coopersmith
  2019-09-14 21:35     ` Eric Engestrom
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Coopersmith @ 2019-09-13 23:26 UTC (permalink / raw)
  To: Eric Engestrom; +Cc: dri-devel

On 9/10/19 5:55 AM, Eric Engestrom wrote:
> On Monday, 2019-09-09 16:51:16 -0700, Alan Coopersmith wrote:
>> 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.
> 
> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
> 
> Alternatively, how about this?
> ---8<---
> diff --git a/meson.build b/meson.build
> index bc5cfc588d0c621a9725..263f691ab2b9107f5be1 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -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).

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:

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>

-- 
	-Alan Coopersmith-               alan.coopersmith@oracle.com
	 Oracle Solaris Engineering - https://blogs.oracle.com/alanc
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH libdrm] meson: Fix sys/mkdev.h detection on Solaris
  2019-09-13 23:26   ` Alan Coopersmith
@ 2019-09-14 21:35     ` Eric Engestrom
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Engestrom @ 2019-09-14 21:35 UTC (permalink / raw)
  To: Alan Coopersmith; +Cc: dri-devel

On Friday, 2019-09-13 16:26:55 -0700, Alan Coopersmith wrote:
> On 9/10/19 5:55 AM, Eric Engestrom wrote:
> > On Monday, 2019-09-09 16:51:16 -0700, Alan Coopersmith wrote:
> > > 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.
> > 
> > Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
> > 
> > Alternatively, how about this?
> > ---8<---
> > diff --git a/meson.build b/meson.build
> > index bc5cfc588d0c621a9725..263f691ab2b9107f5be1 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -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).
> 
> 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:
> 
> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
> Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>

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 :)

> 
> -- 
> 	-Alan Coopersmith-               alan.coopersmith@oracle.com
> 	 Oracle Solaris Engineering - https://blogs.oracle.com/alanc
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-14 21:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09 23:51 [PATCH libdrm] meson: Fix sys/mkdev.h detection on Solaris Alan Coopersmith
2019-09-10 12:55 ` Eric Engestrom
2019-09-13 23:26   ` Alan Coopersmith
2019-09-14 21:35     ` Eric Engestrom

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.