dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [SHELL] Fix 64-bit Solaris build
@ 2015-12-11 13:07 Jonathan Perkin
  2016-06-06 14:27 ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Perkin @ 2015-12-11 13:07 UTC (permalink / raw)
  To: dash

In a 64-bit Solaris environment there is no stat64() function, only
stat().  This conflicts with the stat64 #define used to support
dietlibc/klibc when stat64() is not found and results in:

  ./../config.h:194:16: error: redefinition of 'struct stat'
   #define stat64 stat
                ^
  In file included from cd.c:36:0:
  /usr/include/sys/stat.h:217:8: note: originally defined here
   struct stat {
          ^

Instead, add a AC_CHECK_DECL test for stat64, and only perform the
AC_CHECK_FUNC test if it isn't already defined.
---
 configure.ac | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8ae0dc6..f4c9b87 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,10 +139,12 @@ if test "$ac_cv_func_signal" != yes; then
 fi
 
 dnl Check for stat64 (dietlibc/klibc).
-AC_CHECK_FUNC(stat64,, [
-	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])
+AC_CHECK_DECL(stat64,,[
+	AC_CHECK_FUNC(stat64,, [
+		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])
+	])
 ])
 
 AC_CHECK_FUNC(open64,, [
-- 
2.4.9 (Apple Git-60)

-- 
Jonathan Perkin  -  Joyent, Inc.  -  www.joyent.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [SHELL] Fix 64-bit Solaris build
  2015-12-11 13:07 [PATCH] [SHELL] Fix 64-bit Solaris build Jonathan Perkin
@ 2016-06-06 14:27 ` Herbert Xu
  2016-06-06 15:22   ` Jonathan Perkin
  0 siblings, 1 reply; 4+ messages in thread
From: Herbert Xu @ 2016-06-06 14:27 UTC (permalink / raw)
  To: Jonathan Perkin; +Cc: dash

On Fri, Dec 11, 2015 at 01:07:14PM +0000, Jonathan Perkin wrote:
> In a 64-bit Solaris environment there is no stat64() function, only
> stat().  This conflicts with the stat64 #define used to support
> dietlibc/klibc when stat64() is not found and results in:
> 
>   ./../config.h:194:16: error: redefinition of 'struct stat'
>    #define stat64 stat
>                 ^
>   In file included from cd.c:36:0:
>   /usr/include/sys/stat.h:217:8: note: originally defined here
>    struct stat {
>           ^
> 
> Instead, add a AC_CHECK_DECL test for stat64, and only perform the
> AC_CHECK_FUNC test if it isn't already defined.

I don't understand, does stat64 exist or not? If it doesn't then
how can AC_CHECK_DECL help? Or do you mean that it only exists as
a macro?

Thanks,
-- 
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [SHELL] Fix 64-bit Solaris build
  2016-06-06 14:27 ` Herbert Xu
@ 2016-06-06 15:22   ` Jonathan Perkin
  2016-06-07  6:50     ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Perkin @ 2016-06-06 15:22 UTC (permalink / raw)
  To: Herbert Xu; +Cc: dash

* On 2016-06-06 at 15:27 BST, Herbert Xu wrote:

> On Fri, Dec 11, 2015 at 01:07:14PM +0000, Jonathan Perkin wrote:
> > In a 64-bit Solaris environment there is no stat64() function, only
> > stat().  This conflicts with the stat64 #define used to support
> > dietlibc/klibc when stat64() is not found and results in:
> > 
> >   ./../config.h:194:16: error: redefinition of 'struct stat'
> >    #define stat64 stat
> >                 ^
> >   In file included from cd.c:36:0:
> >   /usr/include/sys/stat.h:217:8: note: originally defined here
> >    struct stat {
> >           ^
> > 
> > Instead, add a AC_CHECK_DECL test for stat64, and only perform the
> > AC_CHECK_FUNC test if it isn't already defined.
> 
> I don't understand, does stat64 exist or not? If it doesn't then
> how can AC_CHECK_DECL help? Or do you mean that it only exists as
> a macro?

Right, it only exists as a macro, defined as

  #define stat64 stat
  
in sys/stat.h.  The AC_CHECK_FUNC test fails as it doesn't pull in any
includes, and cannot find a stat64() function in libc.

Adding the AC_CHECK_DECL test finds the definition and avoids running
the AC_CHECK_FUNC tests if that is the case.

-- 
Jonathan Perkin  -  Joyent, Inc.  -  www.joyent.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [SHELL] Fix 64-bit Solaris build
  2016-06-06 15:22   ` Jonathan Perkin
@ 2016-06-07  6:50     ` Herbert Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2016-06-07  6:50 UTC (permalink / raw)
  To: Jonathan Perkin; +Cc: dash

On Mon, Jun 06, 2016 at 04:22:59PM +0100, Jonathan Perkin wrote:
>
> Right, it only exists as a macro, defined as
> 
>   #define stat64 stat
>   
> in sys/stat.h.  The AC_CHECK_FUNC test fails as it doesn't pull in any
> includes, and cannot find a stat64() function in libc.
> 
> Adding the AC_CHECK_DECL test finds the definition and avoids running
> the AC_CHECK_FUNC tests if that is the case.

OK, how about just changing the AC_CHECK_FUNC to AC_CHECK_DECL?

Please resubmit the patch.

Thanks,
-- 
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-07  6:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-11 13:07 [PATCH] [SHELL] Fix 64-bit Solaris build Jonathan Perkin
2016-06-06 14:27 ` Herbert Xu
2016-06-06 15:22   ` Jonathan Perkin
2016-06-07  6:50     ` Herbert Xu

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).