[racket] Detecting 32/64-bit racket

From: Norman Gray (norman at astro.gla.ac.uk)
Date: Sat Oct 29 11:38:19 EDT 2011

Thomas and all, hello.

On 2011 Oct 29, at 15:11, Thomas Chust wrote:

> 2011/10/29 Norman Gray <norman at astro.gla.ac.uk>:
>> I'm writing a racket extension to wrap a C library
>> <http://purl.org/nxg/dist/racket-librdf>, and in the configure.ac, I
>> want to be able to detect whether racket is a 32- or 64-bit
>> executable, so I know whether to (adjust CFLAGS to) check for a
>> suitably-compiled version of the library being wrapped -- a 32-bit
>> racket needs a 32-bit underlying library, and so on.
>> [...]
> While it is true that all the linked objects must be compiled for the
> same architecture, this kind of check is automatically performed by
> any decent linker without the need for special flags and failure to
> find matching libraries will result in a linker error.

Without the test, the link would indeed fail in the Correct Way at build time.  However I want to test this at configure time, so that if it fails I can tell the user why it's failed and what to do next, rather than leaving them with a (temporarily) puzzling link error.

(Frequently, the said user is me, getting confused about what I've put into the relevant paths).


>  ;; 64bit? : -> boolean
>  (define (64bit?) (eq? (expt 2 61) (expt 2 61)))

...works perfectly (128-bit qualifications aside!).  Many thanks.

All the best,


Norman Gray  :  http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK

Posted on the users mailing list.