[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for-4.15] autoconf: check endian.h include path


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 4 Feb 2021 11:21:52 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QFSUr6ePCOde4sXwl/2PbMxM4K0uNjg4kBcKWGbFAQ4=; b=T+RrZuCTiFYWY4IHkuoPH6ZIm8Z0YlcM7AdIKDlAEid3MEEPKa8wyD+g4vC173Zk9BdXBabKSGgbR8+xz2tGmxe9X6mtvfH3PokUsrkg7Fj0WdnVeDH6jQkCTtONRG6nREwHR1lWfvh8UeHNJVYFIK3Wxy6COdtW4In2iYWoTq4rLVPOrOgUBokKwQqaQ/o0hnqXCZUm++BezgM0zqhjy34srUXdl40VqWbsoscxOfHsbJH6emtb3XM/PDACReSeaiFuGaVER/InfI0W+RopNJtDgpIOiBjZYGO1EOCygiCSFE7tsnEC/SVlqYCToj5G91PK3vZc8Qe7Be5sB4H+sg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Muj8S/1Saj6fSzV+H13s6+yNp4UhpOdkcwlwmbKfXd1gx1z/OGUwhPPS642T88nCZi6qWE93vo3Q2erbbu/G7JqSiZ4DiOG6V6QoQkUpXy5+DgdFVWF3MruwhxYO5rJ/6ElVax9W45UQS2EaFjOubKdoOchWGNag0hYgRy1BeEwfhJfrQN1aF3OYa4oiGmFQF5T+3rCz6/wTDWLqyd+JPN98NxCMBPJhnn8MkI2W+TjJx+x8uUiFPYPYZ1PKJYpRmIqIEXMPj109d6wuOcwCnbK0am5Qau5kFSdutSNlrpkn8I8fuAP+7b6xfyqEP1AuJU+psv3QqpZlWQhe+joK8Q==
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 04 Feb 2021 10:22:16 +0000
  • Ironport-sdr: UNaKVtKZ5/jdDvBi5K+FwM1yEc8zZ0NzOVm486rId56lYGSg7EafAB63t8fKEigDN+zcuO+jVu pgK5qi3A/jMFSyS6PABbaJjThfp1xTuu27QYftokstGbsTzrSJrQuviZ0Wdjw5pVR2v/xWZk06 puXy8tnTY5hX3OndLSLqeKO8vz1NDpg4fDxkegyRkkp+aHGB/j2zEYdZC9pPX8u4fcRSQWjlEw dYL3zS9I5QO38Sjra17LgGXwihFD0uSPQ6LKFSdUCZOA0K69gHHW1Nzct8WIdEqGh16rxx6kbj 6iU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Feb 04, 2021 at 11:13:43AM +0100, Jan Beulich wrote:
> On 04.02.2021 10:59, Roger Pau Monné wrote:
> > On Thu, Feb 04, 2021 at 10:46:58AM +0100, Jan Beulich wrote:
> >> On 04.02.2021 10:38, Roger Pau Monne wrote:
> >>> --- a/tools/configure.ac
> >>> +++ b/tools/configure.ac
> >>> @@ -74,6 +74,7 @@ m4_include([../m4/ax_compare_version.m4])
> >>>  m4_include([../m4/paths.m4])
> >>>  m4_include([../m4/systemd.m4])
> >>>  m4_include([../m4/golang.m4])
> >>> +m4_include([../m4/header.m4])
> >>>  
> >>>  AX_XEN_EXPAND_CONFIG()
> >>>  
> >>> @@ -517,4 +518,6 @@ AC_ARG_ENABLE([pvshim],
> >>>  ])
> >>>  AC_SUBST(pvshim)
> >>>  
> >>> +AX_FIND_HEADER([INCLUDE_ENDIAN_H], [endian.h sys/endian.h])
> >>
> >> Instead of a new macro, can't you use AC_CHECK_HEADERS()?
> > 
> > AC_CHECK_HEADERS doesn't do what we want here: it will instead produce
> > a HAVE_header-file define for each header on the list that's present,
> > and the action-if-found doesn't get passed the path of the found
> > header according to the documentation.
> > 
> > Here I want the variable to be set to the include path of the first
> > header on the list that's present on the system.
> 
> I was thinking of
> 
> #if defined(HAVE_SYS_ENDIAN_H)
> # include <sys/endian.h>
> #elif defined(HAVE_ENDIAN_H)
> # include <endian.h>
> #else
> # error ...
> #endif

I think having to replicate this logic in all places that include
endian.h is cumbersome.

> >> I'm also not certain about the order of checks - what if both
> >> exist?
> > 
> > With my macro the first one will be picked.
> 
> And which one is to be the first one? IOW how likely is it that
> on a system having both the first one is what we're after vs
> the second one?

Not sure, but the same will happen with your proposal above: in your
chunk sys/endian.h will be picked over endian.h. If we think that's
the right precedence I can adjust AX_FIND_HEADER to be:

AX_FIND_HEADER([INCLUDE_ENDIAN_H], [sys/endian.h endian.h])

Which will achieve the same as your proposed snipped.

I can also add a comment to the macro that the first match will be the
one that gets set.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.