[Top][All Lists]

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

RE: Force 32 bit build

From: Jannick
Subject: RE: Force 32 bit build
Date: Sat, 8 May 2021 12:21:28 +0200

On Thu, 6 May 2021 19:45:45 +0200, aotto wrote:
> I want to write a "autoconf/automake" script for an application ONLY for
> 32 bit on 64 bit Linux.
> This meant that the default for configure must be 32 bit and nothing else.

Best is to check the bitness with the compiler itself instead of using triplet 
strings or compiler flags which might or might not exist. Autoconf provides a 
vast of techniques of how to check things.  So here the idea is to calculate 
CHAR_BIT*sizeof(void*) to produce the compiler's bitness. 

A snippet below you might want to plug into your which I believe 
is portable.  The corresponding script configure then runs into an emergency 
stop when the current compiler is checked not to be 32bit. It applies to 
cross-compiling, too. 

AC_MSG_CHECKING([for compiler bitness])
  [CHAR_BIT*sizeof(void*)],[[#include <limits.h>]],
   AC_MSG_ERROR([check for bitness of compiler '$CC' failed],[99])])
  [AC_MSG_ERROR([Package compiles cleanly only for 32bit compilers. Abortion 
for compiler '$CC'.])])


reply via email to

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