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.

Let's make sure we check for all 3 major(), minor() and makedev().

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: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Tested-by: Alan Coopersmith <alan.coopersmith@oracle.com>
main
Eric Engestrom 2019-09-14 22:22:03 +01:00
parent 10cd9c3da8
commit 827a2a2042
1 changed files with 7 additions and 2 deletions

View File

@ -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'))