[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: determining 32 v. 64 bit compilatio
From: |
Russ Allbery |
Subject: |
Re: determining 32 v. 64 bit compilatio |
Date: |
Tue, 29 Jun 2010 14:44:14 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Wesley Smith <address@hidden> writes:
> For 64bit builds, I need to #define x86_64 for a lib I'm using. It has
> nothing to do with the size of longs from my perspective, but whether
> the binary is compiled for a 64 or 32 bit target.
I think what everyone is struggling with here is that you're asking a
question that seems straightforward to you, but which from a portability
perspective is not a valid question. There are no simple "64-bit" or
"32-bit" labels that you can apply to things. Do you mean the size of a
pointer? The size of a long? The size of size_t? The native word size
of the underlying hardware? Or is that question being used as a proxy for
whether the processor supports an x86_64 instruction set?
I suspect that you're dealing with "all the world is Linux" code, and
therefore doing something like:
AC_CHECK_SIZEOF([long])
AS_IF([test "$ac_cv_sizeof_long" -eq 8],
[AC_DEFINE([OSBIT], 64, [Define to the size of a long in bits.])],
[AC_DEFINE([OSBIT], 32, [Define to the size of a long in bits.])])
would do what you want, but you won't find something exactly like that
built into Autoconf since it's not generally a meaningful thing to do on a
broader variety of platforms.
--
Russ Allbery (address@hidden) <http://www.eyrie.org/~eagle/>
- Re: determining 32 v. 64 bit compilatio, (continued)
- Re: determining 32 v. 64 bit compilatio, Mike Frysinger, 2010/06/29
- Re: determining 32 v. 64 bit compilatio, Wesley Smith, 2010/06/29
- Re: determining 32 v. 64 bit compilatio, Raphael 'kena' Poss, 2010/06/29
- Re: determining 32 v. 64 bit compilatio, Wesley Smith, 2010/06/30
- Re: determining 32 v. 64 bit compilatio, Andrew W. Nosenko, 2010/06/30
- Re: determining 32 v. 64 bit compilatio, John Calcote, 2010/06/30
- Re: determining 32 v. 64 bit compilatio, Wesley Smith, 2010/06/30
- Re: determining 32 v. 64 bit compilatio, Peter O'Gorman, 2010/06/30
- Re: determining 32 v. 64 bit compilatio, Bob Friesenhahn, 2010/06/29
- Re: determining 32 v. 64 bit compilatio, Mike Frysinger, 2010/06/29
- Re: determining 32 v. 64 bit compilatio,
Russ Allbery <=
- Re: determining 32 v. 64 bit compilatio, Bob Friesenhahn, 2010/06/29