dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saagar Jha <saagar@saagarjha.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: dash@vger.kernel.org
Subject: Re: shell: Call CHECK_DECL on stat64
Date: Thu, 27 May 2021 01:43:29 -0700	[thread overview]
Message-ID: <27A6D788-7940-4C36-BB1F-45ABC9F3C65B@saagarjha.com> (raw)
In-Reply-To: <20210526054938.tgkhhh3z5vn2hjyi@gondor.apana.org.au>

I was able the compilation to succeed with the patch and the binary seemed to work in my basic tests, so it looks good from my side. Thanks for preparing this!

Regards,
Saagar

> On May 25, 2021, at 22:49, Herbert Xu <herbert@gondor.apana.org.au> wrote:
> 
> Saagar Jha <saagar@saagarjha.com> wrote:
>> 
>> Even though stat64 is not in the public headers, AC_CHECK_FUNC will “find” it because the symbol exists at link time for the test, even though it is not meant to be used. What do you think would be the best way to fix this check on this platform? Would it be preferred to check if the headers contain a declaration of the function?
> 
> Yes we should check for a declaration.  Does this patch fix the
> problem?
> 
> ---8<---
> On macOS it is possible to find stat64 at link-time but not at
> compile-time.  To make the build process more robust we should
> check for the header file as well as the library.
> 
> Reported-by: Saagar Jha <saagar@saagarjha.com>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> diff --git a/configure.ac b/configure.ac
> index 44f2f95..466df4c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -140,11 +140,12 @@ if test "$ac_cv_func_signal" != yes; then
> fi
> 
> dnl Check for stat64 (dietlibc/klibc).
> -AC_CHECK_FUNC(stat64,, [
> +AC_CHECK_DECL(stat64, AC_CHECK_FUNC(stat64))
> +if test "$ac_cv_func_stat64" != yes; then
> 	AC_DEFINE(fstat64, fstat, [64-bit operations are the same as 32-bit])
> 	AC_DEFINE(lstat64, lstat, [64-bit operations are the same as 32-bit])
> 	AC_DEFINE(stat64, stat, [64-bit operations are the same as 32-bit])
> -])
> +fi
> 
> AC_CHECK_FUNC(glob64,, [
> 	AC_DEFINE(glob64_t, glob_t, [64-bit operations are the same as 32-bit])
> -- 
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


      reply	other threads:[~2021-05-27  8:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-16  8:47 Configure check for stat64 does not work on Apple silicon Saagar Jha
2021-05-26  5:49 ` shell: Call CHECK_DECL on stat64 Herbert Xu
2021-05-27  8:43   ` Saagar Jha [this message]

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=27A6D788-7940-4C36-BB1F-45ABC9F3C65B@saagarjha.com \
    --to=saagar@saagarjha.com \
    --cc=dash@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --subject='Re: shell: Call CHECK_DECL on stat64' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).