[igt-dev] [PATCH i-g-t] meson: Port cpuid.h test from configure.ac

Petri Latvala petri.latvala at intel.com
Mon Feb 10 11:46:28 UTC 2020


On Mon, Feb 10, 2020 at 01:43:43PM +0200, Petri Latvala wrote:
> On Mon, Feb 10, 2020 at 10:52:33AM +0800, Nicolas Boichat wrote:
> > When cross-compiling for arm64, we noticed that the header file
> > may be present, but it is not functional:
> > /usr/lib64/clang/10.0.0/include/cpuid.h:11:2: error: this header is for x86 only
> > 
> > Signed-off-by: Nicolas Boichat <drinkcat at chromium.org>
> 
> Reviewed-by: Petri Latvala <petri.latvala at intel.com>

And merged, thanks!


> 
> > ---
> >  meson.build | 12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index 4d5003ba..bcb69e1c 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -207,8 +207,16 @@ endif
> >  if cc.has_header('sys/io.h')
> >  	config.set('HAVE_SYS_IO_H', 1)
> >  endif
> > -if cc.has_header('cpuid.h')
> > -	# FIXME: Do we need the example link test from configure.ac?
> > +if cc.links('''
> > +#include <cpuid.h>
> > +#include <stddef.h>
> > +
> > +int main(void) {
> > +  int eax, ebx, ecx, edx;
> > +  if (__get_cpuid_max(0, NULL) < 4)
> > +    return 0;
> > +  __cpuid_count(4, 0, eax, ebx, ecx, edx);
> > +}''', name : 'cpuid.h')
> >  	config.set('HAVE_CPUID_H', 1)
> >  endif
> >  if cc.has_header_symbol('unistd.h', 'gettid', args : '-D_GNU_SOURCE')
> > -- 
> > 2.25.0.341.g760bfbb309-goog
> > 
> > _______________________________________________
> > igt-dev mailing list
> > igt-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list