Re: determining 32 v. 64 bit compilatio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wesley Smith <wesley.hoke@xxxxxxxxx> 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 (rra@xxxxxxxxxxxx)             <http://www.eyrie.org/~eagle/>

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux