autoconf
[Top][All Lists]
Advanced

[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/>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]