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

Re: how to support 32- & 64-bit versions of libraries



On Wed, Apr 01, 2009 at 05:39:33PM +0200, Goswin von Brederlow wrote:
> "Steve M. Robbins" <steve@sumost.ca> writes:

> > I've run into a roadblock, however, in that the header gmp.h is
> > generated by configure.  It has some parameters (size of a limb) that
> > depend on whether compiled for 32 or 64 bits.  So on amd64, for
> > example, I have two incompatible gmp.h files.  Matthias provided a
> > gmp.h wrapper from Redhat that selects between architecture variants
> > based on preprocessor symbols, e.g.
> >
> >     #if defined(__i386__)
> >     #include "gmp-i386.h"
> >     #elif defined(__ia64__)
> >     #include "gmp-ia64.h"
> >     ...
> >
> > However, in the case at hand it is the same architecture.  One
> > variant is compiled with -m32 and the other with -m64.  Is there a
> > symbol that can distinguish the two so that I can use the Redhat
> > trick?  Other solutions?
> 
> -m32 defines __i386__ while -m64 defined __x86_64__ and so on for each
> architecture. So just use the architecture defines. The Redhat trick
> already does the job.

Hey, that's great!  My next question is: how can I discover the suffix
programmatically?  Is there something like "dpkg-architecture
-qDEB_HOST_GNU_CPU" or "gcc -dumpmachine" that will spit out the right
suffix when given -m32 or -m64, etc?

Thanks,
-Steve

Attachment: signature.asc
Description: Digital signature


Reply to: