[v2,1/2] examples/vhost_scsi: Don't build without virtio_scsi.h

Message ID 20190130221602.13866-2-msantana@redhat.com
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series
  • Introduce travis support
Related show

Checks

Context Check Description
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Michael Santana Jan. 30, 2019, 10:16 p.m.
From: Aaron Conole <aconole@redhat.com>

The vhost_scsi example code is set to build, even if the requisite header
file virtio_scsi.h isn't available.  This happens on some Ubuntu systems
when some versions of the libc-dev package aren't available.

Check whether the virtio_scsi.h file exists, and if not, set the build
flag to false.

Signed-off-by: Aaron Conole <aconole@redhat.com>
---
v2:
  Introduced.

 examples/vhost_scsi/meson.build | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Bruce Richardson Jan. 31, 2019, 9:15 a.m. | #1
On Wed, Jan 30, 2019 at 05:16:01PM -0500, Michael Santana wrote:
> From: Aaron Conole <aconole@redhat.com>
> 
> The vhost_scsi example code is set to build, even if the requisite header
> file virtio_scsi.h isn't available.  This happens on some Ubuntu systems
> when some versions of the libc-dev package aren't available.
> 
> Check whether the virtio_scsi.h file exists, and if not, set the build
> flag to false.
> 
> Signed-off-by: Aaron Conole <aconole@redhat.com>
> ---
> v2:
>   Introduced.
> 
>  examples/vhost_scsi/meson.build | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/examples/vhost_scsi/meson.build b/examples/vhost_scsi/meson.build
> index 2303bcaed..3bff05c81 100644
> --- a/examples/vhost_scsi/meson.build
> +++ b/examples/vhost_scsi/meson.build
> @@ -9,6 +9,12 @@
>  if host_machine.system() != 'linux'
>  	build = false
>  endif
> +
> +cc = meson.get_compiler('c')
> +if not cc.has_header('virtio_scsi.h')
> +	build = false
> +endif
> +

We already assign "cc" at the top level meson.build file, so it's not
needed to be repeated here. We could merge the if conditions, but it's
probably more readable this way, so with the "cc = " line removed:

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

>  deps += 'vhost'
>  cflags += ['-D_FILE_OFFSET_BITS=64']
>  sources = files(
> -- 
> 2.19.1
>

Patch

diff --git a/examples/vhost_scsi/meson.build b/examples/vhost_scsi/meson.build
index 2303bcaed..3bff05c81 100644
--- a/examples/vhost_scsi/meson.build
+++ b/examples/vhost_scsi/meson.build
@@ -9,6 +9,12 @@ 
 if host_machine.system() != 'linux'
 	build = false
 endif
+
+cc = meson.get_compiler('c')
+if not cc.has_header('virtio_scsi.h')
+	build = false
+endif
+
 deps += 'vhost'
 cflags += ['-D_FILE_OFFSET_BITS=64']
 sources = files(