All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org>,
	Juergen Gross <jgross@suse.com>, <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH for-4.15] autoconf: check endian.h include path
Date: Thu, 4 Feb 2021 11:21:52 +0100	[thread overview]
Message-ID: <YBvKwNiIopKKZx/F@Air-de-Roger> (raw)
In-Reply-To: <0e3576d3-4565-9898-e954-4a888b21d92f@suse.com>

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.


  reply	other threads:[~2021-02-04 10:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04  9:38 [PATCH for-4.15] autoconf: check endian.h include path Roger Pau Monne
2021-02-04  9:46 ` Jan Beulich
2021-02-04  9:59   ` Roger Pau Monné
2021-02-04 10:13     ` Jan Beulich
2021-02-04 10:21       ` Roger Pau Monné [this message]
2021-02-04 10:32         ` Jan Beulich
2021-02-04 10:48           ` Roger Pau Monné
2021-02-04 11:37             ` Ian Jackson
2021-02-04 11:34 ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YBvKwNiIopKKZx/F@Air-de-Roger \
    --to=roger.pau@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.